@wordpress/block-library 9.7.1-next.5368f64a9.0 → 9.8.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 (132) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/form-input/deprecated.js +113 -1
  19. package/build/form-input/deprecated.js.map +1 -1
  20. package/build/form-input/edit.js +16 -12
  21. package/build/form-input/edit.js.map +1 -1
  22. package/build/form-input/save.js +9 -1
  23. package/build/form-input/save.js.map +1 -1
  24. package/build/image/image.js +5 -2
  25. package/build/image/image.js.map +1 -1
  26. package/build/index.js +1 -0
  27. package/build/index.js.map +1 -1
  28. package/build/navigation-submenu/index.js +13 -0
  29. package/build/navigation-submenu/index.js.map +1 -1
  30. package/build/post-template/edit.js +6 -1
  31. package/build/post-template/edit.js.map +1 -1
  32. package/build/post-title/index.js +1 -4
  33. package/build/post-title/index.js.map +1 -1
  34. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  35. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  36. package/build/query/edit/inspector-controls/index.js +45 -9
  37. package/build/query/edit/inspector-controls/index.js.map +1 -1
  38. package/build/query/edit/query-content.js +26 -10
  39. package/build/query/edit/query-content.js.map +1 -1
  40. package/build/query/index.js +3 -1
  41. package/build/query/index.js.map +1 -1
  42. package/build/query/utils.js +12 -1
  43. package/build/query/utils.js.map +1 -1
  44. package/build/site-title/index.js +1 -4
  45. package/build/site-title/index.js.map +1 -1
  46. package/build/social-link/edit.js +13 -11
  47. package/build/social-link/edit.js.map +1 -1
  48. package/build-module/categories/edit.js +40 -19
  49. package/build-module/categories/edit.js.map +1 -1
  50. package/build-module/categories/index.js +10 -3
  51. package/build-module/categories/index.js.map +1 -1
  52. package/build-module/categories/variations.js +36 -0
  53. package/build-module/categories/variations.js.map +1 -0
  54. package/build-module/embed/edit.js +1 -0
  55. package/build-module/embed/edit.js.map +1 -1
  56. package/build-module/embed/edit.native.js +1 -0
  57. package/build-module/embed/edit.native.js.map +1 -1
  58. package/build-module/embed/embed-preview.js +80 -100
  59. package/build-module/embed/embed-preview.js.map +1 -1
  60. package/build-module/embed/embed-preview.native.js +1 -0
  61. package/build-module/embed/embed-preview.native.js.map +1 -1
  62. package/build-module/form/view.js +1 -0
  63. package/build-module/form/view.js.map +1 -1
  64. package/build-module/form-input/deprecated.js +114 -2
  65. package/build-module/form-input/deprecated.js.map +1 -1
  66. package/build-module/form-input/edit.js +16 -12
  67. package/build-module/form-input/edit.js.map +1 -1
  68. package/build-module/form-input/save.js +9 -1
  69. package/build-module/form-input/save.js.map +1 -1
  70. package/build-module/image/image.js +5 -2
  71. package/build-module/image/image.js.map +1 -1
  72. package/build-module/index.js +1 -0
  73. package/build-module/index.js.map +1 -1
  74. package/build-module/navigation-submenu/index.js +13 -0
  75. package/build-module/navigation-submenu/index.js.map +1 -1
  76. package/build-module/post-template/edit.js +6 -1
  77. package/build-module/post-template/edit.js.map +1 -1
  78. package/build-module/post-title/index.js +1 -4
  79. package/build-module/post-title/index.js.map +1 -1
  80. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  81. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  82. package/build-module/query/edit/inspector-controls/index.js +45 -9
  83. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  84. package/build-module/query/edit/query-content.js +27 -11
  85. package/build-module/query/edit/query-content.js.map +1 -1
  86. package/build-module/query/index.js +3 -1
  87. package/build-module/query/index.js.map +1 -1
  88. package/build-module/query/utils.js +12 -1
  89. package/build-module/query/utils.js.map +1 -1
  90. package/build-module/site-title/index.js +1 -4
  91. package/build-module/site-title/index.js.map +1 -1
  92. package/build-module/social-link/edit.js +14 -12
  93. package/build-module/social-link/edit.js.map +1 -1
  94. package/build-style/editor-rtl.css +1 -1
  95. package/build-style/editor.css +1 -1
  96. package/build-style/form-input/style-rtl.css +7 -8
  97. package/build-style/form-input/style.css +7 -8
  98. package/build-style/gallery/editor-rtl.css +1 -1
  99. package/build-style/gallery/editor.css +1 -1
  100. package/build-style/post-title/style-rtl.css +4 -18
  101. package/build-style/post-title/style.css +4 -18
  102. package/build-style/site-title/style-rtl.css +4 -18
  103. package/build-style/site-title/style.css +4 -18
  104. package/build-style/style-rtl.css +15 -44
  105. package/build-style/style.css +15 -44
  106. package/package.json +35 -35
  107. package/src/categories/block.json +7 -2
  108. package/src/categories/edit.js +69 -30
  109. package/src/categories/index.js +2 -0
  110. package/src/categories/index.php +21 -9
  111. package/src/categories/variations.js +40 -0
  112. package/src/comments-pagination-next/index.php +1 -1
  113. package/src/comments-pagination-previous/index.php +2 -1
  114. package/src/embed/embed-preview.js +96 -112
  115. package/src/form-input/deprecated.js +114 -1
  116. package/src/form-input/edit.js +17 -11
  117. package/src/form-input/save.js +13 -3
  118. package/src/form-input/style.scss +9 -8
  119. package/src/image/image.js +2 -1
  120. package/src/navigation-submenu/block.json +13 -0
  121. package/src/post-template/edit.js +6 -0
  122. package/src/post-template/index.php +5 -0
  123. package/src/post-title/block.json +1 -4
  124. package/src/post-title/style.scss +4 -21
  125. package/src/query/block.json +3 -1
  126. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  127. package/src/query/edit/inspector-controls/index.js +68 -9
  128. package/src/query/edit/query-content.js +38 -5
  129. package/src/query/utils.js +16 -1
  130. package/src/site-title/block.json +1 -4
  131. package/src/site-title/style.scss +4 -21
  132. package/src/social-link/edit.js +11 -7
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = EmbedPreview;
8
8
  var _util = require("./util");
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
10
  var _i18n = require("@wordpress/i18n");
