@wordpress/block-library 9.21.0 → 9.23.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 (201) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/calendar/index.js +1 -0
  3. package/build/calendar/index.js.map +1 -1
  4. package/build/comments/edit/comments-inspector-controls.js +13 -13
  5. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  6. package/build/comments/edit/index.js +4 -2
  7. package/build/comments/edit/index.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +9 -12
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/index.js +1 -1
  11. package/build/cover/index.js.map +1 -1
  12. package/build/details/edit.js +1 -5
  13. package/build/details/edit.js.map +1 -1
  14. package/build/details/index.js +1 -1
  15. package/build/details/index.js.map +1 -1
  16. package/build/group/edit.js +17 -13
  17. package/build/group/edit.js.map +1 -1
  18. package/build/image/edit.js +0 -6
  19. package/build/image/edit.js.map +1 -1
  20. package/build/latest-posts/edit.js +100 -54
  21. package/build/latest-posts/edit.js.map +1 -1
  22. package/build/navigation/view.js +2 -1
  23. package/build/navigation/view.js.map +1 -1
  24. package/build/navigation-link/edit.js +0 -21
  25. package/build/navigation-link/edit.js.map +1 -1
  26. package/build/navigation-link/index.js +0 -3
  27. package/build/navigation-link/index.js.map +1 -1
  28. package/build/navigation-link/transforms.js +0 -2
  29. package/build/navigation-link/transforms.js.map +1 -1
  30. package/build/navigation-link/update-attributes.js +0 -1
  31. package/build/navigation-link/update-attributes.js.map +1 -1
  32. package/build/navigation-submenu/edit.js +1 -24
  33. package/build/navigation-submenu/edit.js.map +1 -1
  34. package/build/navigation-submenu/index.js +0 -3
  35. package/build/navigation-submenu/index.js.map +1 -1
  36. package/build/post-comments-count/index.js +0 -1
  37. package/build/post-comments-count/index.js.map +1 -1
  38. package/build/post-comments-link/index.js +0 -1
  39. package/build/post-comments-link/index.js.map +1 -1
  40. package/build/post-featured-image/edit.js +15 -5
  41. package/build/post-featured-image/edit.js.map +1 -1
  42. package/build/query/edit/inspector-controls/index.js +47 -59
  43. package/build/query/edit/inspector-controls/index.js.map +1 -1
  44. package/build/query/edit/inspector-controls/parent-control.js +2 -2
  45. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  46. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  47. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  48. package/build/query/edit/query-content.js +15 -29
  49. package/build/query/edit/query-content.js.map +1 -1
  50. package/build/quote/index.js +1 -1
  51. package/build/quote/index.js.map +1 -1
  52. package/build/separator/edit.js +13 -12
  53. package/build/separator/edit.js.map +1 -1
  54. package/build/social-links/edit.js +29 -31
  55. package/build/social-links/edit.js.map +1 -1
  56. package/build/table/index.js +3 -3
  57. package/build/table/index.js.map +1 -1
  58. package/build/table/transforms.js +11 -3
  59. package/build/table/transforms.js.map +1 -1
  60. package/build/table-of-contents/edit.js +1 -1
  61. package/build/table-of-contents/edit.js.map +1 -1
  62. package/build/table-of-contents/hooks.js +6 -3
  63. package/build/table-of-contents/hooks.js.map +1 -1
  64. package/build/template-part/edit/advanced-controls.js +14 -12
  65. package/build/template-part/edit/advanced-controls.js.map +1 -1
  66. package/build/template-part/edit/index.js +2 -1
  67. package/build/template-part/edit/index.js.map +1 -1
  68. package/build-module/calendar/index.js +1 -0
  69. package/build-module/calendar/index.js.map +1 -1
  70. package/build-module/comments/edit/comments-inspector-controls.js +14 -14
  71. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  72. package/build-module/comments/edit/index.js +4 -2
  73. package/build-module/comments/edit/index.js.map +1 -1
  74. package/build-module/cover/edit/inspector-controls.js +10 -13
  75. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  76. package/build-module/cover/index.js +1 -1
  77. package/build-module/cover/index.js.map +1 -1
  78. package/build-module/details/edit.js +1 -5
  79. package/build-module/details/edit.js.map +1 -1
  80. package/build-module/details/index.js +1 -1
  81. package/build-module/details/index.js.map +1 -1
  82. package/build-module/group/edit.js +16 -14
  83. package/build-module/group/edit.js.map +1 -1
  84. package/build-module/image/edit.js +0 -6
  85. package/build-module/image/edit.js.map +1 -1
  86. package/build-module/latest-posts/edit.js +100 -54
  87. package/build-module/latest-posts/edit.js.map +1 -1
  88. package/build-module/navigation/view.js +2 -1
  89. package/build-module/navigation/view.js.map +1 -1
  90. package/build-module/navigation-link/edit.js +0 -21
  91. package/build-module/navigation-link/edit.js.map +1 -1
  92. package/build-module/navigation-link/index.js +0 -3
  93. package/build-module/navigation-link/index.js.map +1 -1
  94. package/build-module/navigation-link/transforms.js +0 -2
  95. package/build-module/navigation-link/transforms.js.map +1 -1
  96. package/build-module/navigation-link/update-attributes.js +0 -1
  97. package/build-module/navigation-link/update-attributes.js.map +1 -1
  98. package/build-module/navigation-submenu/edit.js +1 -24
  99. package/build-module/navigation-submenu/edit.js.map +1 -1
  100. package/build-module/navigation-submenu/index.js +0 -3
  101. package/build-module/navigation-submenu/index.js.map +1 -1
  102. package/build-module/post-comments-count/index.js +0 -1
  103. package/build-module/post-comments-count/index.js.map +1 -1
  104. package/build-module/post-comments-link/index.js +0 -1
  105. package/build-module/post-comments-link/index.js.map +1 -1
  106. package/build-module/post-featured-image/edit.js +15 -5
  107. package/build-module/post-featured-image/edit.js.map +1 -1
  108. package/build-module/query/edit/inspector-controls/index.js +49 -61
  109. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  110. package/build-module/query/edit/inspector-controls/parent-control.js +2 -2
  111. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  112. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  113. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  114. package/build-module/query/edit/query-content.js +16 -30
  115. package/build-module/query/edit/query-content.js.map +1 -1
  116. package/build-module/quote/index.js +1 -1
  117. package/build-module/quote/index.js.map +1 -1
  118. package/build-module/separator/edit.js +15 -14
  119. package/build-module/separator/edit.js.map +1 -1
  120. package/build-module/social-links/edit.js +30 -32
  121. package/build-module/social-links/edit.js.map +1 -1
  122. package/build-module/table/index.js +3 -3
  123. package/build-module/table/index.js.map +1 -1
  124. package/build-module/table/transforms.js +11 -3
  125. package/build-module/table/transforms.js.map +1 -1
  126. package/build-module/table-of-contents/edit.js +1 -1
  127. package/build-module/table-of-contents/edit.js.map +1 -1
  128. package/build-module/table-of-contents/hooks.js +6 -3
  129. package/build-module/table-of-contents/hooks.js.map +1 -1
  130. package/build-module/template-part/edit/advanced-controls.js +14 -12
  131. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  132. package/build-module/template-part/edit/index.js +2 -1
  133. package/build-module/template-part/edit/index.js.map +1 -1
  134. package/build-style/editor-rtl.css +1 -50
  135. package/build-style/editor.css +1 -50
  136. package/build-style/media-text/style-rtl.css +0 -2
  137. package/build-style/media-text/style.css +0 -2
  138. package/build-style/search/style-rtl.css +1 -0
  139. package/build-style/search/style.css +1 -0
  140. package/build-style/social-links/editor-rtl.css +1 -50
  141. package/build-style/social-links/editor.css +1 -50
  142. package/build-style/style-rtl.css +1 -6
  143. package/build-style/style.css +1 -6
  144. package/build-style/tag-cloud/style-rtl.css +0 -4
  145. package/build-style/tag-cloud/style.css +0 -4
  146. package/package.json +35 -35
  147. package/src/button/index.php +2 -3
  148. package/src/calendar/block.json +1 -0
  149. package/src/comments/edit/comments-inspector-controls.js +14 -12
  150. package/src/comments/edit/index.js +2 -1
  151. package/src/cover/edit/inspector-controls.js +9 -12
  152. package/src/cover/index.js +1 -1
  153. package/src/details/edit.js +6 -8
  154. package/src/details/index.js +1 -1
  155. package/src/file/index.php +2 -3
  156. package/src/group/edit.js +11 -10
  157. package/src/image/edit.js +0 -4
  158. package/src/latest-comments/index.php +1 -1
  159. package/src/latest-posts/edit.js +113 -81
  160. package/src/latest-posts/index.php +3 -0
  161. package/src/loginout/index.php +5 -1
  162. package/src/media-text/style.scss +0 -2
  163. package/src/navigation/index.php +1 -2
  164. package/src/navigation/view.js +2 -1
  165. package/src/navigation-link/block.json +0 -3
  166. package/src/navigation-link/edit.js +1 -22
  167. package/src/navigation-link/index.php +2 -6
  168. package/src/navigation-link/transforms.js +1 -2
  169. package/src/navigation-link/update-attributes.js +0 -1
  170. package/src/navigation-submenu/block.json +0 -3
  171. package/src/navigation-submenu/edit.js +1 -24
  172. package/src/navigation-submenu/index.php +1 -5
  173. package/src/post-author/index.php +1 -1
  174. package/src/post-author-name/index.php +1 -1
  175. package/src/post-comments-count/block.json +0 -1
  176. package/src/post-comments-count/index.php +4 -0
  177. package/src/post-comments-link/block.json +0 -1
  178. package/src/post-comments-link/index.php +4 -0
  179. package/src/post-featured-image/edit.js +94 -77
  180. package/src/query/edit/inspector-controls/index.js +66 -91
  181. package/src/query/edit/inspector-controls/parent-control.js +2 -2
  182. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  183. package/src/query/edit/query-content.js +17 -27
  184. package/src/quote/index.js +1 -1
  185. package/src/search/index.php +12 -9
  186. package/src/search/style.scss +1 -0
  187. package/src/separator/edit.js +16 -12
  188. package/src/social-links/edit.js +29 -30
  189. package/src/social-links/editor.scss +1 -59
  190. package/src/table/index.js +3 -3
  191. package/src/table/transforms.js +14 -2
  192. package/src/table-of-contents/edit.js +1 -1
  193. package/src/table-of-contents/hooks.js +5 -2
  194. package/src/tag-cloud/style.scss +0 -5
  195. package/src/template-part/edit/advanced-controls.js +9 -8
  196. package/src/template-part/edit/index.js +1 -0
  197. package/build/utils/messages.js +0 -22
  198. package/build/utils/messages.js.map +0 -1
  199. package/build-module/utils/messages.js +0 -15
  200. package/build-module/utils/messages.js.map +0 -1
  201. package/src/utils/messages.js +0 -31
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","__experimentalVStack","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAhB5C;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAMQ,WAAW,GA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ACA,IAAAE,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEZ,iBAAiB,EAAG;MAC1B;IACD;IACAJ,cAAc,CAAEG,aAAa,CAAChB,GAAG,CAAImC,MAAM,IAAMA,MAAM,CAAClD,IAAK,CAAE,CAAC;EACjE,CAAC,EAAE,CAAE+B,aAAa,EAAEC,iBAAiB,CAAG,CAAC;EACzC,MAAMmB,aAAa,GAAKC,aAAa,IAAM;IAC1C,MAAMhC,UAAU,GAAG,IAAIiC,GAAG,CAAC,CAAC;IAC5B,KAAM,MAAM1D,SAAS,IAAIyD,aAAa,EAAG;MACxC,MAAMxD,MAAM,GAAGH,oBAAoB,CAAEsC,aAAa,EAAEpC,SAAU,CAAC;MAC/D,IAAKC,MAAM,EAAG;QACbwB,UAAU,CAACkC,GAAG,CAAE1D,MAAO,CAAC;MACzB;IACD;IACAgC,cAAc,CAAExC,WAAY,CAAC;IAC7BgB,QAAQ,CAAEmD,KAAK,CAACC,IAAI,CAAEpC,UAAW,CAAE,CAAC;EACrC,CAAC;EACD,oBACC,IAAAjC,WAAA,CAAAwB,GAAA;IAAK8C,SAAS,EAAC,iDAAiD;IAAA3C,QAAA,eAC/D,IAAA3B,WAAA,CAAAwB,GAAA,EAAChC,WAAA,CAAA+E,cAAc;MACdC,KAAK,EAAG3C,QAAQ,CAAChB,IAAM;MACvByB,KAAK,EAAGA,KAAO;MACfmC,aAAa,EAAG/B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3BkC,gBAAgB,EAAGC,4BAAgB;MACnC1D,QAAQ,EAAG+C,aAAe;MAC1BY,uBAAuB,EAAG,KAAO;MACjCC,uBAAuB;MACvBC,qBAAqB;IAAA,CACrB;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","__experimentalVStack","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, taxonomy.slug, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ taxonomy.slug, termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAhB5C;AACA;AACA;;AAWA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10
  var _element = require("@wordpress/element");
