@wordpress/block-directory 4.35.0 → 5.0.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 (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-ratings/index.js +7 -6
  3. package/build/components/block-ratings/index.js.map +1 -1
  4. package/build/components/block-ratings/stars.js +23 -25
  5. package/build/components/block-ratings/stars.js.map +1 -1
  6. package/build/components/compact-list/index.js +26 -22
  7. package/build/components/compact-list/index.js.map +1 -1
  8. package/build/components/downloadable-block-icon/index.js +3 -3
  9. package/build/components/downloadable-block-icon/index.js.map +1 -1
  10. package/build/components/downloadable-block-list-item/index.js +37 -27
  11. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  12. package/build/components/downloadable-block-notice/index.js +8 -6
  13. package/build/components/downloadable-block-notice/index.js.map +1 -1
  14. package/build/components/downloadable-blocks-list/index.js +26 -26
  15. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-panel/index.js +24 -17
  17. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/inserter-panel.js +21 -14
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/no-results.js +20 -11
  21. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  22. package/build/plugins/get-install-missing/index.js +18 -15
  23. package/build/plugins/get-install-missing/index.js.map +1 -1
  24. package/build/plugins/get-install-missing/install-button.js +6 -5
  25. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  26. package/build/plugins/index.js +4 -2
  27. package/build/plugins/index.js.map +1 -1
  28. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  29. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  30. package/build/plugins/installed-blocks-pre-publish-panel/index.js +10 -8
  31. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  32. package/build-module/components/block-ratings/index.js +7 -6
  33. package/build-module/components/block-ratings/index.js.map +1 -1
  34. package/build-module/components/block-ratings/stars.js +24 -25
  35. package/build-module/components/block-ratings/stars.js.map +1 -1
  36. package/build-module/components/compact-list/index.js +27 -22
  37. package/build-module/components/compact-list/index.js.map +1 -1
  38. package/build-module/components/downloadable-block-icon/index.js +3 -3
  39. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  40. package/build-module/components/downloadable-block-list-item/index.js +39 -27
  41. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  42. package/build-module/components/downloadable-block-notice/index.js +9 -6
  43. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  44. package/build-module/components/downloadable-blocks-list/index.js +26 -26
  45. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  46. package/build-module/components/downloadable-blocks-panel/index.js +26 -17
  47. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  48. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +23 -14
  49. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  50. package/build-module/components/downloadable-blocks-panel/no-results.js +22 -11
  51. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  52. package/build-module/plugins/get-install-missing/index.js +19 -15
  53. package/build-module/plugins/get-install-missing/index.js.map +1 -1
  54. package/build-module/plugins/get-install-missing/install-button.js +6 -5
  55. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  56. package/build-module/plugins/index.js +6 -2
  57. package/build-module/plugins/index.js.map +1 -1
  58. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  59. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  60. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +11 -8
  61. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  62. package/package.json +23 -22
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_icons","_compactList","_interopRequireDefault","_store","_window$wp$editor","PluginPrePublishPanel","window","wp","editor","InstalledBlocksPrePublishPanel","newBlockTypes","useSelect","select","blockDirectoryStore","getNewBlockTypes","length","_react","createElement","icon","blockDefault","title","sprintf","_n","initialOpen","className","default","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\n// We shouldn't import the editor package directly\n// because it would include the wp-editor in all pages loading the block-directory script.\nconst { PluginPrePublishPanel } = window?.wp?.editor ?? {};\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,IAAAM,iBAAA;AAX3D;AACA;AACA;AAKA;AACA;AACA;AAIA;AACA;AACA,MAAM;EAAEC;AAAsB,CAAC,IAAAD,iBAAA,GAAGE,MAAM,EAAEC,EAAE,EAAEC,MAAM,cAAAJ,iBAAA,cAAAA,iBAAA,GAAI,CAAC,CAAC;AAE3C,SAASK,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEJ,aAAa,CAACK,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,qBAAqB;IACrBa,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG,IAAAC,aAAO;IACd;IACA,IAAAC,QAAE,EACD,iBAAiB,EACjB,kBAAkB,EAClBZ,aAAa,CAACK,MACf,CAAC,EACDL,aAAa,CAACK,MACf,CAAG;IACHQ,WAAW;EAAA,GAEX,IAAAP,MAAA,CAAAC,aAAA;IAAGO,SAAS,EAAC;EAA0C,GACpD,IAAAF,QAAE,EACH,kDAAkD,EAClD,oDAAoD,EACpDZ,aAAa,CAACK,MACf,CACE,CAAC,EACJ,IAAAC,MAAA,CAAAC,aAAA,EAAChB,YAAA,CAAAwB,OAAW;IAACC,KAAK,EAAGhB;EAAe,CAAE,CAChB,CAAC;AAE1B","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_data","_icons","_compactList","_interopRequireDefault","_store","_jsxRuntime","_window$wp$editor","PluginPrePublishPanel","window","wp","editor","InstalledBlocksPrePublishPanel","newBlockTypes","useSelect","select","blockDirectoryStore","getNewBlockTypes","length","jsxs","icon","blockDefault","title","sprintf","_n","initialOpen","children","jsx","className","default","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\n// We shouldn't import the editor package directly\n// because it would include the wp-editor in all pages loading the block-directory script.\nconst { PluginPrePublishPanel } = window?.wp?.editor ?? {};\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAAA,IAAAO,iBAAA;AAX3D;AACA;AACA;AAKA;AACA;AACA;AAIA;AACA;AACA,MAAM;EAAEC;AAAsB,CAAC,IAAAD,iBAAA,GAAGE,MAAM,EAAEC,EAAE,EAAEC,MAAM,cAAAJ,iBAAA,cAAAA,iBAAA,GAAI,CAAC,CAAC;AAE3C,SAASK,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEJ,aAAa,CAACK,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAZ,WAAA,CAAAa,IAAA,EAACX,qBAAqB;IACrBY,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG,IAAAC,aAAO;IACd;IACA,IAAAC,QAAE,EACD,iBAAiB,EACjB,kBAAkB,EAClBX,aAAa,CAACK,MACf,CAAC,EACDL,aAAa,CAACK,MACf,CAAG;IACHO,WAAW;IAAAC,QAAA,gBAEX,IAAApB,WAAA,CAAAqB,GAAA;MAAGC,SAAS,EAAC,0CAA0C;MAAAF,QAAA,EACpD,IAAAF,QAAE,EACH,kDAAkD,EAClD,oDAAoD,EACpDX,aAAa,CAACK,MACf;IAAC,CACC,CAAC,eACJ,IAAAZ,WAAA,CAAAqB,GAAA,EAACxB,YAAA,CAAA0B,OAAW;MAACC,KAAK,EAAGjB;IAAe,CAAE,CAAC;EAAA,CACjB,CAAC;AAE1B","ignoreList":[]}
@@ -1,14 +1,15 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * Internal dependencies
4
3
  */
5
4
  import Stars from './stars';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export const BlockRatings = ({
7
7
  rating
8
- }) => createElement("span", {
9
- className: "block-directory-block-ratings"
10
- }, createElement(Stars, {
11
- rating: rating
12
- }));
8
+ }) => /*#__PURE__*/_jsx("span", {
9
+ className: "block-directory-block-ratings",
10
+ children: /*#__PURE__*/_jsx(Stars, {
11
+ rating: rating
12
+ })
13
+ });
13
14
  export default BlockRatings;
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Stars","BlockRatings","rating","createElement","className"],"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Stars from './stars';\n\nexport const BlockRatings = ( { rating } ) => (\n\t<span className=\"block-directory-block-ratings\">\n\t\t<Stars rating={ rating } />\n\t</span>\n);\n\nexport default BlockRatings;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,SAAS;AAE3B,OAAO,MAAMC,YAAY,GAAGA,CAAE;EAAEC;AAAO,CAAC,KACvCC,aAAA;EAAMC,SAAS,EAAC;AAA+B,GAC9CD,aAAA,CAACH,KAAK;EAACE,MAAM,EAAGA;AAAQ,CAAE,CACrB,CACN;AAED,eAAeD,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["Stars","jsx","_jsx","BlockRatings","rating","className","children"],"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Stars from './stars';\n\nexport const BlockRatings = ( { rating } ) => (\n\t<span className=\"block-directory-block-ratings\">\n\t\t<Stars rating={ rating } />\n\t</span>\n);\n\nexport default BlockRatings;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5B,OAAO,MAAMC,YAAY,GAAGA,CAAE;EAAEC;AAAO,CAAC,kBACvCF,IAAA;EAAMG,SAAS,EAAC,+BAA+B;EAAAC,QAAA,eAC9CJ,IAAA,CAACF,KAAK;IAACI,MAAM,EAAGA;EAAQ,CAAE;AAAC,CACtB,CACN;AAED,eAAeD,YAAY","ignoreList":[]}
@@ -1,9 +1,10 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { __, sprintf } from '@wordpress/i18n';
6
5
  import { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
8
  function Stars({
8
9
  rating
9
10
  }) {
@@ -11,31 +12,29 @@ function Stars({
11
12
  const fullStarCount = Math.floor(rating);
12
13
  const halfStarCount = Math.ceil(rating - fullStarCount);
13
14
  const emptyStarCount = 5 - (fullStarCount + halfStarCount);
14
- return createElement("span", {
15
+ return /*#__PURE__*/_jsxs("span", {
15
16
  "aria-label": sprintf( /* translators: %s: number of stars. */
16
- __('%s out of 5 stars'), stars)
17
- }, Array.from({
18
- length: fullStarCount
19
- }).map((_, i) => createElement(Icon, {
20
- key: `full_stars_${i}`,
21
- className: "block-directory-block-ratings__star-full",
22
- icon: starFilled,
23
- size: 16
24
- })), Array.from({
25
- length: halfStarCount
26
- }).map((_, i) => createElement(Icon, {
27
- key: `half_stars_${i}`,
28
- className: "block-directory-block-ratings__star-half-full",
29
- icon: starHalf,
30
- size: 16
31
- })), Array.from({
32
- length: emptyStarCount
33
- }).map((_, i) => createElement(Icon, {
34
- key: `empty_stars_${i}`,
35
- className: "block-directory-block-ratings__star-empty",
36
- icon: starEmpty,
37
- size: 16
38
- })));
17
+ __('%s out of 5 stars'), stars),
18
+ children: [Array.from({
19
+ length: fullStarCount
20
+ }).map((_, i) => /*#__PURE__*/_jsx(Icon, {
21
+ className: "block-directory-block-ratings__star-full",
22
+ icon: starFilled,
23
+ size: 16
24
+ }, `full_stars_${i}`)), Array.from({
25
+ length: halfStarCount
26
+ }).map((_, i) => /*#__PURE__*/_jsx(Icon, {
27
+ className: "block-directory-block-ratings__star-half-full",
28
+ icon: starHalf,
29
+ size: 16
30
+ }, `half_stars_${i}`)), Array.from({
31
+ length: emptyStarCount
32
+ }).map((_, i) => /*#__PURE__*/_jsx(Icon, {
33
+ className: "block-directory-block-ratings__star-empty",
34
+ icon: starEmpty,
35
+ size: 16
36
+ }, `empty_stars_${i}`))]
37
+ });
39
38
  }
40
39
  export default Stars;
41
40
  //# sourceMappingURL=stars.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Icon","starEmpty","starFilled","starHalf","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","createElement","Array","from","length","map","_","i","key","className","icon","size"],"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,kBAAkB;AAExE,SAASC,KAAKA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC5B,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CAAEH,MAAM,GAAG,GAAI,CAAC,GAAG,GAAG;EAE9C,MAAMI,aAAa,GAAGF,IAAI,CAACG,KAAK,CAAEL,MAAO,CAAC;EAC1C,MAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAI,CAAEP,MAAM,GAAGI,aAAc,CAAC;EACzD,MAAMI,cAAc,GAAG,CAAC,IAAKJ,aAAa,GAAGE,aAAa,CAAE;EAE5D,OACCG,aAAA;IACC,cAAaf,OAAO,EACnB;IACAD,EAAE,CAAE,mBAAoB,CAAC,EACzBQ,KACD;EAAG,GAEDS,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAER;EAAc,CAAE,CAAC,CAACS,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACpDN,aAAA,CAACd,IAAI;IACJqB,GAAG,EAAI,cAAcD,CAAG,EAAG;IAC3BE,SAAS,EAAC,0CAA0C;IACpDC,IAAI,EAAGrB,UAAY;IACnBsB,IAAI,EAAG;EAAI,CACX,CACA,CAAC,EACDT,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAEN;EAAc,CAAE,CAAC,CAACO,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACpDN,aAAA,CAACd,IAAI;IACJqB,GAAG,EAAI,cAAcD,CAAG,EAAG;IAC3BE,SAAS,EAAC,+CAA+C;IACzDC,IAAI,EAAGpB,QAAU;IACjBqB,IAAI,EAAG;EAAI,CACX,CACA,CAAC,EACDT,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAEJ;EAAe,CAAE,CAAC,CAACK,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACrDN,aAAA,CAACd,IAAI;IACJqB,GAAG,EAAI,eAAeD,CAAG,EAAG;IAC5BE,SAAS,EAAC,2CAA2C;IACrDC,IAAI,EAAGtB,SAAW;IAClBuB,IAAI,EAAG;EAAI,CACX,CACA,CACG,CAAC;AAET;AAEA,eAAepB,KAAK","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","Icon","starEmpty","starFilled","starHalf","jsx","_jsx","jsxs","_jsxs","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","children","Array","from","length","map","_","i","className","icon","size"],"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzE,SAASC,KAAKA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC5B,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CAAEH,MAAM,GAAG,GAAI,CAAC,GAAG,GAAG;EAE9C,MAAMI,aAAa,GAAGF,IAAI,CAACG,KAAK,CAAEL,MAAO,CAAC;EAC1C,MAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAI,CAAEP,MAAM,GAAGI,aAAc,CAAC;EACzD,MAAMI,cAAc,GAAG,CAAC,IAAKJ,aAAa,GAAGE,aAAa,CAAE;EAE5D,oBACCR,KAAA;IACC,cAAaR,OAAO,EACnB;IACAD,EAAE,CAAE,mBAAoB,CAAC,EACzBY,KACD,CAAG;IAAAQ,QAAA,GAEDC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAER;IAAc,CAAE,CAAC,CAACS,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpDnB,IAAA,CAACL,IAAI;MAEJyB,SAAS,EAAC,0CAA0C;MACpDC,IAAI,EAAGxB,UAAY;MACnByB,IAAI,EAAG;IAAI,GAHJ,cAAcH,CAAG,EAIxB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEN;IAAc,CAAE,CAAC,CAACO,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpDnB,IAAA,CAACL,IAAI;MAEJyB,SAAS,EAAC,+CAA+C;MACzDC,IAAI,EAAGvB,QAAU;MACjBwB,IAAI,EAAG;IAAI,GAHJ,cAAcH,CAAG,EAIxB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEJ;IAAe,CAAE,CAAC,CAACK,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACrDnB,IAAA,CAACL,IAAI;MAEJyB,SAAS,EAAC,2CAA2C;MACrDC,IAAI,EAAGzB,SAAW;MAClB0B,IAAI,EAAG;IAAI,GAHJ,eAAeH,CAAG,EAIzB,CACA,CAAC;EAAA,CACE,CAAC;AAET;AAEA,eAAehB,KAAK","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -8,32 +7,38 @@ import { __, sprintf } from '@wordpress/i18n';
8
7
  * Internal dependencies
9
8
  */
10
9
  import DownloadableBlockIcon from '../downloadable-block-icon';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  export default function CompactList({
12
13
  items
13
14
  }) {
14
15
  if (!items.length) {
15
16
  return null;
16
17
  }
17
- return createElement("ul", {
18
- className: "block-directory-compact-list"
19
- }, items.map(({
20
- icon,
21
- id,
22
- title,
23
- author
24
- }) => createElement("li", {
25
- key: id,
26
- className: "block-directory-compact-list__item"
27
- }, createElement(DownloadableBlockIcon, {
28
- icon: icon,
29
- title: title
30
- }), createElement("div", {
31
- className: "block-directory-compact-list__item-details"
32
- }, createElement("div", {
33
- className: "block-directory-compact-list__item-title"
34
- }, title), createElement("div", {
35
- className: "block-directory-compact-list__item-author"
36
- }, sprintf( /* translators: %s: Name of the block author. */
37
- __('By %s'), author))))));
18
+ return /*#__PURE__*/_jsx("ul", {
19
+ className: "block-directory-compact-list",
20
+ children: items.map(({
21
+ icon,
22
+ id,
23
+ title,
24
+ author
25
+ }) => /*#__PURE__*/_jsxs("li", {
26
+ className: "block-directory-compact-list__item",
27
+ children: [/*#__PURE__*/_jsx(DownloadableBlockIcon, {
28
+ icon: icon,
29
+ title: title
30
+ }), /*#__PURE__*/_jsxs("div", {
31
+ className: "block-directory-compact-list__item-details",
32
+ children: [/*#__PURE__*/_jsx("div", {
33
+ className: "block-directory-compact-list__item-title",
34
+ children: title
35
+ }), /*#__PURE__*/_jsx("div", {
36
+ className: "block-directory-compact-list__item-author",
37
+ children: sprintf( /* translators: %s: Name of the block author. */
38
+ __('By %s'), author)
39
+ })]
40
+ })]
41
+ }, id))
42
+ });
38
43
  }
39
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","DownloadableBlockIcon","CompactList","items","length","createElement","className","map","icon","id","title","author","key"],"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAE9D,eAAe,SAASC,WAAWA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChD,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA;IAAIC,SAAS,EAAC;EAA8B,GACzCH,KAAK,CAACI,GAAG,CAAE,CAAE;IAAEC,IAAI;IAAEC,EAAE;IAAEC,KAAK;IAAEC;EAAO,CAAC,KACzCN,aAAA;IAAIO,GAAG,EAAGH,EAAI;IAACH,SAAS,EAAC;EAAoC,GAC5DD,aAAA,CAACJ,qBAAqB;IAACO,IAAI,EAAGA,IAAM;IAACE,KAAK,EAAGA;EAAO,CAAE,CAAC,EAEvDL,aAAA;IAAKC,SAAS,EAAC;EAA4C,GAC1DD,aAAA;IAAKC,SAAS,EAAC;EAA0C,GACtDI,KACE,CAAC,EACNL,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACvDN,OAAO,EACR;EACAD,EAAE,CAAE,OAAQ,CAAC,EACbY,MACD,CACI,CACD,CACF,CACH,CACC,CAAC;AAEP","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","DownloadableBlockIcon","jsx","_jsx","jsxs","_jsxs","CompactList","items","length","className","children","map","icon","id","title","author"],"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE/D,eAAe,SAASC,WAAWA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChD,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,oBACCL,IAAA;IAAIM,SAAS,EAAC,8BAA8B;IAAAC,QAAA,EACzCH,KAAK,CAACI,GAAG,CAAE,CAAE;MAAEC,IAAI;MAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAO,CAAC,kBACzCV,KAAA;MAAeI,SAAS,EAAC,oCAAoC;MAAAC,QAAA,gBAC5DP,IAAA,CAACF,qBAAqB;QAACW,IAAI,EAAGA,IAAM;QAACE,KAAK,EAAGA;MAAO,CAAE,CAAC,eAEvDT,KAAA;QAAKI,SAAS,EAAC,4CAA4C;QAAAC,QAAA,gBAC1DP,IAAA;UAAKM,SAAS,EAAC,0CAA0C;UAAAC,QAAA,EACtDI;QAAK,CACH,CAAC,eACNX,IAAA;UAAKM,SAAS,EAAC,2CAA2C;UAAAC,QAAA,EACvDV,OAAO,EACR;UACAD,EAAE,CAAE,OAAQ,CAAC,EACbgB,MACD;QAAC,CACG,CAAC;MAAA,CACF,CAAC;IAAA,GAdGF,EAeN,CACH;EAAC,CACA,CAAC;AAEP","ignoreList":[]}
@@ -1,17 +1,17 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { BlockIcon } from '@wordpress/block-editor';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  function DownloadableBlockIcon({
7
7
  icon
8
8
  }) {
9
9
  const className = 'block-directory-downloadable-block-icon';
10
- return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? createElement("img", {
10
+ return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/_jsx("img", {
11
11
  className: className,
12
12
  src: icon,
13
13
  alt: ""
14
- }) : createElement(BlockIcon, {
14
+ }) : /*#__PURE__*/_jsx(BlockIcon, {
15
15
  className: className,
16
16
  icon: icon,
17
17
  showColors: true
@@ -1 +1 @@
1
- {"version":3,"names":["BlockIcon","DownloadableBlockIcon","icon","className","match","createElement","src","alt","showColors"],"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\n\nfunction DownloadableBlockIcon( { icon } ) {\n\tconst className = 'block-directory-downloadable-block-icon';\n\treturn icon.match( /\\.(jpeg|jpg|gif|png|svg)(?:\\?.*)?$/ ) !== null ? (\n\t\t<img className={ className } src={ icon } alt=\"\" />\n\t) : (\n\t\t<BlockIcon className={ className } icon={ icon } showColors />\n\t);\n}\n\nexport default DownloadableBlockIcon;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AAEnD,SAASC,qBAAqBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC1C,MAAMC,SAAS,GAAG,yCAAyC;EAC3D,OAAOD,IAAI,CAACE,KAAK,CAAE,oCAAqC,CAAC,KAAK,IAAI,GACjEC,aAAA;IAAKF,SAAS,EAAGA,SAAW;IAACG,GAAG,EAAGJ,IAAM;IAACK,GAAG,EAAC;EAAE,CAAE,CAAC,GAEnDF,aAAA,CAACL,SAAS;IAACG,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACM,UAAU;EAAA,CAAE,CAC7D;AACF;AAEA,eAAeP,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["BlockIcon","jsx","_jsx","DownloadableBlockIcon","icon","className","match","src","alt","showColors"],"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\n\nfunction DownloadableBlockIcon( { icon } ) {\n\tconst className = 'block-directory-downloadable-block-icon';\n\treturn icon.match( /\\.(jpeg|jpg|gif|png|svg)(?:\\?.*)?$/ ) !== null ? (\n\t\t<img className={ className } src={ icon } alt=\"\" />\n\t) : (\n\t\t<BlockIcon className={ className } icon={ icon } showColors />\n\t);\n}\n\nexport default DownloadableBlockIcon;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpD,SAASC,qBAAqBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC1C,MAAMC,SAAS,GAAG,yCAAyC;EAC3D,OAAOD,IAAI,CAACE,KAAK,CAAE,oCAAqC,CAAC,KAAK,IAAI,gBACjEJ,IAAA;IAAKG,SAAS,EAAGA,SAAW;IAACE,GAAG,EAAGH,IAAM;IAACI,GAAG,EAAC;EAAE,CAAE,CAAC,gBAEnDN,IAAA,CAACF,SAAS;IAACK,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACK,UAAU;EAAA,CAAE,CAC7D;AACF;AAEA,eAAeN,qBAAqB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement, Fragment } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -17,6 +16,9 @@ import DownloadableBlockIcon from '../downloadable-block-icon';
17
16
  import DownloadableBlockNotice from '../downloadable-block-notice';
18
17
  import { store as blockDirectoryStore } from '../../store';
19
18
  import { unlock } from '../../lock-unlock';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
20
22
  const {
21
23
  CompositeItemV2: CompositeItem
22
24
  } = unlock(componentsPrivateApis);
@@ -90,8 +92,8 @@ function DownloadableBlockListItem({
90
92
  } else if (isInstalling) {
91
93
  statusText = __('Installing…');
92
94
  }
93
- return createElement(CompositeItem, {
94
- render: createElement(Button, {
95
+ return /*#__PURE__*/_jsxs(CompositeItem, {
96
+ render: /*#__PURE__*/_jsx(Button, {
95
97
  __experimentalIsFocusable: true,
96
98
  type: "button",
97
99
  role: "option",
@@ -110,30 +112,40 @@ function DownloadableBlockListItem({
110
112
  tooltipPosition: "top center"
111
113
  }),
112
114
  store: composite,
113
- disabled: isInstalling || !isInstallable
114
- }, createElement("div", {
115
- className: "block-directory-downloadable-block-list-item__icon"
116
- }, createElement(DownloadableBlockIcon, {
117
- icon: icon,
118
- title: title
119
- }), isInstalling ? createElement("span", {
120
- className: "block-directory-downloadable-block-list-item__spinner"
121
- }, createElement(Spinner, null)) : createElement(BlockRatings, {
122
- rating: rating
123
- })), createElement("span", {
124
- className: "block-directory-downloadable-block-list-item__details"
125
- }, createElement("span", {
126
- className: "block-directory-downloadable-block-list-item__title"
127
- }, createInterpolateElement(sprintf( /* translators: %1$s: block title, %2$s: author name. */
128
- __('%1$s <span>by %2$s</span>'), decodeEntities(title), author), {
129
- span: createElement("span", {
130
- className: "block-directory-downloadable-block-list-item__author"
131
- })
132
- })), hasNotice ? createElement(DownloadableBlockNotice, {
133
- block: item
134
- }) : createElement(Fragment, null, createElement("span", {
135
- className: "block-directory-downloadable-block-list-item__desc"
136
- }, !!statusText ? statusText : decodeEntities(description)), isInstallable && !(isInstalled || isInstalling) && createElement(VisuallyHidden, null, __('Install block')))));
115
+ disabled: isInstalling || !isInstallable,
116
+ children: [/*#__PURE__*/_jsxs("div", {
117
+ className: "block-directory-downloadable-block-list-item__icon",
118
+ children: [/*#__PURE__*/_jsx(DownloadableBlockIcon, {
119
+ icon: icon,
120
+ title: title
121
+ }), isInstalling ? /*#__PURE__*/_jsx("span", {
122
+ className: "block-directory-downloadable-block-list-item__spinner",
123
+ children: /*#__PURE__*/_jsx(Spinner, {})
124
+ }) : /*#__PURE__*/_jsx(BlockRatings, {
125
+ rating: rating
126
+ })]
127
+ }), /*#__PURE__*/_jsxs("span", {
128
+ className: "block-directory-downloadable-block-list-item__details",
129
+ children: [/*#__PURE__*/_jsx("span", {
130
+ className: "block-directory-downloadable-block-list-item__title",
131
+ children: createInterpolateElement(sprintf( /* translators: %1$s: block title, %2$s: author name. */
132
+ __('%1$s <span>by %2$s</span>'), decodeEntities(title), author), {
133
+ span: /*#__PURE__*/_jsx("span", {
134
+ className: "block-directory-downloadable-block-list-item__author"
135
+ })
136
+ })
137
+ }), hasNotice ? /*#__PURE__*/_jsx(DownloadableBlockNotice, {
138
+ block: item
139
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
140
+ children: [/*#__PURE__*/_jsx("span", {
141
+ className: "block-directory-downloadable-block-list-item__desc",
142
+ children: !!statusText ? statusText : decodeEntities(description)
143
+ }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/_jsx(VisuallyHidden, {
144
+ children: __('Install block')
145
+ })]
146
+ })]
147
+ })]
148
+ });
137
149
  }
138
150
  export default DownloadableBlockListItem;
139
151
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","_n","sprintf","Button","Spinner","VisuallyHidden","privateApis","componentsPrivateApis","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","unlock","CompositeItemV2","CompositeItem","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","createElement","render","__experimentalIsFocusable","type","role","className","isBusy","event","preventDefault","label","showTooltip","tooltipPosition","disabled","span","block","Fragment"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\trender={\n\t\t\t\t<Button\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\t\t\thasNotice,\n\t\t\t\t\t\tisInstalled,\n\t\t\t\t\t\tisInstalling,\n\t\t\t\t\t} ) }\n\t\t\t\t\tshowTooltip\n\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\tstore={ composite }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</CompositeItem>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAC1D,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,eAAe,EAAEC;AAAc,CAAC,GAAGF,MAAM,CAAEV,qBAAsB,C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AAO,CAAE,CAAC,EACrDK,YAAY,GACbqB,aAAA;IAAMK,SAAS,EAAC;EAAuD,GACtEL,aAAA,CAAC3C,OAAO,MAAE,CACL,CAAC,GAEP2C,aAAA,CAACnC,YAAY;IAACU,MAAM,EAAGA;EAAQ,CAAE,CAE9B,CAAC,EACNyB,aAAA;IAAMK,SAAS,EAAC;EAAuD,GACtEL,aAAA;IAAMK,SAAS,EAAC;EAAqD,GAClE5C,wBAAwB,CACzBN,OAAO,EACN;EACAF,EAAE,CAAE,2BAA4B,CAAC,EACjCS,cAAc,CAAEY,KAAM,CAAC,EACvBa,MACD,CAAC,EACD;IACC0B,IAAI,EACHb,aAAA;MAAMK,SAAS,EAAC;IAAsD,CAAE;EAE1E,CACD,CACK,CAAC,EACL5B,SAAS,GACVuB,aAAA,CAACjC,uBAAuB;IAAC+C,KAAK,EAAG7B;EAAM,CAAE,CAAC,GAE1Ce,aAAA,CAAAe,QAAA,QACCf,aAAA;IAAMK,SAAS,EAAC;EAAoD,GACjE,CAAC,CAAEN,UAAU,GACZA,UAAU,GACVrC,cAAc,CAAE0B,WAAY,CAC1B,CAAC,EACLG,aAAa,IACd,EAAIb,WAAW,IAAIC,YAAY,CAAE,IAChCqB,aAAA,CAAC1C,cAAc,QACZL,EAAE,CAAE,eAAgB,CACP,CAEjB,CAEE,CACQ,CAAC;AAElB;AAEA,eAAe8B,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["__","_n","sprintf","Button","Spinner","VisuallyHidden","privateApis","componentsPrivateApis","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CompositeItemV2","CompositeItem","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","render","__experimentalIsFocusable","type","role","className","isBusy","event","preventDefault","label","showTooltip","tooltipPosition","disabled","children","span","block"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\trender={\n\t\t\t\t<Button\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\t\t\thasNotice,\n\t\t\t\t\t\tisInstalled,\n\t\t\t\t\t\tisInstalling,\n\t\t\t\t\t} ) }\n\t\t\t\t\tshowTooltip\n\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\tstore={ composite }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\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AC,EACvBa,MACD,CAAC,EACD;UACC0B,IAAI,eACH/C,IAAA;YAAMsC,SAAS,EAAC;UAAsD,CAAE;QAE1E,CACD;MAAC,CACI,CAAC,EACL3B,SAAS,gBACVX,IAAA,CAACL,uBAAuB;QAACqD,KAAK,EAAG7B;MAAM,CAAE,CAAC,gBAE1CjB,KAAA,CAAAE,SAAA;QAAA0C,QAAA,gBACC9C,IAAA;UAAMsC,SAAS,EAAC,oDAAoD;UAAAQ,QAAA,EACjE,CAAC,CAAEb,UAAU,GACZA,UAAU,GACV3C,cAAc,CAAEgC,WAAY;QAAC,CAC3B,CAAC,EACLG,aAAa,IACd,EAAIb,WAAW,IAAIC,YAAY,CAAE,iBAChCb,IAAA,CAACd,cAAc;UAAA4D,QAAA,EACZjE,EAAE,CAAE,eAAgB;QAAC,CACR,CAChB;MAAA,CACD,CACF;IAAA,CACI,CAAC;EAAA,CACO,CAAC;AAElB;AAEA,eAAeoC,yBAAyB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -9,6 +8,8 @@ import { useSelect } from '@wordpress/data';
9
8
  * Internal dependencies
10
9
  */
11
10
  import { store as blockDirectoryStore } from '../../store';
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
12
13
  export const DownloadableBlockNotice = ({
13
14
  block
14
15
  }) => {
@@ -16,11 +17,13 @@ export const DownloadableBlockNotice = ({
16
17
  if (!errorNotice) {
17
18
  return null;
18
19
  }
19
- return createElement("div", {
20
- className: "block-directory-downloadable-block-notice"
21
- }, createElement("div", {
22
- className: "block-directory-downloadable-block-notice__content"
23
- }, errorNotice.message, errorNotice.isFatal ? ' ' + __('Try reloading the page.') : null));
20
+ return /*#__PURE__*/_jsx("div", {
21
+ className: "block-directory-downloadable-block-notice",
22
+ children: /*#__PURE__*/_jsxs("div", {
23
+ className: "block-directory-downloadable-block-notice__content",
24
+ children: [errorNotice.message, errorNotice.isFatal ? ' ' + __('Try reloading the page.') : null]
25
+ })
26
+ });
24
27
  };
25
28
  export default DownloadableBlockNotice;
26
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","store","blockDirectoryStore","DownloadableBlockNotice","block","errorNotice","select","getErrorNoticeForBlock","id","createElement","className","message","isFatal"],"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport const DownloadableBlockNotice = ( { block } ) => {\n\tconst errorNotice = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockDirectoryStore ).getErrorNoticeForBlock( block.id ),\n\t\t[ block ]\n\t);\n\n\tif ( ! errorNotice ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-directory-downloadable-block-notice\">\n\t\t\t<div className=\"block-directory-downloadable-block-notice__content\">\n\t\t\t\t{ errorNotice.message }\n\t\t\t\t{ errorNotice.isFatal\n\t\t\t\t\t? ' ' + __( 'Try reloading the page.' )\n\t\t\t\t\t: null }\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAE1D,OAAO,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAM,CAAC,KAAM;EACvD,MAAMC,WAAW,GAAGL,SAAS,CAC1BM,MAAM,IACPA,MAAM,CAAEJ,mBAAoB,CAAC,CAACK,sBAAsB,CAAEH,KAAK,CAACI,EAAG,CAAC,EACjE,CAAEJ,KAAK,CACR,CAAC;EAED,IAAK,CAAEC,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACCI,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACzDD,aAAA;IAAKC,SAAS,EAAC;EAAoD,GAChEL,WAAW,CAACM,OAAO,EACnBN,WAAW,CAACO,OAAO,GAClB,GAAG,GAAGb,EAAE,CAAE,yBAA0B,CAAC,GACrC,IACC,CACD,CAAC;AAER,CAAC;AAED,eAAeI,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["__","useSelect","store","blockDirectoryStore","jsxs","_jsxs","jsx","_jsx","DownloadableBlockNotice","block","errorNotice","select","getErrorNoticeForBlock","id","className","children","message","isFatal"],"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport const DownloadableBlockNotice = ( { block } ) => {\n\tconst errorNotice = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockDirectoryStore ).getErrorNoticeForBlock( block.id ),\n\t\t[ block ]\n\t);\n\n\tif ( ! errorNotice ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-directory-downloadable-block-notice\">\n\t\t\t<div className=\"block-directory-downloadable-block-notice__content\">\n\t\t\t\t{ errorNotice.message }\n\t\t\t\t{ errorNotice.isFatal\n\t\t\t\t\t? ' ' + __( 'Try reloading the page.' )\n\t\t\t\t\t: null }\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAAC,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3D,OAAO,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAM,CAAC,KAAM;EACvD,MAAMC,WAAW,GAAGT,SAAS,CAC1BU,MAAM,IACPA,MAAM,CAAER,mBAAoB,CAAC,CAACS,sBAAsB,CAAEH,KAAK,CAACI,EAAG,CAAC,EACjE,CAAEJ,KAAK,CACR,CAAC;EAED,IAAK,CAAEC,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,oBACCH,IAAA;IAAKO,SAAS,EAAC,2CAA2C;IAAAC,QAAA,eACzDV,KAAA;MAAKS,SAAS,EAAC,oDAAoD;MAAAC,QAAA,GAChEL,WAAW,CAACM,OAAO,EACnBN,WAAW,CAACO,OAAO,GAClB,GAAG,GAAGjB,EAAE,CAAE,yBAA0B,CAAC,GACrC,IAAI;IAAA,CACH;EAAC,CACF,CAAC;AAER,CAAC;AAED,eAAeQ,uBAAuB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -13,6 +12,7 @@ import { useDispatch } from '@wordpress/data';
13
12
  import DownloadableBlockListItem from '../downloadable-block-list-item';
14
13
  import { store as blockDirectoryStore } from '../../store';
15
14
  import { unlock } from '../../lock-unlock';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
16
  const {
17
17
  CompositeV2: Composite,
18
18
  useCompositeStoreV2: useCompositeStore
@@ -30,34 +30,34 @@ function DownloadableBlocksList({
30
30
  if (!items.length) {
31
31
  return null;
32
32
  }
33
- return createElement(Composite, {
33
+ return /*#__PURE__*/_jsx(Composite, {
34
34
  store: composite,
35
35
  role: "listbox",
36
36
  className: "block-directory-downloadable-blocks-list",
37
- "aria-label": __('Blocks available for install')
38
- }, items.map(item => {
39
- return createElement(DownloadableBlockListItem, {
40
- key: item.id,
41
- composite: composite,
42
- onClick: () => {
43
- // Check if the block is registered (`getBlockType`
44
- // will return an object). If so, insert the block.
45
- // This prevents installing existing plugins.
46
- if (getBlockType(item.name)) {
47
- onSelect(item);
48
- } else {
49
- installBlockType(item).then(success => {
50
- if (success) {
51
- onSelect(item);
52
- }
53
- });
54
- }
55
- onHover(null);
56
- },
57
- onHover: onHover,
58
- item: item
59
- });
60
- }));
37
+ "aria-label": __('Blocks available for install'),
38
+ children: items.map(item => {
39
+ return /*#__PURE__*/_jsx(DownloadableBlockListItem, {
40
+ composite: composite,
41
+ onClick: () => {
42
+ // Check if the block is registered (`getBlockType`
43
+ // will return an object). If so, insert the block.
44
+ // This prevents installing existing plugins.
45
+ if (getBlockType(item.name)) {
46
+ onSelect(item);
47
+ } else {
48
+ installBlockType(item).then(success => {
49
+ if (success) {
50
+ onSelect(item);
51
+ }
52
+ });
53
+ }
54
+ onHover(null);
55
+ },
56
+ onHover: onHover,
57
+ item: item
58
+ }, item.id);
59
+ })
60
+ });
61
61
  }
62
62
  export default DownloadableBlocksList;
63
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","privateApis","componentsPrivateApis","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","unlock","CompositeV2","Composite","useCompositeStoreV2","useCompositeStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","createElement","role","className","map","item","key","id","onClick","name","then","success"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =\n\tunlock( componentsPrivateApis );\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeStore();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\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\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAC1D,SAASC,MAAM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1
+ {"version":3,"names":["__","privateApis","componentsPrivateApis","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","unlock","jsx","_jsx","CompositeV2","Composite","useCompositeStoreV2","useCompositeStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","role","className","children","map","item","onClick","name","then","success","id"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =\n\tunlock( componentsPrivateApis );\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeStore();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\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\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAC1D,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAM;EAAEC,WAAW,EAAEC,SAAS;EAAEC,mBAAmB,EAAEC;AAAkB,CAAC,GACvEN,MAAM,CAAEN,qBAAsB,CAAC;AAChC,MAAMa,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,sBAAsBA,CAAE;EAAEC,KAAK;EAAEC,OAAO,GAAGH,IAAI;EAAEI;AAAS,CAAC,EAAG;EACtE,MAAMC,SAAS,GAAGN,iBAAiB,CAAC,CAAC;EACrC,MAAM;IAAEO;EAAiB,CAAC,GAAGjB,WAAW,CAAEG,mBAAoB,CAAC;EAE/D,IAAK,CAAEU,KAAK,CAACK,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,oBACCZ,IAAA,CAACE,SAAS;IACTN,KAAK,EAAGc,SAAW;IACnBG,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,0CAA0C;IACpD,cAAaxB,EAAE,CAAE,8BAA+B,CAAG;IAAAyB,QAAA,EAEjDR,KAAK,CAACS,GAAG,CAAIC,IAAI,IAAM;MACxB,oBACCjB,IAAA,CAACL,yBAAyB;QAEzBe,SAAS,EAAGA,SAAW;QACvBQ,OAAO,EAAGA,CAAA,KAAM;UACf;UACA;UACA;UACA,IAAKzB,YAAY,CAAEwB,IAAI,CAACE,IAAK,CAAC,EAAG;YAChCV,QAAQ,CAAEQ,IAAK,CAAC;UACjB,CAAC,MAAM;YACNN,gBAAgB,CAAEM,IAAK,CAAC,CAACG,IAAI,CAAIC,OAAO,IAAM;cAC7C,IAAKA,OAAO,EAAG;gBACdZ,QAAQ,CAAEQ,IAAK,CAAC;cACjB;YACD,CAAE,CAAC;UACJ;UACAT,OAAO,CAAE,IAAK,CAAC;QAChB,CAAG;QACHA,OAAO,EAAGA,OAAS;QACnBS,IAAI,EAAGA;MAAM,GAlBPA,IAAI,CAACK,EAmBX,CAAC;IAEJ,CAAE;EAAC,CACO,CAAC;AAEd;AAEA,eAAehB,sBAAsB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement, Fragment } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -15,6 +14,9 @@ import DownloadableBlocksList from '../downloadable-blocks-list';
15
14
  import DownloadableBlocksInserterPanel from './inserter-panel';
16
15
  import DownloadableBlocksNoResults from './no-results';
17
16
  import { store as blockDirectoryStore } from '../../store';
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { Fragment as _Fragment } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
20
  const EMPTY_ARRAY = [];
19
21
  const useDownloadableBlocks = filterValue => useSelect(select => {
20
22
  const {
@@ -70,30 +72,37 @@ export default function DownloadableBlocksPanel({
70
72
  isLoading
71
73
  } = useDownloadableBlocks(filterValue);
72
74
  if (hasPermission === undefined || isLoading || isTyping) {
73
- return createElement(Fragment, null, hasPermission && !hasLocalBlocks && createElement(Fragment, null, createElement("p", {
74
- className: "block-directory-downloadable-blocks-panel__no-local"
75
- }, __('No results available from your installed blocks.')), createElement("div", {
76
- className: "block-editor-inserter__quick-inserter-separator"
77
- })), createElement("div", {
78
- className: "block-directory-downloadable-blocks-panel has-blocks-loading"
79
- }, createElement(Spinner, null)));
75
+ return /*#__PURE__*/_jsxs(_Fragment, {
76
+ children: [hasPermission && !hasLocalBlocks && /*#__PURE__*/_jsxs(_Fragment, {
77
+ children: [/*#__PURE__*/_jsx("p", {
78
+ className: "block-directory-downloadable-blocks-panel__no-local",
79
+ children: __('No results available from your installed blocks.')
80
+ }), /*#__PURE__*/_jsx("div", {
81
+ className: "block-editor-inserter__quick-inserter-separator"
82
+ })]
83
+ }), /*#__PURE__*/_jsx("div", {
84
+ className: "block-directory-downloadable-blocks-panel has-blocks-loading",
85
+ children: /*#__PURE__*/_jsx(Spinner, {})
86
+ })]
87
+ });
80
88
  }
81
89
  if (false === hasPermission) {
82
90
  if (!hasLocalBlocks) {
83
- return createElement(DownloadableBlocksNoResults, null);
91
+ return /*#__PURE__*/_jsx(DownloadableBlocksNoResults, {});
84
92
  }
85
93
  return null;
86
94
  }
87
95
  if (downloadableBlocks.length === 0) {
88
- return hasLocalBlocks ? null : createElement(DownloadableBlocksNoResults, null);
96
+ return hasLocalBlocks ? null : /*#__PURE__*/_jsx(DownloadableBlocksNoResults, {});
89
97
  }
90
- return createElement(DownloadableBlocksInserterPanel, {
98
+ return /*#__PURE__*/_jsx(DownloadableBlocksInserterPanel, {
91
99
  downloadableItems: downloadableBlocks,
92
- hasLocalBlocks: hasLocalBlocks
93
- }, createElement(DownloadableBlocksList, {
94
- items: downloadableBlocks,
95
- onSelect: onSelect,
96
- onHover: onHover
97
- }));
100
+ hasLocalBlocks: hasLocalBlocks,
101
+ children: /*#__PURE__*/_jsx(DownloadableBlocksList, {
102
+ items: downloadableBlocks,
103
+ onSelect: onSelect,
104
+ onHover: onHover
105
+ })
106
+ });
98
107
  }
99
108
  //# sourceMappingURL=index.js.map