@@ -31,114 +31,94 @@ var _jsxRuntime = require("react/jsx-runtime");
31
31
  * Internal dependencies
32
32
  */
33
33
 
34
- class EmbedPreview extends _element.Component {
35
- constructor() {
36
- super(...arguments);
37
- this.hideOverlay = this.hideOverlay.bind(this);
38
- this.state = {
39
- interactive: false
40
- };
34
+ function EmbedPreview({
35
+ preview,
36
+ previewable,
37
+ url,
38
+ type,
39
+ isSelected,
40
+ className,
41
+ icon,
42
+ label,
43
+ insertBlocksAfter,
44
+ attributes,
45
+ setAttributes
46
+ }) {
47
+ const [interactive, setInteractive] = (0, _element.useState)(false);
48
+ if (!isSelected && interactive) {
49
+ // We only want to change this when the block is not selected, because changing it when
50
+ // the block becomes selected makes the overlap disappear too early. Hiding the overlay
51
+ // happens on mouseup when the overlay is clicked.
52
+ setInteractive(false);
41
53
  }
42
- static getDerivedStateFromProps(nextProps, state) {
43
- if (!nextProps.isSelected && state.interactive) {
44
- // We only want to change this when the block is not selected, because changing it when
45
- // the block becomes selected makes the overlap disappear too early. Hiding the overlay
46
- // happens on mouseup when the overlay is clicked.
47
- return {
48
- interactive: false
49
- };
50
- }
51
- return null;
52
- }
53
- hideOverlay() {
54
+ const hideOverlay = () => {
54
55
  // This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop
55
56
  // changing, because that happens on mouse down, and the overlay immediately disappears,
56
57
  // and the mouse event can end up in the preview content. We can't use onClick on
57
58
  // the overlay to hide it either, because then the editor misses the mouseup event, and
58
59
  // thinks we're multi-selecting blocks.
59
- this.setState({
60
- interactive: true
61
- });
62
- }
63
- render() {
64
- const {
65
- preview,
66
- previewable,
67
- url,
68
- type,
69
- className,
70
- icon,
71
- label,
72
- insertBlocksAfter,
73
- attributes,
74
- setAttributes,
75
- isSelected
76
- } = this.props;
77
- const {
78
- scripts
79
- } = preview;
80
- const {
81
- interactive
82
- } = this.state;
83
- const html = 'photo' === type ? (0, _util.getPhotoHtml)(preview) : preview.html;
84
- const embedSourceUrl = (0, _url.getAuthority)(url);
85
- const iframeTitle = (0, _i18n.sprintf)(
86
- // translators: %s: host providing embed content e.g: www.youtube.com
87
- (0, _i18n.__)('Embedded content from %s'), embedSourceUrl);
88
- const sandboxClassnames = (0, _clsx.default)(type, className, 'wp-block-embed__wrapper');
60
+ setInteractive(true);
61
+ };
62
+ const {
63
+ scripts
64
+ } = preview;
65
+ const html = 'photo' === type ? (0, _util.getPhotoHtml)(preview) : preview.html;
66
+ const embedSourceUrl = (0, _url.getAuthority)(url);
67
+ const iframeTitle = (0, _i18n.sprintf)(
68
+ // translators: %s: host providing embed content e.g: www.youtube.com
69
+ (0, _i18n.__)('Embedded content from %s'), embedSourceUrl);
70
+ const sandboxClassnames = (0, _clsx.default)(type, className, 'wp-block-embed__wrapper');
89
71
 
90
- // Disabled because the overlay div doesn't actually have a role or functionality
91
- // as far as the user is concerned. We're just catching the first click so that
92
- // the block can be selected without interacting with the embed preview that the overlay covers.
93
- /* eslint-disable jsx-a11y/no-static-element-interactions */
94
- const embedWrapper = 'wp-embed' === type ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_wpEmbedPreview.default, {
95
- html: html
96
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
97
- className: "wp-block-embed__wrapper",
98
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SandBox, {
99
- html: html,
100
- scripts: scripts,
101
- title: iframeTitle,
102
- type: sandboxClassnames,
103
- onFocus: this.hideOverlay
104
- }), !interactive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
105
- className: "block-library-embed__interactive-overlay",
106
- onMouseUp: this.hideOverlay
107
- })]
108
- });
109
- /* eslint-enable jsx-a11y/no-static-element-interactions */
72
+ // Disabled because the overlay div doesn't actually have a role or functionality
73
+ // as far as the user is concerned. We're just catching the first click so that
74
+ // the block can be selected without interacting with the embed preview that the overlay covers.
75
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
76
+ const embedWrapper = 'wp-embed' === type ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_wpEmbedPreview.default, {
77
+ html: html
78
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
79
+ className: "wp-block-embed__wrapper",
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SandBox, {
81
+ html: html,
82
+ scripts: scripts,
83
+ title: iframeTitle,
84
+ type: sandboxClassnames,
85
+ onFocus: hideOverlay
86
+ }), !interactive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
+ className: "block-library-embed__interactive-overlay",
88
+ onMouseUp: hideOverlay
89
+ })]
90
+ });
91
+ /* eslint-enable jsx-a11y/no-static-element-interactions */
110
92
 
