@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 1.2 kB
Source Map (JSON)
{"version":3,"file":"offset-controls.cjs","names":["NumberControl","_x"],"sources":["../../../../src/query/edit/inspector-controls/offset-controls.jsx"],"sourcesContent":["import { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\n\nconst MIN_OFFSET = 0;\nconst MAX_OFFSET = 100;\n\nexport const OffsetControl = ( { offset = 0, onChange } ) => {\n\treturn (\n\t\t<NumberControl\n\t\t\tlabel={ _x( 'Offset', 'Number of posts to skip in a query' ) }\n\t\t\tvalue={ offset }\n\t\t\tmin={ MIN_OFFSET }\n\t\t\tonChange={ ( newOffset ) => {\n\t\t\t\tif (\n\t\t\t\t\tisNaN( newOffset ) ||\n\t\t\t\t\tnewOffset < MIN_OFFSET ||\n\t\t\t\t\tnewOffset > MAX_OFFSET\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonChange( { offset: newOffset } );\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nexport default OffsetControl;\n"],"mappings":";;;;;;;;;AAGA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAa,iBAAkB,EAAE,SAAS,GAAG,eAAgB;CAC5D,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,6BAAD;EACC,QAAA,GAAQC,gBAAAA,GAAAA,CAAI,UAAU,oCAAqC;EAC3D,OAAQ;EACR,KAAM;EACN,WAAa,cAAe;GAC3B,IACC,MAAO,SAAU,KACjB,YAAY,cACZ,YAAY,YAEZ;GAED,SAAU,EAAE,QAAQ,UAAU,CAAE;EACjC;CACA,CAAA;AAEH"}