@backstage/plugin-search 0.7.5-next.1 → 0.8.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.8.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.9.4-next.0
9
+ - @backstage/core-plugin-api@1.0.2-next.0
10
+ - @backstage/plugin-catalog-react@1.1.0-next.1
11
+ - @backstage/plugin-search-react@0.2.0-next.1
12
+
13
+ ## 0.8.1-next.0
14
+
15
+ ### Patch Changes
16
+
17
+ - 11a46863de: Fix issue with `HomePageSearchBar` requiring `SearchContext`
18
+ - Updated dependencies
19
+ - @backstage/plugin-catalog-react@1.1.0-next.0
20
+ - @backstage/plugin-search-react@0.1.1-next.0
21
+
22
+ ## 0.8.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 520e21aaea: The following exports has now been fully deleted from this package and can be import from `@backstage/plugin-search-react` instead.
27
+
28
+ `SearchApi` interface.
29
+ `searchApiRef`
30
+ `SearchContextProvider`
31
+ `useSearch`
32
+
33
+ `SearchContext` has now been fully deleted from this package and is no longer exported publicly. Use `SearchContextProvider` when access to the context is needed.
34
+
35
+ ### Patch Changes
36
+
37
+ - 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
38
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
39
+ - 5c062f275e: Support customizing the content of the `SidebarSearchModal`
40
+ - 38e01f2f70: Switch to `SearchDocument` type in `DefaultResultListItem` props
41
+ - 230ad0826f: Bump to using `@types/node` v16
42
+ - ab230a433f: The following exports has been moved to `@backstage/plugin-search-react` and will be removed in the next release. import from `@backstage/plugin-search-react` instead.
43
+
44
+ - `SearchApi` interface.
45
+ - `searchApiRef`
46
+ - `SearchContext`
47
+ - `SearchContextProvider`
48
+ - `useSearch`
49
+
50
+ - Updated dependencies
51
+ - @backstage/plugin-catalog-react@1.0.1
52
+ - @backstage/catalog-model@1.0.1
53
+ - @backstage/core-components@0.9.3
54
+ - @backstage/core-plugin-api@1.0.1
55
+ - @backstage/plugin-search-react@0.1.0
56
+ - @backstage/plugin-search-common@0.3.3
57
+
3
58
  ## 0.7.5-next.1
4
59
 
5
60
  ### Patch Changes
@@ -1,15 +1,12 @@
1
- export { S as SearchPage } from './index-927faa3d.esm.js';
2
- import '@backstage/core-plugin-api';
3
- import '@backstage/errors';
4
- import 'qs';
1
+ export { a as SearchBar, b as SearchBarBase } from './index-a995a1ca.esm.js';
5
2
  import 'react';
6
3
  import '@material-ui/icons/FilterList';
7
4
  import '@material-ui/core';
8
5
  import 'react-use/lib/useDebounce';
6
+ import '@backstage/core-plugin-api';
9
7
  import '@material-ui/icons/Search';
10
8
  import '@material-ui/icons/Clear';
11
- import 'react-use/lib/useAsync';
12
- import 'react-use/lib/usePrevious';
9
+ import '@backstage/plugin-search-react';
13
10
  import '@material-ui/lab';
14
11
  import 'react-use/lib/useAsyncFn';
15
12
  import '@material-ui/icons/Launch';
@@ -18,13 +15,17 @@ import '@backstage/core-components';
18
15
  import 'react-text-truncate';
19
16
  import '@material-ui/icons/ArrowBackIos';
20
17
  import '@material-ui/icons/ArrowForwardIos';
18
+ import '@backstage/errors';
19
+ import 'qs';
20
+ import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
23
23
  import '@material-ui/core/IconButton';
24
+ import 'react-use/lib/useAsync';
24
25
  import '@backstage/plugin-catalog-react';
25
26
  import '@backstage/catalog-model';
26
27
  import 'react-use/lib/useEffectOnce';
27
28
  import '@material-ui/icons/ExpandMore';
28
29
  import '@material-ui/icons/FontDownload';
29
30
  import 'react-router-dom';
30
- //# sourceMappingURL=index-9a79e9c2.esm.js.map
31
+ //# sourceMappingURL=index-03e76ebf.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-03e76ebf.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,15 +1,12 @@
1
- export { D as DefaultResultListItem } from './index-927faa3d.esm.js';
2
- import '@backstage/core-plugin-api';
3
- import '@backstage/errors';
4
- import 'qs';
1
+ export { D as DefaultResultListItem } from './index-a995a1ca.esm.js';
5
2
  import 'react';