111
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
112
- className: (0, _clsx.default)(className, 'wp-block-embed', {
113
- 'is-type-video': 'video' === type
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
94
+ className: (0, _clsx.default)(className, 'wp-block-embed', {
95
+ 'is-type-video': 'video' === type
96
+ }),
97
+ children: [previewable ? embedWrapper : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
98
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
99
+ icon: icon,
100
+ showColors: true
114
101
  }),
115
- children: [previewable ? embedWrapper : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
116
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
117
- icon: icon,
118
- showColors: true
119
- }),
120
- label: label,
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
122
- className: "components-placeholder__error",
123
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
124
- href: url,
125
- children: url
126
- })
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
128
- className: "components-placeholder__error",
129
- children: (0, _i18n.sprintf)( /* translators: %s: host providing embed content e.g: www.youtube.com */
130
- (0, _i18n.__)("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
131
- })]
132
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
133
- attributes: attributes,
134
- setAttributes: setAttributes,
135
- isSelected: isSelected,
136
- insertBlocksAfter: insertBlocksAfter,
137
- label: (0, _i18n.__)('Embed caption text'),
138
- showToolbarButton: isSelected
102
+ label: label,
103
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
104
+ className: "components-placeholder__error",
105
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
106
+ href: url,
107
+ children: url
108
+ })
109
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
110
+ className: "components-placeholder__error",
111
+ children: (0, _i18n.sprintf)( /* translators: %s: host providing embed content e.g: www.youtube.com */
112
+ (0, _i18n.__)("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
139
113
  })]
140
- });
141
- }
114
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
115
+ attributes: attributes,
116
+ setAttributes: setAttributes,
117
+ isSelected: isSelected,
118
+ insertBlocksAfter: insertBlocksAfter,
119
+ label: (0, _i18n.__)('Embed caption text'),
120
+ showToolbarButton: isSelected
121
+ })]
122
+ });
142
123
  }
