diff --git a/.changeset/rude-bees-rest.md b/.changeset/rude-bees-rest.md index 793b130b35..7ca4e7492c 100644 --- a/.changeset/rude-bees-rest.md +++ b/.changeset/rude-bees-rest.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-search-react': patch +'@backstage/plugin-search-react': minor --- New search package to hold things the search plugin itself and other frontend plugins (e.g. techdocs, home) depend on. diff --git a/plugins/home/api-report.md b/plugins/home/api-report.md index 21c5592636..a65f8cda5c 100644 --- a/plugins/home/api-report.md +++ b/plugins/home/api-report.md @@ -119,12 +119,13 @@ export const SettingsModal: (props: { children: JSX.Element; }) => JSX.Element; +// Warning: (ae-forgotten-export) The symbol "TemplateBackstageLogoProps" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "TemplateBackstageLogo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const TemplateBackstageLogo: (props: { - classes: Classes; -}) => JSX.Element; +export const TemplateBackstageLogo: ( + props: TemplateBackstageLogoProps, +) => JSX.Element; // Warning: (ae-missing-release-tag) "TemplateBackstageLogoIcon" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -136,7 +137,6 @@ export const WelcomeTitle: () => JSX.Element; // Warnings were encountered during analysis: // -// src/assets/TemplateBackstageLogo.d.ts:7:5 - (ae-forgotten-export) The symbol "Classes" needs to be exported by the entry point index.d.ts // src/extensions.d.ts:6:5 - (ae-forgotten-export) The symbol "RendererProps" needs to be exported by the entry point index.d.ts // src/extensions.d.ts:27:5 - (ae-forgotten-export) The symbol "ComponentParts" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/home/src/assets/TemplateBackstageLogo.tsx b/plugins/home/src/assets/TemplateBackstageLogo.tsx index 0fc908ee39..9088cfa58c 100644 --- a/plugins/home/src/assets/TemplateBackstageLogo.tsx +++ b/plugins/home/src/assets/TemplateBackstageLogo.tsx @@ -21,7 +21,11 @@ type Classes = { path: string; }; -export const TemplateBackstageLogo = (props: { classes: Classes }) => { +type TemplateBackstageLogoProps = { + classes: Classes; +}; + +export const TemplateBackstageLogo = (props: TemplateBackstageLogoProps) => { return ( ; -// Warning: (ae-forgotten-export) The symbol "SearchContextValue" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const SearchContext: React_2.Context; - // @public (undocumented) export const SearchContextProvider: ({ initialState, @@ -49,7 +44,7 @@ export const SearchContextProviderForStorybook: ( props: ComponentProps & QueryResultProps, ) => JSX.Element; -// @public +// @public (undocumented) export type SearchContextState = { term: string; types: string[]; @@ -57,6 +52,8 @@ export type SearchContextState = { pageCursor?: string; }; +// Warning: (ae-forgotten-export) The symbol "SearchContextValue" needs to be exported by the entry point index.d.ts +// // @public (undocumented) export const useSearch: () => SearchContextValue; diff --git a/plugins/search-react/package.json b/plugins/search-react/package.json index 15251b4ac7..151660943e 100644 --- a/plugins/search-react/package.json +++ b/plugins/search-react/package.json @@ -44,8 +44,8 @@ "devDependencies": { "@backstage/test-utils": "^1.0.1-next.1", "@testing-library/react": "^12.1.3", - "@testing-library/react-hooks": "^8.0.0", - "@testing-library/jest-dom": "^5.16.4" + "@testing-library/react-hooks": "^7.0.2", + "@testing-library/jest-dom": "^5.10.1" }, "files": [ "dist" diff --git a/plugins/search-react/src/context/SearchContext.tsx b/plugins/search-react/src/context/SearchContext.tsx index 217c94cca2..d6245d5ccf 100644 --- a/plugins/search-react/src/context/SearchContext.tsx +++ b/plugins/search-react/src/context/SearchContext.tsx @@ -40,7 +40,6 @@ type SearchContextValue = { } & SearchContextState; /** - * The initial state of `SearchContextProvider`. * * @public */ @@ -58,6 +57,10 @@ export const SearchContext = createContext( undefined, ); +/** + * The initial state of `SearchContextProvider`. + * + */ const searchInitialState: SearchContextState = { term: '', pageCursor: undefined, diff --git a/plugins/search-react/src/index.ts b/plugins/search-react/src/index.ts index 498e4d6ce3..934cf2e9f1 100644 --- a/plugins/search-react/src/index.ts +++ b/plugins/search-react/src/index.ts @@ -14,5 +14,12 @@ * limitations under the License. */ -export * from './api'; -export * from './context'; +export { searchApiRef } from './api'; +export type { SearchApi } from './api'; +export { + SearchContextProvider, + useSearch, + SearchContextProviderForStorybook, + SearchApiProviderForStorybook, +} from './context'; +export type { SearchContextState } from './context'; diff --git a/plugins/search/api-report.md b/plugins/search/api-report.md index f524652f51..d85158c925 100644 --- a/plugins/search/api-report.md +++ b/plugins/search/api-report.md @@ -81,7 +81,6 @@ export type HomePageSearchBarProps = Partial< // @public (undocumented) export const Router: () => JSX.Element; -// Warning: (tsdoc-at-sign-in-word) The "@" character looks like part of a TSDoc tag; use a backslash to escape it // Warning: (ae-missing-release-tag) "SearchApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) @@ -90,7 +89,6 @@ export interface SearchApi { query(query: SearchQuery): Promise; } -// Warning: (tsdoc-at-sign-in-word) The "@" character looks like part of a TSDoc tag; use a backslash to escape it // Warning: (ae-missing-release-tag) "searchApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) @@ -140,7 +138,6 @@ export const SearchBarNext: ({ // @public export type SearchBarProps = Partial; -// Warning: (tsdoc-at-sign-in-word) The "@" character looks like part of a TSDoc tag; use a backslash to escape it // Warning: (ae-missing-release-tag) "SearchContextProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) diff --git a/plugins/search/src/apis.ts b/plugins/search/src/apis.ts index 62f65dbe4a..096b11bb5e 100644 --- a/plugins/search/src/apis.ts +++ b/plugins/search/src/apis.ts @@ -25,14 +25,14 @@ import { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common'; import qs from 'qs'; /** - * @deprecated import from "@backstage/plugin-search-react" instead + * @deprecated import from `@backstage/plugin-search-react` instead */ export const searchApiRef = createApiRef({ id: 'plugin.search.queryservice', }); /** - * @deprecated import from "@backstage/plugin-search-react" instead + * @deprecated import from `@backstage/plugin-search-react` instead */ export interface SearchApi { query(query: SearchQuery): Promise; diff --git a/plugins/search/src/components/SearchContext/SearchContext.tsx b/plugins/search/src/components/SearchContext/SearchContext.tsx index d52e43af88..c87295ab99 100644 --- a/plugins/search/src/components/SearchContext/SearchContext.tsx +++ b/plugins/search/src/components/SearchContext/SearchContext.tsx @@ -52,7 +52,7 @@ export type SearchContextState = { }; /** - * @deprecated import from "@backstage/plugin-search-react" instead + * @deprecated import from `@backstage/plugin-search-react` instead */ export const SearchContext = createContext( undefined, @@ -66,7 +66,7 @@ const searchInitialState: SearchContextState = { }; /** - * @deprecated import from "@backstage/plugin-search-react" instead + * @deprecated import from `@backstage/plugin-search-react` instead */ export const SearchContextProvider = ({ initialState = searchInitialState, diff --git a/yarn.lock b/yarn.lock index 223c451347..076b9f222a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5560,21 +5560,6 @@ lodash "^4.17.15" redent "^3.0.0" -"@testing-library/jest-dom@^5.16.4": - version "5.16.4" - resolved "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.4.tgz#938302d7b8b483963a3ae821f1c0808f872245cd" - integrity sha512-Gy+IoFutbMQcky0k+bqqumXZ1cTGswLsFqmNLzNdSKkU9KGV2u9oXhukCbbJ9/LRPKiqwxEE8VpV/+YZlfkPUA== - dependencies: - "@babel/runtime" "^7.9.2" - "@types/testing-library__jest-dom" "^5.9.1" - aria-query "^5.0.0" - chalk "^3.0.0" - css "^3.0.0" - css.escape "^1.5.1" - dom-accessibility-api "^0.5.6" - lodash "^4.17.15" - redent "^3.0.0" - "@testing-library/react-hooks@^7.0.2": version "7.0.2" resolved "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-7.0.2.tgz#3388d07f562d91e7f2431a4a21b5186062ecfee0" @@ -5586,14 +5571,6 @@ "@types/react-test-renderer" ">=16.9.0" react-error-boundary "^3.1.0" -"@testing-library/react-hooks@^8.0.0": - version "8.0.0" - resolved "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-8.0.0.tgz#7d0164bffce4647f506039de0a97f6fcbd20f4bf" - integrity sha512-uZqcgtcUUtw7Z9N32W13qQhVAD+Xki2hxbTR461MKax8T6Jr8nsUvZB+vcBTkzY2nFvsUet434CsgF0ncW2yFw== - dependencies: - "@babel/runtime" "^7.12.5" - react-error-boundary "^3.1.0" - "@testing-library/react@^12.1.3": version "12.1.4" resolved "https://registry.npmjs.org/@testing-library/react/-/react-12.1.4.tgz#09674b117e550af713db3f4ec4c0942aa8bbf2c0"