@backstage/plugin-search-react 0.0.0-nightly-20231018021545 → 0.0.0-nightly-20231020021216

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,14 +1,21 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
- ## 0.0.0-nightly-20231018021545
3
+ ## 0.0.0-nightly-20231020021216
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 6c2b8721531e: Add official support for React 18.
8
+ - 71c97e7d7393: The filter options passed to `SearchResultGroupLayout` are now always explicitly rendered as strings by default.
9
+ - e7c09c4f4b60: Use default extensions boundary and suspense on the alpha declarative `createSearchResultListItem` extension factory.
7
10
  - Updated dependencies
8
- - @backstage/frontend-plugin-api@0.0.0-nightly-20231018021545
9
- - @backstage/frontend-app-api@0.0.0-nightly-20231018021545
10
- - @backstage/core-components@0.0.0-nightly-20231018021545
11
- - @backstage/core-plugin-api@0.0.0-nightly-20231018021545
11
+ - @backstage/core-components@0.0.0-nightly-20231020021216
12
+ - @backstage/frontend-plugin-api@0.0.0-nightly-20231020021216
13
+ - @backstage/frontend-app-api@0.0.0-nightly-20231020021216
14
+ - @backstage/core-plugin-api@0.0.0-nightly-20231020021216
15
+ - @backstage/version-bridge@0.0.0-nightly-20231020021216
16
+ - @backstage/theme@0.0.0-nightly-20231020021216
17
+ - @backstage/types@1.1.1
18
+ - @backstage/plugin-search-common@1.2.7
12
19
 
13
20
  ## 1.7.1
14
21
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "0.0.0-nightly-20231018021545",
3
+ "version": "0.0.0-nightly-20231020021216",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.esm.js CHANGED
@@ -1,42 +1,46 @@
1
- import React, { lazy, Suspense } from 'react';
1
+ import React, { lazy } from 'react';
2
2
  import { createExtensionDataRef, createSchemaFromZod, createExtension, ExtensionBoundary } from '@backstage/frontend-plugin-api';
3
- import { Progress } from '@backstage/core-components';
4
3
  import { a as SearchResultListItemExtension } from './esm/extensions-c878c532.esm.js';
5
4
  import '@backstage/core-plugin-api';
6
5
  import '@material-ui/core';
7
6
  import '@material-ui/core/Typography';
7
+ import '@backstage/core-components';
8
8
 
9
9
  const searchResultItemExtensionData = createExtensionDataRef("plugin.search.result.item.data");
10
10
  function createSearchResultListItemExtension(options) {
11
11
  var _a;
12
+ const id = `plugin.search.result.item.${options.id}`;
12
13
  const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
13
14
  (z) => z.object({
14
15
  noTrack: z.boolean().default(false)
15
16
  })
16
17
  );
17
18
  return createExtension({
18
- id: `plugin.search.result.item.${options.id}`,
19
- attachTo: (_a = options.attachTo) != null ? _a : { id: "plugin.search.page", input: "items" },
19
+ id,
20
+ attachTo: (_a = options.attachTo) != null ? _a : {
21
+ id: "plugin.search.page",
22
+ input: "items"
23
+ },
20
24
  configSchema,
21
25
  output: {
22
26
  item: searchResultItemExtensionData
23
27
  },
24
28
  factory({ bind, config, source }) {
25
- const LazyComponent = lazy(
29
+ const ExtensionComponent = lazy(
26
30
  () => options.component({ config }).then((component) => ({ default: component }))
27
31
  );
28
32
  bind({
29
33
  item: {
30
34
  predicate: options.predicate,
31
- component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { source }, /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(
35
+ component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { id, source }, /* @__PURE__ */ React.createElement(
32
36
  SearchResultListItemExtension,
33
37
  {
34
38
  rank: props.rank,
35
39
  result: props.result,
36
40
  noTrack: config.noTrack
37
41
  },
38
- /* @__PURE__ */ React.createElement(LazyComponent, { ...props })
39
- )))
42
+ /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props })
43
+ ))
40
44
  }
41
45
  });
42
46
  }
