@backstage/plugin-search-react 1.7.14-next.3 → 1.8.0-next.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,42 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
+ ## 1.8.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9d66d8c: Make use of the `useApp` hook to retrieve the specified search icon in the SearchBar
8
+
9
+ ### Patch Changes
10
+
11
+ - fec8b57: Updated exports to use the new type parameters for extensions and extension blueprints.
12
+ - f26ff99: Slight type tweak to match newer React versions better
13
+ - 5446061: The `/alpha` export no longer export extension creators for the new frontend system, existing usage should be switched to use the equivalent extension blueprint instead. For more information see the [new frontend system 1.30 migration documentation](https://backstage.io/docs/frontend-system/architecture/migrations#130).
14
+ - Updated dependencies
15
+ - @backstage/frontend-plugin-api@0.8.0-next.0
16
+ - @backstage/core-components@0.14.10
17
+ - @backstage/core-plugin-api@1.9.3
18
+ - @backstage/theme@0.5.6
19
+ - @backstage/types@1.1.1
20
+ - @backstage/version-bridge@1.0.8
21
+ - @backstage/plugin-search-common@1.2.14
22
+
23
+ ## 1.7.14
24
+
25
+ ### Patch Changes
26
+
27
+ - 7bd27e1: Deprecate the old pattern of `create*Extension`, and replace it with the equivalent Blueprint implementation instead.
28
+ - 31bfc44: Updated alpha definitions of extension data references.
29
+ - 3123c16: Fix package metadata
30
+ - 6349099: Added config input type to the extensions
31
+ - Updated dependencies
32
+ - @backstage/frontend-plugin-api@0.7.0
33
+ - @backstage/core-components@0.14.10
34
+ - @backstage/plugin-search-common@1.2.14
35
+ - @backstage/core-plugin-api@1.9.3
36
+ - @backstage/theme@0.5.6
37
+ - @backstage/types@1.1.1
38
+ - @backstage/version-bridge@1.0.8
39
+
3
40
  ## 1.7.14-next.3
4
41
 
5
42
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react__alpha",
3
- "version": "1.7.14-next.3",
3
+ "version": "1.8.0-next.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -0,0 +1,41 @@
1
+ import React, { lazy } from 'react';
2
+ import { createExtensionBlueprint, ExtensionBoundary } from '@backstage/frontend-plugin-api';
3
+ import { searchResultListItemDataRef } from './types.esm.js';
4
+ import { SearchResultListItemExtension } from '../../extensions.esm.js';
5
+
6
+ const SearchResultListItemBlueprint = createExtensionBlueprint({
7
+ kind: "search-result-list-item",
8
+ attachTo: {
9
+ id: "page:search",
10
+ input: "items"
11
+ },
12
+ config: {
13
+ schema: {
14
+ noTrack: (z) => z.boolean().default(false)
15
+ }
16
+ },
17
+ output: [searchResultListItemDataRef],
18
+ dataRefs: {
19
+ item: searchResultListItemDataRef
20
+ },
21
+ *factory(params, { config, node }) {
22
+ const ExtensionComponent = lazy(
23
+ () => params.component({ config }).then((component) => ({ default: component }))
24
+ );
25
+ yield searchResultListItemDataRef({
26
+ predicate: params.predicate,
27
+ component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(
28
+ SearchResultListItemExtension,
29
+ {
30
+ rank: props.rank,
31
+ result: props.result,
32
+ noTrack: config.noTrack
33
+ },
34
+ /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props })
35
+ ))
36
+ });
37
+ }
38
+ });
39
+
40
+ export { SearchResultListItemBlueprint };
41
+ //# sourceMappingURL=SearchResultListItemBlueprint.esm.js.map
@@ -0,0 +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 React, { 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,wBAAyB,CAAA;AAAA,EACpE,IAAM,EAAA,yBAAA;AAAA,EACN,QAAU,EAAA;AAAA,IACR,EAAI,EAAA,aAAA;AAAA,IACJ,KAAO,EAAA,OAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,CAAK,CAAA,KAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,KACzC;AAAA,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,2BAA2B,CAAA;AAAA,EACpC,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,2BAAA;AAAA,GACR;AAAA,EACA,CAAC,OAAQ,CAAA,MAAA,EAA6C,EAAE,MAAA,EAAQ,MAAQ,EAAA;AACtE,IAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,MAAK,MAC9B,MAAA,CAAO,SAAU,CAAA,EAAE,MAAO,EAAC,CAAE,CAAA,IAAA,CAAK,CAAc,SAAA,MAAA,EAAE,OAAS,EAAA,SAAA,EAAY,CAAA,CAAA;AAAA,KACzE,CAAA;AAEA,IAAA,MAAM,2BAA4B,CAAA;AAAA,MAChC,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB,SAAW,EAAA,CAAC,KACV,qBAAA,KAAA,CAAA,aAAA,CAAC,qBAAkB,IACjB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,MAAM,KAAM,CAAA,IAAA;AAAA,UACZ,QAAQ,KAAM,CAAA,MAAA;AAAA,UACd,SAAS,MAAO,CAAA,OAAA;AAAA,SAAA;AAAA,wBAEhB,KAAA,CAAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,OAEnC,CAAA;AAAA,KAEH,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
@@ -0,0 +1,6 @@
1
+ import { createExtensionDataRef } from '@backstage/frontend-plugin-api';
2
+
3
+ const searchResultListItemDataRef = createExtensionDataRef().with({ id: "search.search-result-list-item.item" });
4
+
5
+ export { searchResultListItemDataRef };
6
+ //# sourceMappingURL=types.esm.js.map
@@ -0,0 +1 @@
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 { 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\nexport const searchResultListItemDataRef = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>().with({ id: 'search.search-result-list-item.item' });\n"],"names":[],"mappings":";;AAsCO,MAAM,8BAA8B,sBAGxC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,uCAAuC;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
3
- import { PortableSchema } from '@backstage/frontend-plugin-api';
4
3
  import { ListItemProps } from '@material-ui/core/ListItem';
5
4
  import { SearchDocument, SearchResult } from '@backstage/plugin-search-common';
6
5
 
@@ -13,51 +12,49 @@ type BaseSearchResultListItemProps<T = {}> = T & {
13
12
  type SearchResultItemExtensionComponent = <P extends BaseSearchResultListItemProps>(props: P) => JSX.Element | null;
14
13
  /** @alpha */
15
14
  type SearchResultItemExtensionPredicate = (result: SearchResult) => boolean;
15
+
16
16
  /** @alpha */
17
- type SearchResultItemExtensionOptions<TConfig extends {
18
- noTrack?: boolean;
19
- }> = {
20
- /**
21
- * The extension namespace.
22
- */
23
- namespace?: string;
24
- /**
25
- * The extension name.
26
- */
27
- name?: string;
28
- /**
29
- * The extension attachment point (e.g., search modal or page).
30
- */
31
- attachTo?: {
32
- id: string;
33
- input: string;
34
- };
35
- /**
36
- * Optional extension config schema.
37
- */
38
- configSchema?: PortableSchema<TConfig>;
17
+ interface SearchResultListItemBlueprintParams {
39
18
  /**
40
19
  * The extension component.
41
20
  */
42
21
  component: (options: {
43
- config: TConfig;
22
+ config: {
23
+ noTrack?: boolean;
24
+ };
44
25
  }) => Promise<SearchResultItemExtensionComponent>;
45
26
  /**
46
27
  * When an extension defines a predicate, it returns true if the result should be rendered by that extension.
47
28
  * Defaults to a predicate that returns true, which means it renders all sorts of results.
48
29
  */
49
30
  predicate?: SearchResultItemExtensionPredicate;
50
- };
51
- /** @alpha */
52
- declare function createSearchResultListItemExtension<TConfig extends {
53
- noTrack?: boolean;
54
- }>(options: SearchResultItemExtensionOptions<TConfig>): _backstage_frontend_plugin_api.ExtensionDefinition<TConfig, TConfig, never, never, string | undefined, string | undefined, string | undefined>;
55
- /** @alpha */
56
- declare namespace createSearchResultListItemExtension {
57
- const itemDataRef: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
31
+ }
32
+ /**
33
+ * @alpha
34
+ * Creates SearchResultListItem extensions
35
+ */
36
+ declare const SearchResultListItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
37
+ kind: "search-result-list-item";
38
+ namespace: undefined;
39
+ name: undefined;
40
+ params: SearchResultListItemBlueprintParams;
41
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
58
42
  predicate?: SearchResultItemExtensionPredicate | undefined;
59
43
  component: SearchResultItemExtensionComponent;
60
44
  }, "search.search-result-list-item.item", {}>;
61
- }
45
+ inputs: {};
46
+ config: {
47
+ noTrack: boolean;
48
+ };
49
+ configInput: {
50
+ noTrack?: boolean | undefined;
51
+ };
52
+ dataRefs: {
53
+ item: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
54
+ predicate?: SearchResultItemExtensionPredicate | undefined;
55
+ component: SearchResultItemExtensionComponent;
56
+ }, "search.search-result-list-item.item", {}>;
57
+ };
58
+ }>;
62
59
 
