Further review feedback.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-06-10 11:05:41 +02:00
parent 2dc4818541
commit effb3b27a4
7 changed files with 35 additions and 48 deletions
+2 -35
View File
@@ -27,7 +27,7 @@ export const AutocompleteFilter: (
// @public (undocumented)
export const CheckboxFilter: (props: SearchFilterComponentProps) => JSX.Element;
// @public
// @public (undocumented)
export const DefaultResultListItem: (
props: DefaultResultListItemProps,
) => JSX.Element;
@@ -168,7 +168,7 @@ export type SearchFilterWrapperProps = SearchFilterComponentProps & {
debug?: boolean;
};
// @public
// @public (undocumented)
export const SearchResult: (props: SearchResultProps) => JSX.Element;
// @public
@@ -187,39 +187,6 @@ export type SearchResultProps = {
// @public (undocumented)
export const SelectFilter: (props: SearchFilterComponentProps) => JSX.Element;
// @public
export const useAsyncFilterValues: (
fn: ((partial: string) => Promise<string[]>) | undefined,
inputValue: string,
defaultValues?: string[],
debounce?: number,
) =>
| {
loading: boolean;
error?: undefined;
value?: undefined;
}
| {
loading: false;
error: Error;
value?: undefined;
}
| {
loading: true;
error?: Error | undefined;
value?: string[] | undefined;
}
| {
loading: boolean;
value: string[];
};
// @public
export const useDefaultFilterValue: (
name: string,
defaultValue?: string | string[] | null | undefined,
) => void;
// @public
export const useSearch: () => SearchContextValue;
@@ -317,8 +317,8 @@ describe('SearchBar', () => {
expect(analyticsApiSpy.getEvents()[0]).toEqual({
action: 'search',
context: {
extension: 'App',
pluginId: 'root',
extension: 'SearchBar',
pluginId: 'search',
routeRef: 'unknown',
searchTypes: 'software-catalog,techdocs',
},
@@ -340,8 +340,8 @@ describe('SearchBar', () => {
expect(analyticsApiSpy.getEvents()[1]).toEqual({
action: 'search',
context: {
extension: 'App',
pluginId: 'root',
extension: 'SearchBar',
pluginId: 'search',
routeRef: 'unknown',
searchTypes: 'software-catalog,techdocs',
},
@@ -31,7 +31,11 @@ import {
import SearchIcon from '@material-ui/icons/Search';
import ClearButton from '@material-ui/icons/Clear';
import { configApiRef, useApi } from '@backstage/core-plugin-api';
import {
AnalyticsContext,
configApiRef,
useApi,
} from '@backstage/core-plugin-api';
import {
SearchContextProvider,
@@ -175,5 +179,11 @@ export const SearchBar = ({ onChange, ...props }: SearchBarProps) => {
[onChange, setTerm],
);
return <SearchBarBase value={term} onChange={handleChange} {...props} />;
return (
<AnalyticsContext
attributes={{ pluginId: 'search', extension: 'SearchBar' }}
>
<SearchBarBase value={term} onChange={handleChange} {...props} />
</AnalyticsContext>
);
};
@@ -16,7 +16,6 @@
export { CheckboxFilter, SearchFilter, SelectFilter } from './SearchFilter';
export { AutocompleteFilter } from './SearchFilter.Autocomplete';
export { useAsyncFilterValues, useDefaultFilterValue } from './hooks';
export type {
SearchFilterComponentProps,
SearchFilterWrapperProps,
+6 -6
View File
@@ -22,13 +22,13 @@ export const DefaultResultListItem: (
props: DefaultResultListItemProps,
) => JSX.Element;
// @public (undocumented)
// @public @deprecated (undocumented)
export type FilterOptions = {
kind: Array<string>;
lifecycle: Array<string>;
};
// @public (undocumented)
// @public @deprecated (undocumented)
export const Filters: ({
filters,
filterOptions,
@@ -37,19 +37,19 @@ export const Filters: ({
updateChecked,
}: FiltersProps) => JSX.Element;
// @public (undocumented)
// @public @deprecated (undocumented)
export const FiltersButton: ({
numberOfSelectedFilters,
handleToggleFilters,
}: FiltersButtonProps) => JSX.Element;
// @public
// @public @deprecated
export type FiltersButtonProps = {
numberOfSelectedFilters: number;
handleToggleFilters: () => void;
};
// @public
// @public @deprecated
export type FiltersProps = {
filters: FiltersState;
filterOptions: FilterOptions;
@@ -58,7 +58,7 @@ export type FiltersProps = {
updateChecked: (filter: string) => void;
};
// @public (undocumented)
// @public @deprecated (undocumented)
export type FiltersState = {
selected: string;
checked: Array<string>;
@@ -46,6 +46,8 @@ const useStyles = makeStyles(theme => ({
/**
* @public
* @deprecated This type and corresponding component will be removed in a
* future release.
*/
export type FiltersState = {
selected: string;
@@ -54,6 +56,8 @@ export type FiltersState = {
/**
* @public
* @deprecated This type and corresponding component will be removed in a
* future release.
*/
export type FilterOptions = {
kind: Array<string>;
@@ -64,6 +68,8 @@ export type FilterOptions = {
* Props for {@link Filters}.
*
* @public
* @deprecated This type and corresponding component will be removed in a
* future release.
*/
export type FiltersProps = {
filters: FiltersState;
@@ -75,6 +81,8 @@ export type FiltersProps = {
/**
* @public
* @deprecated This component will be removed in a future release. Use
* `SearchFilter` from `@backstage/plugin-search-react` instead.
*/
export const Filters = ({
filters,
@@ -32,6 +32,8 @@ const useStyles = makeStyles(theme => ({
* Props for {@link FiltersButton}.
*
* @public
* @deprecated This type and corresponding component will be removed in a
* future release.
*/
export type FiltersButtonProps = {
numberOfSelectedFilters: number;
@@ -40,6 +42,7 @@ export type FiltersButtonProps = {
/**
* @public
* @deprecated See `SearchFilter` in `@backstage/plugin-search-react` instead.
*/
export const FiltersButton = ({
numberOfSelectedFilters,