/* @jsx jsx */ /* eslint-disable functional/no-return-void */ // WordPress dependencies import '@wordpress/core-data'; import { SelectControl } from '@wordpress/components'; import { _x } from '@wordpress/i18n'; // Nelio Unlocker dependencies import { usePostTypes } from '@nelio-unlocker/hooks'; // External dependencies import { css, jsx } from '@emotion/react'; // Internal dependencies import { PostSearcher } from './post-searcher'; // TYPES export type FullPostSearcherProps = { readonly isDisabled?: boolean; readonly onPostIdChange: ( postId: number ) => void; readonly onPostTypeChange: ( postType: string, postId: number ) => void; readonly postId: number; readonly postType: string; }; // VIEWS export const FullPostSearcher = ( { isDisabled, onPostTypeChange, onPostIdChange, postType, postId, }: FullPostSearcherProps ): JSX.Element => { const postTypes = usePostTypes().map( ( pt ) => ( { label: pt.labels.singular_name, value: pt.slug, } ) ); const postTypeLoader = { label: _x( 'Loading…', 'text', 'nelio-unlocker' ), value: '', }; return (