UNPKG

@wordpress/block-library

Version:
1 lines • 2.06 kB
{"version":3,"file":"enhanced-pagination-control.cjs","names":["useUnsupportedBlocks","__","sprintf","ToggleControl"],"sources":["../../../../src/query/edit/inspector-controls/enhanced-pagination-control.jsx"],"sourcesContent":["import { ToggleControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useUnsupportedBlocks } from '../../utils';\n\nexport default function EnhancedPaginationControl( {\n\tenhancedPagination,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst unsupportedBlocks = useUnsupportedBlocks( clientId );\n\n\tlet help = __(\n\t\t'Reload the full page—instead of just the posts list—when visitors navigate between pages.'\n\t);\n\tif ( unsupportedBlocks.length ) {\n\t\thelp = sprintf(\n\t\t\t/* translators: %s: A list of block titles. */\n\t\t\t__(\n\t\t\t\t`Some blocks aren't supported: %s. Remove them to change this setting.`\n\t\t\t),\n\t\t\tunsupportedBlocks.join(\n\t\t\t\t/* translators: Used between list items, there is a space after the comma. */\n\t\t\t\t__( ', ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Reload full page' ) }\n\t\t\t\thelp={ help }\n\t\t\t\tchecked={ ! enhancedPagination }\n\t\t\t\tdisabled={ !! unsupportedBlocks.length }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tenhancedPagination: ! value,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAIA,SAAwB,0BAA2B,EAClD,oBACA,eACA,YACG;CACH,MAAM,qBAAA,GAAoBA,eAAAA,qBAAAA,CAAsB,QAAS;CAEzD,IAAI,QAAA,GAAOC,gBAAAA,GAAAA,CACV,2FACD;CACA,IAAK,kBAAkB,QACtB,QAAA,GAAOC,gBAAAA,QAAAA,EAAAA,GAEND,gBAAAA,GAAAA,CACC,uEACD,GACA,kBAAkB,MAAA,GAEjBA,gBAAAA,GAAAA,CAAI,IAAK,CACV,CACD;CAGD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,eAAD;EACC,QAAA,GAAQF,gBAAAA,GAAAA,CAAI,kBAAmB;EACxB;EACP,SAAU,CAAE;EACZ,UAAW,CAAC,CAAE,kBAAkB;EAChC,WAAa,UAAW;GACvB,cAAe,EACd,oBAAoB,CAAE,MACvB,CAAE;EACH;CACA,CAAA,EACA,CAAA;AAEJ"}