6
3
  import '@material-ui/icons/FilterList';
7
4
  import '@material-ui/core';
8
5
  import 'react-use/lib/useDebounce';
6
+ import '@backstage/core-plugin-api';
9
7
  import '@material-ui/icons/Search';
10
8
  import '@material-ui/icons/Clear';
11
- import 'react-use/lib/useAsync';
12
- import 'react-use/lib/usePrevious';
9
+ import '@backstage/plugin-search-react';
13
10
  import '@material-ui/lab';
14
11
  import 'react-use/lib/useAsyncFn';
15
12
  import '@material-ui/icons/Launch';
@@ -18,13 +15,17 @@ import '@backstage/core-components';
18
15
  import 'react-text-truncate';
19
16
  import '@material-ui/icons/ArrowBackIos';
20
17
  import '@material-ui/icons/ArrowForwardIos';
18
+ import '@backstage/errors';
19
+ import 'qs';
20
+ import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
23
23
  import '@material-ui/core/IconButton';
24
+ import 'react-use/lib/useAsync';
24
25
  import '@backstage/plugin-catalog-react';
25
26
  import '@backstage/catalog-model';
26
27
  import 'react-use/lib/useEffectOnce';
27
28
  import '@material-ui/icons/ExpandMore';
28
29
  import '@material-ui/icons/FontDownload';
29
30
  import 'react-router-dom';
30
- //# sourceMappingURL=index-841ba24a.esm.js.map
31
+ //# sourceMappingURL=index-48917ac5.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-48917ac5.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,16 +1,13 @@
1
1
  import React from 'react';
2
2
  import SearchIcon from '@material-ui/icons/Search';
3
3
  import { SidebarItem } from '@backstage/core-components';
4
- import { u as useSearchModal, d as SearchModal } from './index-927faa3d.esm.js';
5
- import '@backstage/core-plugin-api';
6
- import '@backstage/errors';
7
- import 'qs';
4
+ import { u as useSearchModal, d as SearchModal } from './index-a995a1ca.esm.js';
8
5
  import '@material-ui/icons/FilterList';
9
6
  import '@material-ui/core';
10
7
  import 'react-use/lib/useDebounce';
8
+ import '@backstage/core-plugin-api';
11
9
  import '@material-ui/icons/Clear';
12
- import 'react-use/lib/useAsync';
13
- import 'react-use/lib/usePrevious';
10
+ import '@backstage/plugin-search-react';
14
11
  import '@material-ui/lab';
15
12
  import 'react-use/lib/useAsyncFn';
16
13
  import '@material-ui/icons/Launch';
@@ -18,9 +15,13 @@ import '@material-ui/core/styles';
18
15
  import 'react-text-truncate';
19
16
  import '@material-ui/icons/ArrowBackIos';
20
17
  import '@material-ui/icons/ArrowForwardIos';
18
+ import '@backstage/errors';
19
+ import 'qs';
20
+ import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
23
23
  import '@material-ui/core/IconButton';
24
+ import 'react-use/lib/useAsync';
24
25
  import '@backstage/plugin-catalog-react';
25
26
  import '@backstage/catalog-model';
26
27
  import 'react-use/lib/useEffectOnce';
@@ -44,4 +45,4 @@ const SidebarSearchModal = (props) => {
44
45
  };
45
46
 
46
47
  export { SidebarSearchModal };