@@ -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, Suspense } from 'react';\n\nimport { ListItemProps } from '@material-ui/core';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { Progress } from '@backstage/core-components';\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 const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension id.\n */\n id: 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 return createExtension({\n id: `plugin.search.result.item.${options.id}`,\n attachTo: options.attachTo ?? { id: 'plugin.search.page', input: 'items' },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ bind, config, source }) {\n const LazyComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n bind({\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary source={source}>\n <Suspense fallback={<Progress />}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <LazyComponent {...props} />\n </SearchResultListItemExtension>\n </Suspense>\n </ExtensionBoundary>\n ),\n },\n });\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAmDa,MAAA,6BAAA,GAAgC,uBAG1C,gCAAgC,EAAA;AAgC5B,SAAS,oCAEd,OAAoD,EAAA;AAxFtD,EAAA,IAAA,EAAA,CAAA;AAyFE,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CAAA,CAAA,KACnB,EAAE,MAAO,CAAA;AAAA,MACP,OAAS,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,KACnC,CAAA;AAAA,GACH,CAAA;AACN,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,EAAA,EAAI,CAA6B,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023 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';\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 const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension id.\n */\n id: 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 id = `plugin.search.result.item.${options.id}`;\n\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 id,\n attachTo: options.attachTo ?? {\n id: 'plugin.search.page',\n input: 'items',\n },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ bind, config, source }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n bind({\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary id={id} source={source}>\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"],"names":[],"mappings":";;;;;;;;AAkDa,MAAA,6BAAA,GAAgC,uBAG1C,gCAAgC,EAAA;AAgC5B,SAAS,oCAEd,OAAoD,EAAA;AAvFtD,EAAA,IAAA,EAAA,CAAA;AAwFE,EAAM,MAAA,EAAA,GAAK,CAA6B,0BAAA,EAAA,OAAA,CAAQ,EAAE,CAAA,CAAA,CAAA;AAElD,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CAAA,CAAA,KACnB,EAAE,MAAO,CAAA;AAAA,MACP,OAAS,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,KACnC,CAAA;AAAA,GACH,CAAA;AAEN,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,EAAA;AAAA,IACA,QAAA,EAAA,CAAU,EAAQ,GAAA,OAAA,CAAA,QAAA,KAAR,IAAoB,GAAA,EAAA,GAAA;AAAA,MAC5B,EAAI,EAAA,oBAAA;AAAA,MACJ,KAAO,EAAA,OAAA;AAAA,KACT;AAAA,IACA,YAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA,6BAAA;AAAA,KACR;AAAA,IACA,OAAQ,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,QAAU,EAAA;AAChC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,OAAA,CACG,SAAU,CAAA,EAAE,MAAO,EAAC,CACpB,CAAA,IAAA,CAAK,CAAc,SAAA,MAAA,EAAE,OAAS,EAAA,SAAA,EAAY,CAAA,CAAA;AAAA,OAC/C,CAAA;AAEA,MAAK,IAAA,CAAA;AAAA,QACH,IAAM,EAAA;AAAA,UACJ,WAAW,OAAQ,CAAA,SAAA;AAAA,UACnB,SAAW,EAAA,CAAA,KAAA,qBACR,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,IAAQ,MACzB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,6BAAA;AAAA,YAAA;AAAA,cACC,MAAM,KAAM,CAAA,IAAA;AAAA,cACZ,QAAQ,KAAM,CAAA,MAAA;AAAA,cACd,SAAS,MAAO,CAAA,OAAA;AAAA,aAAA;AAAA,4BAEhB,KAAA,CAAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,WAEnC,CAAA;AAAA,SAEJ;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "0.0.0-nightly-20231018021545",
3
+ "version": "0.0.0-nightly-20231020021216",
4
4
  "main": "./dist/index.esm.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -43,14 +43,14 @@
43
43
  "start": "backstage-cli package start"
44
44
  },
45
45
  "dependencies": {
46
- "@backstage/core-components": "^0.0.0-nightly-20231018021545",
47
- "@backstage/core-plugin-api": "^0.0.0-nightly-20231018021545",
48
- "@backstage/frontend-app-api": "^0.0.0-nightly-20231018021545",
49
- "@backstage/frontend-plugin-api": "^0.0.0-nightly-20231018021545",
46
+ "@backstage/core-components": "^0.0.0-nightly-20231020021216",
47
+ "@backstage/core-plugin-api": "^0.0.0-nightly-20231020021216",
48
+ "@backstage/frontend-app-api": "^0.0.0-nightly-20231020021216",
49
+ "@backstage/frontend-plugin-api": "^0.0.0-nightly-20231020021216",
50
50
  "@backstage/plugin-search-common": "^1.2.7",
51
- "@backstage/theme": "^0.4.3",
51
+ "@backstage/theme": "^0.0.0-nightly-20231020021216",
52
52
  "@backstage/types": "^1.1.1",
53
- "@backstage/version-bridge": "^1.0.6",
53
+ "@backstage/version-bridge": "^0.0.0-nightly-20231020021216",
54
54
  "@material-ui/core": "^4.12.2",
55
55
  "@material-ui/icons": "^4.9.1",
56
56
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -60,18 +60,17 @@
60
60
  "react-use": "^17.3.2"
61
61
  },
62
62
  "peerDependencies": {
63
- "react": "^16.13.1 || ^17.0.0",
64
- "react-dom": "^16.13.1 || ^17.0.0",
63
+ "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
64
+ "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
65
65
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@backstage/cli": "^0.23.0",
69
- "@backstage/core-app-api": "^0.0.0-nightly-20231018021545",
70
- "@backstage/test-utils": "^0.0.0-nightly-20231018021545",
68
+ "@backstage/cli": "^0.0.0-nightly-20231020021216",
69
+ "@backstage/core-app-api": "^0.0.0-nightly-20231020021216",
70
+ "@backstage/test-utils": "^0.0.0-nightly-20231020021216",
71
71
  "@testing-library/dom": "^9.0.0",
72
72
  "@testing-library/jest-dom": "^6.0.0",
73
- "@testing-library/react": "^12.1.3",
74
- "@testing-library/react-hooks": "^8.0.0",
73
+ "@testing-library/react": "^14.0.0",
75
74
  "@testing-library/user-event": "^14.0.0"
76
75
  },
77
76
  "files": [