143
- var _default = exports.default = EmbedPreview;
144
124
  //# sourceMappingURL=embed-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_util","require","_clsx","_interopRequireDefault","_i18n","_components","_blockEditor","_element","_url","_wpEmbedPreview","_caption","_jsxRuntime","EmbedPreview","Component","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","className","icon","label","insertBlocksAfter","attributes","setAttributes","props","scripts","html","getPhotoHtml","embedSourceUrl","getAuthority","iframeTitle","sprintf","__","sandboxClassnames","clsx","embedWrapper","jsx","default","jsxs","children","SandBox","title","onFocus","onMouseUp","Placeholder","BlockIcon","showColors","href","Caption","showToolbarButton","_default","exports"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\nimport { Caption } from '../utils/caption';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tpreview,\n\t\t\tpreviewable,\n\t\t\turl,\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tlabel,\n\t\t\tinsertBlocksAfter,\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisSelected,\n\t\t} = this.props;\n\t\tconst { scripts } = preview;\n\t\tconst { interactive } = this.state;\n\n\t\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\t\tconst embedSourceUrl = getAuthority( url );\n\t\tconst iframeTitle = sprintf(\n\t\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t\t__( 'Embedded content from %s' ),\n\t\t\tembedSourceUrl\n\t\t);\n\t\tconst sandboxClassnames = clsx(\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\t'wp-block-embed__wrapper'\n\t\t);\n\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tconst embedWrapper =\n\t\t\t'wp-embed' === type ? (\n\t\t\t\t<WpEmbedPreview html={ html } />\n\t\t\t) : (\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<SandBox\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tonFocus={ this.hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\t\tonMouseUp={ this.hideOverlay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\tclassName={ clsx( className, 'wp-block-embed', {\n\t\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tembedSourceUrl\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Embed caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSelected }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t);\n\t}\n}\n\nexport default EmbedPreview;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AA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,KAAK,EAAGA,KAAO;QAAAmB,QAAA,gBAEf,IAAAvC,WAAA,CAAAoC,GAAA;UAAGlB,SAAS,EAAC,+BAA+B;UAAAqB,QAAA,eAC3C,IAAAvC,WAAA,CAAAoC,GAAA;YAAGW,IAAI,EAAG/B,GAAK;YAAAuB,QAAA,EAAGvB;UAAG,CAAK;QAAC,CACzB,CAAC,eACJ,IAAAhB,WAAA,CAAAoC,GAAA;UAAGlB,SAAS,EAAC,+BAA+B;UAAAqB,QAAA,EACzC,IAAAR,aAAO,GACR;UACA,IAAAC,QAAE,EACD,4DACD,CAAC,EACDJ,cACD;QAAC,CACC,CAAC;MAAA,CACQ,CACb,eACD,IAAA5B,WAAA,CAAAoC,GAAA,EAACrC,QAAA,CAAAiD,OAAO;QACP1B,UAAU,EAAGA,UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BZ,UAAU,EAAGA,UAAY;QACzBU,iBAAiB,EAAGA,iBAAmB;QACvCD,KAAK,EAAG,IAAAY,QAAE,EAAE,oBAAqB,CAAG;QACpCiB,iBAAiB,EAAGtC;MAAY,CAChC,CAAC;IAAA,CACK,CAAC;EAEX;AACD;AAAC,IAAAuC,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcpC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_util","require","_clsx","_interopRequireDefault","_i18n","_components","_blockEditor","_element","_url","_wpEmbedPreview","_caption","_jsxRuntime","EmbedPreview","preview","previewable","url","type","isSelected","className","icon","label","insertBlocksAfter","attributes","setAttributes","interactive","setInteractive","useState","hideOverlay","scripts","html","getPhotoHtml","embedSourceUrl","getAuthority","iframeTitle","sprintf","__","sandboxClassnames","clsx","embedWrapper","jsx","default","jsxs","children","SandBox","title","onFocus","onMouseUp","Placeholder","BlockIcon","showColors","href","Caption","showToolbarButton"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\nimport { Caption } from '../utils/caption';\n\nexport default function EmbedPreview( {\n\tpreview,\n\tpreviewable,\n\turl,\n\ttype,\n\tisSelected,\n\tclassName,\n\ticon,\n\tlabel,\n\tinsertBlocksAfter,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst [ interactive, setInteractive ] = useState( false );\n\n\tif ( ! isSelected && interactive ) {\n\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t// happens on mouseup when the overlay is clicked.\n\t\tsetInteractive( false );\n\t}\n\n\tconst hideOverlay = () => {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tsetInteractive( true );\n\t};\n\n\tconst { scripts } = preview;\n\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst embedSourceUrl = getAuthority( url );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tembedSourceUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t// as far as the user is concerned. We're just catching the first click so that\n\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\tconst embedWrapper =\n\t\t'wp-embed' === type ? (\n\t\t\t<WpEmbedPreview html={ html } />\n\t\t) : (\n\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t<SandBox\n\t\t\t\t\thtml={ html }\n\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\tonFocus={ hideOverlay }\n\t\t\t\t/>\n\t\t\t\t{ ! interactive && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\tonMouseUp={ hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\treturn (\n\t\t<figure\n\t\t\tclassName={ clsx( className, 'wp-block-embed', {\n\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ previewable ? (\n\t\t\t\tembedWrapper\n\t\t\t) : (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t</p>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tembedSourceUrl\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t<Caption\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tinsertBlocksAfter={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A,gBAEf,IAAA/B,WAAA,CAAA4B,GAAA;QAAGrB,SAAS,EAAC,+BAA+B;QAAAwB,QAAA,eAC3C,IAAA/B,WAAA,CAAA4B,GAAA;UAAGW,IAAI,EAAGnC,GAAK;UAAA2B,QAAA,EAAG3B;QAAG,CAAK;MAAC,CACzB,CAAC,eACJ,IAAAJ,WAAA,CAAA4B,GAAA;QAAGrB,SAAS,EAAC,+BAA+B;QAAAwB,QAAA,EACzC,IAAAR,aAAO,GACR;QACA,IAAAC,QAAE,EACD,4DACD,CAAC,EACDJ,cACD;MAAC,CACC,CAAC;IAAA,CACQ,CACb,eACD,IAAApB,WAAA,CAAA4B,GAAA,EAAC7B,QAAA,CAAAyC,OAAO;MACP7B,UAAU,EAAGA,UAAY;MACzBC,aAAa,EAAGA,aAAe;MAC/BN,UAAU,EAAGA,UAAY;MACzBI,iBAAiB,EAAGA,iBAAmB;MACvCD,KAAK,EAAG,IAAAe,QAAE,EAAE,oBAAqB,CAAG;MACpCiB,iBAAiB,EAAGnC;IAAY,CAChC,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_clsx","_interopRequireDefault","_primitives","_blockEditor","_i18n","_element","_components","_data","_util","_embedNoPreview","_wpEmbedPreview","_styles","_jsxRuntime","EmbedPreview","align","className","clientId","icon","insertBlocksAfter","isSelected","label","onFocus","preview","previewable","isProviderPreviewable","type","url","isDefaultEmbedInfo","isCaptionSelected","setIsCaptionSelected","useState","locale","useSelect","blockEditorStore","getSettings","wrapperStyle","styles","wrapperAlignStyle","sandboxAlignStyle","accessibilityLabelCreator","caption","RichText","isEmpty","__","sprintf","onEmbedPreviewPress","onFocusCaption","provider_url","providerUrl","html","getPhotoHtml","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","clsx","PreviewContent","WpEmbedPreview","SandBox","embedWrapper","jsx","Fragment","children","TouchableWithoutFeedback","onPress","View","pointerEvents","style","lang","title","containerStyle","accessible","disabled","jsxs","default","BlockCaption","_default","exports","memo"],"sources":["@wordpress/block-library/src/embed/embed-preview.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tBlockCaption,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { memo, useState } from '@wordpress/element';\nimport { SandBox } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\nimport EmbedNoPreview from './embed-no-preview';\nimport WpEmbedPreview from './wp-embed-preview';\nimport styles from './styles.scss';\n\nconst EmbedPreview = ( {\n\talign,\n\tclassName,\n\tclientId,\n\ticon,\n\tinsertBlocksAfter,\n\tisSelected,\n\tlabel,\n\tonFocus,\n\tpreview,\n\tpreviewable,\n\tisProviderPreviewable,\n\ttype,\n\turl,\n\tisDefaultEmbedInfo,\n} ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tconst { locale } = useSelect( blockEditorStore ).getSettings();\n\n\tconst wrapperStyle = styles[ 'embed-preview__wrapper' ];\n\tconst wrapperAlignStyle =\n\t\tstyles[ `embed-preview__wrapper--align-${ align }` ];\n\tconst sandboxAlignStyle =\n\t\tstyles[ `embed-preview__sandbox--align-${ align }` ];\n\n\tfunction accessibilityLabelCreator( caption ) {\n\t\treturn RichText.isEmpty( caption )\n\t\t\t? /* translators: accessibility text. Empty Embed caption. */\n\t\t\t __( 'Embed caption. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: Embed caption. */\n\t\t\t\t\t__( 'Embed caption. %s' ),\n\t\t\t\t\tcaption\n\t\t\t );\n\t}\n\n\tfunction onEmbedPreviewPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( onFocus ) {\n\t\t\tonFocus();\n\t\t}\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tconst { provider_url: providerUrl } = preview;\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst parsedHost = new URL( url ).host.split( '.' );\n\tconst parsedHostBaseUrl = parsedHost\n\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t.join( '.' );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tparsedHostBaseUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\tconst PreviewContent = 'wp-embed' === type ? WpEmbedPreview : SandBox;\n\tconst embedWrapper = (\n\t\t<>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ () => {\n\t\t\t\t\tif ( onFocus ) {\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( isCaptionSelected ) {\n\t\t\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"box-only\"\n\t\t\t\t\tstyle={ [ wrapperStyle, wrapperAlignStyle ] }\n\t\t\t\t>\n\t\t\t\t\t<PreviewContent\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tlang={ locale }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tproviderUrl={ providerUrl }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tcontainerStyle={ sandboxAlignStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</>\n\t);\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onEmbedPreviewPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t{ isProviderPreviewable && previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<EmbedNoPreview\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonPress={ () => setIsCaptionSelected( false ) }\n\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\tisDefaultEmbedInfo={ isDefaultEmbedInfo }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessibilityLabelCreator={ accessibilityLabelCreator }\n\t\t\t\t\taccessible\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n};\n\nexport default memo( EmbedPreview );\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,eAAA,GAA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version":3,"names":["_reactNative","require","_clsx","_interopRequireDefault","_primitives","_blockEditor","_i18n","_element","_components","_data","_util","_embedNoPreview","_wpEmbedPreview","_styles","_jsxRuntime","EmbedPreview","align","className","clientId","icon","insertBlocksAfter","isSelected","label","onFocus","preview","previewable","isProviderPreviewable","type","url","isDefaultEmbedInfo","isCaptionSelected","setIsCaptionSelected","useState","locale","useSelect","blockEditorStore","getSettings","wrapperStyle","styles","wrapperAlignStyle","sandboxAlignStyle","accessibilityLabelCreator","caption","RichText","isEmpty","__","sprintf","onEmbedPreviewPress","onFocusCaption","provider_url","providerUrl","html","getPhotoHtml","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","clsx","PreviewContent","WpEmbedPreview","SandBox","embedWrapper","jsx","Fragment","children","TouchableWithoutFeedback","onPress","View","pointerEvents","style","lang","title","containerStyle","accessible","disabled","jsxs","default","BlockCaption","_default","exports","memo"],"sources":["@wordpress/block-library/src/embed/embed-preview.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tBlockCaption,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { memo, useState } from '@wordpress/element';\nimport { SandBox } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\nimport EmbedNoPreview from './embed-no-preview';\nimport WpEmbedPreview from './wp-embed-preview';\nimport styles from './styles.scss';\n\nconst EmbedPreview = ( {\n\talign,\n\tclassName,\n\tclientId,\n\ticon,\n\tinsertBlocksAfter,\n\tisSelected,\n\tlabel,\n\tonFocus,\n\tpreview,\n\tpreviewable,\n\tisProviderPreviewable,\n\ttype,\n\turl,\n\tisDefaultEmbedInfo,\n} ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tconst { locale } = useSelect( blockEditorStore ).getSettings();\n\n\tconst wrapperStyle = styles[ 'embed-preview__wrapper' ];\n\tconst wrapperAlignStyle =\n\t\tstyles[ `embed-preview__wrapper--align-${ align }` ];\n\tconst sandboxAlignStyle =\n\t\tstyles[ `embed-preview__sandbox--align-${ align }` ];\n\n\tfunction accessibilityLabelCreator( caption ) {\n\t\treturn RichText.isEmpty( caption )\n\t\t\t? /* translators: accessibility text. Empty Embed caption. */\n\t\t\t __( 'Embed caption. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: Embed caption. */\n\t\t\t\t\t__( 'Embed caption. %s' ),\n\t\t\t\t\tcaption\n\t\t\t );\n\t}\n\n\tfunction onEmbedPreviewPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( onFocus ) {\n\t\t\tonFocus();\n\t\t}\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tconst { provider_url: providerUrl } = preview;\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst parsedHost = new URL( url ).host.split( '.' );\n\tconst parsedHostBaseUrl = parsedHost\n\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t.join( '.' );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tparsedHostBaseUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\tconst PreviewContent = 'wp-embed' === type ? WpEmbedPreview : SandBox;\n\tconst embedWrapper = (\n\t\t<>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ () => {\n\t\t\t\t\tif ( onFocus ) {\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( isCaptionSelected ) {\n\t\t\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"box-only\"\n\t\t\t\t\tstyle={ [ wrapperStyle, wrapperAlignStyle ] }\n\t\t\t\t>\n\t\t\t\t\t<PreviewContent\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tlang={ locale }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tproviderUrl={ providerUrl }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tcontainerStyle={ sandboxAlignStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</>\n\t);\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onEmbedPreviewPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t{ isProviderPreviewable && previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<EmbedNoPreview\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonPress={ () => setIsCaptionSelected( false ) }\n\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\tisDefaultEmbedInfo={ isDefaultEmbedInfo }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessibilityLabelCreator={ accessibilityLabelCreator }\n\t\t\t\t\taccessible\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\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,kBAAkB,EAAGA;MAAoB,CACzC,CACD,eACD,IAAAf,WAAA,CAAAsD,GAAA,EAAC/D,YAAA,CAAA8E,YAAY;QACZ1C,yBAAyB,EAAGA,yBAA2B;QACvDsC,UAAU;QACV7D,QAAQ,EAAGA,QAAU;QACrBE,iBAAiB,EAAGA,iBAAmB;QACvCC,UAAU,EAAGS,iBAAmB;QAChCP,OAAO,EAAGyB;MAAgB,CAC1B,CAAC;IAAA,CACG;EAAC,CACkB,CAAC;AAE7B,CAAC;AAAC,IAAAoC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEa,IAAAI,aAAI,EAAEvE,YAAa,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  // eslint-disable-next-line eslint-comments/disable-enable-pair