47
- //# sourceMappingURL=index-6ef71f25.esm.js.map
48
+ //# sourceMappingURL=index-87731096.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-6ef71f25.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 React from 'react';\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport {\n SearchModal,\n SearchModalChildrenProps,\n useSearchModal,\n} from '../SearchModal';\n\nexport type SidebarSearchModalProps = {\n icon?: IconComponent;\n children?: (props: SearchModalChildrenProps) => JSX.Element;\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n const { state, toggleModal } = useSearchModal();\n const Icon = props.icon ? props.icon : SearchIcon;\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={Icon}\n text=\"Search\"\n onClick={toggleModal}\n />\n <SearchModal\n {...state}\n toggleModal={toggleModal}\n children={props.children}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAAC;AAClD,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AACpD,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACpH,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,IAAI,EAAE,IAAI;AACd,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,OAAO,EAAE,WAAW;AACxB,GAAG,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACvD,IAAI,GAAG,KAAK;AACZ,IAAI,WAAW;AACf,IAAI,QAAQ,EAAE,KAAK,CAAC,QAAQ;AAC5B,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"index-87731096.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 React from 'react';\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport {\n SearchModal,\n SearchModalChildrenProps,\n useSearchModal,\n} from '../SearchModal';\n\nexport type SidebarSearchModalProps = {\n icon?: IconComponent;\n children?: (props: SearchModalChildrenProps) => JSX.Element;\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n const { state, toggleModal } = useSearchModal();\n const Icon = props.icon ? props.icon : SearchIcon;\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={Icon}\n text=\"Search\"\n onClick={toggleModal}\n />\n <SearchModal\n {...state}\n toggleModal={toggleModal}\n children={props.children}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAAC;AAClD,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AACpD,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACpH,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,IAAI,EAAE,IAAI;AACd,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,OAAO,EAAE,WAAW;AACxB,GAAG,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACvD,IAAI,GAAG,KAAK;AACZ,IAAI,WAAW;AACf,IAAI,QAAQ,EAAE,KAAK,CAAC,QAAQ;AAC5B,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
@@ -1,17 +1,15 @@
1
1
  import React, { useCallback, useState } from 'react';
2
2
  import { makeStyles } from '@material-ui/core/styles';
3
- import { r as rootRouteRef, b as SearchBarBase } from './index-927faa3d.esm.js';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-a995a1ca.esm.js';
4
4
  import qs from 'qs';
5
5
  import { useNavigate } from 'react-router-dom';
6
6
  import { useRouteRef } from '@backstage/core-plugin-api';
7
- import '@backstage/errors';
8
7
  import '@material-ui/icons/FilterList';
9
8
  import '@material-ui/core';
10
9
  import 'react-use/lib/useDebounce';
11
10
  import '@material-ui/icons/Search';
12
11
  import '@material-ui/icons/Clear';
13
- import 'react-use/lib/useAsync';
14
- import 'react-use/lib/usePrevious';
12
+ import '@backstage/plugin-search-react';
15
13
  import '@material-ui/lab';
16
14
  import 'react-use/lib/useAsyncFn';
17
15
  import '@material-ui/icons/Launch';
@@ -19,9 +17,12 @@ import '@backstage/core-components';
19
17
  import 'react-text-truncate';
20
18
  import '@material-ui/icons/ArrowBackIos';
21
19
  import '@material-ui/icons/ArrowForwardIos';
20
+ import '@backstage/errors';
21
+ import 'react-use/lib/usePrevious';
22
22
  import 'react-router';
23
23
  import '@material-ui/core/InputBase';
24
24
  import '@material-ui/core/IconButton';
25
+ import 'react-use/lib/useAsync';
25
26
  import '@backstage/plugin-catalog-react';
26
27
  import '@backstage/catalog-model';
27
28
  import 'react-use/lib/useEffectOnce';
@@ -64,4 +65,4 @@ const HomePageSearchBar = ({ ...props }) => {
64
65
  };
65
66
 
66
67
  export { HomePageSearchBar };