11
11
  var _blockEditor = require("@wordpress/block-editor");
12
- var _components = require("@wordpress/components");
13
12
  var _i18n = require("@wordpress/i18n");
14
13
  var _coreData = require("@wordpress/core-data");
15
14
  var _enhancedPaginationControl = _interopRequireDefault(require("./inspector-controls/enhanced-pagination-control"));
15
+ var _lockUnlock = require("../../lock-unlock");
16
16
  var _inspectorControls = _interopRequireDefault(require("./inspector-controls"));
17
17
  var _enhancedPaginationModal = _interopRequireDefault(require("./enhanced-pagination-modal"));
18
18
  var _utils = require("../utils");
19
19
  var _queryToolbar = _interopRequireDefault(require("./query-toolbar"));
20
- var _messages = require("../../utils/messages");
21
20
  var _jsxRuntime = require("react/jsx-runtime");
22
21
  /**
23
22
  * WordPress dependencies
@@ -27,6 +26,9 @@ var _jsxRuntime = require("react/jsx-runtime");
27
26
  * Internal dependencies
28
27
  */
29
28
 
29
+ const {
30
+ HTMLElementControl
31
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
30
32
  const DEFAULTS_POSTS_PER_PAGE = 3;
31
33
  const TEMPLATE = [['core/post-template']];
32
34
  function QueryContent({
@@ -39,7 +41,6 @@ function QueryContent({
39
41
  const {
40
42
  queryId,
41
43
  query,
42
- displayLayout,
43
44
  enhancedPagination,
44
45
  tagName: TagName = 'div',
45
46
  query: {
@@ -93,12 +94,12 @@ function QueryContent({
93
94
  // Changes in query property (which is an object) need to be in the same callback,
94
95
  // because updates are batched after the render and changes in different query properties
95
96
  // would cause to override previous wanted changes.
96
- const updateQuery = (0, _element.useCallback)(newQuery => setAttributes({
97
+ const updateQuery = (0, _element.useCallback)(newQuery => setAttributes(prevAttributes => ({
97
98
  query: {
98
- ...query,
99
+ ...prevAttributes.query,
99
100
  ...newQuery
100
101
  }
101
- }), [query, setAttributes]);
102
+ })), [setAttributes]);
102
103
  (0, _element.useEffect)(() => {
103
104
  const newQuery = {};
104
105
  // When we inherit from global query always need to set the `perPage`
@@ -108,16 +109,11 @@ function QueryContent({
108
109
  } else if (!query.perPage && postsPerPage) {
109
110
  newQuery.perPage = postsPerPage;
110
111
  }
111
- // We need to reset the `inherit` value if in a singular template, as queries
112
- // are not inherited when in singular content (e.g. post, page, 404, blank).
113
- if (isSingular && query.inherit) {
114
- newQuery.inherit = false;
115
- }
116
112
  if (!!Object.keys(newQuery).length) {
117
113
  __unstableMarkNextChangeAsNotPersistent();
118
114
  updateQuery(newQuery);
119
115
  }
120
- }, [query.perPage, query.inherit, postsPerPage, inherit, isSingular, __unstableMarkNextChangeAsNotPersistent, updateQuery]);
116
+ }, [query.perPage, inherit, postsPerPage, __unstableMarkNextChangeAsNotPersistent, updateQuery]);
121
117
  // We need this for multi-query block pagination.
122
118
  // Query parameters for each block are scoped to their ID.
123
119
  (0, _element.useEffect)(() => {
@@ -128,12 +124,6 @@ function QueryContent({
128
124
  });
129
125
  }
130
126
  }, [queryId, instanceId, __unstableMarkNextChangeAsNotPersistent, setAttributes]);
131
- const updateDisplayLayout = newDisplayLayout => setAttributes({
132
- displayLayout: {
133
- ...displayLayout,
134
- ...newDisplayLayout
135
- }
136
- });
137
127
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
138
128
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_enhancedPaginationModal.default, {
139
129
  attributes: attributes,
@@ -144,7 +134,6 @@ function QueryContent({
144
134
  name: name,
145
135
  attributes: attributes,
146
136
  setQuery: updateQuery,
147
- setDisplayLayout: updateDisplayLayout,
148
137
  setAttributes: setAttributes,
149
138
  clientId: clientId,
150
139
  isSingular: isSingular
@@ -156,10 +145,12 @@ function QueryContent({
156
145
  })
157
146
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.InspectorControls, {
158
147
  group: "advanced",
159
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
160
- __nextHasNoMarginBottom: true,
161
- __next40pxDefaultSize: true,
162
- label: (0, _i18n.__)('HTML element'),
148
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
149
+ tagName: TagName,
150
+ onChange: value => setAttributes({
151
+ tagName: value
152
+ }),
153
+ clientId: clientId,
163
154
  options: [{
164
155
  label: (0, _i18n.__)('Default (<div>)'),
165
156
  value: 'div'
@@ -172,12 +163,7 @@ function QueryContent({
172
163
  }, {
173
164
  label: '<aside>',
174
165
  value: 'aside'
175
- }],
176
- value: TagName,
177
- onChange: value => setAttributes({
178
- tagName: value
179
- }),
180
- help: _messages.htmlElementMessages[TagName]
166
+ }]
181
167
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_enhancedPaginationControl.default, {
182
168
  enhancedPagination: enhancedPagination,
183
169
  setAttributes: setAttributes,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_messages","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","useEffect","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","setDisplayLayout","BlockControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onChange","help","htmlElementMessages"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// We need to reset the `inherit` value if in a singular template, as queries\n\t\t// are not inherited when in singular content (e.g. post, page, 404, blank).\n\t\tif ( isSingular && query.inherit ) {\n\t\t\tnewQuery.inherit = false;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.inherit,\n\t\tpostsPerPage,\n\t\tinherit,\n\t\tisSingular,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,0BAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,wBAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,SAAA,GAAAb,OAAA;AAA2D,IAAAc,WAAA,GAAAd,OAAA;AAzB3D;AACA;AACA;;AAeA;AACA;AACA;;AAQA,MAAMe,uBAAuB,GAAG,CAAC;AAEjC,MAAMC,QAAQ,GAAG,CAAE,CAAE,oBAAoB,CAAE,CAAE;AAC9B,SAASC,YAAYA,CAAE;EACrCC,UAAU;EACVC,aAAa;EACbC,QAAQ;EACRC,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,OAAO;IACPC,KAAK;IACLC,aAAa;IACbC,kBAAkB;IAClBC,OAAO,EAAEC,OAAO,GAAG,KAAK;IACxBJ,KAAK,EAAE;MAAEK;IAAQ,CAAC,GAAG,CAAC;EACvB,CAAC,GAAGX,UAAU;EACd,MAAM;IAAEY;EAAa,CAAC,GAAGT,OAAO;EAChC,MAAM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AE,SAAS;UAAEG,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGvD,OAAS;QACjBwD,QAAQ,EAAKD,KAAK,IACjBhE,aAAa,CAAE;UAAEQ,OAAO,EAAEwD;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGC,6BAAmB,CAAE1D,OAAO;MAAI,CACvC,CAAC,eACF,IAAAd,WAAA,CAAAwD,GAAA,EAAC/D,0BAAA,CAAAgE,OAAyB;QACzB7C,kBAAkB,EAAGA,kBAAoB;QACzCP,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAN,WAAA,CAAAwD,GAAA,EAAC1C,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_lockUnlock","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","prevAttributes","useEffect","perPage","Object","keys","length","Number","isFinite","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","BlockControls","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD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AAL,QAAA,eACb,IAAAxD,WAAA,CAAAyD,GAAA,EAAC1D,aAAA,CAAA2D,OAAY;QAACnD,UAAU,EAAGA,UAAY;QAACE,QAAQ,EAAGA;MAAU,CAAE;IAAC,CAClD,CAAC,eAChB,IAAAT,WAAA,CAAAsD,IAAA,EAAChE,YAAA,CAAAqE,iBAAiB;MAACG,KAAK,EAAC,UAAU;MAAAN,QAAA,gBAClC,IAAAxD,WAAA,CAAAyD,GAAA,EAACxD,kBAAkB;QAClBc,OAAO,EAAGC,OAAS;QACnB+C,QAAQ,EAAKC,KAAK,IACjBxD,aAAa,CAAE;UAAEO,OAAO,EAAEiD;QAAM,CAAE,CAClC;QACDvD,QAAQ,EAAGA,QAAU;QACrBwD,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;UAAEH,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,QAAQ;UAAEF,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH,CAAC,eACF,IAAAhE,WAAA,CAAAyD,GAAA,EAAChE,0BAAA,CAAAiE,OAAyB;QACzB5C,kBAAkB,EAAGA,kBAAoB;QACzCN,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAT,WAAA,CAAAyD,GAAA,EAACzC,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
@@ -130,7 +130,7 @@ const settings = exports.settings = {
130
130
  icon: _icons.quote,
131
131
  example: {
132
132
  attributes: {
133
- citation: 'Julio Cortázar'
133
+ citation: (0, _i18n.__)('Julio Cortázar')
134
134
  },
135
135
  innerBlocks: [{
136
136
  name: 'core/paragraph',
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","value","type","source","selector","multiline","role","citation","textAlign","supports","anchor","align","html","background","backgroundImage","backgroundSize","__experimentalDefaultControls","__experimentalBorder","color","radius","style","width","dimensions","minHeight","__experimentalOnEnter","__experimentalOnMerge","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","gradients","heading","link","text","layout","allowEditing","spacing","blockGap","padding","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","settings","icon","example","innerBlocks","content","__","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/quote/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { quote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcitation: 'Julio Cortázar',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'In quoting others, we cite ourselves.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,C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;IAAAC,OAAA;MAAAC,QAAA;MAAAC,OAAA;MAAAC,MAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAArD,IAAA;IAAAsD,KAAA;IAAAC,SAAA;EAAA;IAAAvD,IAAA;IAAAsD,KAAA;EAAA;EAAAE,WAAA;EAAA9B,KAAA;AAAA;AAUA,MAAM;EAAE1B;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAMyD,QAAQ,GAAA5D,OAAA,CAAA4D,QAAA,GAAG;EACvBC,IAAI,EAAJA,YAAI;EACJC,OAAO,EAAE;IACRrD,UAAU,EAAE;MACXO,QAAQ,EAAE;IACX,CAAC;IACD+C,WAAW,EAAE,CACZ;MACC5D,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXuD,OAAO,EAAE,IAAAC,QAAE,EAAE,uCAAwC;MACtD;IACD,CAAC;EAEH,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEpE,IAAI;EAAEJ,QAAQ;EAAE6D;AAAS,CAAE,CAAC;AAAC5D,OAAA,CAAAsE,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","value","type","source","selector","multiline","role","citation","textAlign","supports","anchor","align","html","background","backgroundImage","backgroundSize","__experimentalDefaultControls","__experimentalBorder","color","radius","style","width","dimensions","minHeight","__experimentalOnEnter","__experimentalOnMerge","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","gradients","heading","link","text","layout","allowEditing","spacing","blockGap","padding","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","settings","icon","example","__","innerBlocks","content","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/quote/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { quote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcitation: __( 'Julio Cortázar' ),\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'In quoting others, we cite ourselves.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAQ,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,K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D,QAAA,GAAG;EACvBC,IAAI,EAAJA,YAAI;EACJC,OAAO,EAAE;IACRrD,UAAU,EAAE;MACXO,QAAQ,EAAE,IAAA+C,QAAE,EAAE,gBAAiB;IAChC,CAAC;IACDC,WAAW,EAAE,CACZ;MACC7D,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXwD,OAAO,EAAE,IAAAF,QAAE,EAAE,uCAAwC;MACtD;IACD,CAAC;EAEH,CAAC;EACDG,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEpE,IAAI;EAAEJ,QAAQ;EAAE6D;AAAS,CAAE,CAAC;AAAC5D,OAAA,CAAAsE,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -10,7 +10,7 @@ var _components = require("@wordpress/components");
10
10
  var _blockEditor = require("@wordpress/block-editor");
11
11
  var _i18n = require("@wordpress/i18n");
12
12
  var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
13
- var _messages = require("../utils/messages");
13
+ var _lockUnlock = require("../lock-unlock");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  /**
16
16
  * External dependencies
@@ -24,9 +24,13 @@ var _jsxRuntime = require("react/jsx-runtime");
24
24
  * Internal dependencies
25
25
  */
26
26
 
27
+ const {
28
+ HTMLElementControl
29
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
27
30
  function SeparatorEdit({
28
31
  attributes,
29
- setAttributes
32
+ setAttributes,
33
+ clientId
30
34
  }) {
31
35
  const {
32
36
  backgroundColor,
@@ -56,22 +60,19 @@ function SeparatorEdit({
56
60
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
57
61
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
58
62
  group: "advanced",
59
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
60
- __nextHasNoMarginBottom: true,
61
- __next40pxDefaultSize: true,
62
- label: (0, _i18n.__)('HTML element'),
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
64
+ tagName: tagName,
65
+ onChange: value => setAttributes({
66
+ tagName: value
67
+ }),
68
+ clientId: clientId,
63
69
  options: [{
64
70
  label: (0, _i18n.__)('Default (<hr>)'),
65
71
  value: 'hr'
66
72
  }, {
67
73
  label: '<div>',
68
74
  value: 'div'
69
- }],
70
- value: tagName,
71
- onChange: value => setAttributes({
72
- tagName: value
73
- }),
74
- help: _messages.htmlElementMessages[tagName]
75
+ }]
75
76
  })
76
77
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
77
78
  ...(0, _blockEditor.useBlockProps)({
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_messages","_jsxRuntime","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onChange","help","htmlElementMessages","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule, SelectControl } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\nimport { htmlElementMessages } from '../utils/messages';\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<Wrapper\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,C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QAAA,gBACC,IAAAxB,WAAA,CAAAyB,GAAA,EAAC7B,YAAA,CAAA8B,iBAAiB;MAACC,KAAK,EAAC,UAAU;MAAAH,QAAA,eAClC,IAAAxB,WAAA,CAAAyB,GAAA,EAAC9B,WAAA,CAAAiC,aAAa;QACbC,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,cAAe,CAAG;QAC9BC,OAAO,EAAG,CACT;UAAEF,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;UAAEE,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEH,KAAK,EAAE,OAAO;UAAEG,KAAK,EAAE;QAAM,CAAC,CAC9B;QACHA,KAAK,EAAG3B,OAAS;QACjB4B,QAAQ,EAAKD,KAAK,IACjB/B,aAAa,CAAE;UAAEI,OAAO,EAAE2B;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGC,6BAAmB,CAAE9B,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpB,IAAAP,WAAA,CAAAyB,GAAA,EAACL,OAAO;MAAA,GACF,IAAAkB,0BAAa,EAAE;QACnBrB,SAAS;QACTX,KAAK,EAAEK,cAAc,GAAGQ,MAAM,GAAGoB;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","SeparatorEdit","attributes","setAttributes","clientId","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","onChange","value","options","label","__","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function SeparatorEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\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AK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDG,UAAU,CAACS,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdP,KAAK,EAAEF,YAAY;IACnBN,eAAe,EAAEM;EAClB,CAAC;EACD,MAAMU,OAAO,GAAGb,OAAO,KAAK,IAAI,GAAGc,0BAAc,GAAGd,OAAO;EAE3D,oBACC,IAAAX,WAAA,CAAA0B,IAAA,EAAA1B,WAAA,CAAA2B,QAAA;IAAAC,QAAA,gBACC,IAAA5B,WAAA,CAAA6B,GAAA,EAACjC,YAAA,CAAAkC,iBAAiB;MAACC,KAAK,EAAC,UAAU;MAAAH,QAAA,eAClC,IAAA5B,WAAA,CAAA6B,GAAA,EAAC5B,kBAAkB;QAClBU,OAAO,EAAGA,OAAS;QACnBqB,QAAQ,EAAKC,KAAK,IACjB3B,aAAa,CAAE;UAAEK,OAAO,EAAEsB;QAAM,CAAE,CAClC;QACD1B,QAAQ,EAAGA,QAAU;QACrB2B,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;UAAEH,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEE,KAAK,EAAE,OAAO;UAAEF,KAAK,EAAE;QAAM,CAAC;MAC9B,CACH;IAAC,CACgB,CAAC,eACpB,IAAAjC,WAAA,CAAA6B,GAAA,EAACL,OAAO;MAAA,GACF,IAAAa,0BAAa,EAAE;QACnBhB,SAAS;QACTX,KAAK,EAAEK,cAAc,GAAGQ,MAAM,GAAGe;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
@@ -54,51 +54,50 @@ function SocialLinksEdit(props) {
54
54
  } = props;
55
55
  const {
56
56
  iconBackgroundColorValue,
57
- customIconBackgroundColor,
58
57
  iconColorValue,
59
58
  openInNewTab,
60
59
  showLabels,
61
60
  size
62
61
  } = attributes;
63
- const hasSelectedChild = (0, _data.useSelect)(select => select(_blockEditor.store).hasSelectedInnerBlock(clientId), [clientId]);
62
+ const {
63
+ hasSocialIcons,
64
+ hasSelectedChild
65
+ } = (0, _data.useSelect)(select => {
66
+ const {
67
+ getBlockCount,
68
+ hasSelectedInnerBlock
69
+ } = select(_blockEditor.store);
70
+ return {
71
+ hasSocialIcons: getBlockCount(clientId) > 0,
72
+ hasSelectedChild: hasSelectedInnerBlock(clientId)
73
+ };
74
+ }, [clientId]);
64
75
  const hasAnySelected = isSelected || hasSelectedChild;
65
76
  const logosOnly = attributes.className?.includes('is-style-logos-only');
66
77
  const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
67
78
 
68
79
  // Remove icon background color when logos only style is selected or
69
80
  // restore it when any other style is selected.
70
- const backgroundBackupRef = (0, _element.useRef)({});
71
81
  (0, _element.useEffect)(() => {
72
82
  if (logosOnly) {
73
- backgroundBackupRef.current = {
74
- iconBackgroundColor,
75
- iconBackgroundColorValue,
76
- customIconBackgroundColor
77
- };
78
- setAttributes({
79
- iconBackgroundColor: undefined,
80
- customIconBackgroundColor: undefined,
81
- iconBackgroundColorValue: undefined
83
+ let restore;
84
+ setAttributes(prev => {
85
+ restore = {
86
+ iconBackgroundColor: prev.iconBackgroundColor,
87
+ iconBackgroundColorValue: prev.iconBackgroundColorValue,
88
+ customIconBackgroundColor: prev.customIconBackgroundColor
89
+ };
90
+ return {
91
+ iconBackgroundColor: undefined,
92
+ iconBackgroundColorValue: undefined,
93
+ customIconBackgroundColor: undefined
94
+ };
82
95
  });
83
- } else {
84
- setAttributes({
85
- ...backgroundBackupRef.current
96
+ return () => setAttributes({
97
+ ...restore
86
98
  });
87
99
  }
88
- }, [logosOnly]);
89
- const SocialPlaceholder = /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
90
- className: "wp-block-social-links__social-placeholder",
91
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
92
- className: "wp-block-social-links__social-placeholder-icons",
93
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
94
- className: "wp-social-link wp-social-link-twitter"
95
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
96
- className: "wp-social-link wp-social-link-facebook"
97
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
98
- className: "wp-social-link wp-social-link-instagram"
99
- })]
100
- })
101
- });
100
+ }, [logosOnly, setAttributes]);
102
101
 
103
102
  // Fallback color values are used maintain selections in case switching
104
103
  // themes and named colors in palette do not match.
@@ -111,11 +110,10 @@ function SocialLinksEdit(props) {
111
110
  className
112
111
  });
113
112
  const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
114
- placeholder: !isSelected && SocialPlaceholder,
115
113
  templateLock: false,
116
114
  orientation: (_attributes$layout$or = attributes.layout?.orientation) !== null && _attributes$layout$or !== void 0 ? _attributes$layout$or : 'horizontal',
117
115
  __experimentalAppenderTagName: 'li',
118
- renderAppender: hasAnySelected && _blockEditor.InnerBlocks.ButtonBlockAppender
116
+ renderAppender: !hasSocialIcons || hasAnySelected ? _blockEditor.InnerBlocks.ButtonBlockAppender : undefined
119
117
  });
120
118
  const POPOVER_PROPS = {
121
119
  position: 'bottom right'
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_blockEditor","_components","_i18n","_icons","_data","_hooks","_jsxRuntime","sizeOptions","name","__","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","hasSelectedChild","useSelect","select","blockEditorStore","hasSelectedInnerBlock","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","useToolsPanelDropdownMenuProps","backgroundBackupRef","useRef","useEffect","current","undefined","SocialPlaceholder","jsx","children","jsxs","clsx","color","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","placeholder","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","InnerBlocks","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","useMultipleOriginColorsAndGradients","Fragment","BlockControls","group","ToolbarDropdownMenu","text","icon","popoverProps","onClose","MenuGroup","map","entry","MenuItem","check","onClick","role","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","ContrastChecker","textColor","backgroundColor","isLargeText","iconColorAttributes","_default","exports","default","withColors"],"sources":["@wordpress/block-library/src/social-links/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst hasSelectedChild = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).hasSelectedInnerBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackupRef = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackupRef.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackupRef.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tplaceholder: ! isSelected && SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender: hasAnySelected && InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\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\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\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\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAYA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAAgE,IAAAQ,WAAA,GAAAR,OAAA;AApChE;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;;AAGA,MAAMS,WAAW,GAAG,CACnB;EAAEC,IAAI,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EAAEC,KAAK,EAAE;AAAsB,CAAC,EACrD;EAAEF,IAAI,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EAAEC,KAAK,EAAE;AAAuB,CAAC,EACvD;EAAEF,IAAI,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EAAEC,KAAK,EAAE;AAAsB,CAAC,EACrD;EAAEF,IAAI,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EAAEC,KAAK,EAAE;AAAqB,CAAC,CACnD;AAEM,SAASC,eAAeA,CAAEC,KAAK,EAAG;EAAA,IAAAC,qBAAA;EACxC,MAAM;IACLC,QAAQ;IACRC,UAAU;IACVC,mBAAmB;IACnBC,SAAS;IACTC,UAAU;IACVC,aAAa;IACbC,sBAAsB;IACtBC;EACD,CAAC,GAAGT,KAAK;EAET,MAAM;IACLU,wBAAwB;IACxBC,yBAAyB;IACzBC,cAAc;IACdC,YAAY;IACZC,UAAU;IACVC;EACD,CAAC,GAAGZ,UAAU;EAEd,MAAMa,gBAAgB,GAAG,IAAAC,e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B,sBAAuBH,KAAK,EAelC,CAEH,CAAC,EACC,CAAEjC,SAAS,iBACZ,IAAA5B,WAAA,CAAAuC,GAAA,EAAC7C,YAAA,CAAAyG,eAAe;QAEdC,SAAS,EAAElF,cAAc;QACzBmF,eAAe,EAAErF,wBAAwB;QAE1CsF,WAAW,EAAG;MAAO,CACrB,CACD;IAAA,CACiB,CACnB,eACD,IAAAtG,WAAA,CAAAuC,GAAA;MAAA,GAASO;IAAgB,CAAI,CAAC;EAAA,CAC7B,CAAC;AAEL;AAEA,MAAMyD,mBAAmB,GAAG;EAC3B5F,SAAS,EAAE,YAAY;EACvBD,mBAAmB,EAAE;AACtB,CAAC;AAAC,IAAA8F,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,uBAAU,EAAEJ,mBAAoB,CAAC,CAAElG,eAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_blockEditor","_components","_i18n","_icons","_data","_hooks","_jsxRuntime","sizeOptions","name","__","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","showLabels","size","hasSocialIcons","hasSelectedChild","useSelect","select","getBlockCount","hasSelectedInnerBlock","blockEditorStore","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","useToolsPanelDropdownMenuProps","useEffect","restore","prev","customIconBackgroundColor","undefined","clsx","color","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","InnerBlocks","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","useMultipleOriginColorsAndGradients","jsxs","Fragment","children","jsx","BlockControls","group","ToolbarDropdownMenu","text","icon","popoverProps","onClose","MenuGroup","map","entry","MenuItem","check","onClick","role","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","ContrastChecker","textColor","backgroundColor","isLargeText","iconColorAttributes","_default","exports","default","withColors"],"sources":["@wordpress/block-library/src/social-links/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\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\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\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\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAYA,I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C,CAAEjG,eAAgB,CAAC","ignoreList":[]}
@@ -259,7 +259,7 @@ const settings = exports.settings = {
259
259
  content: '5.2',
260
260
  tag: 'td'
261
261
  }, {
262
- content: 'Jaco Pastorius',
262
+ content: (0, _i18n.__)('Jaco Pastorius'),
263
263
  tag: 'td'
264
264
  }, {
265
265
  content: (0, _i18n.__)('May 7, 2019'),
@@ -270,7 +270,7 @@ const settings = exports.settings = {
270
270
  content: '5.1',
271
271
  tag: 'td'
272
272
  }, {
273
- content: 'Betty Carter',
273
+ content: (0, _i18n.__)('Betty Carter'),
274
274
  tag: 'td'
275
275
  }, {
276
276
  content: (0, _i18n.__)('February 21, 2019'),
@@ -281,7 +281,7 @@ const settings = exports.settings = {
281
281
  content: '5.0',
282
282
  tag: 'td'
283
283
  }, {
284
- content: 'Bebo Valdés',
284
+ content: (0, _i18n.__)('Bebo Valdés'),
285
285
  tag: 'td'
286
286
  }, {
287
287
  content: (0, _i18n.__)('December 6, 2018'),