63
- export { type BaseSearchResultListItemProps, type SearchResultItemExtensionComponent, type SearchResultItemExtensionOptions, type SearchResultItemExtensionPredicate, createSearchResultListItemExtension };
60
+ export { type BaseSearchResultListItemProps, type SearchResultItemExtensionComponent, type SearchResultItemExtensionPredicate, SearchResultListItemBlueprint, type SearchResultListItemBlueprintParams };
package/dist/alpha.esm.js CHANGED
@@ -1,49 +1,2 @@
1
- import React, { lazy } from 'react';
2
- import { createExtensionDataRef, createSchemaFromZod, createExtension, ExtensionBoundary } from '@backstage/frontend-plugin-api';
3
- import { SearchResultListItemExtension } from './extensions.esm.js';
4
-
5
- function createSearchResultListItemExtension(options) {
6
- const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
7
- (z) => z.object({
8
- noTrack: z.boolean().default(false)
9
- })
10
- );
11
- return createExtension({
12
- kind: "search-result-list-item",
13
- namespace: options.namespace,
14
- name: options.name,
15
- attachTo: options.attachTo ?? {
16
- id: "page:search",
17
- input: "items"
18
- },
19
- configSchema,
20
- output: {
21
- item: createSearchResultListItemExtension.itemDataRef
22
- },
23
- factory({ config, node }) {
24
- const ExtensionComponent = lazy(
25
- () => options.component({ config }).then((component) => ({ default: component }))
26
- );
27
- return {
28
- item: {
29
- predicate: options.predicate,
30
- component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(
31
- SearchResultListItemExtension,
32
- {
33
- rank: props.rank,
34
- result: props.result,
35
- noTrack: config.noTrack
36
- },
37
- /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props })
38
- ))
39
- }
40
- };
41
- }
42
- });
43
- }
44
- ((createSearchResultListItemExtension2) => {
45
- createSearchResultListItemExtension2.itemDataRef = createExtensionDataRef().with({ id: "search.search-result-list-item.item" });
46
- })(createSearchResultListItemExtension || (createSearchResultListItemExtension = {}));
47
-
48
- export { createSearchResultListItemExtension };
1
+ export { SearchResultListItemBlueprint } from './alpha/blueprints/SearchResultListItemBlueprint.esm.js';
49
2
  //# sourceMappingURL=alpha.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 React, { lazy } from 'react';\n\nimport { ListItemProps } from '@material-ui/core/ListItem';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\n\nimport { SearchResultListItemExtension } from './extensions';\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 type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension namespace.\n */\n namespace?: string;\n /**\n * The extension name.\n */\n name?: string;\n /**\n * The extension attachment point (e.g., search modal or page).\n */\n attachTo?: { id: string; input: string };\n /**\n * Optional extension config schema.\n */\n configSchema?: PortableSchema<TConfig>;\n /**\n * The extension component.\n */\n component: (options: {\n config: TConfig;\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/** @alpha */\nexport function createSearchResultListItemExtension<\n TConfig extends { noTrack?: boolean },\n>(options: SearchResultItemExtensionOptions<TConfig>) {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n noTrack: z.boolean().default(false),\n }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n kind: 'search-result-list-item',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? {\n id: 'page:search',\n input: 'items',\n },\n configSchema,\n output: {\n item: createSearchResultListItemExtension.itemDataRef,\n },\n factory({ config, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n return {\n item: {\n predicate: options.predicate,\n component: props => (\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 });\n}\n\n/** @alpha */\nexport namespace createSearchResultListItemExtension {\n export const itemDataRef = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n }>().with({ id: 'search.search-result-list-item.item' });\n}\n"],"names":["createSearchResultListItemExtension"],"mappings":";;;;AAmFO,SAAS,oCAEd,OAAo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AAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,WAEnC,CAAA;AAAA,SAEJ;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,oCAAV,KAAA;AACE,EAAMA,oCAAAA,CAAA,cAAc,sBAGxB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,uCAAuC,CAAA,CAAA;AAAA,CAJxC,EAAA,mCAAA,KAAA,mCAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,9 +1,9 @@
