@backstage/plugin-search-react 1.9.6-next.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a521911: Add support for customizable icons in `SearchResultListItemBlueprint` and related components
8
+
9
+ ### Patch Changes
10
+
11
+ - 05f60e1: Refactored constructor parameter properties to explicit property declarations for compatibility with TypeScript's `erasableSyntaxOnly` setting. This internal refactoring maintains all existing functionality while ensuring TypeScript compilation compatibility.
12
+ - Updated dependencies
13
+ - @backstage/frontend-plugin-api@0.13.0
14
+ - @backstage/core-components@0.18.3
15
+ - @backstage/core-plugin-api@1.12.0
16
+ - @backstage/plugin-search-common@1.2.21
17
+
18
+ ## 1.10.0-next.1
19
+
20
+ ### Minor Changes
21
+
22
+ - a521911: Add support for customizable icons in `SearchResultListItemBlueprint` and related components
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+ - @backstage/core-components@0.18.3-next.1
28
+ - @backstage/core-plugin-api@1.11.2-next.1
29
+ - @backstage/frontend-plugin-api@0.12.2-next.1
30
+
3
31
  ## 1.9.6-next.0
4
32
 
5
33
  ### Patch Changes
@@ -31,7 +31,7 @@ const SearchResultListItemBlueprint = createExtensionBlueprint({
31
31
  rank: props.rank,
32
32
  result: props.result,
33
33
  noTrack: config.noTrack,
34
- children: /* @__PURE__ */ jsx(ExtensionComponent, { ...props })
34
+ children: /* @__PURE__ */ jsx(ExtensionComponent, { icon: params.icon, ...props })
35
35
  }
36
36
  ) })