67
- //# sourceMappingURL=index-d0499309.esm.js.map
68
+ //# sourceMappingURL=index-8bd3badc.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-8bd3badc.esm.js","sources":["../../src/components/util.ts","../../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 */\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","/*\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 React, { useCallback, useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { SearchBarBase, SearchBarBaseProps } from '../SearchBar';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n root: {\n border: '1px solid #555',\n borderRadius: '6px',\n fontSize: '1.5em',\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 *\n * @public\n */\nexport const HomePageSearchBar = ({ ...props }: HomePageSearchBarProps) => {\n const classes = useStyles(props);\n const [query, setQuery] = useState('');\n const handleSearch = useNavigateToQuery();\n\n const handleSubmit = () => {\n handleSearch({ query });\n };\n\n const handleChange = useCallback(\n value => {\n setQuery(value);\n },\n [setQuery],\n );\n\n return (\n <SearchBarBase\n classes={{ root: classes.root }}\n value={query}\n onSubmit={handleSubmit}\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,kBAAkB,GAAG,MAAM;AACxC,EAAE,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;AAChD,EAAE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AACjC,EAAE,OAAO,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK;AACpC,IAAI,MAAM,WAAW,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,IAAI,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AAC/C,GAAG,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9B,CAAC;;ACRD,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,EAAE,IAAI,EAAE;AACR,IAAI,MAAM,EAAE,gBAAgB;AAC5B,IAAI,YAAY,EAAE,KAAK;AACvB,IAAI,QAAQ,EAAE,OAAO;AACrB,GAAG;AACH,CAAC,CAAC,CAAC;AACS,MAAC,iBAAiB,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK;AACnD,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACnC,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AACzC,EAAE,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;AAC5C,EAAE,MAAM,YAAY,GAAG,MAAM;AAC7B,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5B,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAAK,KAAK;AAC9C,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpB,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE;AAC5D,IAAI,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;AACnC,IAAI,KAAK,EAAE,KAAK;AAChB,IAAI,QAAQ,EAAE,YAAY;AAC1B,IAAI,QAAQ,EAAE,YAAY;AAC1B,IAAI,GAAG,KAAK;AACZ,GAAG,CAAC,CAAC;AACL;;;;"}
@@ -1,14 +1,11 @@
1
- import { createApiRef, useApi, AnalyticsContext, useAnalytics, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
2
- import { ResponseError } from '@backstage/errors';
3
- import qs from 'qs';
4
- import React, { createContext, useState, useCallback, useEffect, useContext, useRef, Fragment, cloneElement } from 'react';
1
+ import React, { useEffect, useState, useCallback, useRef, Fragment, cloneElement } from 'react';
5
2
  import FilterListIcon from '@material-ui/icons/FilterList';
6
3
  import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, TextField, Chip, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, Dialog, useTheme, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Tabs, Tab } from '@material-ui/core';
7
4
  import useDebounce from 'react-use/lib/useDebounce';
5
+ import { useAnalytics, useApi, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
8
6
  import SearchIcon from '@material-ui/icons/Search';
9
7
  import ClearButton from '@material-ui/icons/Clear';
10
- import useAsync from 'react-use/lib/useAsync';
11
- import usePrevious from 'react-use/lib/usePrevious';
8
+ import { useSearch, useSearchContextCheck, SearchContextProvider, searchApiRef } from '@backstage/plugin-search-react';
12
9
  import { Autocomplete, Alert } from '@material-ui/lab';
13
10
  import useAsyncFn from 'react-use/lib/useAsyncFn';
14
11
  import LaunchIcon from '@material-ui/icons/Launch';
@@ -17,9 +14,13 @@ import { Link, Progress, ResponseErrorPanel, EmptyState, useContent, Table, useQ
17
14
  import TextTruncate from 'react-text-truncate';
18
15
  import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
19
16
  import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
17
+ import { ResponseError } from '@backstage/errors';
18
+ import qs from 'qs';
19
+ import usePrevious from 'react-use/lib/usePrevious';
20
20
  import { useOutlet, useLocation } from 'react-router';
21
21
  import InputBase$1 from '@material-ui/core/InputBase';
22
22
  import IconButton$1 from '@material-ui/core/IconButton';
23
+ import useAsync from 'react-use/lib/useAsync';
23
24
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
24
25
  import { DEFAULT_NAMESPACE } from '@backstage/catalog-model';
25
26
  import useEffectOnce from 'react-use/lib/useEffectOnce';
@@ -27,28 +28,6 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
27
28
  import AllIcon from '@material-ui/icons/FontDownload';
28
29
  import { useNavigate } from 'react-router-dom';
29
30
 
30
- const searchApiRef = createApiRef({
31
- id: "plugin.search.queryservice"
32
- });
33
- class SearchClient {
34
- constructor(options) {
35
- this.discoveryApi = options.discoveryApi;
36
- this.identityApi = options.identityApi;
37
- }
38
- async query(query) {
39
- const { token } = await this.identityApi.getCredentials();
40
- const queryString = qs.stringify(query);
41
- const url = `${await this.discoveryApi.getBaseUrl("search/query")}?${queryString}`;
42
- const response = await fetch(url, {
43
- headers: token ? { Authorization: `Bearer ${token}` } : {}
44
- });
45
- if (!response.ok) {
46
- throw await ResponseError.fromResponse(response);
47
- }
48
- return response.json();
49
- }
50
- }
51
-
52
31
  const useStyles$b = makeStyles((theme) => ({
53
32
  filters: {
54
33
  width: "250px",
@@ -147,73 +126,6 @@ const Filters$1 = ({
147
126
  }))))));
148
127
  };