1
- import { useApi, configApiRef, AnalyticsContext } from '@backstage/core-plugin-api';
1
+ import { useApi, configApiRef, useApp, AnalyticsContext } from '@backstage/core-plugin-api';
2
2
  import IconButton from '@material-ui/core/IconButton';
3
3
  import InputAdornment from '@material-ui/core/InputAdornment';
4
4
  import TextField from '@material-ui/core/TextField';
5
5
  import Button from '@material-ui/core/Button';
6
- import SearchIcon from '@material-ui/icons/Search';
6
+ import DefaultSearchIcon from '@material-ui/icons/Search';
7
7
  import React, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
8
8
  import useDebounce from 'react-use/esm/useDebounce';
9
9
  import { useSearch, SearchContextProvider } from '../../context/SearchContext.esm.js';
@@ -76,6 +76,7 @@ const SearchBarBase = withContext(
76
76
  }, [onChange, onClear]);
77
77
  const ariaLabel = label ? void 0 : "Search";
78
78
  const inputPlaceholder = placeholder ?? `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
79
+ const SearchIcon = useApp().getSystemIcon("search") || DefaultSearchIcon;
79
80
  const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Query", size: "small", disabled: true }, /* @__PURE__ */ React.createElement(SearchIcon, null)));
80
81
  const clearButtonEndAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
81
82
  Button,
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport SearchIcon from '@material-ui/icons/Search';\nimport React, {\n ChangeEvent,\n ComponentType,\n forwardRef,\n ForwardRefExoticComponent,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\n\nimport { SearchContextProvider, useSearch } from '../../context';\n\nfunction withContext<T>(Component: ComponentType<T>) {\n return forwardRef<HTMLDivElement, T>((props, ref) => (\n <SearchContextProvider inheritParentContextIfAvailable>\n <Component {...props} ref={ref} />\n </SearchContextProvider>\n ));\n}\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: React.ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase: ForwardRefExoticComponent<SearchBarBaseProps> =\n withContext(\n forwardRef((props, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n );\n }),\n );\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar: ForwardRefExoticComponent<SearchBarProps> = withContext(\n forwardRef((props, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n );\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,SAAS,YAAe,SAA6B,EAAA;AACnD,EAAA,OAAO,UAA8B,CAAA,CAAC,KAAO,EAAA,GAAA,yCAC1C,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,KAAO,EAAA,GAAA,EAAU,CAClC,CACD,CAAA,CAAA;AACH,CAAA;AAuBO,MAAM,aACX,G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,OAAQ,EAAA,GAAI,SAAU,EAAA,CAAA;AAEpC,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,YAAc,EAAA;AAChB,QAAQ,OAAA,CAAA,MAAA,CAAO,YAAY,CAAC,CAAA,CAAA;AAAA,OAC9B;AAAA,KACC,EAAA,CAAC,YAAc,EAAA,OAAO,CAAC,CAAA,CAAA;AAE1B,IAAA,MAAM,YAAe,GAAA,WAAA;AAAA,MACnB,CAAC,QAAqB,KAAA;AACpB,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,QAAA,CAAS,QAAQ,CAAA,CAAA;AAAA,SACZ,MAAA;AACL,UAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAAA,SAClB;AAAA,OACF;AAAA,MACA,CAAC,UAAU,OAAO,CAAA;AAAA,KACpB,CAAA;AAEA,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAY,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,WAAW,WAAY,EAAA;AAAA,OAAA;AAAA,sBAEzD,KAAA,CAAA,aAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACE,GAAG,IAAA;AAAA,UACJ,GAAA;AAAA,UACA,KAAO,EAAA,IAAA;AAAA,UACP,QAAU,EAAA,YAAA;AAAA,SAAA;AAAA,OACZ;AAAA,KACF,CAAA;AAAA,GAEH,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n useApp,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport DefaultSearchIcon from '@material-ui/icons/Search';\nimport React, {\n ChangeEvent,\n ComponentType,\n forwardRef,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\n\nimport { SearchContextProvider, useSearch } from '../../context';\n\nfunction withContext<T>(Component: ComponentType<T>) {\n return forwardRef<HTMLDivElement, T>((props, ref) => (\n <SearchContextProvider inheritParentContextIfAvailable>\n <Component {...props} ref={ref} />\n </SearchContextProvider>\n ));\n}\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: React.ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase = withContext(\n forwardRef<HTMLDivElement, SearchBarBaseProps>((props, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n );\n }),\n);\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar = withContext(\n forwardRef<HTMLDivElement, SearchBarProps>((props, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n );\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,SAAS,YAAe,SAA6B,EAAA;AACnD,EAAA,OAAO,UAA8B,CAAA,CAAC,KAAO,EAAA,GAAA,yCAC1C,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,KAAO,EAAA,GAAA,EAAU,CAClC,CACD,CAAA,CAAA;AACH,CAAA;AAuBO,MAAM,aAAgB,GAAA,WAAA;AAAA,EAC3B,UAAA,CAA+C,CAAC,KAAA,EAAO,GAAQ,KAAA;AAC7D,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,YAAY,MAAM;AAAA,OAAC;AAAA,MACnB,UAAU,MAAM;AAAA,OAAC;AAAA,MACjB,WAAW,MAAM;AAAA,OAAC;AAAA,MAClB,YAAe,GAAA,GAAA;AAAA,MACf,WAAc,GAAA,IAAA;AAAA,MACd,SAAY,GAAA,IAAA;AAAA,MACZ,KAAO,EAAA,YAAA;AAAA,MACP,KAAA;AAAA,MACA,WAAA;AAAA,MACA,aA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B,CAAC,QAAqB,KAAA;AACpB,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,QAAA,CAAS,QAAQ,CAAA,CAAA;AAAA,SACZ,MAAA;AACL,UAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAAA,SAClB;AAAA,OACF;AAAA,MACA,CAAC,UAAU,OAAO,CAAA;AAAA,KACpB,CAAA;AAEA,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAY,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,WAAW,WAAY,EAAA;AAAA,OAAA;AAAA,sBAEzD,KAAA,CAAA,aAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACE,GAAG,IAAA;AAAA,UACJ,GAAA;AAAA,UACA,KAAO,EAAA,IAAA;AAAA,UACP,QAAU,EAAA,YAAA;AAAA,SAAA;AAAA,OACZ;AAAA,KACF,CAAA;AAAA,GAEH,CAAA;AACH;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { Extension } from '@backstage/core-plugin-api';
4
4
  import { SearchQuery, SearchResultSet, SearchDocument, SearchResult as SearchResult$1, ResultHighlight } from '@backstage/plugin-search-common';
5
- import React, { PropsWithChildren, ReactNode, ForwardRefExoticComponent, ReactElement } from 'react';
5
+ import React, { PropsWithChildren, ReactNode, ReactElement } from 'react';
6
6
  import { ListProps } from '@material-ui/core/List';
7
7
  import { ListItemProps } from '@material-ui/core/ListItem';
8
8
  import { TextFieldProps } from '@material-ui/core/TextField';
@@ -125,7 +125,7 @@ type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {
125
125
  *
126
126
  * @public
127
127
  */
128
- declare const SearchBarBase: ForwardRefExoticComponent<SearchBarBaseProps>;
128
+ declare const SearchBarBase: React.ForwardRefExoticComponent<Omit<Omit<SearchBarBaseProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
129
129
  /**
130
130
  * Props for {@link SearchBar}.
131
131
  *
@@ -137,7 +137,7 @@ type SearchBarProps = Partial<SearchBarBaseProps>;
137
137
  *
138
138
  * @public
139
139
  */
140
- declare const SearchBar: ForwardRefExoticComponent<SearchBarProps>;
140
+ declare const SearchBar: React.ForwardRefExoticComponent<Omit<Omit<Partial<SearchBarBaseProps>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
141
141
 
142
142
  /**
143
143
  * Props for {@link SearchAutocomplete}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.7.14-next.3",
3
+ "version": "1.8.0-next.0",
4
4
  "backstage": {
5
5
  "role": "web-library",
6
6
  "pluginId": "search",
@@ -55,10 +55,10 @@
55
55
  "test": "backstage-cli package test"
56
56
  },
57
57
  "dependencies": {
58
- "@backstage/core-components": "^0.14.10-next.0",
58
+ "@backstage/core-components": "^0.14.10",
59
59
  "@backstage/core-plugin-api": "^1.9.3",
60
- "@backstage/frontend-plugin-api": "^0.7.0-next.3",
61
- "@backstage/plugin-search-common": "^1.2.14-next.1",
60
+ "@backstage/frontend-plugin-api": "^0.8.0-next.0",
61
+ "@backstage/plugin-search-common": "^1.2.14",
62
62
  "@backstage/theme": "^0.5.6",
63
63
  "@backstage/types": "^1.1.1",
64
64
  "@backstage/version-bridge": "^1.0.8",
@@ -71,11 +71,11 @@
71
71
  "react-use": "^17.3.2"
72
72
  },
73
73
  "devDependencies": {
74
- "@backstage/cli": "^0.27.0-next.4",
75
- "@backstage/core-app-api": "^1.14.2-next.0",
76
- "@backstage/frontend-app-api": "^0.7.5-next.3",
77
- "@backstage/frontend-test-utils": "^0.1.12-next.3",
78
- "@backstage/test-utils": "^1.5.10-next.2",
74
+ "@backstage/cli": "^0.27.1-next.0",
75
+ "@backstage/core-app-api": "^1.14.2",
76
+ "@backstage/frontend-app-api": "^0.9.0-next.0",
77
+ "@backstage/frontend-test-utils": "^0.2.0-next.0",
78
+ "@backstage/test-utils": "^1.6.0-next.0",
79
79
  "@testing-library/dom": "^10.0.0",
80
80
  "@testing-library/jest-dom": "^6.0.0",
81
81
  "@testing-library/react": "^15.0.0",