From 721cd87b87ab848a4d7b6960254f0176171c4126 Mon Sep 17 00:00:00 2001 From: Guido Scialfa Date: Thu, 25 Jul 2024 19:45:41 +0200 Subject: [PATCH] Rename the Project --- .eslintrc.js | 2 +- .wp-env.json | 2 +- @types/index.d.ts | 14 ++--- README.md | 8 +-- composer.json | 4 +- docs/_config.yml | 12 ++-- docs/api.md | 10 +-- docs/components.md | 12 ++-- docs/control-option.md | 8 +-- docs/development.md | 4 +- docs/hooks.md | 6 +- docs/installation.md | 2 +- docs/logging.md | 4 +- docs/readme.md | 2 +- package.json | 2 +- phpcs.xml | 2 +- plugin.php | 12 ++-- .../src/api/create-search-entities-options.ts | 8 +-- .../client/src/api/search-entities-options.ts | 21 +++---- sources/client/src/api/search-entities.ts | 8 +-- .../components/composite-entities-by-kind.tsx | 19 +++--- .../src/components/no-options-message.tsx | 4 +- .../src/components/plural-select-control.tsx | 10 +-- .../components/preset-entities-by-kind.tsx | 36 +++++------ .../client/src/components/radio-control.tsx | 12 ++-- .../client/src/components/search-control.tsx | 14 ++--- .../components/singular-select-control.tsx | 10 +-- .../client/src/components/toggle-control.tsx | 16 ++--- .../src/hooks/use-entities-options-storage.ts | 23 +++---- .../client/src/hooks/use-entity-records.ts | 4 +- .../hooks/use-query-viewable-post-types.ts | 14 +++-- .../hooks/use-query-viewable-taxonomies.ts | 14 +++-- sources/client/src/hooks/use-search.ts | 20 +++--- sources/client/src/logging/index.ts | 30 ++++----- sources/client/src/models/immutable-record.ts | 4 +- .../src/storage/entities/initial-state.ts | 8 +-- .../client/src/storage/entities/reducer.ts | 11 ++-- .../convert-entities-to-control-options.ts | 4 +- sources/client/src/utils/is-control-option.ts | 4 +- .../order-selected-options-at-the-top.ts | 10 +-- .../src/utils/unique-control-options.ts | 10 +-- .../src/value-objects/control-option.ts | 10 ++- sources/server/src/Library.php | 2 +- .../server/src/Modules/BlockEditor/Module.php | 6 +- sources/server/src/Modules/E2e/Module.php | 12 ++-- .../js/post-types-example-block/block.json | 4 +- .../js/post-types-example-block/index.js | 10 +-- .../js/taxonomies-example-block/block.json | 4 +- .../js/taxonomies-example-block/index.js | 10 +-- sources/server/src/Modules/Logging/Module.php | 4 +- .../preset-posts-types.markup.test.tsx.snap | 8 +-- .../composite-entities-by-kind.test.tsx | 63 +++++++------------ .../preset-posts-types.markup.test.tsx | 6 +- tests/client/unit/api/search-entities.test.ts | 6 +- tests/client/unit/api/search-posts.test.ts | 4 +- .../plural-select-control.test.tsx.snap | 2 +- .../__snapshots__/radio-control.test.tsx.snap | 2 +- .../search-control.test.tsx.snap | 4 +- .../toggle-control.test.tsx.snap | 16 ++--- .../components/plural-select-control.test.tsx | 14 ++--- .../components/preset-posts-types.test.tsx | 8 +-- .../unit/components/radio-control.test.tsx | 4 +- .../singular-select-control.test.tsx | 17 +++-- .../unit/components/toggle-control.test.tsx | 2 +- .../use-entities-options-storage.test.tsx | 18 ++---- .../unit/hooks/use-entity-records.test.ts | 14 ++--- .../use-query-viewable-post-types.test.ts | 6 +- .../use-query-viewable-taxonomies.test.ts | 8 +-- tests/client/unit/hooks/use-search.test.ts | 12 ++-- tests/client/unit/storage/reducer.test.ts | 4 +- tests/client/unit/utils.ts | 6 +- ...onvert-entities-to-control-options.test.ts | 4 +- ...rdered-selected-options-at-the-top.test.ts | 12 ++-- .../unit/utils/unique-control-options.test.ts | 4 +- webpack.config.js | 2 +- 75 files changed, 338 insertions(+), 390 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9c60ba6..eac01d5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { '@wordpress/i18n-text-domain': [ 'error', { - allowedTextDomain: 'wp-entities-search', + allowedTextDomain: 'kensaku', }, ], '@typescript-eslint/array-type': [ 'error', { default: 'generic' } ], diff --git a/.wp-env.json b/.wp-env.json index dd57a22..ae176b7 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -5,7 +5,7 @@ "development": { "phpVersion": "8.1", "mappings": { - "wp-content/plugins/wp-entities-search": "." + "wp-content/plugins/kensaku": "." } } }, diff --git a/@types/index.d.ts b/@types/index.d.ts index 5ec4e72..dd585cc 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -4,10 +4,10 @@ import { BaseEntityRecords, Context } from '@wordpress/core-data'; import type { Set } from '../sources/client/src'; -export default EntitiesSearch; +export default Kensaku; // TODO Try to convert it to a module. -declare namespace EntitiesSearch { +declare namespace Kensaku { type Post = BaseEntityRecords.Post; type PostType = BaseEntityRecords.Type; type Taxonomy = BaseEntityRecords.Taxonomy; @@ -23,7 +23,7 @@ declare namespace EntitiesSearch { Readonly<{ exclude: Set; include: Set; - fields: EntitiesSearch.SearchQueryFields; + fields: Kensaku.SearchQueryFields; [p: string]: unknown; }> > {} @@ -42,7 +42,7 @@ declare namespace EntitiesSearch { type SearchEntitiesFunction = ( phrase: string, kind: Kind, - queryArguments?: EntitiesSearch.QueryArguments + queryArguments?: Kensaku.QueryArguments ) => Promise>; type SingularControl = { @@ -104,7 +104,7 @@ declare namespace EntitiesSearch { */ // TODO Better to convert the SearchQueryFields to a Set. type SearchQueryFields = ReadonlyArray< - keyof EntitiesSearch.SearchEntityFields + keyof Kensaku.SearchEntityFields >; /* @@ -113,7 +113,7 @@ declare namespace EntitiesSearch { interface EntitiesState< E, K, - OptionSet = Set> + OptionSet = Set> > extends Readonly<{ entities: Entities; kind: Kind; @@ -150,7 +150,7 @@ declare namespace EntitiesSearch { } | { type: 'UPDATE_ENTITIES_OPTIONS_FOR_NEW_KIND'; - entitiesOptions: Set>; + entitiesOptions: Set>; kind: EntitiesState['kind']; } | { diff --git a/README.md b/README.md index f61d7c8..df2b437 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Wp Entities Search +# Kensaku > A WordPress package to search Entities including Rest API Endpoints and React Components -[![JS Quality Assurance](https://github.com/spaghetti-dojo/wp-entities-search/actions/workflows/js-qa.yml/badge.svg)](https://github.com/spaghetti-dojo/wp-entities-search/actions/workflows/js-qa.yml) -[![PHP Quality Assurance](https://github.com/spaghetti-dojo/wp-entities-search/actions/workflows/php-qa.yml/badge.svg)](https://github.com/spaghetti-dojo/wp-entities-search/actions/workflows/php-qa.yml) +[![JS Quality Assurance](https://github.com/spaghetti-dojo/kensaku/actions/workflows/js-qa.yml/badge.svg)](https://github.com/spaghetti-dojo/kensaku/actions/workflows/js-qa.yml) +[![PHP Quality Assurance](https://github.com/spaghetti-dojo/kensaku/actions/workflows/php-qa.yml/badge.svg)](https://github.com/spaghetti-dojo/kensaku/actions/workflows/php-qa.yml) This package is a library exposing reusable Components and Utilities to help you build Entities searching and storage. @@ -12,7 +12,7 @@ more Post Types but also, to search for Terms belonging to one or more Taxonomie ## Documentation -Go to [documentation](./docs) or visit the site [wp-entities-search](https://spaghetti-dojo.github.io/wp-entities-search/). +Go to [documentation](./docs) or visit the site [kensaku](https://spaghetti-dojo.github.io/kensaku/). ## License diff --git a/composer.json b/composer.json index 725bd35..90f200e 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,11 @@ { - "name": "spaghetti-dojo/wp-entities-search", + "name": "spaghetti-dojo/kensaku", "description": "A WordPress package to search Entities including Rest API Endpoints and React Components", "type": "library", "license": "GPL-2.0-or-later", "autoload": { "psr-4": { - "SpaghettiDojo\\Wp\\EntitiesSearch\\": "sources/server/src/" + "SpaghettiDojo\\Kensaku\\": "sources/server/src/" } }, "authors": [ diff --git a/docs/_config.yml b/docs/_config.yml index 24f73a5..74d4689 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,20 +1,20 @@ -title: Wp Entities Search +title: Kensaku description: >- A WordPress package to search Entities including Rest API Endpoints and React Components -url: "https://spaghetti-dojo.github.io/wp-entities-search" -baseurl: "/wp-entities-search" +url: "https://spaghetti-dojo.github.io/kensaku" +baseurl: "/kensaku" remote_theme: just-the-docs/just-the-docs aux_links: - "Wp Entities Search on Github": - - "https://github.com/spaghetti-dojo/wp-entities-search" + "Kensaku on Github": + - "https://github.com/spaghetti-dojo/kensaku" aux_links_new_tab: true nav_external_links: - title: Go to the Repository - url: https://github.com/spaghetti-dojo/wp-entities-search + url: https://github.com/spaghetti-dojo/kensaku opens_in_new_tab: true back_to_top: true diff --git a/docs/api.md b/docs/api.md index 653d861..f0f9c35 100644 --- a/docs/api.md +++ b/docs/api.md @@ -14,7 +14,7 @@ The package provide then the following functions to interact with the WordPress This function is a wrapper for the Search Endpoint of the WordPress API. It will return a `Set` of entities matching the search query. -The possible query arguments are specified by the `EntitiesSearch.QueryArguments` type, an interface you can expand to add more arguments. +The possible query arguments are specified by the `Kensaku.QueryArguments` type, an interface you can expand to add more arguments. This function is not directly consumed by the components, and it is not intended to be used internally. The idea is to follow the Tell don't Ask principle and let the consumer specify how to search the Entities. @@ -22,7 +22,7 @@ Below a possible example of its usage related to a component: ```tsx // my-component.tsx -type Search = EntitiesSearch.SearchEntitiesFunction; +type Search = Kensaku.SearchEntitiesFunction; type Props = { search: Search } @@ -48,7 +48,7 @@ const MyComponent (props: Props) => { } // index.tsx -import {searchEntities} from 'wp-entities-search'; +import {searchEntities} from 'kensaku'; root.render(); ``` @@ -60,7 +60,7 @@ The function accept four parameters - `type` - The root type. We have two built-int supported types `post`, `term`. - `subtype` - The subtype of the entity. For example, if the `type` is `post`, the `subtype` can be `page`, `post`, etc. WordPress exclude automatically the `attachment` subtype. - `phrase` - The search phrase. This becomes the `s` parameter for the Search Endpoint. -- `queryArguments` - All the supported and extra query arguments. The `EntitiesSearch.QueryArguments` type is an interface you can expand to add more arguments. +- `queryArguments` - All the supported and extra query arguments. The `Kensaku.QueryArguments` type is an interface you can expand to add more arguments. ### Return @@ -77,7 +77,7 @@ The `searchEntities` will automatically abort the requests with the same paramet ## `searchEntitiesOptions` This function is a wrapper for the `searchEntites` which perform a small additional task you might want to do quite ofter after retrieving the entities that is -to convert the entities to `EntitiesSearch.ControlOptions`. The argument taken are the same of the `searchEntities`. +to convert the entities to `Kensaku.ControlOptions`. The argument taken are the same of the `searchEntities`. ### `createSearchEntitiesOptions` diff --git a/docs/components.md b/docs/components.md index 38613c8..f611d0b 100644 --- a/docs/components.md +++ b/docs/components.md @@ -6,7 +6,7 @@ nav_order: 4 # Components -The Wp Entities Search provides a set of components you can use to build your search UI. +Kensaku provides a set of components you can use to build your search UI. We have to distinguish between two types of components: @@ -57,7 +57,7 @@ possible to use a search function in conjunction with a `search` field. An example of its usage is: ```jsx -import { CompositeEntitiesByKind } from 'wp-entities-search'; +import { CompositeEntitiesByKind } from 'kensaku'; export function MyComponent(props) { const entities = { @@ -146,7 +146,7 @@ In the example below we only allow to select the entities belonging to the `page the user to switch between them. ```jsx -import { CompositeEntitiesByKind } from 'wp-entities-search'; +import { CompositeEntitiesByKind } from 'kensaku'; export function MyComponent(props) { const entities = { @@ -228,11 +228,11 @@ Therefore, the preset simplify and take care of some parts that you would have t - `entitiesFinder` - The function which perform the search of the contextual entities. You can use the `createSearchEntitiesOptions` function by passing the `root` value such as `term` or `post`. - `className` - For better customization you can pass your own custom classes. -- `entities` - A `EntitiesSearch.Entities` set of selected entities. For when you want some entities already selected. +- `entities` - A `Kensaku.Entities` set of selected entities. For when you want some entities already selected. - `onChangeEntities` - A task to perform when the selection change due to a user interaction. - `entitiesComponent` - The component to use to render the control ui for the entities. - `kind` - The predefined set of kind (e.g. post-types or taxonomies) you want to have already selected. -- `kindOptions` - A collection of `EntitiesSearch.ControlOption` among which the user can choose to retrieve the entities from. +- `kindOptions` - A collection of `Kensaku.ControlOption` among which the user can choose to retrieve the entities from. - `onChangeKind` - A task to perform when the selection change due to a user interaction. - `kindComponent` - The component to use to render the control ui for the kinds. - `entitiesFields` - Additional fields you want to retrieve and have available within your `entitiesComponent` and `kindComponent`. For more info read the [Control Option](./control-option.md) documentation. @@ -246,7 +246,7 @@ The Singular Components always get a single value, therefore you have to conside the `Set`. ```jsx -import { CompositeEntitiesByKind } from 'wp-entities-search'; +import { CompositeEntitiesByKind } from 'kensaku'; export function MyComponent(props) { return ` to the children. +the `entities` of type `Kensaku.BaseControl< E >` to the children. ```jsx -(entities: EntitiesSearch.BaseControl< E >) => { +(entities: Kensaku.BaseControl< E >) => { return ; } ``` diff --git a/docs/development.md b/docs/development.md index 6682458..c221584 100644 --- a/docs/development.md +++ b/docs/development.md @@ -9,8 +9,8 @@ nav_order: 2 The first thing to do is to clone the repository and install the dependencies: ```bash -$ git clone git@github.com:spaghetti-dojo/wp-entities-search.git -$ cd wp-entities-search +$ git clone git@github.com:spaghetti-dojo/kensaku.git +$ cd kensaku $ composer install $ yarn install ``` diff --git a/docs/hooks.md b/docs/hooks.md index f91a597..1a42dd8 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -6,7 +6,7 @@ nav_order: 6 # Hooks -The Wp Entities Search expose some hooks to help you to work with the search and the rest calls. +Kensaku expose some hooks to help you to work with the search and the rest calls. - `useEntitiesOptionsStorage` - `useEntitiesRecords` @@ -64,7 +64,7 @@ endpoint. The following example is retrieving the list of the `postType`s from the server. ```ts -const entitiesRecords = useEntityRecords>( +const entitiesRecords = useEntityRecords>( 'root', 'postType', { per_page: -1 } @@ -94,5 +94,5 @@ It requires a function `searchEntities` to perform the search to the server, the query for the new entities values. In the future there'll be the possibility to reuse the storage directly from within the hook reducing the amount of parameters, and for last the `dispatch`, necessary to update the shared state. -When the state update fail for any reason an action `wp-entities-search.on-search.error` is fired. You can hook into it +When the state update fails for any reason, an action `kensaku.on-search.error` is fired. You can hook into it and consume the given `error` instance. More on this in the [logging](./logging.md) documentation. diff --git a/docs/installation.md b/docs/installation.md index d0c9dd2..3250819 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -16,7 +16,7 @@ The JavaScript implementation is composed of a set of utilities and React compon To install the package as part of the composer dependencies of your project, run the following command: ```bash -composer require spaghetti-dojo/wp-entities-search +composer require spaghetti-dojo/kensaku ``` ## NPM diff --git a/docs/logging.md b/docs/logging.md index 26cb8eb..d3e709d 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -18,8 +18,8 @@ For instance, below you can see an example of one of the actions error logging. ```ts addAction( - 'wp-entities-search.on-change-entities.error', - 'wp-entities-search/wp-on-change-entities.error', + 'kensaku.on-change-entities.error', + 'kensaku/wp-on-change-entities.error', (error) => { console.error( `Composite Entities by Kind - on Change Entities: ${ diff --git a/docs/readme.md b/docs/readme.md index fe7af33..8ce4482 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,6 +1,6 @@ --- layout: home -title: Wp Entities Search +title: Kensaku permalink: / nav_order: 0 --- diff --git a/package.json b/package.json index 43bc014..a7eaad9 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "wp-entities-search", + "name": "kensaku", "description": "A WordPress package to search Entities including Rest API Endpoints and React Components", "author": "guido scialfa ", "main": "./build/index.js", diff --git a/phpcs.xml b/phpcs.xml index bc54382..72bb48b 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,7 @@ - + diff --git a/plugin.php b/plugin.php index 2e9c82d..44d99c7 100644 --- a/plugin.php +++ b/plugin.php @@ -1,18 +1,18 @@ package(); + $package = Kensaku\Library::new(\plugin_dir_url(__FILE__))->package(); } return $package; @@ -42,6 +42,6 @@ function autoload(string $projectRoot): void \add_action( 'plugins_loaded', fn() => package() - ->addModule(EntitiesSearch\Modules\E2e\Module::new()) + ->addModule(Kensaku\Modules\E2e\Module::new()) ->boot() ); diff --git a/sources/client/src/api/create-search-entities-options.ts b/sources/client/src/api/create-search-entities-options.ts index 2105e52..c4fd5db 100644 --- a/sources/client/src/api/create-search-entities-options.ts +++ b/sources/client/src/api/create-search-entities-options.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -import EntitiesSearch from '@types'; +import Kensaku from '@types'; /** * Internal dependencies @@ -12,8 +12,8 @@ import { searchEntitiesOptions } from './search-entities-options'; export function createSearchEntitiesOptions< E >( type: string ) { return async ( phrase: string, - postTypes: EntitiesSearch.Kind< string >, - queryArguments?: EntitiesSearch.QueryArguments - ): Promise< Set< EntitiesSearch.ControlOption< E > > > => + postTypes: Kensaku.Kind< string >, + queryArguments?: Kensaku.QueryArguments + ): Promise< Set< Kensaku.ControlOption< E > > > => searchEntitiesOptions( type, phrase, postTypes, queryArguments ); } diff --git a/sources/client/src/api/search-entities-options.ts b/sources/client/src/api/search-entities-options.ts index d3caecc..8f32937 100644 --- a/sources/client/src/api/search-entities-options.ts +++ b/sources/client/src/api/search-entities-options.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -import EntitiesSearch from '@types'; +import Kensaku from '@types'; /** * Internal dependencies @@ -13,16 +13,15 @@ import { convertEntitiesToControlOptions } from '../utils/convert-entities-to-co export async function searchEntitiesOptions< E >( type: string, phrase: string, - postTypes: EntitiesSearch.Kind< string >, - queryArguments?: EntitiesSearch.QueryArguments -): Promise< Set< EntitiesSearch.ControlOption< E > > > { - const postsEntities = - await searchEntities< EntitiesSearch.SearchEntityFields >( - type, - postTypes, - phrase, - queryArguments - ); + postTypes: Kensaku.Kind< string >, + queryArguments?: Kensaku.QueryArguments +): Promise< Set< Kensaku.ControlOption< E > > > { + const postsEntities = await searchEntities< Kensaku.SearchEntityFields >( + type, + postTypes, + phrase, + queryArguments + ); const { fields = [] } = queryArguments ?? {}; const [ label = 'title', value = 'id', ...extraFields ] = fields; diff --git a/sources/client/src/api/search-entities.ts b/sources/client/src/api/search-entities.ts index 12e4ead..4020af9 100644 --- a/sources/client/src/api/search-entities.ts +++ b/sources/client/src/api/search-entities.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -import EntitiesSearch from '@types'; +import Kensaku from '@types'; /** * WordPress dependencies @@ -20,7 +20,7 @@ export async function searchEntities< E >( type: string, subtype: Set< string >, phrase: string, - queryArguments?: EntitiesSearch.QueryArguments + queryArguments?: Kensaku.QueryArguments ): Promise< Set< E > > { const { exclude, @@ -57,7 +57,7 @@ export async function searchEntities< E >( signal: controller?.signal() ?? null, } ).catch( ( error ) => { if ( error instanceof DOMException && error.name === 'AbortError' ) { - doAction( 'wp-entities-search.on-search.abort', error ); + doAction( 'kensaku.on-search.abort', error ); } throw error; @@ -66,6 +66,6 @@ export async function searchEntities< E >( return new Set( entities ); } -function serializeFields( fields: EntitiesSearch.SearchQueryFields ): string { +function serializeFields( fields: Kensaku.SearchQueryFields ): string { return fields.join( ',' ); } diff --git a/sources/client/src/components/composite-entities-by-kind.tsx b/sources/client/src/components/composite-entities-by-kind.tsx index f0da36a..7b2a1f5 100644 --- a/sources/client/src/components/composite-entities-by-kind.tsx +++ b/sources/client/src/components/composite-entities-by-kind.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import type EntitiesSearch from '@types'; +import type Kensaku from '@types'; import React, { JSX } from 'react'; /** @@ -25,7 +25,7 @@ import { Set } from '../models/set'; * @param props The component props. */ export function CompositeEntitiesByKind< E, K >( - props: EntitiesSearch.CompositeEntitiesKinds< E, K > + props: Kensaku.CompositeEntitiesKinds< E, K > ): JSX.Element { const [ state, dispatch ] = useEntitiesOptionsStorage< E, K >( { @@ -41,7 +41,7 @@ export function CompositeEntitiesByKind< E, K >( dispatch ); - const onChangeEntities = ( entities: EntitiesSearch.Entities< E > ) => { + const onChangeEntities = ( entities: Kensaku.Entities< E > ) => { props.entities.onChange( entities ); if ( entities.length() <= 0 ) { @@ -75,14 +75,11 @@ export function CompositeEntitiesByKind< E, K >( } ); } ) .catch( ( error ) => { - doAction( - 'wp-entities-search.on-change-entities.error', - error - ); + doAction( 'kensaku.on-change-entities.error', error ); } ); }; - const onChangeKind = ( kind: EntitiesSearch.Kind< K > ) => { + const onChangeKind = ( kind: Kensaku.Kind< K > ) => { const emptySet = new Set< any >(); props.kind.onChange( kind ); @@ -111,11 +108,11 @@ export function CompositeEntitiesByKind< E, K >( dispatch( { type: 'CLEAN_ENTITIES_OPTIONS', } ); - doAction( 'wp-entities-search.on-change-kind.error', error ); + doAction( 'kensaku.on-change-kind.error', error ); } ); }; - const entities: EntitiesSearch.BaseControl< E > = { + const entities: Kensaku.BaseControl< E > = { ...props.entities, value: state.entities, options: orderSelectedOptionsAtTheTop< E >( @@ -129,7 +126,7 @@ export function CompositeEntitiesByKind< E, K >( onChange: onChangeEntities, }; - const kind: EntitiesSearch.BaseControl< K > = { + const kind: Kensaku.BaseControl< K > = { ...props.kind, value: state.kind, onChange: onChangeKind, diff --git a/sources/client/src/components/no-options-message.tsx b/sources/client/src/components/no-options-message.tsx index e596a4f..88530f4 100644 --- a/sources/client/src/components/no-options-message.tsx +++ b/sources/client/src/components/no-options-message.tsx @@ -10,8 +10,8 @@ import { __ } from '@wordpress/i18n'; export function NoOptionsMessage(): JSX.Element { return ( -

- { __( 'No options', 'wp-entities-search' ) } +

+ { __( 'No options', 'kensaku' ) }

); } diff --git a/sources/client/src/components/plural-select-control.tsx b/sources/client/src/components/plural-select-control.tsx index 6d33acb..738a9fc 100644 --- a/sources/client/src/components/plural-select-control.tsx +++ b/sources/client/src/components/plural-select-control.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import EntitiesSearch from '@types'; +import Kensaku from '@types'; import classnames from 'classnames'; import React, { JSX } from 'react'; @@ -12,15 +12,15 @@ import { Set } from '../models/set'; import { NoOptionsMessage } from './no-options-message'; export function PluralSelectControl( - props: EntitiesSearch.BaseControl< EntitiesSearch.Value > & { + props: Kensaku.BaseControl< Kensaku.Value > & { className?: string; } ): JSX.Element { const [ selected, setSelected ] = React.useState( props.value ); const className = classnames( props.className, - 'wes-select-control', - 'wes-select-control--plural' + 'kensaku-select-control', + 'kensaku-select-control--plural' ); const onChange = ( event: React.ChangeEvent< HTMLSelectElement > ) => { @@ -55,7 +55,7 @@ export function PluralSelectControl( { props.options.map( ( option ) => (