Merge branch 'master' into techdocs/remove-warnings

Signed-off-by: Morgan Bentell <morgan.bentell@gmail.com>
This commit is contained in:
Morgan Bentell
2023-03-16 16:18:32 +01:00
committed by GitHub
1099 changed files with 36089 additions and 25992 deletions
+36
View File
@@ -1,5 +1,41 @@
# @backstage/plugin-search-react
## 1.5.1
### Patch Changes
- 65454876fb2: Minor API report tweaks
- 553f3c95011: Correctly disable next button in `SearchPagination` on last page
- Updated dependencies
- @backstage/core-components@0.12.5
- @backstage/core-plugin-api@1.5.0
- @backstage/theme@0.2.18
- @backstage/types@1.0.2
- @backstage/version-bridge@1.0.3
- @backstage/plugin-search-common@1.2.2
## 1.5.1-next.2
### Patch Changes
- 65454876fb2: Minor API report tweaks
- 553f3c95011: Correctly disable next button in `SearchPagination` on last page
- Updated dependencies
- @backstage/core-components@0.12.5-next.2
- @backstage/core-plugin-api@1.5.0-next.2
## 1.5.1-next.1
### Patch Changes
- Updated dependencies
- @backstage/core-components@0.12.5-next.1
- @backstage/core-plugin-api@1.4.1-next.1
- @backstage/theme@0.2.18-next.0
- @backstage/types@1.0.2
- @backstage/version-bridge@1.0.3
- @backstage/plugin-search-common@1.2.2-next.0
## 1.5.1-next.0
### Patch Changes
+13 -15
View File
@@ -60,11 +60,9 @@ export type DefaultResultListItemProps = {
};
// @public (undocumented)
export const HighlightedSearchResultText: ({
text,
preTag,
postTag,
}: HighlightedSearchResultTextProps) => JSX.Element;
export const HighlightedSearchResultText: (
props: HighlightedSearchResultTextProps,
) => JSX.Element;
// @public
export type HighlightedSearchResultTextProps = {
@@ -100,14 +98,9 @@ export type SearchAutocompleteComponent = <Option>(
) => JSX.Element;
// @public
export const SearchAutocompleteDefaultOption: ({
icon,
primaryText,
primaryTextTypographyProps,
secondaryText,
secondaryTextTypographyProps,
disableTextTypography,
}: SearchAutocompleteDefaultOptionProps) => JSX.Element;
export const SearchAutocompleteDefaultOption: (
props: SearchAutocompleteDefaultOptionProps,
) => JSX.Element;
// @public
export type SearchAutocompleteDefaultOptionProps = {
@@ -193,7 +186,7 @@ export type SearchContextValue = {
// @public (undocumented)
export const SearchFilter: {
({ component: Element, ...props }: SearchFilterWrapperProps): JSX.Element;
(props: SearchFilterWrapperProps): JSX.Element;
Checkbox(
props: Omit<SearchFilterWrapperProps, 'component'> &
SearchFilterComponentProps,
@@ -234,6 +227,7 @@ export type SearchPaginationBaseProps = {
className?: string;
total?: number;
cursor?: string;
hasNextPage?: boolean;
onCursorChange?: (pageCursor: string) => void;
limit?: number;
limitLabel?: ReactNode;
@@ -264,7 +258,11 @@ export type SearchPaginationLimitText = (params: {
// @public
export type SearchPaginationProps = Omit<
SearchPaginationBaseProps,
'pageLimit' | 'onPageLimitChange' | 'pageCursor' | 'onPageCursorChange'
| 'pageLimit'
| 'onPageLimitChange'
| 'pageCursor'
| 'onPageCursorChange'
| 'hasNextPage'
>;
// @public
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-search-react",
"version": "1.5.1-next.0",
"version": "1.5.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -38,16 +38,17 @@ export type HighlightedSearchResultTextProps = {
/**
* @public
*/
export const HighlightedSearchResultText = ({
text,
preTag,
postTag,
}: HighlightedSearchResultTextProps) => {
export const HighlightedSearchResultText = (
props: HighlightedSearchResultTextProps,
) => {
const { text, preTag, postTag } = props;
const classes = useStyles();
const terms = useMemo(
() => text.split(new RegExp(`(${preTag}.+?${postTag})`)),
[postTag, preTag, text],
);
return (
<>
{terms.map((t, idx) =>
@@ -40,22 +40,28 @@ export type SearchAutocompleteDefaultOptionProps = {
*
* @public
*/
export const SearchAutocompleteDefaultOption = ({
icon,
primaryText,
primaryTextTypographyProps,
secondaryText,
secondaryTextTypographyProps,
disableTextTypography,
}: SearchAutocompleteDefaultOptionProps) => (
<>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText
primary={primaryText}
primaryTypographyProps={primaryTextTypographyProps}
secondary={secondaryText}
secondaryTypographyProps={secondaryTextTypographyProps}
disableTypography={disableTextTypography}
/>
</>
);
export const SearchAutocompleteDefaultOption = (
props: SearchAutocompleteDefaultOptionProps,
) => {
const {
icon,
primaryText,
primaryTextTypographyProps,
secondaryText,
secondaryTextTypographyProps,
disableTextTypography,
} = props;
return (
<>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText
primary={primaryText}
primaryTypographyProps={primaryTextTypographyProps}
secondary={secondaryText}
secondaryTypographyProps={secondaryTextTypographyProps}
disableTypography={disableTextTypography}
/>
</>
);
};
@@ -208,10 +208,10 @@ export const SelectFilter = (props: SearchFilterComponentProps) => {
/**
* @public
*/
const SearchFilter = ({
component: Element,
...props
}: SearchFilterWrapperProps) => <Element {...props} />;
const SearchFilter = (props: SearchFilterWrapperProps) => {
const { component: Element, ...elementProps } = props;
return <Element {...elementProps} />;
};
SearchFilter.Checkbox = (
props: Omit<SearchFilterWrapperProps, 'component'> &
@@ -77,6 +77,10 @@ export type SearchPaginationBaseProps = {
* The cursor for the current page.
*/
cursor?: string;
/**
* Whether a next page exists
*/
hasNextPage?: boolean;
/**
* Callback fired when the current page cursor is changed.
*/
@@ -118,6 +122,7 @@ export const SearchPaginationBase = (props: SearchPaginationBaseProps) => {
const {
total: count = -1,
cursor: pageCursor,
hasNextPage,
onCursorChange: onPageCursorChange,
limit: rowsPerPage = 25,
limitLabel: labelRowsPerPage = 'Results per page:',
@@ -151,6 +156,9 @@ export const SearchPaginationBase = (props: SearchPaginationBaseProps) => {
component="div"
count={count}
page={page}
nextIconButtonProps={{
...(hasNextPage !== undefined && { disabled: !hasNextPage }),
}}
onPageChange={handlePageChange}
rowsPerPage={rowsPerPage}
labelRowsPerPage={labelRowsPerPage}
@@ -167,7 +175,11 @@ export const SearchPaginationBase = (props: SearchPaginationBaseProps) => {
*/
export type SearchPaginationProps = Omit<
SearchPaginationBaseProps,
'pageLimit' | 'onPageLimitChange' | 'pageCursor' | 'onPageCursorChange'
| 'pageLimit'
| 'onPageLimitChange'
| 'pageCursor'
| 'onPageCursorChange'
| 'hasNextPage'
>;
/**
@@ -176,11 +188,13 @@ export type SearchPaginationProps = Omit<
* @public
*/
export const SearchPagination = (props: SearchPaginationProps) => {
const { pageLimit, setPageLimit, pageCursor, setPageCursor } = useSearch();
const { pageLimit, setPageLimit, pageCursor, setPageCursor, fetchNextPage } =
useSearch();
return (
<SearchPaginationBase
{...props}
hasNextPage={!!fetchNextPage}
limit={pageLimit}
onLimitChange={setPageLimit}
cursor={pageCursor}