@@ -1 +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","_wp_http_referer","href","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\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.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;IAC5Cc,QAAQ,CAACS,gBAAgB,GAAGjB,MAAM,CAACC,QAAQ,CAACiB,IAAI;IAChDV,QAAQ,CAACK,UAAU,GAAGpB,IAAI,CAACC,MAAM;IAEjC,IAAI;MACH,MAAMyB,QAAQ,GAAG,MAAMC,KAAK,CAAEL,mBAAmB,CAACM,OAAO,EAAE;QAC1DC,MAAM,EAAE,MAAM;QACdC,OAAO,EAAE;UACR,cAAc,EAAE;QACjB,CAAC;QACDC,IAAI,EAAE,IAAIzB,eAAe,CAAES,QAAS,CAAC,CAACJ,QAAQ,CAAC;MAChD,CAAE,CAAC;MACH,IAAKe,QAAQ,CAACM,EAAE,EAAG;QAClB7B,oBAAoB,CAAE,SAAU,CAAC;MAClC,CAAC,MAAM;QACNA,oBAAoB,CAAE,OAAQ,CAAC;MAChC;IACD,CAAC,CAAC,OAAQ8B,KAAK,EAAG;MACjB9B,oBAAoB,CAAE,OAAQ,CAAC;IAChC;EACD,CAAE,CAAC;AACJ,CAAE,CAAC","ignoreList":[]}
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","_wp_http_referer","href","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\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.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;IAC5Cc,QAAQ,CAACS,gBAAgB,GAAGjB,MAAM,CAACC,QAAQ,CAACiB,IAAI;IAChDV,QAAQ,CAACK,UAAU,GAAGpB,IAAI,CAACC,MAAM;IAEjC,IAAI;MACH,MAAMyB,QAAQ,GAAG,MAAMC,KAAK,CAAEL,mBAAmB,CAACM,OAAO,EAAE;QAC1DC,MAAM,EAAE,MAAM;QACdC,OAAO,EAAE;UACR,cAAc,EAAE;QACjB,CAAC;QACDC,IAAI,EAAE,IAAIzB,eAAe,CAAES,QAAS,CAAC,CAACJ,QAAQ,CAAC;MAChD,CAAE,CAAC;MACH,IAAKe,QAAQ,CAACM,EAAE,EAAG;QAClB7B,oBAAoB,CAAE,SAAU,CAAC;MAClC,CAAC,MAAM;QACNA,oBAAoB,CAAE,OAAQ,CAAC;MAChC;IACD,CAAC,CAAC,OAAQ8B,KAAK,EAAG;MACjB9B,oBAAoB,CAAE,OAAQ,CAAC;IAChC;EACD,CAAE,CAAC;AACJ,CAAE,CAAC","ignoreList":[]}
@@ -27,6 +27,118 @@ const getNameFromLabelV1 = content => {
27
27
  // Remove any remaining leading or trailing hyphens.
28
28
  .replace(/(^-+)|(-+$)/g, '');
29
29
  };
