@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 1.95 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../../src/query/edit/inspector-controls/order-control.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst defaultOrderByOptions = [\n\t{\n\t\tlabel: __( 'Newest to oldest' ),\n\t\tvalue: 'date/desc',\n\t},\n\t{\n\t\tlabel: __( 'Oldest to newest' ),\n\t\tvalue: 'date/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\tlabel: __( 'A \u2192 Z' ),\n\t\tvalue: 'title/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\tlabel: __( 'Z \u2192 A' ),\n\t\tvalue: 'title/desc',\n\t},\n];\n\nfunction OrderControl( {\n\torder,\n\torderBy,\n\torderByOptions = defaultOrderByOptions,\n\tonChange,\n} ) {\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Order by' ) }\n\t\t\tvalue={ `${ orderBy }/${ order }` }\n\t\t\toptions={ orderByOptions }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tconst [ newOrderBy, newOrder ] = value.split( '/' );\n\t\t\t\tonChange( { order: newOrder, orderBy: newOrderBy } );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default OrderControl;\n"],
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AA8BjB;AA5BF,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,YAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,YAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AACD;AAEA,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,OAAQ,GAAI,UAAW;AAAA,MACvB,OAAQ,GAAI,OAAQ,IAAK,KAAM;AAAA,MAC/B,SAAU;AAAA,MACV,UAAW,CAAE,UAAW;AACvB,cAAM,CAAE,YAAY,QAAS,IAAI,MAAM,MAAO,GAAI;AAClD,iBAAU,EAAE,OAAO,UAAU,SAAS,WAAW,CAAE;AAAA,MACpD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,wBAAQ;",
"names": []
}