149
128
 
150
- const SearchContext = createContext(void 0);
151
- const searchInitialState = {
152
- term: "",
153
- pageCursor: void 0,
154
- filters: {},
155
- types: []
156
- };
157
- const SearchContextProvider = ({
158
- initialState = searchInitialState,
159
- children
160
- }) => {
161
- var _a, _b, _c, _d;
162
- const searchApi = useApi(searchApiRef);
163
- const [pageCursor, setPageCursor] = useState(initialState.pageCursor);
164
- const [filters, setFilters] = useState(initialState.filters);
165
- const [term, setTerm] = useState(initialState.term);
166
- const [types, setTypes] = useState(initialState.types);
167
- const prevTerm = usePrevious(term);
168
- const result = useAsync(() => searchApi.query({
169
- term,
170
- filters,
171
- pageCursor,
172
- types
173
- }), [term, filters, types, pageCursor]);
174
- const hasNextPage = !result.loading && !result.error && ((_a = result.value) == null ? void 0 : _a.nextPageCursor);
175
- const hasPreviousPage = !result.loading && !result.error && ((_b = result.value) == null ? void 0 : _b.previousPageCursor);
176
- const fetchNextPage = useCallback(() => {
177
- var _a2;
178
- setPageCursor((_a2 = result.value) == null ? void 0 : _a2.nextPageCursor);
179
- }, [(_c = result.value) == null ? void 0 : _c.nextPageCursor]);
180
- const fetchPreviousPage = useCallback(() => {
181
- var _a2;
182
- setPageCursor((_a2 = result.value) == null ? void 0 : _a2.previousPageCursor);
183
- }, [(_d = result.value) == null ? void 0 : _d.previousPageCursor]);
184
- useEffect(() => {
185
- if (term && prevTerm && term !== prevTerm) {
186
- setPageCursor(void 0);
187
- }
188
- }, [term, prevTerm, initialState.pageCursor]);
189
- const value = {
190
- result,
191
- filters,
192
- setFilters,
193
- term,
194
- setTerm,
195
- types,
196
- setTypes,
197
- pageCursor,
198
- setPageCursor,
199
- fetchNextPage: hasNextPage ? fetchNextPage : void 0,
200
- fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : void 0
201
- };
202
- return /* @__PURE__ */ React.createElement(AnalyticsContext, {
203
- attributes: { searchTypes: types.sort().join(",") }
204
- }, /* @__PURE__ */ React.createElement(SearchContext.Provider, {
205
- value,
206
- children
207
- }));
208
- };
209
- const useSearch = () => {
210
- const context = useContext(SearchContext);
211
- if (context === void 0) {
212
- throw new Error("useSearch must be used within a SearchContextProvider");
213
- }
214
- return context;
215
- };
216
-
217
129
  const TrackSearch = ({ children }) => {
218
130
  const analytics = useAnalytics();
219
131
  const { term } = useSearch();
@@ -225,10 +137,6 @@ const TrackSearch = ({ children }) => {
225
137
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
226
138
  };
227
139
 
228
- const useSearchContextCheck = () => {
229
- const context = useContext(SearchContext);
230
- return context !== void 0;
231
- };
232
140
  const SearchBarBase = ({
233
141
  onChange,
234
142
  onKeyDown,
@@ -596,6 +504,25 @@ const SearchResultPager = () => {
596
504
  }, "Next"));
597
505
  };
598
506
 
507
+ class SearchClient {
508
+ constructor(options) {
509
+ this.discoveryApi = options.discoveryApi;
510
+ this.identityApi = options.identityApi;
511
+ }
512
+ async query(query) {
513
+ const { token } = await this.identityApi.getCredentials();
514
+ const queryString = qs.stringify(query);
515
+ const url = `${await this.discoveryApi.getBaseUrl("search/query")}?${queryString}`;
516
+ const response = await fetch(url, {
517
+ headers: token ? { Authorization: `Bearer ${token}` } : {}
518
+ });
519
+ if (!response.ok) {
520
+ throw await ResponseError.fromResponse(response);
521
+ }
522
+ return response.json();
523
+ }
524
+ }
525
+
599
526
  const rootRouteRef = createRouteRef({
600
527
  id: "search"
601
528
  });
@@ -620,54 +547,54 @@ const searchPlugin = createPlugin({
620
547
  });
621
548
  const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
