UNPKG

@wordpress/block-library

Version:
1 lines • 1.84 kB
{"version":3,"file":"enhanced-pagination-control.mjs","names":[],"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,oBAAoB,qBAAsB,QAAS;CAEzD,IAAI,OAAO,GACV,2FACD;CACA,IAAK,kBAAkB,QACtB,OAAO,QAEN,GACC,uEACD,GACA,kBAAkB,KAEjB,GAAI,IAAK,CACV,CACD;CAGD,OACC,oBAAA,UAAA,EAAA,UACC,oBAAC,eAAD;EACC,OAAQ,GAAI,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"}