@backstage/plugin-search 1.4.29-next.1 → 1.4.29
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 +30 -0
- package/dist/alpha.d.ts +11 -9
- package/dist/alpha.esm.js +4 -4
- package/dist/alpha.esm.js.map +1 -1
- package/dist/apis.esm.js.map +1 -1
- package/dist/components/HomePageComponent/HomePageSearchBar.esm.js.map +1 -1
- package/dist/components/SearchModal/SearchModal.esm.js.map +1 -1
- package/dist/components/SearchModal/useSearchModal.esm.js +1 -1
- package/dist/components/SearchModal/useSearchModal.esm.js.map +1 -1
- package/dist/components/SearchPage/SearchPage.esm.js.map +1 -1
- package/dist/components/SearchType/SearchType.Accordion.esm.js.map +1 -1
- package/dist/components/SearchType/SearchType.Tabs.esm.js.map +1 -1
- package/dist/components/SearchType/SearchType.esm.js.map +1 -1
- package/dist/components/SidebarSearch/SidebarSearch.esm.js.map +1 -1
- package/dist/components/SidebarSearchModal/SidebarSearchModal.esm.js.map +1 -1
- package/dist/components/util.esm.js.map +1 -1
- package/dist/index.d.ts +0 -10
- package/dist/package.json.esm.js +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/plugin-search
|
|
2
2
|
|
|
3
|
+
## 1.4.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
|
|
8
|
+
- f2f133c: Internal update to use the new variant of `ApiBlueprint`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/core-components@0.17.5
|
|
11
|
+
- @backstage/frontend-plugin-api@0.11.0
|
|
12
|
+
- @backstage/core-compat-api@0.5.0
|
|
13
|
+
- @backstage/plugin-search-react@1.9.3
|
|
14
|
+
- @backstage/plugin-catalog-react@1.20.0
|
|
15
|
+
|
|
16
|
+
## 1.4.29-next.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/frontend-plugin-api@0.11.0-next.1
|
|
23
|
+
- @backstage/core-compat-api@0.5.0-next.2
|
|
24
|
+
- @backstage/plugin-search-react@1.9.3-next.1
|
|
25
|
+
- @backstage/plugin-catalog-react@1.20.0-next.2
|
|
26
|
+
- @backstage/core-components@0.17.5-next.1
|
|
27
|
+
- @backstage/core-plugin-api@1.10.9
|
|
28
|
+
- @backstage/errors@1.2.7
|
|
29
|
+
- @backstage/types@1.2.1
|
|
30
|
+
- @backstage/version-bridge@1.0.11
|
|
31
|
+
- @backstage/plugin-search-common@1.2.19
|
|
32
|
+
|
|
3
33
|
## 1.4.29-next.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const searchApi: _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
|
23
23
|
name: undefined;
|
|
24
24
|
config: {};
|
|
25
25
|
configInput: {};
|
|
26
|
-
output: _backstage_frontend_plugin_api.
|
|
26
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_core_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
27
27
|
inputs: {};
|
|
28
28
|
params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_core_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_core_plugin_api.AnyApiFactory>;
|
|
29
29
|
}>;
|
|
@@ -39,7 +39,7 @@ declare const searchPage: _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
|
39
39
|
} & {
|
|
40
40
|
path?: string | undefined;
|
|
41
41
|
};
|
|
42
|
-
output: _backstage_frontend_plugin_api.
|
|
42
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
43
43
|
optional: true;
|
|
44
44
|
}>;
|
|
45
45
|
inputs: {
|
|
@@ -68,7 +68,8 @@ declare const searchPage: _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
|
68
68
|
kind: "page";
|
|
69
69
|
name: undefined;
|
|
70
70
|
params: {
|
|
71
|
-
defaultPath:
|
|
71
|
+
defaultPath?: [Error: `Use the 'path' param instead`];
|
|
72
|
+
path: string;
|
|
72
73
|
loader: () => Promise<JSX.Element>;
|
|
73
74
|
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
74
75
|
};
|
|
@@ -79,7 +80,7 @@ declare const searchNavItem: _backstage_frontend_plugin_api.ExtensionDefinition<
|
|
|
79
80
|
name: undefined;
|
|
80
81
|
config: {};
|
|
81
82
|
configInput: {};
|
|
82
|
-
output: _backstage_frontend_plugin_api.
|
|
83
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<{
|
|
83
84
|
title: string;
|
|
84
85
|
icon: _backstage_core_plugin_api.IconComponent;
|
|
85
86
|
routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
@@ -92,7 +93,7 @@ declare const searchNavItem: _backstage_frontend_plugin_api.ExtensionDefinition<
|
|
|
92
93
|
};
|
|
93
94
|
}>;
|
|
94
95
|
/** @alpha */
|
|
95
|
-
declare const _default: _backstage_frontend_plugin_api.
|
|
96
|
+
declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{
|
|
96
97
|
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
97
98
|
}, {}, {
|
|
98
99
|
"api:search": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -100,7 +101,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
100
101
|
name: undefined;
|
|
101
102
|
config: {};
|
|
102
103
|
configInput: {};
|
|
103
|
-
output: _backstage_frontend_plugin_api.
|
|
104
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_core_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
104
105
|
inputs: {};
|
|
105
106
|
params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_core_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_core_plugin_api.AnyApiFactory>;
|
|
106
107
|
}>;
|
|
@@ -109,7 +110,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
109
110
|
name: undefined;
|
|
110
111
|
config: {};
|
|
111
112
|
configInput: {};
|
|
112
|
-
output: _backstage_frontend_plugin_api.
|
|
113
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<{
|
|
113
114
|
title: string;
|
|
114
115
|
icon: _backstage_core_plugin_api.IconComponent;
|
|
115
116
|
routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
@@ -132,7 +133,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
132
133
|
} & {
|
|
133
134
|
path?: string | undefined;
|
|
134
135
|
};
|
|
135
|
-
output: _backstage_frontend_plugin_api.
|
|
136
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
136
137
|
optional: true;
|
|
137
138
|
}>;
|
|
138
139
|
inputs: {
|
|
@@ -161,7 +162,8 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
161
162
|
kind: "page";
|
|
162
163
|
name: undefined;
|
|
163
164
|
params: {
|
|
164
|
-
defaultPath:
|
|
165
|
+
defaultPath?: [Error: `Use the 'path' param instead`];
|
|
166
|
+
path: string;
|
|
165
167
|
loader: () => Promise<JSX.Element>;
|
|
166
168
|
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
167
169
|
};
|
package/dist/alpha.esm.js
CHANGED
|
@@ -5,11 +5,11 @@ import Paper from '@material-ui/core/Paper';
|
|
|
5
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
6
6
|
import SearchIcon from '@material-ui/icons/Search';
|
|
7
7
|
import { useSidebarPinState, Page, Header, Content, CatalogIcon, DocsIcon } from '@backstage/core-components';
|
|
8
|
-
import {
|
|
8
|
+
import { fetchApiRef, discoveryApiRef, useApi } from '@backstage/core-plugin-api';
|
|
9
9
|
import { ApiBlueprint, PageBlueprint, createExtensionInput, NavItemBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
10
10
|
import { catalogApiRef, CATALOG_FILTER_EXISTS } from '@backstage/plugin-catalog-react';
|
|
11
11
|
import { searchApiRef, SearchContextProvider, useSearch, SearchBar, SearchFilter, SearchPagination, SearchResult, SearchResultPager, DefaultResultListItem } from '@backstage/plugin-search-react';
|
|
12
|
-
import {
|
|
12
|
+
import { SearchFilterResultTypeBlueprint, SearchFilterBlueprint, SearchResultListItemBlueprint } from '@backstage/plugin-search-react/alpha';
|
|
13
13
|
import { rootRouteRef } from './plugin.esm.js';
|
|
14
14
|
import { SearchClient } from './apis.esm.js';
|
|
15
15
|
import { SearchType } from './components/SearchType/SearchType.esm.js';
|
|
@@ -18,7 +18,7 @@ import { convertLegacyRouteRef, compatWrapper, convertLegacyRouteRefs } from '@b
|
|
|
18
18
|
export { searchTranslationRef } from './translation.esm.js';
|
|
19
19
|
|
|
20
20
|
const searchApi = ApiBlueprint.make({
|
|
21
|
-
params: (
|
|
21
|
+
params: (defineParams) => defineParams({
|
|
22
22
|
api: searchApiRef,
|
|
23
23
|
deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },
|
|
24
24
|
factory: ({ discoveryApi, fetchApi }) => new SearchClient({ discoveryApi, fetchApi })
|
|
@@ -52,7 +52,7 @@ const searchPage = PageBlueprint.makeWithOverrides({
|
|
|
52
52
|
},
|
|
53
53
|
factory(originalFactory, { config, inputs }) {
|
|
54
54
|
return originalFactory({
|
|
55
|
-
|
|
55
|
+
path: "/search",
|
|
56
56
|
routeRef: convertLegacyRouteRef(rootRouteRef),
|
|
57
57
|
loader: async () => {
|
|
58
58
|
const getResultItemComponent = (result) => {
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -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 Grid from '@material-ui/core/Grid';\nimport Paper from '@material-ui/core/Paper';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport SearchIcon from '@material-ui/icons/Search';\n\nimport {\n CatalogIcon,\n Content,\n DocsIcon,\n Header,\n Page,\n useSidebarPinState,\n} from '@backstage/core-components';\nimport {\n useApi,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport {\n createFrontendPlugin,\n ApiBlueprint,\n createExtensionInput,\n PageBlueprint,\n NavItemBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n catalogApiRef,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/plugin-catalog-react';\n\nimport {\n DefaultResultListItem,\n SearchBar,\n SearchFilter,\n SearchPagination,\n SearchResult as SearchResults,\n SearchResultPager,\n useSearch,\n SearchContextProvider,\n} from '@backstage/plugin-search-react';\nimport { SearchResult } from '@backstage/plugin-search-common';\nimport { searchApiRef } from '@backstage/plugin-search-react';\nimport {\n SearchResultListItemBlueprint,\n SearchFilterResultTypeBlueprint,\n SearchFilterBlueprint,\n} from '@backstage/plugin-search-react/alpha';\n\nimport { rootRouteRef } from './plugin';\nimport { SearchClient } from './apis';\nimport { SearchType } from './components/SearchType';\nimport { UrlUpdater } from './components/SearchPage/SearchPage';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\n\n/** @alpha */\nexport const searchApi = ApiBlueprint.make({\n params: define =>\n define({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new SearchClient({ discoveryApi, fetchApi }),\n }),\n});\n\nconst useSearchPageStyles = makeStyles((theme: Theme) => ({\n filter: {\n '& + &': {\n marginTop: theme.spacing(2.5),\n },\n },\n filters: {\n padding: theme.spacing(2),\n marginTop: theme.spacing(2),\n },\n}));\n\n/** @alpha */\nexport const searchPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n inputs: {\n items: createExtensionInput([SearchResultListItemBlueprint.dataRefs.item]),\n resultTypes: createExtensionInput([\n SearchFilterResultTypeBlueprint.dataRefs.resultType,\n ]),\n searchFilters: createExtensionInput([\n SearchFilterBlueprint.dataRefs.searchFilters,\n ]),\n },\n factory(originalFactory, { config, inputs }) {\n return originalFactory({\n defaultPath: '/search',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: async () => {\n const getResultItemComponent = (result: SearchResult) => {\n const value = inputs.items.find(item =>\n item\n ?.get(SearchResultListItemBlueprint.dataRefs.item)\n .predicate?.(result),\n );\n return (\n value?.get(SearchResultListItemBlueprint.dataRefs.item).component ??\n DefaultResultListItem\n );\n };\n\n const resultTypes = inputs.resultTypes.map(item =>\n item.get(SearchFilterResultTypeBlueprint.dataRefs.resultType),\n );\n\n const additionalSearchFilters = inputs.searchFilters.map(\n item =>\n item.get(SearchFilterBlueprint.dataRefs.searchFilters).component,\n );\n\n const Component = () => {\n const classes = useSearchPageStyles();\n const { isMobile } = useSidebarPinState();\n const { types } = useSearch();\n const catalogApi = useApi(catalogApiRef);\n\n return (\n <Page themeId=\"home\">\n {!isMobile && <Header title=\"Search\" />}\n <Content>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchBar debounceTime={100} />\n </Grid>\n {!isMobile && (\n <Grid item xs={3}>\n <SearchType.Accordion\n name=\"Result Type\"\n defaultValue=\"software-catalog\"\n showCounts\n types={[\n {\n value: 'software-catalog',\n name: 'Software Catalog',\n icon: <CatalogIcon />,\n },\n {\n value: 'techdocs',\n name: 'Documentation',\n icon: <DocsIcon />,\n },\n ].concat(resultTypes)}\n />\n <Paper className={classes.filters}>\n {types.includes('techdocs') && (\n <SearchFilter.Select\n className={classes.filter}\n label=\"Entity\"\n name=\"name\"\n values={async () => {\n // Return a list of entities which are documented.\n const { items } = await catalogApi.getEntities({\n fields: ['metadata.name'],\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref':\n CATALOG_FILTER_EXISTS,\n },\n });\n\n const names = items.map(\n entity => entity.metadata.name,\n );\n names.sort();\n return names;\n }}\n />\n )}\n <SearchFilter.Select\n className={classes.filter}\n label=\"Kind\"\n name=\"kind\"\n values={[\n 'API',\n 'Component',\n 'Domain',\n 'Group',\n 'Location',\n 'Resource',\n 'System',\n 'Template',\n 'User',\n ]}\n />\n <SearchFilter.Checkbox\n className={classes.filter}\n label=\"Lifecycle\"\n name=\"lifecycle\"\n values={['experimental', 'production']}\n />\n {additionalSearchFilters.map(SearchFilterComponent => (\n <SearchFilterComponent className={classes.filter} />\n ))}\n </Paper>\n </Grid>\n )}\n <Grid item xs>\n <SearchPagination />\n <SearchResults>\n {({ results }) => (\n <>\n {results.map((result, index) => {\n const { noTrack } = config;\n const { document, ...rest } = result;\n const SearchResultListItem =\n getResultItemComponent(result);\n return (\n <SearchResultListItem\n {...rest}\n key={index}\n result={document}\n noTrack={noTrack}\n />\n );\n })}\n </>\n )}\n </SearchResults>\n <SearchResultPager />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n };\n\n return compatWrapper(\n <SearchContextProvider>\n <UrlUpdater />\n <Component />\n </SearchContextProvider>,\n );\n },\n });\n },\n});\n\n/** @alpha */\nexport const searchNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Search',\n icon: SearchIcon,\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'search',\n info: { packageJson: () => import('../package.json') },\n extensions: [searchApi, searchPage, searchNavItem],\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n }),\n});\n\n/** @alpha */\nexport { searchTranslationRef } from './translation';\n"],"names":["SearchResults"],"mappings":";;;;;;;;;;;;;;;;;;;AA6Ea,MAAA,SAAA,GAAY,aAAa,IAAK,CAAA;AAAA,EACzC,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,GAAK,EAAA,YAAA;AAAA,IACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,UAAU,WAAY,EAAA;AAAA,IAC7D,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,YAAa,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,GAC9C;AACL,CAAC;AAED,MAAM,mBAAA,GAAsB,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EACxD,MAAQ,EAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAC9B,GACF;AAAA,EACA,OAA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AA,aAAA,EACF,CACF,EAAA;AAAA,WACF,EAAA,CAAA;AAAA,SAEJ;AAEA,QAAO,OAAA,aAAA;AAAA,+BACJ,qBACC,EAAA,EAAA,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,UAAW,EAAA,EAAA,CAAA;AAAA,gCACX,SAAU,EAAA,EAAA;AAAA,WACb,EAAA;AAAA,SACF;AAAA;AACF,KACD,CAAA;AAAA;AAEL,CAAC;AAGY,MAAA,aAAA,GAAgB,iBAAiB,IAAK,CAAA;AAAA,EACjD,MAAQ,EAAA;AAAA,IACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,KAAO,EAAA,QAAA;AAAA,IACP,IAAM,EAAA;AAAA;AAEV,CAAC;AAGD,YAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,QAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,uBAAiB,CAAE,EAAA;AAAA,EACrD,UAAY,EAAA,CAAC,SAAW,EAAA,UAAA,EAAY,aAAa,CAAA;AAAA,EACjD,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,IAAM,EAAA;AAAA,GACP;AACH,CAAC,CAAA;;;;"}
|
|
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 Grid from '@material-ui/core/Grid';\nimport Paper from '@material-ui/core/Paper';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport SearchIcon from '@material-ui/icons/Search';\n\nimport {\n CatalogIcon,\n Content,\n DocsIcon,\n Header,\n Page,\n useSidebarPinState,\n} from '@backstage/core-components';\nimport {\n useApi,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport {\n createFrontendPlugin,\n ApiBlueprint,\n createExtensionInput,\n PageBlueprint,\n NavItemBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n catalogApiRef,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/plugin-catalog-react';\n\nimport {\n DefaultResultListItem,\n SearchBar,\n SearchFilter,\n SearchPagination,\n SearchResult as SearchResults,\n SearchResultPager,\n useSearch,\n SearchContextProvider,\n} from '@backstage/plugin-search-react';\nimport { SearchResult } from '@backstage/plugin-search-common';\nimport { searchApiRef } from '@backstage/plugin-search-react';\nimport {\n SearchResultListItemBlueprint,\n SearchFilterResultTypeBlueprint,\n SearchFilterBlueprint,\n} from '@backstage/plugin-search-react/alpha';\n\nimport { rootRouteRef } from './plugin';\nimport { SearchClient } from './apis';\nimport { SearchType } from './components/SearchType';\nimport { UrlUpdater } from './components/SearchPage/SearchPage';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\n\n/** @alpha */\nexport const searchApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new SearchClient({ discoveryApi, fetchApi }),\n }),\n});\n\nconst useSearchPageStyles = makeStyles((theme: Theme) => ({\n filter: {\n '& + &': {\n marginTop: theme.spacing(2.5),\n },\n },\n filters: {\n padding: theme.spacing(2),\n marginTop: theme.spacing(2),\n },\n}));\n\n/** @alpha */\nexport const searchPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n inputs: {\n items: createExtensionInput([SearchResultListItemBlueprint.dataRefs.item]),\n resultTypes: createExtensionInput([\n SearchFilterResultTypeBlueprint.dataRefs.resultType,\n ]),\n searchFilters: createExtensionInput([\n SearchFilterBlueprint.dataRefs.searchFilters,\n ]),\n },\n factory(originalFactory, { config, inputs }) {\n return originalFactory({\n path: '/search',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: async () => {\n const getResultItemComponent = (result: SearchResult) => {\n const value = inputs.items.find(item =>\n item\n ?.get(SearchResultListItemBlueprint.dataRefs.item)\n .predicate?.(result),\n );\n return (\n value?.get(SearchResultListItemBlueprint.dataRefs.item).component ??\n DefaultResultListItem\n );\n };\n\n const resultTypes = inputs.resultTypes.map(item =>\n item.get(SearchFilterResultTypeBlueprint.dataRefs.resultType),\n );\n\n const additionalSearchFilters = inputs.searchFilters.map(\n item =>\n item.get(SearchFilterBlueprint.dataRefs.searchFilters).component,\n );\n\n const Component = () => {\n const classes = useSearchPageStyles();\n const { isMobile } = useSidebarPinState();\n const { types } = useSearch();\n const catalogApi = useApi(catalogApiRef);\n\n return (\n <Page themeId=\"home\">\n {!isMobile && <Header title=\"Search\" />}\n <Content>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchBar debounceTime={100} />\n </Grid>\n {!isMobile && (\n <Grid item xs={3}>\n <SearchType.Accordion\n name=\"Result Type\"\n defaultValue=\"software-catalog\"\n showCounts\n types={[\n {\n value: 'software-catalog',\n name: 'Software Catalog',\n icon: <CatalogIcon />,\n },\n {\n value: 'techdocs',\n name: 'Documentation',\n icon: <DocsIcon />,\n },\n ].concat(resultTypes)}\n />\n <Paper className={classes.filters}>\n {types.includes('techdocs') && (\n <SearchFilter.Select\n className={classes.filter}\n label=\"Entity\"\n name=\"name\"\n values={async () => {\n // Return a list of entities which are documented.\n const { items } = await catalogApi.getEntities({\n fields: ['metadata.name'],\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref':\n CATALOG_FILTER_EXISTS,\n },\n });\n\n const names = items.map(\n entity => entity.metadata.name,\n );\n names.sort();\n return names;\n }}\n />\n )}\n <SearchFilter.Select\n className={classes.filter}\n label=\"Kind\"\n name=\"kind\"\n values={[\n 'API',\n 'Component',\n 'Domain',\n 'Group',\n 'Location',\n 'Resource',\n 'System',\n 'Template',\n 'User',\n ]}\n />\n <SearchFilter.Checkbox\n className={classes.filter}\n label=\"Lifecycle\"\n name=\"lifecycle\"\n values={['experimental', 'production']}\n />\n {additionalSearchFilters.map(SearchFilterComponent => (\n <SearchFilterComponent className={classes.filter} />\n ))}\n </Paper>\n </Grid>\n )}\n <Grid item xs>\n <SearchPagination />\n <SearchResults>\n {({ results }) => (\n <>\n {results.map((result, index) => {\n const { noTrack } = config;\n const { document, ...rest } = result;\n const SearchResultListItem =\n getResultItemComponent(result);\n return (\n <SearchResultListItem\n {...rest}\n key={index}\n result={document}\n noTrack={noTrack}\n />\n );\n })}\n </>\n )}\n </SearchResults>\n <SearchResultPager />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n };\n\n return compatWrapper(\n <SearchContextProvider>\n <UrlUpdater />\n <Component />\n </SearchContextProvider>,\n );\n },\n });\n },\n});\n\n/** @alpha */\nexport const searchNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Search',\n icon: SearchIcon,\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'search',\n info: { packageJson: () => import('../package.json') },\n extensions: [searchApi, searchPage, searchNavItem],\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n }),\n});\n\n/** @alpha */\nexport { searchTranslationRef } from './translation';\n"],"names":["SearchResults"],"mappings":";;;;;;;;;;;;;;;;;;;AA6EO,MAAM,SAAA,GAAY,aAAa,IAAA,CAAK;AAAA,EACzC,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,YAAA;AAAA,IACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,IAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,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,MAAM,CAAA;AAC/B,kBAAA,uBACE,aAAA;AAAA,oBAAC,oBAAA;AAAA,oBAAA;AAAA,sBACE,GAAG,IAAA;AAAA,sBACJ,GAAA,EAAK,KAAA;AAAA,sBACL,MAAA,EAAQ,QAAA;AAAA,sBACR;AAAA;AAAA,mBACF;AAAA,gBAEJ,CAAC,GACH,CAAA,EAEJ,CAAA;AAAA,oCACC,iBAAA,EAAA,EAAkB;AAAA,eAAA,EACrB;AAAA,aAAA,EACF,CAAA,EACF;AAAA,WAAA,EACF,CAAA;AAAA,QAEJ,CAAA;AAEA,QAAA,OAAO,aAAA;AAAA,+BACJ,qBAAA,EAAA,EACC,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,UAAA,EAAA,EAAW,CAAA;AAAA,gCACX,SAAA,EAAA,EAAU;AAAA,WAAA,EACb;AAAA,SACF;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAAiB,IAAA,CAAK;AAAA,EACjD,MAAA,EAAQ;AAAA,IACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,KAAA,EAAO,QAAA;AAAA,IACP,IAAA,EAAM;AAAA;AAEV,CAAC;AAGD,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,QAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,uBAAiB,CAAA,EAAE;AAAA,EACrD,UAAA,EAAY,CAAC,SAAA,EAAW,UAAA,EAAY,aAAa,CAAA;AAAA,EACjD,QAAQ,sBAAA,CAAuB;AAAA,IAC7B,IAAA,EAAM;AAAA,GACP;AACH,CAAC,CAAA;;;;"}
|
package/dist/apis.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.esm.js","sources":["../src/apis.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { SearchApi } from '@backstage/plugin-search-react';\nimport { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';\n\nimport qs from 'qs';\n\nexport class SearchClient implements SearchApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n async query(query: SearchQuery): Promise<SearchResultSet> {\n const queryString = qs.stringify(query);\n const url = `${await this.discoveryApi.getBaseUrl(\n 'search',\n )}/query?${queryString}`;\n const response = await this.fetchApi.fetch(url);\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n}\n"],"names":[],"mappings":";;;AAuBO,MAAM,
|
|
1
|
+
{"version":3,"file":"apis.esm.js","sources":["../src/apis.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { SearchApi } from '@backstage/plugin-search-react';\nimport { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';\n\nimport qs from 'qs';\n\nexport class SearchClient implements SearchApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n async query(query: SearchQuery): Promise<SearchResultSet> {\n const queryString = qs.stringify(query);\n const url = `${await this.discoveryApi.getBaseUrl(\n 'search',\n )}/query?${queryString}`;\n const response = await this.fetchApi.fetch(url);\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n}\n"],"names":[],"mappings":";;;AAuBO,MAAM,YAAA,CAAkC;AAAA,EAC5B,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAA6D;AACvE,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA,EAEA,MAAM,MAAM,KAAA,EAA8C;AACxD,IAAA,MAAM,WAAA,GAAc,EAAA,CAAG,SAAA,CAAU,KAAK,CAAA;AACtC,IAAA,MAAM,GAAA,GAAM,CAAA,EAAG,MAAM,IAAA,CAAK,YAAA,CAAa,UAAA;AAAA,MACrC;AAAA,KACD,UAAU,WAAW,CAAA,CAAA;AACtB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,QAAA,CAAS,MAAM,GAAG,CAAA;AAE9C,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,MAAM,aAAA,CAAc,YAAA,CAAa,QAAQ,CAAA;AAAA,IACjD;AAEA,IAAA,OAAO,SAAS,IAAA,EAAK;AAAA,EACvB;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePageSearchBar.esm.js","sources":["../../../src/components/HomePageComponent/HomePageSearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useCallback, useRef, useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n SearchBarBase,\n SearchBarBaseProps,\n} from '@backstage/plugin-search-react';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBarRoot: {\n fontSize: '1.5em',\n },\n searchBarOutline: {\n border: '1px solid #555',\n borderRadius: '6px',\n },\n});\n\n/**\n * Props for {@link HomePageSearchBar}.\n *\n * @public\n */\nexport type HomePageSearchBarProps = Partial<\n Omit<SearchBarBaseProps, 'onChange' | 'onSubmit'>\n>;\n\n/**\n * The search bar created specifically for the composable home page.\n */\nexport const HomePageSearchBar = (props: HomePageSearchBarProps) => {\n const classes = useStyles(props);\n const [query, setQuery] = useState('');\n const ref = useRef<HTMLInputElement | null>(null);\n\n const handleSearch = useNavigateToQuery();\n\n // This handler is called when \"enter\" is pressed\n const handleSubmit = useCallback(() => {\n // Using ref to get the current field value without waiting for a query debounce\n handleSearch({ query: ref.current?.value ?? '' });\n }, [handleSearch]);\n\n return (\n <SearchBarBase\n value={query}\n onSubmit={handleSubmit}\n onChange={setQuery}\n inputProps={{ ref }}\n InputProps={{\n ...props.InputProps,\n classes: {\n root: classes.searchBarRoot,\n notchedOutline: classes.searchBarOutline,\n ...props.InputProps?.classes,\n },\n }}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwBA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"HomePageSearchBar.esm.js","sources":["../../../src/components/HomePageComponent/HomePageSearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useCallback, useRef, useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n SearchBarBase,\n SearchBarBaseProps,\n} from '@backstage/plugin-search-react';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBarRoot: {\n fontSize: '1.5em',\n },\n searchBarOutline: {\n border: '1px solid #555',\n borderRadius: '6px',\n },\n});\n\n/**\n * Props for {@link HomePageSearchBar}.\n *\n * @public\n */\nexport type HomePageSearchBarProps = Partial<\n Omit<SearchBarBaseProps, 'onChange' | 'onSubmit'>\n>;\n\n/**\n * The search bar created specifically for the composable home page.\n */\nexport const HomePageSearchBar = (props: HomePageSearchBarProps) => {\n const classes = useStyles(props);\n const [query, setQuery] = useState('');\n const ref = useRef<HTMLInputElement | null>(null);\n\n const handleSearch = useNavigateToQuery();\n\n // This handler is called when \"enter\" is pressed\n const handleSubmit = useCallback(() => {\n // Using ref to get the current field value without waiting for a query debounce\n handleSearch({ query: ref.current?.value ?? '' });\n }, [handleSearch]);\n\n return (\n <SearchBarBase\n value={query}\n onSubmit={handleSubmit}\n onChange={setQuery}\n inputProps={{ ref }}\n InputProps={{\n ...props.InputProps,\n classes: {\n root: classes.searchBarRoot,\n notchedOutline: classes.searchBarOutline,\n ...props.InputProps?.classes,\n },\n }}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,aAAA,EAAe;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,MAAA,EAAQ,gBAAA;AAAA,IACR,YAAA,EAAc;AAAA;AAElB,CAAC,CAAA;AAcM,MAAM,iBAAA,GAAoB,CAAC,KAAA,KAAkC;AAClE,EAAA,MAAM,OAAA,GAAU,UAAU,KAAK,CAAA;AAC/B,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,EAAE,CAAA;AACrC,EAAA,MAAM,GAAA,GAAM,OAAgC,IAAI,CAAA;AAEhD,EAAA,MAAM,eAAe,kBAAA,EAAmB;AAGxC,EAAA,MAAM,YAAA,GAAe,YAAY,MAAM;AAErC,IAAA,YAAA,CAAa,EAAE,KAAA,EAAO,GAAA,CAAI,OAAA,EAAS,KAAA,IAAS,IAAI,CAAA;AAAA,EAClD,CAAA,EAAG,CAAC,YAAY,CAAC,CAAA;AAEjB,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,KAAA;AAAA,MACP,QAAA,EAAU,YAAA;AAAA,MACV,QAAA,EAAU,QAAA;AAAA,MACV,UAAA,EAAY,EAAE,GAAA,EAAI;AAAA,MAClB,UAAA,EAAY;AAAA,QACV,GAAG,KAAA,CAAM,UAAA;AAAA,QACT,OAAA,EAAS;AAAA,UACP,MAAM,OAAA,CAAQ,aAAA;AAAA,UACd,gBAAgB,OAAA,CAAQ,gBAAA;AAAA,UACxB,GAAG,MAAM,UAAA,EAAY;AAAA;AACvB,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchModal.esm.js","sources":["../../../src/components/SearchModal/SearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport { useContent } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n SearchBar,\n SearchContextProvider,\n SearchResult,\n SearchResultPager,\n} from '@backstage/plugin-search-react';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { useTheme } from '@material-ui/core/styles';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ArrowForwardIcon from '@material-ui/icons/ArrowForward';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { ReactNode, useCallback, useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { rootRouteRef } from '../../plugin';\nimport { SearchResultSet } from '@backstage/plugin-search-common';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport interface SearchModalChildrenProps {\n /**\n * A function that should be invoked when navigating away from the modal.\n */\n toggleModal: () => void;\n\n /**\n * Ability to provide custom components to render the result items\n */\n resultItemComponents?:\n | ReactNode\n | ((resultSet: SearchResultSet) => JSX.Element);\n}\n\n/**\n * @public\n */\nexport interface SearchModalProps {\n /**\n * If true, it renders the modal.\n */\n open?: boolean;\n /**\n * This is supposed to be used together with the open prop.\n * If `hidden` is true, it hides the modal.\n * If `open` is false, the value of `hidden` has no effect on the modal.\n * Use `open` for controlling whether the modal should be rendered or not.\n */\n hidden?: boolean;\n /**\n * a function invoked when a search item is pressed or when the dialog\n * should be closed.\n */\n toggleModal: () => void;\n /**\n * A function that returns custom content to render in the search modal in\n * place of the default.\n */\n children?: (props: SearchModalChildrenProps) => JSX.Element;\n\n /**\n * Optional ability to pass in result item component renderers.\n */\n resultItemComponents?: SearchModalChildrenProps['resultItemComponents'];\n}\n\nconst useStyles = makeStyles(theme => ({\n dialogTitle: {\n gap: theme.spacing(1),\n display: 'grid',\n alignItems: 'center',\n gridTemplateColumns: '1fr auto',\n '&> button': {\n marginTop: theme.spacing(1),\n },\n },\n input: {\n flex: 1,\n },\n button: {\n '&:hover': {\n background: 'none',\n },\n },\n // Reduces default height of the modal, keeping a gap of 128px between the top and bottom of the page.\n paperFullWidth: { height: 'calc(100% - 128px)' },\n dialogActionsContainer: { padding: theme.spacing(1, 3) },\n viewResultsLink: { verticalAlign: '0.5em' },\n}));\n\nexport const Modal = ({\n toggleModal,\n resultItemComponents,\n}: SearchModalChildrenProps) => {\n const classes = useStyles();\n const navigate = useNavigate();\n const { transitions } = useTheme();\n const { focusContent } = useContent();\n const { t } = useTranslationRef(searchTranslationRef);\n\n const searchRootRoute = useRouteRef(rootRouteRef)();\n const searchBarRef = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n searchBarRef?.current?.focus();\n });\n\n const handleSearchResultClick = useCallback(() => {\n setTimeout(focusContent, transitions.duration.leavingScreen);\n }, [focusContent, transitions]);\n\n // This handler is called when \"enter\" is pressed\n const handleSearchBarSubmit = useCallback(() => {\n // Using ref to get the current field value without waiting for a query debounce\n const query = searchBarRef.current?.value ?? '';\n navigate(`${searchRootRoute}?query=${query}`);\n handleSearchResultClick();\n }, [navigate, handleSearchResultClick, searchRootRoute]);\n\n return (\n <>\n <DialogTitle>\n <Box className={classes.dialogTitle}>\n <SearchBar\n className={classes.input}\n inputProps={{ ref: searchBarRef }}\n onSubmit={handleSearchBarSubmit}\n />\n\n <IconButton aria-label=\"close\" onClick={toggleModal}>\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent>\n <Grid\n container\n direction=\"row-reverse\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid item>\n <Button\n className={classes.button}\n color=\"primary\"\n endIcon={<ArrowForwardIcon />}\n onClick={handleSearchBarSubmit}\n disableRipple\n >\n {t('searchModal.viewFullResults')}\n </Button>\n </Grid>\n </Grid>\n <Divider />\n <SearchResult\n onClick={handleSearchResultClick}\n onKeyDown={handleSearchResultClick}\n >\n {resultItemComponents}\n </SearchResult>\n </DialogContent>\n <DialogActions className={classes.dialogActionsContainer}>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchResultPager />\n </Grid>\n </Grid>\n </DialogActions>\n </>\n );\n};\n\n/**\n * @public\n */\nexport const SearchModal = (props: SearchModalProps) => {\n const {\n open = true,\n hidden,\n toggleModal,\n children,\n resultItemComponents,\n } = props;\n\n const classes = useStyles();\n\n return (\n <Dialog\n classes={{\n paperFullWidth: classes.paperFullWidth,\n }}\n onClose={toggleModal}\n aria-label=\"Search Modal\"\n aria-modal=\"true\"\n fullWidth\n maxWidth=\"lg\"\n open={open}\n hidden={hidden}\n >\n {open && (\n <SearchContextProvider inheritParentContextIfAvailable>\n {(children &&\n children({\n toggleModal,\n resultItemComponents: resultItemComponents || [],\n })) ?? (\n <Modal\n toggleModal={toggleModal}\n resultItemComponents={resultItemComponents}\n />\n )}\n </SearchContextProvider>\n )}\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6FA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,OAAS,EAAA,MAAA;AAAA,IACT,UAAY,EAAA,QAAA;AAAA,IACZ,mBAAqB,EAAA,UAAA;AAAA,IACrB,WAAa,EAAA;AAAA,MACX,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAC5B,GAC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AAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA;AAAA;AAAA,OAGN,EAAA;AAAA;AAAA,GAEJ;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchModal.esm.js","sources":["../../../src/components/SearchModal/SearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport { useContent } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n SearchBar,\n SearchContextProvider,\n SearchResult,\n SearchResultPager,\n} from '@backstage/plugin-search-react';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { useTheme } from '@material-ui/core/styles';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ArrowForwardIcon from '@material-ui/icons/ArrowForward';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { ReactNode, useCallback, useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { rootRouteRef } from '../../plugin';\nimport { SearchResultSet } from '@backstage/plugin-search-common';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport interface SearchModalChildrenProps {\n /**\n * A function that should be invoked when navigating away from the modal.\n */\n toggleModal: () => void;\n\n /**\n * Ability to provide custom components to render the result items\n */\n resultItemComponents?:\n | ReactNode\n | ((resultSet: SearchResultSet) => JSX.Element);\n}\n\n/**\n * @public\n */\nexport interface SearchModalProps {\n /**\n * If true, it renders the modal.\n */\n open?: boolean;\n /**\n * This is supposed to be used together with the open prop.\n * If `hidden` is true, it hides the modal.\n * If `open` is false, the value of `hidden` has no effect on the modal.\n * Use `open` for controlling whether the modal should be rendered or not.\n */\n hidden?: boolean;\n /**\n * a function invoked when a search item is pressed or when the dialog\n * should be closed.\n */\n toggleModal: () => void;\n /**\n * A function that returns custom content to render in the search modal in\n * place of the default.\n */\n children?: (props: SearchModalChildrenProps) => JSX.Element;\n\n /**\n * Optional ability to pass in result item component renderers.\n */\n resultItemComponents?: SearchModalChildrenProps['resultItemComponents'];\n}\n\nconst useStyles = makeStyles(theme => ({\n dialogTitle: {\n gap: theme.spacing(1),\n display: 'grid',\n alignItems: 'center',\n gridTemplateColumns: '1fr auto',\n '&> button': {\n marginTop: theme.spacing(1),\n },\n },\n input: {\n flex: 1,\n },\n button: {\n '&:hover': {\n background: 'none',\n },\n },\n // Reduces default height of the modal, keeping a gap of 128px between the top and bottom of the page.\n paperFullWidth: { height: 'calc(100% - 128px)' },\n dialogActionsContainer: { padding: theme.spacing(1, 3) },\n viewResultsLink: { verticalAlign: '0.5em' },\n}));\n\nexport const Modal = ({\n toggleModal,\n resultItemComponents,\n}: SearchModalChildrenProps) => {\n const classes = useStyles();\n const navigate = useNavigate();\n const { transitions } = useTheme();\n const { focusContent } = useContent();\n const { t } = useTranslationRef(searchTranslationRef);\n\n const searchRootRoute = useRouteRef(rootRouteRef)();\n const searchBarRef = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n searchBarRef?.current?.focus();\n });\n\n const handleSearchResultClick = useCallback(() => {\n setTimeout(focusContent, transitions.duration.leavingScreen);\n }, [focusContent, transitions]);\n\n // This handler is called when \"enter\" is pressed\n const handleSearchBarSubmit = useCallback(() => {\n // Using ref to get the current field value without waiting for a query debounce\n const query = searchBarRef.current?.value ?? '';\n navigate(`${searchRootRoute}?query=${query}`);\n handleSearchResultClick();\n }, [navigate, handleSearchResultClick, searchRootRoute]);\n\n return (\n <>\n <DialogTitle>\n <Box className={classes.dialogTitle}>\n <SearchBar\n className={classes.input}\n inputProps={{ ref: searchBarRef }}\n onSubmit={handleSearchBarSubmit}\n />\n\n <IconButton aria-label=\"close\" onClick={toggleModal}>\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent>\n <Grid\n container\n direction=\"row-reverse\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid item>\n <Button\n className={classes.button}\n color=\"primary\"\n endIcon={<ArrowForwardIcon />}\n onClick={handleSearchBarSubmit}\n disableRipple\n >\n {t('searchModal.viewFullResults')}\n </Button>\n </Grid>\n </Grid>\n <Divider />\n <SearchResult\n onClick={handleSearchResultClick}\n onKeyDown={handleSearchResultClick}\n >\n {resultItemComponents}\n </SearchResult>\n </DialogContent>\n <DialogActions className={classes.dialogActionsContainer}>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchResultPager />\n </Grid>\n </Grid>\n </DialogActions>\n </>\n );\n};\n\n/**\n * @public\n */\nexport const SearchModal = (props: SearchModalProps) => {\n const {\n open = true,\n hidden,\n toggleModal,\n children,\n resultItemComponents,\n } = props;\n\n const classes = useStyles();\n\n return (\n <Dialog\n classes={{\n paperFullWidth: classes.paperFullWidth,\n }}\n onClose={toggleModal}\n aria-label=\"Search Modal\"\n aria-modal=\"true\"\n fullWidth\n maxWidth=\"lg\"\n open={open}\n hidden={hidden}\n >\n {open && (\n <SearchContextProvider inheritParentContextIfAvailable>\n {(children &&\n children({\n toggleModal,\n resultItemComponents: resultItemComponents || [],\n })) ?? (\n <Modal\n toggleModal={toggleModal}\n resultItemComponents={resultItemComponents}\n />\n )}\n </SearchContextProvider>\n )}\n </Dialog>\n );\n};\n"],"names":[],"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AAQ;AAAA,OAC1B;AAAA,MACA,OAAA,EAAS,WAAA;AAAA,MACT,YAAA,EAAW,cAAA;AAAA,MACX,YAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAS,IAAA;AAAA,MACT,QAAA,EAAS,IAAA;AAAA,MACT,IAAA;AAAA,MACA,MAAA;AAAA,MAEC,kCACC,GAAA,CAAC,qBAAA,EAAA,EAAsB,+BAAA,EAA+B,IAAA,EAClD,uBACA,QAAA,CAAS;AAAA,QACP,WAAA;AAAA,QACA,oBAAA,EAAsB,wBAAwB;AAAC,OAChD,CAAA,qBACD,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA;AAAA;AAAA,OACF,EAEJ;AAAA;AAAA,GAEJ;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useCallback, useContext } from 'react';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import { createVersionedValueMap, createVersionedContext } from '@backstage/version-bridge';
|
|
5
5
|
import useUpdateEffect from 'react-use/esm/useUpdateEffect';
|
|
6
6
|
|
|
7
7
|
const SearchModalContext = createVersionedContext("search-modal-context");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchModal.esm.js","sources":["../../../src/components/SearchModal/useSearchModal.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 { ReactNode, useCallback, useContext, useState } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport useUpdateEffect from 'react-use/esm/useUpdateEffect';\n\n/**\n * The state of the search modal, as well as functions for changing the modal's\n * visibility.\n *\n * @public\n */\nexport type SearchModalValue = {\n state: {\n hidden: boolean;\n open: boolean;\n };\n toggleModal: () => void;\n setOpen: (open: boolean) => void;\n};\n\nconst SearchModalContext = createVersionedContext<{\n 1: SearchModalValue | undefined;\n}>('search-modal-context');\n\n/**\n * Props for the SearchModalProvider.\n * @public\n */\nexport type SearchModalProviderProps = {\n /**\n * Children which should have access to the SearchModal context and the\n * associated useSearchModal() hook.\n */\n children: ReactNode;\n\n /**\n * Pass true if the modal should be rendered initially.\n */\n showInitially?: boolean;\n};\n\n/**\n * A context provider responsible for storing and managing state related to the\n * search modal.\n *\n * @remarks\n * If you need to control visibility of the search toggle outside of the modal\n * itself, you can optionally place this higher up in the react tree where your\n * custom code and the search modal share the same context.\n *\n * @example\n * ```tsx\n * import {\n * SearchModalProvider,\n * SidebarSearchModal,\n * } from '@backstage/plugin-search';\n *\n * // ...\n *\n * <SearchModalProvider>\n * <KeyboardShortcutSearchToggler />\n * <SidebarSearchModal>\n * {({ toggleModal }) => <SearchModal toggleModal={toggleModal} />}\n * </SidebarSearchModal>\n * </SearchModalProvider>\n * ```\n *\n * @public\n */\nexport const SearchModalProvider = (props: SearchModalProviderProps) => {\n const value = useSearchModal(props.showInitially);\n const versionedValue = createVersionedValueMap({ 1: value });\n return (\n <SearchModalContext.Provider value={versionedValue}>\n {props.children}\n </SearchModalContext.Provider>\n );\n};\n\n/**\n * Use this hook to manage the state of {@link SearchModal}\n * and change its visibility. Monitors route changes setting the hidden state\n * to avoid having to call toggleModal on every result click.\n *\n * @public\n *\n * @param initialState - pass `true` to make the modal initially visible\n * @returns an object containing the state of the modal together with\n * functions for changing the visibility of the modal.\n */\nexport function useSearchModal(initialState = false) {\n const [state, setState] = useState({\n hidden: !initialState,\n open: initialState,\n });\n\n const toggleModal = useCallback(\n () =>\n setState(prevState => ({\n open: true,\n hidden: !prevState.hidden,\n })),\n [],\n );\n\n const setOpen = useCallback(\n (open: boolean) =>\n setState(prevState => ({\n open: prevState.open || open,\n hidden: !open,\n })),\n [],\n );\n\n // Check for any existing parent context.\n const parentContext = useContext(SearchModalContext);\n const parentContextValue = parentContext?.atVersion(1);\n const isParentContextPresent = !!parentContextValue?.state;\n\n // Monitor route changes to automatically hide the modal.\n const location = useLocation();\n const locationKey = `${location.pathname}${location.search}${location.hash}`;\n useUpdateEffect(() => {\n setState(prevState => ({\n open: prevState.open,\n hidden: true,\n }));\n }, [locationKey]);\n\n // Inherit from parent context, if set.\n return isParentContextPresent\n ? parentContextValue\n : { state, toggleModal, setOpen };\n}\n"],"names":[],"mappings":";;;;;;AAuCA,MAAM,kBAAA,GAAqB,uBAExB,sBAAsB,CAAA;AA+
|
|
1
|
+
{"version":3,"file":"useSearchModal.esm.js","sources":["../../../src/components/SearchModal/useSearchModal.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 { ReactNode, useCallback, useContext, useState } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport useUpdateEffect from 'react-use/esm/useUpdateEffect';\n\n/**\n * The state of the search modal, as well as functions for changing the modal's\n * visibility.\n *\n * @public\n */\nexport type SearchModalValue = {\n state: {\n hidden: boolean;\n open: boolean;\n };\n toggleModal: () => void;\n setOpen: (open: boolean) => void;\n};\n\nconst SearchModalContext = createVersionedContext<{\n 1: SearchModalValue | undefined;\n}>('search-modal-context');\n\n/**\n * Props for the SearchModalProvider.\n * @public\n */\nexport type SearchModalProviderProps = {\n /**\n * Children which should have access to the SearchModal context and the\n * associated useSearchModal() hook.\n */\n children: ReactNode;\n\n /**\n * Pass true if the modal should be rendered initially.\n */\n showInitially?: boolean;\n};\n\n/**\n * A context provider responsible for storing and managing state related to the\n * search modal.\n *\n * @remarks\n * If you need to control visibility of the search toggle outside of the modal\n * itself, you can optionally place this higher up in the react tree where your\n * custom code and the search modal share the same context.\n *\n * @example\n * ```tsx\n * import {\n * SearchModalProvider,\n * SidebarSearchModal,\n * } from '@backstage/plugin-search';\n *\n * // ...\n *\n * <SearchModalProvider>\n * <KeyboardShortcutSearchToggler />\n * <SidebarSearchModal>\n * {({ toggleModal }) => <SearchModal toggleModal={toggleModal} />}\n * </SidebarSearchModal>\n * </SearchModalProvider>\n * ```\n *\n * @public\n */\nexport const SearchModalProvider = (props: SearchModalProviderProps) => {\n const value = useSearchModal(props.showInitially);\n const versionedValue = createVersionedValueMap({ 1: value });\n return (\n <SearchModalContext.Provider value={versionedValue}>\n {props.children}\n </SearchModalContext.Provider>\n );\n};\n\n/**\n * Use this hook to manage the state of {@link SearchModal}\n * and change its visibility. Monitors route changes setting the hidden state\n * to avoid having to call toggleModal on every result click.\n *\n * @public\n *\n * @param initialState - pass `true` to make the modal initially visible\n * @returns an object containing the state of the modal together with\n * functions for changing the visibility of the modal.\n */\nexport function useSearchModal(initialState = false) {\n const [state, setState] = useState({\n hidden: !initialState,\n open: initialState,\n });\n\n const toggleModal = useCallback(\n () =>\n setState(prevState => ({\n open: true,\n hidden: !prevState.hidden,\n })),\n [],\n );\n\n const setOpen = useCallback(\n (open: boolean) =>\n setState(prevState => ({\n open: prevState.open || open,\n hidden: !open,\n })),\n [],\n );\n\n // Check for any existing parent context.\n const parentContext = useContext(SearchModalContext);\n const parentContextValue = parentContext?.atVersion(1);\n const isParentContextPresent = !!parentContextValue?.state;\n\n // Monitor route changes to automatically hide the modal.\n const location = useLocation();\n const locationKey = `${location.pathname}${location.search}${location.hash}`;\n useUpdateEffect(() => {\n setState(prevState => ({\n open: prevState.open,\n hidden: true,\n }));\n }, [locationKey]);\n\n // Inherit from parent context, if set.\n return isParentContextPresent\n ? parentContextValue\n : { state, toggleModal, setOpen };\n}\n"],"names":[],"mappings":";;;;;;AAuCA,MAAM,kBAAA,GAAqB,uBAExB,sBAAsB,CAAA;AA+ClB,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAoC;AACtE,EAAA,MAAM,KAAA,GAAQ,cAAA,CAAe,KAAA,CAAM,aAAa,CAAA;AAChD,EAAA,MAAM,cAAA,GAAiB,uBAAA,CAAwB,EAAE,CAAA,EAAG,OAAO,CAAA;AAC3D,EAAA,2BACG,kBAAA,CAAmB,QAAA,EAAnB,EAA4B,KAAA,EAAO,cAAA,EACjC,gBAAM,QAAA,EACT,CAAA;AAEJ;AAaO,SAAS,cAAA,CAAe,eAAe,KAAA,EAAO;AACnD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA,CAAS;AAAA,IACjC,QAAQ,CAAC,YAAA;AAAA,IACT,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,MAAM,WAAA,GAAc,WAAA;AAAA,IAClB,MACE,SAAS,CAAA,SAAA,MAAc;AAAA,MACrB,IAAA,EAAM,IAAA;AAAA,MACN,MAAA,EAAQ,CAAC,SAAA,CAAU;AAAA,KACrB,CAAE,CAAA;AAAA,IACJ;AAAC,GACH;AAEA,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACd,CAAC,IAAA,KACC,QAAA,CAAS,CAAA,SAAA,MAAc;AAAA,MACrB,IAAA,EAAM,UAAU,IAAA,IAAQ,IAAA;AAAA,MACxB,QAAQ,CAAC;AAAA,KACX,CAAE,CAAA;AAAA,IACJ;AAAC,GACH;AAGA,EAAA,MAAM,aAAA,GAAgB,WAAW,kBAAkB,CAAA;AACnD,EAAA,MAAM,kBAAA,GAAqB,aAAA,EAAe,SAAA,CAAU,CAAC,CAAA;AACrD,EAAA,MAAM,sBAAA,GAAyB,CAAC,CAAC,kBAAA,EAAoB,KAAA;AAGrD,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,WAAA,GAAc,GAAG,QAAA,CAAS,QAAQ,GAAG,QAAA,CAAS,MAAM,CAAA,EAAG,QAAA,CAAS,IAAI,CAAA,CAAA;AAC1E,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAA,QAAA,CAAS,CAAA,SAAA,MAAc;AAAA,MACrB,MAAM,SAAA,CAAU,IAAA;AAAA,MAChB,MAAA,EAAQ;AAAA,KACV,CAAE,CAAA;AAAA,EACJ,CAAA,EAAG,CAAC,WAAW,CAAC,CAAA;AAGhB,EAAA,OAAO,sBAAA,GACH,kBAAA,GACA,EAAE,KAAA,EAAO,aAAa,OAAA,EAAQ;AACpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchPage.esm.js","sources":["../../../src/components/SearchPage/SearchPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { useEffect } from 'react';\nimport usePrevious from 'react-use/esm/usePrevious';\nimport qs from 'qs';\nimport { useLocation, useOutlet } from 'react-router-dom';\nimport {\n SearchContextProvider,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport { JsonObject } from '@backstage/types';\n\nexport const UrlUpdater = () => {\n const location = useLocation();\n const {\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n filters,\n setFilters,\n } = useSearch();\n\n const prevQueryParams = usePrevious(location.search);\n useEffect(() => {\n // Only respond to changes to url query params\n if (location.search === prevQueryParams) {\n return;\n }\n\n const query =\n qs.parse(location.search.substring(1), { arrayLimit: 0 }) || {};\n\n if (query.filters) {\n setFilters(query.filters as JsonObject);\n }\n\n if (query.query) {\n setTerm(query.query as string);\n }\n\n if (query.pageCursor) {\n setPageCursor(query.pageCursor as string);\n }\n\n if (query.types) {\n setTypes(query.types as string[]);\n }\n }, [prevQueryParams, location, setTerm, setTypes, setPageCursor, setFilters]);\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n query: term,\n types,\n pageCursor,\n filters,\n },\n { arrayFormat: 'brackets' },\n );\n const newUrl = `${window.location.pathname}?${newParams}`;\n\n // We directly manipulate window history here in order to not re-render\n // infinitely (state => location => state => etc). The intention of this\n // code is just to ensure the right query/filters are loaded when a user\n // clicks the \"back\" button after clicking a result.\n window.history.replaceState(null, document.title, newUrl);\n }, [term, types, pageCursor, filters]);\n\n return null;\n};\n\n/**\n * @public\n */\nexport const SearchPage = () => {\n const outlet = useOutlet();\n\n return (\n <SearchContextProvider>\n <UrlUpdater />\n {outlet}\n </SearchContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SearchPage.esm.js","sources":["../../../src/components/SearchPage/SearchPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { useEffect } from 'react';\nimport usePrevious from 'react-use/esm/usePrevious';\nimport qs from 'qs';\nimport { useLocation, useOutlet } from 'react-router-dom';\nimport {\n SearchContextProvider,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport { JsonObject } from '@backstage/types';\n\nexport const UrlUpdater = () => {\n const location = useLocation();\n const {\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n filters,\n setFilters,\n } = useSearch();\n\n const prevQueryParams = usePrevious(location.search);\n useEffect(() => {\n // Only respond to changes to url query params\n if (location.search === prevQueryParams) {\n return;\n }\n\n const query =\n qs.parse(location.search.substring(1), { arrayLimit: 0 }) || {};\n\n if (query.filters) {\n setFilters(query.filters as JsonObject);\n }\n\n if (query.query) {\n setTerm(query.query as string);\n }\n\n if (query.pageCursor) {\n setPageCursor(query.pageCursor as string);\n }\n\n if (query.types) {\n setTypes(query.types as string[]);\n }\n }, [prevQueryParams, location, setTerm, setTypes, setPageCursor, setFilters]);\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n query: term,\n types,\n pageCursor,\n filters,\n },\n { arrayFormat: 'brackets' },\n );\n const newUrl = `${window.location.pathname}?${newParams}`;\n\n // We directly manipulate window history here in order to not re-render\n // infinitely (state => location => state => etc). The intention of this\n // code is just to ensure the right query/filters are loaded when a user\n // clicks the \"back\" button after clicking a result.\n window.history.replaceState(null, document.title, newUrl);\n }, [term, types, pageCursor, filters]);\n\n return null;\n};\n\n/**\n * @public\n */\nexport const SearchPage = () => {\n const outlet = useOutlet();\n\n return (\n <SearchContextProvider>\n <UrlUpdater />\n {outlet}\n </SearchContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,MACE,SA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AA,EAAO,UAAA,EAAY,OAAO,CAAC,CAAA;AAErC,EAAA,OAAO,IAAA;AACT;AAKO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,4BACG,qBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,CAAA;AAAA,IACX;AAAA,GAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchType.Accordion.esm.js","sources":["../../../src/components/SearchType/SearchType.Accordion.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { cloneElement, Fragment, useEffect, useState } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { searchApiRef, useSearch } from '@backstage/plugin-search-react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Typography from '@material-ui/core/Typography';\nimport AllIcon from '@material-ui/icons/FontDownload';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n icon: {\n color: theme.palette.text.primary,\n },\n list: {\n width: '100%',\n },\n listItemIcon: {\n width: '24px',\n height: '24px',\n },\n accordion: {\n backgroundColor: theme.palette.background.paper,\n },\n accordionSummary: {\n minHeight: 'auto',\n '&.Mui-expanded': {\n minHeight: 'auto',\n },\n },\n accordionSummaryContent: {\n margin: theme.spacing(2, 0),\n '&.Mui-expanded': {\n margin: theme.spacing(2, 0),\n },\n },\n accordionDetails: {\n padding: theme.spacing(0, 0, 1),\n },\n}));\n\n/**\n * @public\n */\nexport type SearchTypeAccordionProps = {\n name: string;\n types: Array<{\n value: string;\n name: string;\n icon: JSX.Element;\n }>;\n defaultValue?: string;\n showCounts?: boolean;\n};\n\nexport const SearchTypeAccordion = (props: SearchTypeAccordionProps) => {\n const classes = useStyles();\n const { filters, setPageCursor, setTypes, term, types } = useSearch();\n const searchApi = useApi(searchApiRef);\n const [expanded, setExpanded] = useState(true);\n const { defaultValue, name, showCounts, types: givenTypes } = props;\n const { t } = useTranslationRef(searchTranslationRef);\n\n const toggleExpanded = () => setExpanded(prevState => !prevState);\n const handleClick = (type: string) => {\n return () => {\n setTypes(type !== '' ? [type] : []);\n setPageCursor(undefined);\n };\n };\n\n // Handle any provided defaultValue\n useEffect(() => {\n if (defaultValue) {\n setTypes([defaultValue]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const definedTypes = [\n {\n value: '',\n name: t('searchType.accordion.allTitle'),\n icon: <AllIcon />,\n },\n ...givenTypes,\n ];\n const selected = types[0] || '';\n\n const { value: resultCounts } = useAsync(async () => {\n if (!showCounts) {\n return {};\n }\n\n const counts = await Promise.all(\n definedTypes\n .map(type => type.value)\n .map(async type => {\n const { numberOfResults } = await searchApi.query({\n term,\n types: type ? [type] : [],\n filters:\n types.includes(type) || (!types.length && !type) ? filters : {},\n pageLimit: 0,\n });\n\n return [\n type,\n numberOfResults !== undefined\n ? t('searchType.accordion.numberOfResults', {\n number:\n numberOfResults >= 10000 ? `>10000` : `${numberOfResults}`,\n })\n : ' -- ',\n ];\n }),\n );\n\n return Object.fromEntries(counts);\n }, [filters, showCounts, term, types]);\n\n return (\n <Box>\n <Typography variant=\"body2\" component=\"h2\">\n {name}\n </Typography>\n <Accordion\n className={classes.accordion}\n expanded={expanded}\n onChange={toggleExpanded}\n >\n <AccordionSummary\n classes={{\n root: classes.accordionSummary,\n content: classes.accordionSummaryContent,\n }}\n expandIcon={<ExpandMoreIcon className={classes.icon} />}\n IconButtonProps={{ size: 'small' }}\n >\n {expanded\n ? t('searchType.accordion.collapse')\n : definedTypes.filter(type => type.value === selected)[0]!.name}\n </AccordionSummary>\n <AccordionDetails classes={{ root: classes.accordionDetails }}>\n <List\n className={classes.list}\n component=\"nav\"\n aria-label=\"filter by type\"\n disablePadding\n dense\n >\n {definedTypes.map(type => (\n <Fragment key={type.value}>\n <Divider />\n <ListItem\n selected={\n types[0] === type.value ||\n (types.length === 0 && type.value === '')\n }\n onClick={handleClick(type.value)}\n button\n >\n <ListItemIcon>\n {cloneElement(type.icon, {\n className: classes.listItemIcon,\n })}\n </ListItemIcon>\n <ListItemText\n primary={type.name}\n secondary={resultCounts && resultCounts[type.value]}\n />\n </ListItem>\n </Fragment>\n ))}\n </List>\n </AccordionDetails>\n </Accordion>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA;AAAA,GACT;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,SAAW,EAAA;AAAA,IACT,eAAA,EAAiB,KAAM,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AW,EAAA,gBAAA;AAAA,cACX,cAAc,EAAA,IAAA;AAAA,cACd,KAAK,EAAA,IAAA;AAAA,cAEJ,QAAa,EAAA,YAAA,CAAA,GAAA,CAAI,CAChB,IAAA,qBAAA,IAAA,CAAC,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,CAAA;AAAA,gCACT,IAAA;AAAA,kBAAC,QAAA;AAAA,kBAAA;AAAA,oBACC,QAAA,EACE,KAAM,CAAA,CAAC,CAAM,KAAA,IAAA,CAAK,SACjB,KAAM,CAAA,MAAA,KAAW,CAAK,IAAA,IAAA,CAAK,KAAU,KAAA,EAAA;AAAA,oBAExC,OAAA,EAAS,WAAY,CAAA,IAAA,CAAK,KAAK,CAAA;AAAA,oBAC/B,MAAM,EAAA,IAAA;AAAA,oBAEN,QAAA,EAAA;AAAA,sCAAC,GAAA,CAAA,YAAA,EAAA,EACE,QAAa,EAAA,YAAA,CAAA,IAAA,CAAK,IAAM,EAAA;AAAA,wBACvB,WAAW,OAAQ,CAAA;AAAA,uBACpB,CACH,EAAA,CAAA;AAAA,sCACA,GAAA;AAAA,wBAAC,YAAA;AAAA,wBAAA;AAAA,0BACC,SAAS,IAAK,CAAA,IAAA;AAAA,0BACd,SAAW,EAAA,YAAA,IAAgB,YAAa,CAAA,IAAA,CAAK,KAAK;AAAA;AAAA;AACpD;AAAA;AAAA;AACF,eAnBa,EAAA,EAAA,IAAA,CAAK,KAoBpB,CACD;AAAA;AAAA,WAEL,EAAA;AAAA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchType.Accordion.esm.js","sources":["../../../src/components/SearchType/SearchType.Accordion.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { cloneElement, Fragment, useEffect, useState } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { searchApiRef, useSearch } from '@backstage/plugin-search-react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Typography from '@material-ui/core/Typography';\nimport AllIcon from '@material-ui/icons/FontDownload';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n icon: {\n color: theme.palette.text.primary,\n },\n list: {\n width: '100%',\n },\n listItemIcon: {\n width: '24px',\n height: '24px',\n },\n accordion: {\n backgroundColor: theme.palette.background.paper,\n },\n accordionSummary: {\n minHeight: 'auto',\n '&.Mui-expanded': {\n minHeight: 'auto',\n },\n },\n accordionSummaryContent: {\n margin: theme.spacing(2, 0),\n '&.Mui-expanded': {\n margin: theme.spacing(2, 0),\n },\n },\n accordionDetails: {\n padding: theme.spacing(0, 0, 1),\n },\n}));\n\n/**\n * @public\n */\nexport type SearchTypeAccordionProps = {\n name: string;\n types: Array<{\n value: string;\n name: string;\n icon: JSX.Element;\n }>;\n defaultValue?: string;\n showCounts?: boolean;\n};\n\nexport const SearchTypeAccordion = (props: SearchTypeAccordionProps) => {\n const classes = useStyles();\n const { filters, setPageCursor, setTypes, term, types } = useSearch();\n const searchApi = useApi(searchApiRef);\n const [expanded, setExpanded] = useState(true);\n const { defaultValue, name, showCounts, types: givenTypes } = props;\n const { t } = useTranslationRef(searchTranslationRef);\n\n const toggleExpanded = () => setExpanded(prevState => !prevState);\n const handleClick = (type: string) => {\n return () => {\n setTypes(type !== '' ? [type] : []);\n setPageCursor(undefined);\n };\n };\n\n // Handle any provided defaultValue\n useEffect(() => {\n if (defaultValue) {\n setTypes([defaultValue]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const definedTypes = [\n {\n value: '',\n name: t('searchType.accordion.allTitle'),\n icon: <AllIcon />,\n },\n ...givenTypes,\n ];\n const selected = types[0] || '';\n\n const { value: resultCounts } = useAsync(async () => {\n if (!showCounts) {\n return {};\n }\n\n const counts = await Promise.all(\n definedTypes\n .map(type => type.value)\n .map(async type => {\n const { numberOfResults } = await searchApi.query({\n term,\n types: type ? [type] : [],\n filters:\n types.includes(type) || (!types.length && !type) ? filters : {},\n pageLimit: 0,\n });\n\n return [\n type,\n numberOfResults !== undefined\n ? t('searchType.accordion.numberOfResults', {\n number:\n numberOfResults >= 10000 ? `>10000` : `${numberOfResults}`,\n })\n : ' -- ',\n ];\n }),\n );\n\n return Object.fromEntries(counts);\n }, [filters, showCounts, term, types]);\n\n return (\n <Box>\n <Typography variant=\"body2\" component=\"h2\">\n {name}\n </Typography>\n <Accordion\n className={classes.accordion}\n expanded={expanded}\n onChange={toggleExpanded}\n >\n <AccordionSummary\n classes={{\n root: classes.accordionSummary,\n content: classes.accordionSummaryContent,\n }}\n expandIcon={<ExpandMoreIcon className={classes.icon} />}\n IconButtonProps={{ size: 'small' }}\n >\n {expanded\n ? t('searchType.accordion.collapse')\n : definedTypes.filter(type => type.value === selected)[0]!.name}\n </AccordionSummary>\n <AccordionDetails classes={{ root: classes.accordionDetails }}>\n <List\n className={classes.list}\n component=\"nav\"\n aria-label=\"filter by type\"\n disablePadding\n dense\n >\n {definedTypes.map(type => (\n <Fragment key={type.value}>\n <Divider />\n <ListItem\n selected={\n types[0] === type.value ||\n (types.length === 0 && type.value === '')\n }\n onClick={handleClick(type.value)}\n button\n >\n <ListItemIcon>\n {cloneElement(type.icon, {\n className: classes.listItemIcon,\n })}\n </ListItemIcon>\n <ListItemText\n primary={type.name}\n secondary={resultCounts && resultCounts[type.value]}\n />\n </ListItem>\n </Fragment>\n ))}\n </List>\n </AccordionDetails>\n </Accordion>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA,GAC5C;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,SAAA,EAAW,MAAA;AAAA,IACX,gBAAA,EAAkB;AAAA,MAChB,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,uBAAA,EAAyB;AAAA,IACvB,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAC,CAAA;AAAA,IAC1B,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAC;AAAA;AAC5B,GACF;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,GAAG,CAAC;AAAA;AAElC,CAAA,CAAE,CAAA;AAgBK,MAAM,mBA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/B,MAAA,EAAM,IAAA;AAAA,oBAEN,QAAA,EAAA;AAAA,sCAAA,GAAA,CAAC,YAAA,EAAA,EACE,QAAA,EAAA,YAAA,CAAa,IAAA,CAAK,IAAA,EAAM;AAAA,wBACvB,WAAW,OAAA,CAAQ;AAAA,uBACpB,CAAA,EACH,CAAA;AAAA,sCACA,GAAA;AAAA,wBAAC,YAAA;AAAA,wBAAA;AAAA,0BACC,SAAS,IAAA,CAAK,IAAA;AAAA,0BACd,SAAA,EAAW,YAAA,IAAgB,YAAA,CAAa,IAAA,CAAK,KAAK;AAAA;AAAA;AACpD;AAAA;AAAA;AACF,eAAA,EAAA,EAnBa,IAAA,CAAK,KAoBpB,CACD;AAAA;AAAA,WACH,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchType.Tabs.esm.js","sources":["../../../src/components/SearchType/SearchType.Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { ChangeEvent, useEffect } from 'react';\nimport { useSearch } from '@backstage/plugin-search-react';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Theme } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n tabs: {\n borderBottom: `1px solid ${theme.palette.textVerySubtle}`,\n },\n tab: {\n height: '50px',\n fontWeight: theme.typography.fontWeightBold,\n fontSize: theme.typography.pxToRem(13),\n color: theme.palette.text.primary,\n minWidth: '130px',\n },\n}));\n\n/**\n * @public\n */\nexport type SearchTypeTabsProps = {\n types: Array<{\n value: string;\n name: string;\n }>;\n defaultValue?: string;\n};\n\nexport const SearchTypeTabs = (props: SearchTypeTabsProps) => {\n const classes = useStyles();\n const { setPageCursor, setTypes, types } = useSearch();\n const { defaultValue, types: givenTypes } = props;\n const { t } = useTranslationRef(searchTranslationRef);\n\n const changeTab = (_: ChangeEvent<{}>, newType: string) => {\n setTypes(newType !== '' ? [newType] : []);\n setPageCursor(undefined);\n };\n\n // Handle any provided defaultValue\n useEffect(() => {\n if (defaultValue) {\n setTypes([defaultValue]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const definedTypes = [\n {\n value: '',\n name: t('searchType.tabs.allTitle'),\n },\n ...givenTypes,\n ];\n\n return (\n <Tabs\n aria-label=\"List of search types tabs\"\n className={classes.tabs}\n indicatorColor=\"primary\"\n value={types.length === 0 ? '' : types[0]}\n onChange={changeTab}\n >\n {definedTypes.map((type, idx) => (\n <Tab\n key={idx}\n className={classes.tab}\n label={type.name}\n value={type.value}\n />\n ))}\n </Tabs>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,SAAA,GAAY,
|
|
1
|
+
{"version":3,"file":"SearchType.Tabs.esm.js","sources":["../../../src/components/SearchType/SearchType.Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { ChangeEvent, useEffect } from 'react';\nimport { useSearch } from '@backstage/plugin-search-react';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Theme } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n tabs: {\n borderBottom: `1px solid ${theme.palette.textVerySubtle}`,\n },\n tab: {\n height: '50px',\n fontWeight: theme.typography.fontWeightBold,\n fontSize: theme.typography.pxToRem(13),\n color: theme.palette.text.primary,\n minWidth: '130px',\n },\n}));\n\n/**\n * @public\n */\nexport type SearchTypeTabsProps = {\n types: Array<{\n value: string;\n name: string;\n }>;\n defaultValue?: string;\n};\n\nexport const SearchTypeTabs = (props: SearchTypeTabsProps) => {\n const classes = useStyles();\n const { setPageCursor, setTypes, types } = useSearch();\n const { defaultValue, types: givenTypes } = props;\n const { t } = useTranslationRef(searchTranslationRef);\n\n const changeTab = (_: ChangeEvent<{}>, newType: string) => {\n setTypes(newType !== '' ? [newType] : []);\n setPageCursor(undefined);\n };\n\n // Handle any provided defaultValue\n useEffect(() => {\n if (defaultValue) {\n setTypes([defaultValue]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const definedTypes = [\n {\n value: '',\n name: t('searchType.tabs.allTitle'),\n },\n ...givenTypes,\n ];\n\n return (\n <Tabs\n aria-label=\"List of search types tabs\"\n className={classes.tabs}\n indicatorColor=\"primary\"\n value={types.length === 0 ? '' : types[0]}\n onChange={changeTab}\n >\n {definedTypes.map((type, idx) => (\n <Tab\n key={idx}\n className={classes.tab}\n label={type.name}\n value={type.value}\n />\n ))}\n </Tabs>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,SAAA,GAAY,UAAA,CAAW,CAAC,KAAA,MAAkB;AAAA,EAC9C,IAAA,EAAM;AAAA,IACJ,YAAA,EAAc,CAAA,UAAA,EAA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AAAA,MACX,WAAW,OAAA,CAAQ,IAAA;AAAA,MACnB,cAAA,EAAe,SAAA;AAAA,MACf,OAAO,KAAA,CAAM,MAAA,KAAW,CAAA,GAAI,EAAA,GAAK,MAAM,CAAC,CAAA;AAAA,MACxC,QAAA,EAAU,SAAA;AAAA,MAET,QAAA,EAAA,YAAA,CAAa,GAAA,CAAI,CAAC,IAAA,EAAM,GAAA,qBACvB,GAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UAEC,WAAW,OAAA,CAAQ,GAAA;AAAA,UACnB,OAAO,IAAA,CAAK,IAAA;AAAA,UACZ,OAAO,IAAA,CAAK;AAAA,SAAA;AAAA,QAHP;AAAA,OAKR;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchType.esm.js","sources":["../../../src/components/SearchType/SearchType.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Chip from '@material-ui/core/Chip';\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ChangeEvent } from 'react';\nimport useEffectOnce from 'react-use/esm/useEffectOnce';\nimport {\n SearchTypeAccordion,\n SearchTypeAccordionProps,\n} from './SearchType.Accordion';\nimport { SearchTypeTabs, SearchTypeTabsProps } from './SearchType.Tabs';\nimport { useSearch } from '@backstage/plugin-search-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n textTransform: 'capitalize',\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap',\n marginTop: theme.spacing(1),\n },\n chip: {\n margin: 2,\n },\n}));\n\n/**\n * Props for {@link SearchType}.\n *\n * @public\n */\nexport type SearchTypeProps = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\n/**\n * @public\n */\nconst SearchType = (props: SearchTypeProps) => {\n const { className, defaultValue, name, values = [] } = props;\n const classes = useStyles();\n const { types, setTypes } = useSearch();\n const { t } = useTranslationRef(searchTranslationRef);\n\n useEffectOnce(() => {\n if (!types.length) {\n if (defaultValue && Array.isArray(defaultValue)) {\n setTypes(defaultValue);\n } else if (defaultValue) {\n setTypes([defaultValue]);\n }\n }\n });\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const value = e.target.value as string[];\n setTypes(value as string[]);\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-typefilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n multiple\n variant=\"outlined\"\n value={types}\n onChange={handleChange}\n placeholder={t('searchType.allResults')}\n renderValue={selected => (\n <div className={classes.chips}>\n {(selected as string[]).map(value => (\n <Chip\n key={value}\n label={value}\n className={classes.chip}\n size=\"small\"\n />\n ))}\n </div>\n )}\n >\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n <Checkbox checked={types.indexOf(value) > -1} />\n <ListItemText primary={value} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\n/**\n * A control surface for the search query's \"types\" property, displayed as a\n * single-select collapsible accordion suitable for use in faceted search UIs.\n * @public\n */\nSearchType.Accordion = (props: SearchTypeAccordionProps) => {\n return <SearchTypeAccordion {...props} />;\n};\n\n/**\n * A control surface for the search query's \"types\" property, displayed as a\n * tabs suitable for use in faceted search UIs.\n * @public\n */\nSearchType.Tabs = (props: SearchTypeTabsProps) => {\n return <SearchTypeTabs {...props} />;\n};\n\nexport { SearchType };\nexport type { SearchTypeAccordionProps, SearchTypeTabsProps };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"SearchType.esm.js","sources":["../../../src/components/SearchType/SearchType.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Chip from '@material-ui/core/Chip';\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ChangeEvent } from 'react';\nimport useEffectOnce from 'react-use/esm/useEffectOnce';\nimport {\n SearchTypeAccordion,\n SearchTypeAccordionProps,\n} from './SearchType.Accordion';\nimport { SearchTypeTabs, SearchTypeTabsProps } from './SearchType.Tabs';\nimport { useSearch } from '@backstage/plugin-search-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n textTransform: 'capitalize',\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap',\n marginTop: theme.spacing(1),\n },\n chip: {\n margin: 2,\n },\n}));\n\n/**\n * Props for {@link SearchType}.\n *\n * @public\n */\nexport type SearchTypeProps = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\n/**\n * @public\n */\nconst SearchType = (props: SearchTypeProps) => {\n const { className, defaultValue, name, values = [] } = props;\n const classes = useStyles();\n const { types, setTypes } = useSearch();\n const { t } = useTranslationRef(searchTranslationRef);\n\n useEffectOnce(() => {\n if (!types.length) {\n if (defaultValue && Array.isArray(defaultValue)) {\n setTypes(defaultValue);\n } else if (defaultValue) {\n setTypes([defaultValue]);\n }\n }\n });\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const value = e.target.value as string[];\n setTypes(value as string[]);\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-typefilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n multiple\n variant=\"outlined\"\n value={types}\n onChange={handleChange}\n placeholder={t('searchType.allResults')}\n renderValue={selected => (\n <div className={classes.chips}>\n {(selected as string[]).map(value => (\n <Chip\n key={value}\n label={value}\n className={classes.chip}\n size=\"small\"\n />\n ))}\n </div>\n )}\n >\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n <Checkbox checked={types.indexOf(value) > -1} />\n <ListItemText primary={value} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\n/**\n * A control surface for the search query's \"types\" property, displayed as a\n * single-select collapsible accordion suitable for use in faceted search UIs.\n * @public\n */\nSearchType.Accordion = (props: SearchTypeAccordionProps) => {\n return <SearchTypeAccordion {...props} />;\n};\n\n/**\n * A control surface for the search query's \"types\" property, displayed as a\n * tabs suitable for use in faceted search UIs.\n * @public\n */\nSearchType.Tabs = (props: SearchTypeTabsProps) => {\n return <SearchTypeTabs {...props} />;\n};\n\nexport { SearchType };\nexport type { SearchTypeAccordionProps, SearchTypeTabsProps };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAM,SA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AAChD,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,KAAA,EAAO,CAAA;AACpC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarSearch.esm.js","sources":["../../../src/components/SidebarSearch/SidebarSearch.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../../plugin';\n\nimport { useRouteRef, IconComponent } from '@backstage/core-plugin-api';\nimport { SidebarSearchField, useContent } from '@backstage/core-components';\n\n/**\n * Props for {@link SidebarSearch}.\n *\n * @public\n */\nexport type SidebarSearchProps = {\n icon?: IconComponent;\n};\n\n/**\n * @public\n */\nexport const SidebarSearch = (props: SidebarSearchProps) => {\n const searchRoute = useRouteRef(rootRouteRef);\n const { focusContent } = useContent();\n const navigate = useNavigate();\n const handleSearch = useCallback(\n (query: string): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n focusContent();\n navigate(`${searchRoute()}${queryString}`);\n },\n [focusContent, navigate, searchRoute],\n );\n\n return (\n <SidebarSearchField\n icon={props.icon}\n onSearch={handleSearch}\n to=\"/search\"\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SidebarSearch.esm.js","sources":["../../../src/components/SidebarSearch/SidebarSearch.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../../plugin';\n\nimport { useRouteRef, IconComponent } from '@backstage/core-plugin-api';\nimport { SidebarSearchField, useContent } from '@backstage/core-components';\n\n/**\n * Props for {@link SidebarSearch}.\n *\n * @public\n */\nexport type SidebarSearchProps = {\n icon?: IconComponent;\n};\n\n/**\n * @public\n */\nexport const SidebarSearch = (props: SidebarSearchProps) => {\n const searchRoute = useRouteRef(rootRouteRef);\n const { focusContent } = useContent();\n const navigate = useNavigate();\n const handleSearch = useCallback(\n (query: string): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n focusContent();\n navigate(`${searchRoute()}${queryString}`);\n },\n [focusContent, navigate, searchRoute],\n );\n\n return (\n <SidebarSearchField\n icon={props.icon}\n onSearch={handleSearch}\n to=\"/search\"\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAmCO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA8B;AAC1D,EAAA,MAAM,WAAA,GAAc,YAAY,YAAY,CAAA;AAC5C,EAAA,MAAM,EAAE,YAAA,EAAa,GAAI,UAAA,EAAW;AACpC,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,KAAA,KAAwB;AACvB,MAAA,MAAM,WAAA,GAAc,GAAG,SAAA,CAAU,EAAE,OAAM,EAAG,EAAE,cAAA,EAAgB,IAAA,EAAM,CAAA;AACpE,MAAA,YAAA,EAAa;AACb,MAAA,QAAA,CAAS,CAAA,EAAG,WAAA,EAAa,CAAA,EAAG,WAAW,CAAA,CAAE,CAAA;AAAA,IAC3C,CAAA;AAAA,IACA,CAAC,YAAA,EAAc,QAAA,EAAU,WAAW;AAAA,GACtC;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,MAAM,KAAA,CAAM,IAAA;AAAA,MACZ,QAAA,EAAU,YAAA;AAAA,MACV,EAAA,EAAG;AAAA;AAAA,GACL;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarSearchModal.esm.js","sources":["../../../src/components/SidebarSearchModal/SidebarSearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport {\n SearchModal,\n SearchModalProps,\n SearchModalProvider,\n useSearchModal,\n} from '../SearchModal';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\n/**\n * Props for {@link SidebarSearchModal}.\n *\n * @public\n */\nexport type SidebarSearchModalProps = Pick<\n SearchModalProps,\n 'children' | 'resultItemComponents'\n> & {\n icon?: IconComponent;\n};\n\nconst SidebarSearchModalContent = (props: SidebarSearchModalProps) => {\n const { state, toggleModal } = useSearchModal();\n const Icon = props.icon ? props.icon : SearchIcon;\n const { t } = useTranslationRef(searchTranslationRef);\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={Icon}\n text={t('sidebarSearchModal.title')}\n onClick={toggleModal}\n />\n <SearchModal\n {...state}\n toggleModal={toggleModal}\n resultItemComponents={props.resultItemComponents}\n children={props.children}\n />\n </>\n );\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n return (\n <SearchModalProvider>\n <SidebarSearchModalContent {...props} />\n </SearchModalProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuCA,MAAM,yBAAA,GAA4B,CAAC,KAAmC
|
|
1
|
+
{"version":3,"file":"SidebarSearchModal.esm.js","sources":["../../../src/components/SidebarSearchModal/SidebarSearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport {\n SearchModal,\n SearchModalProps,\n SearchModalProvider,\n useSearchModal,\n} from '../SearchModal';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchTranslationRef } from '../../translation';\n\n/**\n * Props for {@link SidebarSearchModal}.\n *\n * @public\n */\nexport type SidebarSearchModalProps = Pick<\n SearchModalProps,\n 'children' | 'resultItemComponents'\n> & {\n icon?: IconComponent;\n};\n\nconst SidebarSearchModalContent = (props: SidebarSearchModalProps) => {\n const { state, toggleModal } = useSearchModal();\n const Icon = props.icon ? props.icon : SearchIcon;\n const { t } = useTranslationRef(searchTranslationRef);\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={Icon}\n text={t('sidebarSearchModal.title')}\n onClick={toggleModal}\n />\n <SearchModal\n {...state}\n toggleModal={toggleModal}\n resultItemComponents={props.resultItemComponents}\n children={props.children}\n />\n </>\n );\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n return (\n <SearchModalProvider>\n <SidebarSearchModalContent {...props} />\n </SearchModalProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuCA,MAAM,yBAAA,GAA4B,CAAC,KAAA,KAAmC;AACpE,EAAA,MAAM,EAAE,KAAA,EAAO,WAAA,EAAY,GAAI,cAAA,EAAe;AAC9C,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,IAAA,GAAO,KAAA,CAAM,IAAA,GAAO,UAAA;AACvC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,aAAA;AAAA,QACV,IAAA,EAAM,IAAA;AAAA,QACN,IAAA,EAAM,EAAE,0BAA0B,CAAA;AAAA,QAClC,OAAA,EAAS;AAAA;AAAA,KACX;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,WAAA;AAAA,QACA,sBAAsB,KAAA,CAAM,oBAAA;AAAA,QAC5B,UAAU,KAAA,CAAM;AAAA;AAAA;AAClB,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAAmC;AACpE,EAAA,2BACG,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,yBAAA,EAAA,EAA2B,GAAG,OAAO,CAAA,EACxC,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.esm.js","sources":["../../src/components/util.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../plugin';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const useNavigateToQuery = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n return useCallback(\n ({ query }: { query: string }): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,qBAAqB,MAAM;AACtC,
|
|
1
|
+
{"version":3,"file":"util.esm.js","sources":["../../src/components/util.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../plugin';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const useNavigateToQuery = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n return useCallback(\n ({ query }: { query: string }): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,qBAAqB,MAAM;AACtC,EAAA,MAAM,WAAA,GAAc,YAAY,YAAY,CAAA;AAC5C,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,OAAO,WAAA;AAAA,IACL,CAAC,EAAE,KAAA,EAAM,KAA+B;AACtC,MAAA,MAAM,WAAA,GAAc,GAAG,SAAA,CAAU,EAAE,OAAM,EAAG,EAAE,cAAA,EAAgB,IAAA,EAAM,CAAA;AAEpE,MAAA,QAAA,CAAS,CAAA,EAAG,WAAA,EAAa,CAAA,EAAG,WAAW,CAAA,CAAE,CAAA;AAAA,IAC3C,CAAA;AAAA,IACA,CAAC,UAAU,WAAW;AAAA,GACxB;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -177,17 +177,7 @@ type SearchTypeProps = {
|
|
|
177
177
|
*/
|
|
178
178
|
declare const SearchType: {
|
|
179
179
|
(props: SearchTypeProps): react_jsx_runtime.JSX.Element;
|
|
180
|
-
/**
|
|
181
|
-
* A control surface for the search query's "types" property, displayed as a
|
|
182
|
-
* single-select collapsible accordion suitable for use in faceted search UIs.
|
|
183
|
-
* @public
|
|
184
|
-
*/
|
|
185
180
|
Accordion(props: SearchTypeAccordionProps): react_jsx_runtime.JSX.Element;
|
|
186
|
-
/**
|
|
187
|
-
* A control surface for the search query's "types" property, displayed as a
|
|
188
|
-
* tabs suitable for use in faceted search UIs.
|
|
189
|
-
* @public
|
|
190
|
-
*/
|
|
191
181
|
Tabs(props: SearchTypeTabsProps): react_jsx_runtime.JSX.Element;
|
|
192
182
|
};
|
|
193
183
|
|
package/dist/package.json.esm.js
CHANGED
package/dist/plugin.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SearchClient } from './apis.esm.js';
|
|
2
2
|
import { searchApiRef } from '@backstage/plugin-search-react';
|
|
3
|
-
import { createRouteRef, createPlugin, createApiFactory,
|
|
3
|
+
import { createRouteRef, createPlugin, createApiFactory, fetchApiRef, discoveryApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
4
4
|
|
|
5
5
|
const rootRouteRef = createRouteRef({
|
|
6
6
|
id: "search"
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { SearchClient } from './apis';\nimport { searchApiRef } from '@backstage/plugin-search-react';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n createRoutableExtension,\n discoveryApiRef,\n createComponentExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { SidebarSearchModalProps } from './components/SidebarSearchModal';\n\nexport const rootRouteRef = createRouteRef({\n id: 'search',\n});\n\n/**\n * @public\n */\nexport const searchPlugin = createPlugin({\n id: 'search',\n apis: [\n createApiFactory({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) => {\n return new SearchClient({ discoveryApi, fetchApi });\n },\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const SearchPage = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPage',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const SidebarSearchModal = searchPlugin.provide<\n (props: SidebarSearchModalProps) => JSX.Element | null\n>(\n createComponentExtension({\n name: 'SidebarSearchModal',\n component: {\n lazy: () =>\n import('./components/SidebarSearchModal').then(\n m => m.SidebarSearchModal,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const HomePageSearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'HomePageSearchBar',\n component: {\n lazy: () =>\n import('./components/HomePageComponent').then(m => m.HomePageSearchBar),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AA6BO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { SearchClient } from './apis';\nimport { searchApiRef } from '@backstage/plugin-search-react';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n createRoutableExtension,\n discoveryApiRef,\n createComponentExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { SidebarSearchModalProps } from './components/SidebarSearchModal';\n\nexport const rootRouteRef = createRouteRef({\n id: 'search',\n});\n\n/**\n * @public\n */\nexport const searchPlugin = createPlugin({\n id: 'search',\n apis: [\n createApiFactory({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) => {\n return new SearchClient({ discoveryApi, fetchApi });\n },\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const SearchPage = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPage',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const SidebarSearchModal = searchPlugin.provide<\n (props: SidebarSearchModalProps) => JSX.Element | null\n>(\n createComponentExtension({\n name: 'SidebarSearchModal',\n component: {\n lazy: () =>\n import('./components/SidebarSearchModal').then(\n m => m.SidebarSearchModal,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const HomePageSearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'HomePageSearchBar',\n component: {\n lazy: () =>\n import('./components/HomePageComponent').then(m => m.HomePageSearchBar),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AA6BO,MAAM,eAAe,cAAA,CAAe;AAAA,EACzC,EAAA,EAAI;AACN,CAAC;AAKM,MAAM,eAAe,YAAA,CAAa;AAAA,EACvC,EAAA,EAAI,QAAA;AAAA,EACJ,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,YAAA;AAAA,MACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,UAAS,KAAM;AACvC,QAAA,OAAO,IAAI,YAAA,CAAa,EAAE,YAAA,EAAc,UAAU,CAAA;AAAA,MACpD;AAAA,KACD;AAAA,GACH;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA;AAEV,CAAC;AAKM,MAAM,aAAa,YAAA,CAAa,OAAA;AAAA,EACrC,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,YAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,sCAAyB,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAA,EAAY;AAAA,GACb;AACH;AAKO,MAAM,qBAAqB,YAAA,CAAa,OAAA;AAAA,EAG7C,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,oBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,8CAAiC,CAAA,CAAE,IAAA;AAAA,QACxC,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;AAKO,MAAM,oBAAoB,YAAA,CAAa,OAAA;AAAA,EAC5C,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,mBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,6CAAgC,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,iBAAiB;AAAA;AAC1E,GACD;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/**\n * @alpha\n */\nexport const searchTranslationRef = createTranslationRef({\n id: 'search',\n messages: {\n searchModal: {\n viewFullResults: 'View Full Results',\n },\n searchType: {\n allResults: 'All Results',\n tabs: {\n allTitle: 'All',\n },\n accordion: {\n allTitle: 'All',\n collapse: 'Collapse',\n numberOfResults: '{{number}} results',\n },\n },\n sidebarSearchModal: {\n title: 'Search',\n },\n },\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/**\n * @alpha\n */\nexport const searchTranslationRef = createTranslationRef({\n id: 'search',\n messages: {\n searchModal: {\n viewFullResults: 'View Full Results',\n },\n searchType: {\n allResults: 'All Results',\n tabs: {\n allTitle: 'All',\n },\n accordion: {\n allTitle: 'All',\n collapse: 'Collapse',\n numberOfResults: '{{number}} results',\n },\n },\n sidebarSearchModal: {\n title: 'Search',\n },\n },\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,uBAAuB,oBAAA,CAAqB;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,UAAA,EAAY;AAAA,MACV,UAAA,EAAY,aAAA;AAAA,MACZ,IAAA,EAAM;AAAA,QACJ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,SAAA,EAAW;AAAA,QACT,QAAA,EAAU,KAAA;AAAA,QACV,QAAA,EAAU,UAAA;AAAA,QACV,eAAA,EAAiB;AAAA;AACnB,KACF;AAAA,IACA,kBAAA,EAAoB;AAAA,MAClB,KAAA,EAAO;AAAA;AACT;AAEJ,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search",
|
|
3
|
-
"version": "1.4.29
|
|
3
|
+
"version": "1.4.29",
|
|
4
4
|
"description": "The Backstage plugin that provides your backstage app with search",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -70,26 +70,26 @@
|
|
|
70
70
|
"test": "backstage-cli package test"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@backstage/core-compat-api": "0.
|
|
74
|
-
"@backstage/core-components": "0.17.5
|
|
75
|
-
"@backstage/core-plugin-api": "1.10.9",
|
|
76
|
-
"@backstage/errors": "1.2.7",
|
|
77
|
-
"@backstage/frontend-plugin-api": "0.11.0
|
|
78
|
-
"@backstage/plugin-catalog-react": "1.20.0
|
|
79
|
-
"@backstage/plugin-search-common": "1.2.19",
|
|
80
|
-
"@backstage/plugin-search-react": "1.9.3
|
|
81
|
-
"@backstage/types": "1.2.1",
|
|
82
|
-
"@backstage/version-bridge": "1.0.11",
|
|
73
|
+
"@backstage/core-compat-api": "^0.5.0",
|
|
74
|
+
"@backstage/core-components": "^0.17.5",
|
|
75
|
+
"@backstage/core-plugin-api": "^1.10.9",
|
|
76
|
+
"@backstage/errors": "^1.2.7",
|
|
77
|
+
"@backstage/frontend-plugin-api": "^0.11.0",
|
|
78
|
+
"@backstage/plugin-catalog-react": "^1.20.0",
|
|
79
|
+
"@backstage/plugin-search-common": "^1.2.19",
|
|
80
|
+
"@backstage/plugin-search-react": "^1.9.3",
|
|
81
|
+
"@backstage/types": "^1.2.1",
|
|
82
|
+
"@backstage/version-bridge": "^1.0.11",
|
|
83
83
|
"@material-ui/core": "^4.12.2",
|
|
84
84
|
"@material-ui/icons": "^4.9.1",
|
|
85
85
|
"qs": "^6.9.4",
|
|
86
86
|
"react-use": "^17.2.4"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@backstage/cli": "0.
|
|
90
|
-
"@backstage/core-app-api": "1.18.0",
|
|
91
|
-
"@backstage/dev-utils": "1.1.13
|
|
92
|
-
"@backstage/test-utils": "1.7.11
|
|
89
|
+
"@backstage/cli": "^0.34.0",
|
|
90
|
+
"@backstage/core-app-api": "^1.18.0",
|
|
91
|
+
"@backstage/dev-utils": "^1.1.13",
|
|
92
|
+
"@backstage/test-utils": "^1.7.11",
|
|
93
93
|
"@testing-library/dom": "^10.0.0",
|
|
94
94
|
"@testing-library/jest-dom": "^6.0.0",
|
|
95
95
|
"@testing-library/react": "^16.0.0",
|