30
+ const v2 = {
31
+ attributes: {
32
+ type: {
33
+ type: 'string',
34
+ default: 'text'
35
+ },
36
+ name: {
37
+ type: 'string'
38
+ },
39
+ label: {
40
+ type: 'string',
41
+ default: 'Label',
42
+ selector: '.wp-block-form-input__label-content',
43
+ source: 'html',
44
+ __experimentalRole: 'content'
45
+ },
46
+ inlineLabel: {
47
+ type: 'boolean',
48
+ default: false
49
+ },
50
+ required: {
51
+ type: 'boolean',
52
+ default: false,
53
+ selector: '.wp-block-form-input__input',
54
+ source: 'attribute',
55
+ attribute: 'required'
56
+ },
57
+ placeholder: {
58
+ type: 'string',
59
+ selector: '.wp-block-form-input__input',
60
+ source: 'attribute',
61
+ attribute: 'placeholder',
62
+ __experimentalRole: 'content'
63
+ },
64
+ value: {
65
+ type: 'string',
66
+ default: '',
67
+ selector: 'input',
68
+ source: 'attribute',
69
+ attribute: 'value'
70
+ },
71
+ visibilityPermissions: {
72
+ type: 'string',
73
+ default: 'all'
74
+ }
75
+ },
76
+ supports: {
77
+ anchor: true,
78
+ reusable: false,
79
+ spacing: {
80
+ margin: ['top', 'bottom']
81
+ },
82
+ __experimentalBorder: {
83
+ radius: true,
84
+ __experimentalSkipSerialization: true,
85
+ __experimentalDefaultControls: {
86
+ radius: true
87
+ }
88
+ }
89
+ },
90
+ save({
91
+ attributes
92
+ }) {
93
+ const {
94
+ type,
95
+ name,
96
+ label,
97
+ inlineLabel,
98
+ required,
99
+ placeholder,
100
+ value
101
+ } = attributes;
102
+ const borderProps = (0, _blockEditor.__experimentalGetBorderClassesAndStyles)(attributes);
103
+ const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes);
104
+ const inputStyle = {
105
+ ...borderProps.style,
106
+ ...colorProps.style
107
+ };
108
+ const inputClasses = (0, _clsx.default)('wp-block-form-input__input', colorProps.className, borderProps.className);
109
+ const TagName = type === 'textarea' ? 'textarea' : 'input';
110
+ const blockProps = _blockEditor.useBlockProps.save();
111
+ if ('hidden' === type) {
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
113
+ type: type,
114
+ name: name,
115
+ value: value
116
+ });
117
+ }
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
119
+ ...blockProps,
120
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
121
+ className: (0, _clsx.default)('wp-block-form-input__label', {
122
+ 'is-label-inline': inlineLabel
123
+ }),
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
125
+ className: "wp-block-form-input__label-content",
126
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText.Content, {
127
+ value: label
128
+ })
129
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
130
+ className: inputClasses,
131
+ type: 'textarea' === type ? undefined : type,
132
+ name: name || getNameFromLabelV1(label),
133
+ required: required,
134
+ "aria-required": required,
135
+ placeholder: placeholder || undefined,
136
+ style: inputStyle
137
+ })]
138
+ })
139
+ });
140
+ }
141
+ };
30
142
 
31
143
  // Version without wrapper div in saved markup
32
144
  // See: https://github.com/WordPress/gutenberg/pull/56507
@@ -142,6 +254,6 @@ const v1 = {
142
254
  /* eslint-enable jsx-a11y/label-has-associated-control */
143
255
  }
144
256
  };
145
- const deprecated = [v1];
257
+ const deprecated = [v2, v1];
146
258
  var _default = exports.default = deprecated;