622
549
  name: "SearchPage",
623
- component: () => import('./index-9a79e9c2.esm.js').then((m) => m.SearchPage),
550
+ component: () => import('./index-c4f0d862.esm.js').then((m) => m.SearchPage),
624
551
  mountPoint: rootRouteRef
625
552
  }));
626
553
  const SearchPageNext = searchPlugin.provide(createRoutableExtension({
627
554
  name: "SearchPageNext",
628
- component: () => import('./index-9a79e9c2.esm.js').then((m) => m.SearchPage),
555
+ component: () => import('./index-c4f0d862.esm.js').then((m) => m.SearchPage),
629
556
  mountPoint: rootNextRouteRef
630
557
  }));
631
558
  searchPlugin.provide(createComponentExtension({
632
559
  name: "SearchBar",
633
560
  component: {
634
- lazy: () => import('./index-8fe3dbdd.esm.js').then((m) => m.SearchBar)
561
+ lazy: () => import('./index-03e76ebf.esm.js').then((m) => m.SearchBar)
635
562
  }
636
563
  }));
637
564
  const SearchBarNext = searchPlugin.provide(createComponentExtension({
638
565
  name: "SearchBarNext",
639
566
  component: {
640
- lazy: () => import('./index-8fe3dbdd.esm.js').then((m) => m.SearchBar)
567
+ lazy: () => import('./index-03e76ebf.esm.js').then((m) => m.SearchBar)
641
568
  }
642
569
  }));
643
570
  const SearchResult$1 = searchPlugin.provide(createComponentExtension({
644
571
  name: "SearchResult",
645
572
  component: {
646
- lazy: () => import('./index-e7f638c9.esm.js').then((m) => m.SearchResult)
573
+ lazy: () => import('./index-e3f876bf.esm.js').then((m) => m.SearchResult)
647
574
  }
648
575
  }));
649
576
  searchPlugin.provide(createComponentExtension({
650
577
  name: "SearchResultNext",
651
578
  component: {
652
- lazy: () => import('./index-e7f638c9.esm.js').then((m) => m.SearchResult)
579
+ lazy: () => import('./index-e3f876bf.esm.js').then((m) => m.SearchResult)
653
580
  }
654
581
  }));
655
582
  const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
656
583
  name: "SidebarSearchModal",
657
584
  component: {
658
- lazy: () => import('./index-6ef71f25.esm.js').then((m) => m.SidebarSearchModal)
585
+ lazy: () => import('./index-87731096.esm.js').then((m) => m.SidebarSearchModal)
659
586
  }
660
587
  }));
661
588
  const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
662
589
  name: "DefaultResultListItem",
663
590
  component: {
664
- lazy: () => import('./index-841ba24a.esm.js').then((m) => m.DefaultResultListItem)
591
+ lazy: () => import('./index-48917ac5.esm.js').then((m) => m.DefaultResultListItem)
665
592
  }
666
593
  }));
667
594
  const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
668
595
  name: "HomePageSearchBar",
669
596
  component: {
670
- lazy: () => import('./index-d0499309.esm.js').then((m) => m.HomePageSearchBar)
597
+ lazy: () => import('./index-8bd3badc.esm.js').then((m) => m.HomePageSearchBar)
671
598
  }
672
599
  }));
673
600
 
@@ -1422,5 +1349,5 @@ const SidebarSearch = (props) => {
1422
1349
  });
1423
1350
  };
1424
1351
 
1425
- export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchContextProvider as f, useSearch as g, SearchFilter as h, SearchFilterNext as i, SearchResultPager as j, SearchType as k, SidebarSearch as l, DefaultResultListItem as m, SearchBarNext as n, SearchPage$1 as o, SearchPageNext as p, searchPlugin as q, rootRouteRef as r, searchApiRef as s, SearchResult$1 as t, useSearchModal as u, SidebarSearchModal as v };
1426
- //# sourceMappingURL=index-927faa3d.esm.js.map
1352
+ export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchFilter as f, SearchFilterNext as g, SearchResultPager as h, SearchType as i, SidebarSearch as j, DefaultResultListItem as k, SearchBarNext as l, SearchPage$1 as m, SearchPageNext as n, SearchResult$1 as o, SidebarSearchModal as p, rootRouteRef as r, searchPlugin as s, useSearchModal as u };
1353
+ //# sourceMappingURL=index-a995a1ca.esm.js.map