37
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResultListItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/SearchResultListItemBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lazy } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n SearchResultItemExtensionComponent,\n SearchResultItemExtensionPredicate,\n searchResultListItemDataRef,\n} from './types';\nimport {\n SearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '../../extensions';\n\n/** @alpha */\nexport interface SearchResultListItemBlueprintParams {\n /**\n * The extension component.\n */\n component: (options: {\n config: { noTrack?: boolean };\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n}\n\n/**\n * @alpha\n * Creates SearchResultListItem extensions\n */\nexport const SearchResultListItemBlueprint = createExtensionBlueprint({\n kind: 'search-result-list-item',\n attachTo: {\n id: 'page:search',\n input: 'items',\n },\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n output: [searchResultListItemDataRef],\n dataRefs: {\n item: searchResultListItemDataRef,\n },\n *factory(params: SearchResultListItemBlueprintParams, { config, node }) {\n const ExtensionComponent = lazy(() =>\n params.component({ config }).then(component => ({ default: component })),\n );\n\n yield searchResultListItemDataRef({\n predicate: params.predicate,\n component: (props: SearchResultListItemExtensionProps) => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n });\n },\n});\n"],"names":[],"mappings":";;;;;;AAkDO,MAAM,gCAAgC,wBAAA,CAAyB;AAAA,EACpE,IAAA,EAAM,yBAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,aAAA;AAAA,IACJ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,SAAS,CAAA,CAAA,KAAK,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAQ,KAAK;AAAA;AACzC,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,2BAA2B,CAAA;AAAA,EACpC,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,GACR;AAAA,EACA,CAAC,OAAA,CAAQ,MAAA,EAA6C,EAAE,MAAA,EAAQ,MAAK,EAAG;AACtE,IAAA,MAAM,kBAAA,GAAqB,IAAA;AAAA,MAAK,MAC9B,MAAA,CAAO,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAA,CAAE,IAAA,CAAK,CAAA,SAAA,MAAc,EAAE,OAAA,EAAS,SAAA,EAAU,CAAE;AAAA,KACzE;AAEA,IAAA,MAAM,2BAAA,CAA4B;AAAA,MAChC,WAAW,MAAA,CAAO,SAAA;AAAA,MAClB,SAAA,EAAW,CAAC,KAAA,qBACV,GAAA,CAAC,qBAAkB,IAAA,EACjB,QAAA,kBAAA,GAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,MAAM,KAAA,CAAM,IAAA;AAAA,UACZ,QAAQ,KAAA,CAAM,MAAA;AAAA,UACd,SAAS,MAAA,CAAO,OAAA;AAAA,UAEhB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO;AAAA;AAAA,OACjC,EACF;AAAA,KAEH,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"SearchResultListItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/SearchResultListItemBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lazy, JSX } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n SearchResultItemExtensionComponent,\n SearchResultItemExtensionPredicate,\n searchResultListItemDataRef,\n} from './types';\nimport {\n SearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '../../extensions';\n\n/** @alpha */\nexport interface SearchResultListItemBlueprintParams {\n /**\n * The extension component.\n */\n component: (options: {\n config: { noTrack?: boolean };\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n\n /**\n * The icon of the result item.\n */\n icon?: JSX.Element;\n}\n\n/**\n * @alpha\n * Creates SearchResultListItem extensions\n */\nexport const SearchResultListItemBlueprint = createExtensionBlueprint({\n kind: 'search-result-list-item',\n attachTo: {\n id: 'page:search',\n input: 'items',\n },\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n output: [searchResultListItemDataRef],\n dataRefs: {\n item: searchResultListItemDataRef,\n },\n *factory(params: SearchResultListItemBlueprintParams, { config, node }) {\n const ExtensionComponent = lazy(() =>\n params.component({ config }).then(component => ({ default: component })),\n );\n\n yield searchResultListItemDataRef({\n predicate: params.predicate,\n component: (props: SearchResultListItemExtensionProps) => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent icon={params.icon} {...props} />\n </SearchResultListItemExtension>\n </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alpha/blueprints/types.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ListItemProps } from '@material-ui/core/ListItem';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultListItemDataRef = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>().with({ id: 'search.search-result-list-item.item' });\n\n/** @alpha */\nexport const searchResultTypeDataRef = createExtensionDataRef<{\n value: string;\n name: string;\n icon: JSX.Element;\n}>().with({ id: 'search.filters.result-types.type' });\n\n/** @alpha */\nexport type SearchFilterExtensionComponentProps = {\n className: string;\n};\n\n/** @alpha */\nexport type SearchFilterExtensionComponent = (\n props: SearchFilterExtensionComponentProps,\n) => JSX.Element;\n\n/** @alpha */\nexport const searchFilterDataRef = createExtensionDataRef<{\n component: SearchFilterExtensionComponent;\n}>().with({ id: 'search.filters.filter' });\n"],"names":[],"mappings":";;AAuCO,MAAM,8BAA8B,sBAAA,EAGxC,CAAE,KAAK,EAAE,EAAA,EAAI,uCAAuC;AAGhD,MAAM,0BAA0B,sBAAA,EAIpC,CAAE,KAAK,EAAE,EAAA,EAAI,oCAAoC;AAa7C,MAAM,sBAAsB,sBAAA,EAEhC,CAAE,KAAK,EAAE,EAAA,EAAI,yBAAyB;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../../../src/alpha/blueprints/types.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JSX } from 'react';\nimport { ListItemProps } from '@material-ui/core/ListItem';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n icon?: JSX.Element;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultListItemDataRef = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n icon?: JSX.Element;\n}>().with({ id: 'search.search-result-list-item.item' });\n\n/** @alpha */\nexport const searchResultTypeDataRef = createExtensionDataRef<{\n value: string;\n name: string;\n icon: JSX.Element;\n}>().with({ id: 'search.filters.result-types.type' });\n\n/** @alpha */\nexport type SearchFilterExtensionComponentProps = {\n className: string;\n};\n\n/** @alpha */\nexport type SearchFilterExtensionComponent = (\n props: SearchFilterExtensionComponentProps,\n) => JSX.Element;\n\n/** @alpha */\nexport const searchFilterDataRef = createExtensionDataRef<{\n component: SearchFilterExtensionComponent;\n}>().with({ id: 'search.filters.filter' });\n"],"names":[],"mappings":";;AAyCO,MAAM,8BAA8B,sBAAA,EAIxC,CAAE,KAAK,EAAE,EAAA,EAAI,uCAAuC;AAGhD,MAAM,0BAA0B,sBAAA,EAIpC,CAAE,KAAK,EAAE,EAAA,EAAI,oCAAoC;AAa7C,MAAM,sBAAsB,sBAAA,EAEhC,CAAE,KAAK,EAAE,EAAA,EAAI,yBAAyB;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
+ import * as react from 'react';
3
+ import { JSX as JSX$1 } from 'react';
2
4
  import { ListItemProps } from '@material-ui/core/ListItem';
3
5
  import { SearchDocument, SearchResult } from '@backstage/plugin-search-common';
4
6
  import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
@@ -7,9 +9,10 @@ import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/al
7
9
  type BaseSearchResultListItemProps<T = {}> = T & {
8
10
  rank?: number;
9
11
  result?: SearchDocument;
12
+ icon?: JSX$1.Element;
10
13
  } & Omit<ListItemProps, 'button'>;
11
14
  /** @alpha */
12
- type SearchResultItemExtensionComponent = <P extends BaseSearchResultListItemProps>(props: P) => JSX.Element | null;
15
+ type SearchResultItemExtensionComponent = <P extends BaseSearchResultListItemProps>(props: P) => JSX$1.Element | null;
13
16
  /** @alpha */
14
17
  type SearchResultItemExtensionPredicate = (result: SearchResult) => boolean;
15
18
  /** @alpha */
@@ -17,7 +20,7 @@ type SearchFilterExtensionComponentProps = {
17
20
  className: string;
18
21
  };
19
22
  /** @alpha */
20
- type SearchFilterExtensionComponent = (props: SearchFilterExtensionComponentProps) => JSX.Element;
23
+ type SearchFilterExtensionComponent = (props: SearchFilterExtensionComponentProps) => JSX$1.Element;
21
24
 
22
25
  /** @alpha */
23
26
  interface SearchResultListItemBlueprintParams {
@@ -34,6 +37,10 @@ interface SearchResultListItemBlueprintParams {
34
37
  * Defaults to a predicate that returns true, which means it renders all sorts of results.
35
38
  */
36
39
  predicate?: SearchResultItemExtensionPredicate;
40
+ /**
41
+ * The icon of the result item.
42
+ */
43
+ icon?: JSX$1.Element;
37
44
  }
38
45
  /**
39
46
  * @alpha
@@ -45,6 +52,7 @@ declare const SearchResultListItemBlueprint: _backstage_frontend_plugin_api.Exte
45
52
  output: _backstage_frontend_plugin_api.ExtensionDataRef<{
46
53
  predicate?: SearchResultItemExtensionPredicate;
47
54
  component: SearchResultItemExtensionComponent;
55
+ icon?: JSX$1.Element;
48
56
  }, "search.search-result-list-item.item", {}>;
49
57
  inputs: {};
50
58
  config: {
@@ -57,6 +65,7 @@ declare const SearchResultListItemBlueprint: _backstage_frontend_plugin_api.Exte
57
65
  item: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
58
66
  predicate?: SearchResultItemExtensionPredicate;
59
67
  component: SearchResultItemExtensionComponent;
68
+ icon?: JSX$1.Element;
60
69
  }, "search.search-result-list-item.item", {}>;
61
70
  };
62
71
  }>;
@@ -85,7 +94,7 @@ declare const SearchFilterResultTypeBlueprint: _backstage_frontend_plugin_api.Ex
85
94
  output: _backstage_frontend_plugin_api.ExtensionDataRef<{
86
95
  value: string;
87
96
  name: string;
88
- icon: JSX.Element;
97
+ icon: react.JSX.Element;
89
98
  }, "search.filters.result-types.type", {}>;
90
99
  inputs: {};
91
100
  config: {};
@@ -94,7 +103,7 @@ declare const SearchFilterResultTypeBlueprint: _backstage_frontend_plugin_api.Ex
94
103
  resultType: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
95
104
  value: string;
96
105
  name: string;
97
- icon: JSX.Element;
106
+ icon: react.JSX.Element;
98
107
  }, "search.filters.result-types.type", {}>;
99
108
  };
100
109
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.9.6-next.0",
3
+ "version": "1.10.0",
4
4
  "backstage": {
5
5
  "role": "web-library",
6
6
  "pluginId": "search",
@@ -64,13 +64,13 @@
64
64
  "test": "backstage-cli package test"
65
65
  },
66
66
  "dependencies": {
67
- "@backstage/core-components": "0.18.3-next.0",
68
- "@backstage/core-plugin-api": "1.11.2-next.0",
69
- "@backstage/frontend-plugin-api": "0.12.2-next.0",
70
- "@backstage/plugin-search-common": "1.2.21-next.0",
71
- "@backstage/theme": "0.7.0",
72
- "@backstage/types": "1.2.2",
73
- "@backstage/version-bridge": "1.0.11",
67
+ "@backstage/core-components": "^0.18.3",
68
+ "@backstage/core-plugin-api": "^1.12.0",
69
+ "@backstage/frontend-plugin-api": "^0.13.0",
70
+ "@backstage/plugin-search-common": "^1.2.21",
71
+ "@backstage/theme": "^0.7.0",
72
+ "@backstage/types": "^1.2.2",
73
+ "@backstage/version-bridge": "^1.0.11",
74
74
  "@material-ui/core": "^4.12.2",
75
75
  "@material-ui/icons": "^4.9.1",
76
76
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -80,11 +80,11 @@
80
80
  "uuid": "^11.0.2"
81
81
  },
82
82
  "devDependencies": {
83
- "@backstage/cli": "0.34.5-next.0",
84
- "@backstage/core-app-api": "1.19.2-next.0",
85
- "@backstage/frontend-app-api": "0.13.2-next.0",
86
- "@backstage/frontend-test-utils": "0.4.1-next.0",
87
- "@backstage/test-utils": "1.7.13-next.0",
83
+ "@backstage/cli": "^0.34.5",
84
+ "@backstage/core-app-api": "^1.19.2",
85
+ "@backstage/frontend-app-api": "^0.13.2",
86
+ "@backstage/frontend-test-utils": "^0.4.1",
87
+ "@backstage/test-utils": "^1.7.13",
88
88
  "@testing-library/dom": "^10.0.0",
89
89
  "@testing-library/jest-dom": "^6.0.0",
90
90
  "@testing-library/react": "^16.0.0",