147
259
  //# sourceMappingURL=deprecated.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_removeAccents","_blockEditor","_dom","_jsxRuntime","getNameFromLabelV1","content","removeAccents","stripHTML","replace","toLowerCase","v1","attributes","type","default","name","label","selector","source","__experimentalRole","inlineLabel","required","attribute","placeholder","value","visibilityPermissions","supports","className","anchor","reusable","spacing","margin","__experimentalBorder","radius","__experimentalSkipSerialization","__experimentalDefaultControls","save","borderProps","getBorderClassesAndStyles","colorProps","getColorClassesAndStyles","inputStyle","style","inputClasses","clsx","TagName","jsx","jsxs","children","RichText","Content","undefined","deprecated","_default","exports"],"sources":["@wordpress/block-library/src/form-input/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nconst getNameFromLabelV1 = ( content ) => {\n\treturn (\n\t\tremoveAccents( stripHTML( content ) )\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\n// Version without wrapper div in saved markup\n// See: https://github.com/WordPress/gutenberg/pull/56507\nconst v1 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'text',\n\t\t},\n\t\tname: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlabel: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'Label',\n\t\t\tselector: '.wp-block-form-input__label-content',\n\t\t\tsource: 'html',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tinlineLabel: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trequired: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'required',\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: 'string',\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'placeholder',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tvalue: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tselector: 'input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'value',\n\t\t},\n\t\tvisibilityPermissions: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'all',\n\t\t},\n\t},\n\tsupports: {\n\t\tclassName: false,\n\t\tanchor: true,\n\t\treusable: false,\n\t\tspacing: {\n\t\t\tmargin: [ 'top', 'bottom' ],\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\t__experimentalSkipSerialization: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\t\tattributes;\n\n\t\tconst borderProps = getBorderClassesAndStyles( attributes );\n\t\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t\tconst inputStyle = {\n\t\t\t...borderProps.style,\n\t\t\t...colorProps.style,\n\t\t};\n\n\t\tconst inputClasses = clsx(\n\t\t\t'wp-block-form-input__input',\n\t\t\tcolorProps.className,\n\t\t\tborderProps.className\n\t\t);\n\t\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\t\tif ( 'hidden' === type ) {\n\t\t\treturn <input type={ type } name={ name } value={ value } />;\n\t\t}\n\n\t\t/* eslint-disable jsx-a11y/label-has-associated-control */\n\t\treturn (\n\t\t\t<label\n\t\t\t\tclassName={ clsx( 'wp-block-form-input__label', {\n\t\t\t\t\t'is-label-inline': inlineLabel,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<span className=\"wp-block-form-input__label-content\">\n\t\t\t\t\t<RichText.Content value={ label } />\n\t\t\t\t</span>\n\t\t\t\t<TagName\n\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\t\tname={ name || getNameFromLabelV1( label ) }\n\t\t\t\t\trequired={ required }\n\t\t\t\t\taria-required={ required }\n\t\t\t\t\tplaceholder={ placeholder || undefined }\n\t\t\t\t\tstyle={ inputStyle }\n\t\t\t\t/>\n\t\t\t</label>\n\t\t);\n\t\t/* eslint-enable jsx-a11y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EAAGA,IAAM;QAACE,IAAI,EAAGA,IAAM;QAACS,KAAK,EAAGA;MAAO,CAAE,CAAC;IAC7D;;IAEA;IACA,oBACC,IAAApB,WAAA,CAAA2C,IAAA;MACCpB,SAAS,EAAG,IAAAiB,aAAI,EAAE,4BAA4B,EAAE;QAC/C,iBAAiB,EAAExB;MACpB,CAAE,CAAG;MAAA4B,QAAA,gBAEL,IAAA5C,WAAA,CAAA0C,GAAA;QAAMnB,SAAS,EAAC,oCAAoC;QAAAqB,QAAA,eACnD,IAAA5C,WAAA,CAAA0C,GAAA,EAAC5C,YAAA,CAAA+C,QAAQ,CAACC,OAAO;UAAC1B,KAAK,EAAGR;QAAO,CAAE;MAAC,CAC/B,CAAC,eACP,IAAAZ,WAAA,CAAA0C,GAAA,EAACD,OAAO;QACPlB,SAAS,EAAGgB,YAAc;QAC1B9B,IAAI,EAAG,UAAU,KAAKA,IAAI,GAAGsC,SAAS,GAAGtC,IAAM;QAC/CE,IAAI,EAAGA,IAAI,IAAIV,kBAAkB,CAAEW,KAAM,CAAG;QAC5CK,QAAQ,EAAGA,QAAU;QACrB,iBAAgBA,QAAU;QAC1BE,WAAW,EAAGA,WAAW,IAAI4B,SAAW;QACxCT,KAAK,EAAGD;MAAY,CACpB,CAAC;IAAA,CACI,CAAC;IAET;EACD;AACD,CAAC;AAED,MAAMW,UAAU,GAAG,CAAEzC,EAAE,CAAE;AAAC,IAAA0C,QAAA,GAAAC,OAAA,CAAAxC,OAAA,GAEXsC,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_removeAccents","_blockEditor","_dom","_jsxRuntime","getNameFromLabelV1","content","removeAccents","stripHTML","replace","toLowerCase","v2","attributes","type","default","name","label","selector","source","__experimentalRole","inlineLabel","required","attribute","placeholder","value","visibilityPermissions","supports","anchor","reusable","spacing","margin","__experimentalBorder","radius","__experimentalSkipSerialization","__experimentalDefaultControls","save","borderProps","getBorderClassesAndStyles","colorProps","getColorClassesAndStyles","inputStyle","style","inputClasses","clsx","className","TagName","blockProps","useBlockProps","jsx","children","jsxs","RichText","Content","undefined","v1","deprecated","_default","exports"],"sources":["@wordpress/block-library/src/form-input/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nconst getNameFromLabelV1 = ( content ) => {\n\treturn (\n\t\tremoveAccents( stripHTML( content ) )\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\nconst v2 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'text',\n\t\t},\n\t\tname: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlabel: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'Label',\n\t\t\tselector: '.wp-block-form-input__label-content',\n\t\t\tsource: 'html',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tinlineLabel: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trequired: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'required',\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: 'string',\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'placeholder',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tvalue: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tselector: 'input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'value',\n\t\t},\n\t\tvisibilityPermissions: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'all',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\treusable: false,\n\t\tspacing: {\n\t\t\tmargin: [ 'top', 'bottom' ],\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\t__experimentalSkipSerialization: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\t\tattributes;\n\n\t\tconst borderProps = getBorderClassesAndStyles( attributes );\n\t\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t\tconst inputStyle = {\n\t\t\t...borderProps.style,\n\t\t\t...colorProps.style,\n\t\t};\n\n\t\tconst inputClasses = clsx(\n\t\t\t'wp-block-form-input__input',\n\t\t\tcolorProps.className,\n\t\t\tborderProps.className\n\t\t);\n\t\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\t\tconst blockProps = useBlockProps.save();\n\n\t\tif ( 'hidden' === type ) {\n\t\t\treturn <input type={ type } name={ name } value={ value } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/label-has-associated-control */ }\n\t\t\t\t<label\n\t\t\t\t\tclassName={ clsx( 'wp-block-form-input__label', {\n\t\t\t\t\t\t'is-label-inline': inlineLabel,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"wp-block-form-input__label-content\">\n\t\t\t\t\t\t<RichText.Content value={ label } />\n\t\t\t\t\t</span>\n\t\t\t\t\t<TagName\n\t\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\t\t\tname={ name || getNameFromLabelV1( label ) }\n\t\t\t\t\t\trequired={ required }\n\t\t\t\t\t\taria-required={ required }\n\t\t\t\t\t\tplaceholder={ placeholder || undefined }\n\t\t\t\t\t\tstyle={ inputStyle }\n\t\t\t\t\t/>\n\t\t\t\t</label>\n\t\t\t\t{ /* eslint-enable jsx-a11y/label-has-associated-control */ }\n\t\t\t</div>\n\t\t);\n\t},\n};\n\n// Version without wrapper div in saved markup\n// See: https://github.com/WordPress/gutenberg/pull/56507\nconst v1 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'text',\n\t\t},\n\t\tname: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlabel: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'Label',\n\t\t\tselector: '.wp-block-form-input__label-content',\n\t\t\tsource: 'html',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tinlineLabel: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trequired: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'required',\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: 'string',\n\t\t\tselector: '.wp-block-form-input__input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'placeholder',\n\t\t\t__experimentalRole: 'content',\n\t\t},\n\t\tvalue: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tselector: 'input',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'value',\n\t\t},\n\t\tvisibilityPermissions: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'all',\n\t\t},\n\t},\n\tsupports: {\n\t\tclassName: false,\n\t\tanchor: true,\n\t\treusable: false,\n\t\tspacing: {\n\t\t\tmargin: [ 'top', 'bottom' ],\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\t__experimentalSkipSerialization: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\t\tattributes;\n\n\t\tconst borderProps = getBorderClassesAndStyles( attributes );\n\t\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t\tconst inputStyle = {\n\t\t\t...borderProps.style,\n\t\t\t...colorProps.style,\n\t\t};\n\n\t\tconst inputClasses = clsx(\n\t\t\t'wp-block-form-input__input',\n\t\t\tcolorProps.className,\n\t\t\tborderProps.className\n\t\t);\n\t\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\t\tif ( 'hidden' === type ) {\n\t\t\treturn <input type={ type } name={ name } value={ value } />;\n\t\t}\n\n\t\t/* eslint-disable jsx-a11y/label-has-associated-control */\n\t\treturn (\n\t\t\t<label\n\t\t\t\tclassName={ clsx( 'wp-block-form-input__label', {\n\t\t\t\t\t'is-label-inline': inlineLabel,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<span className=\"wp-block-form-input__label-content\">\n\t\t\t\t\t<RichText.Content value={ label } />\n\t\t\t\t</span>\n\t\t\t\t<TagName\n\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\t\tname={ name || getNameFromLabelV1( label ) }\n\t\t\t\t\trequired={ required }\n\t\t\t\t\taria-required={ required }\n\t\t\t\t\tplaceholder={ placeholder || undefined }\n\t\t\t\t\tstyle={ inputStyle }\n\t\t\t\t/>\n\t\t\t</label>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/label-has-associated-control */\n\t},\n};\n\nconst deprecated = [ v2, v1 ];\n\nexport default deprecated;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AAKA,IAAAE,YAAA,G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const isCheckboxOrRadio = type === 'checkbox' || type === 'radio';
44
47
  const controls = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
45
48
  children: ['hidden' !== type && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
46
49
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
@@ -82,6 +85,17 @@ function InputFieldBlock({
82
85
  })
83
86
  })]
84
87
  });
88
+ const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText, {
89
+ tagName: "span",
90
+ className: "wp-block-form-input__label-content",
91
+ value: label,
92
+ onChange: newLabel => setAttributes({
93
+ label: newLabel
94
+ }),
95
+ "aria-label": label ? (0, _i18n.__)('Label') : (0, _i18n.__)('Empty label'),
96
+ "data-empty": !label,
97
+ placeholder: (0, _i18n.__)('Type the label for this input')
98
+ });
85
99
  if ('hidden' === type) {
86
100
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
87
101
  children: [controls, /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
@@ -101,17 +115,7 @@ function InputFieldBlock({
101
115
  className: (0, _clsx.default)('wp-block-form-input__label', {
102
116
  'is-label-inline': inlineLabel || 'checkbox' === type
103
117
  }),
104
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText, {
105
- tagName: "span",
106
- className: "wp-block-form-input__label-content",
107
- value: label,
108
- onChange: newLabel => setAttributes({
109
- label: newLabel
110
- }),
111
- "aria-label": label ? (0, _i18n.__)('Label') : (0, _i18n.__)('Empty label'),
112
- "data-empty": label ? false : true,
113
- placeholder: (0, _i18n.__)('Type the label for this input')
114
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
118
+ children: [!isCheckboxOrRadio && content, /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
115
119
  type: 'textarea' === type ? undefined : type,
116
120
  className: (0, _clsx.default)(className, 'wp-block-form-input__input', colorProps.className, borderProps.className),
117
121
  "aria-label": (0, _i18n.__)('Optional placeholder text')
@@ -129,7 +133,7 @@ function InputFieldBlock({
129
133
  ...borderProps.style,
130
134
  ...colorProps.style
131
135
  }
132
- })]
136
+ }), isCheckboxOrRadio && content]
133
137
  })]
134
138
  });
135
139
  }