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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.8.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 11a46863de: Fix issue with `HomePageSearchBar` requiring `SearchContext`
8
+ - Updated dependencies
9
+ - @backstage/plugin-catalog-react@1.1.0-next.0
10
+ - @backstage/plugin-search-react@0.1.1-next.0
11
+
12
+ ## 0.8.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 520e21aaea: The following exports has now been fully deleted from this package and can be import from `@backstage/plugin-search-react` instead.
17
+
18
+ `SearchApi` interface.
19
+ `searchApiRef`
20
+ `SearchContextProvider`
21
+ `useSearch`
22
+
23
+ `SearchContext` has now been fully deleted from this package and is no longer exported publicly. Use `SearchContextProvider` when access to the context is needed.
24
+
25
+ ### Patch Changes
26
+
27
+ - 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
28
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
29
+ - 5c062f275e: Support customizing the content of the `SidebarSearchModal`
30
+ - 38e01f2f70: Switch to `SearchDocument` type in `DefaultResultListItem` props
31
+ - 230ad0826f: Bump to using `@types/node` v16
32
+ - 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.
33
+
34
+ - `SearchApi` interface.
35
+ - `searchApiRef`
36
+ - `SearchContext`
37
+ - `SearchContextProvider`
38
+ - `useSearch`
39
+
40
+ - Updated dependencies
41
+ - @backstage/plugin-catalog-react@1.0.1
42
+ - @backstage/catalog-model@1.0.1
43
+ - @backstage/core-components@0.9.3
44
+ - @backstage/core-plugin-api@1.0.1
45
+ - @backstage/plugin-search-react@0.1.0
46
+ - @backstage/plugin-search-common@0.3.3
47
+
48
+ ## 0.7.5-next.1
49
+
50
+ ### Patch Changes
51
+
52
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
53
+ - 5c062f275e: Support customizing the content of the `SidebarSearchModal`
54
+ - 230ad0826f: Bump to using `@types/node` v16
55
+ - 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.
56
+
57
+ - `SearchApi` interface.
58
+ - `searchApiRef`
59
+ - `SearchContext`
60
+ - `SearchContextProvider`
61
+ - `useSearch`
62
+
63
+ - Updated dependencies
64
+ - @backstage/core-components@0.9.3-next.2
65
+ - @backstage/core-plugin-api@1.0.1-next.0
66
+ - @backstage/plugin-catalog-react@1.0.1-next.3
67
+ - @backstage/plugin-search-react@0.1.0-next.0
68
+
3
69
  ## 0.7.5-next.0
4
70
 
5
71
  ### Patch Changes
@@ -1,15 +1,12 @@
1
- export { S as SearchPage } from './index-6c1324ea.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-c59968b8.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 { a as SearchBar, b as SearchBarBase } from './index-6c1324ea.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-5c70689c.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-6c1324ea.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';
@@ -38,9 +39,10 @@ const SidebarSearchModal = (props) => {
38
39
  onClick: toggleModal
39
40
  }), /* @__PURE__ */ React.createElement(SearchModal, {
40
41
  ...state,
41
- toggleModal
42
+ toggleModal,
43
+ children: props.children
42
44
  }));
43
45
  };
44
46
 
45
47
  export { SidebarSearchModal };
46
- //# sourceMappingURL=index-6dc0dac9.esm.js.map
48
+ //# sourceMappingURL=index-87731096.esm.js.map
@@ -0,0 +1 @@
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-6c1324ea.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-c88298b1.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-c59968b8.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-c59968b8.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-5c70689c.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-5c70689c.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-ecefd17e.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-ecefd17e.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-6dc0dac9.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-5122e36b.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-c88298b1.esm.js').then((m) => m.HomePageSearchBar)
597
+ lazy: () => import('./index-8bd3badc.esm.js').then((m) => m.HomePageSearchBar)
671
598
  }
672
599
  }));
673
600
 
@@ -740,8 +667,10 @@ const Modal = ({ toggleModal }) => {
740
667
  const SearchModal = ({
741
668
  open = true,
742
669
  hidden,
743
- toggleModal
670
+ toggleModal,
671
+ children
744
672
  }) => {
673
+ var _a;
745
674
  const classes = useStyles$7();
746
675
  return /* @__PURE__ */ React.createElement(Dialog, {
747
676
  classes: {
@@ -753,7 +682,7 @@ const SearchModal = ({
753
682
  maxWidth: "lg",
754
683
  open,
755
684
  hidden
756
- }, open && /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(Modal, {
685
+ }, open && /* @__PURE__ */ React.createElement(SearchContextProvider, null, (_a = children && children({ toggleModal })) != null ? _a : /* @__PURE__ */ React.createElement(Modal, {
757
686
  toggleModal
758
687
  })));
759
688
  };
@@ -1323,7 +1252,8 @@ const SearchTypeTabs = (props) => {
1323
1252
  indicatorColor: "primary",
1324
1253
  value: types.length === 0 ? "" : types[0],
1325
1254
  onChange: changeTab
1326
- }, definedTypes.map((type) => /* @__PURE__ */ React.createElement(Tab, {
1255
+ }, definedTypes.map((type, idx) => /* @__PURE__ */ React.createElement(Tab, {
1256
+ key: idx,
1327
1257
  className: classes.tab,
1328
1258
  disableRipple: true,
1329
1259
  label: type.name,
@@ -1419,5 +1349,5 @@ const SidebarSearch = (props) => {
1419
1349
  });
1420
1350
  };
1421
1351
 
1422
- 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 };
1423
- //# sourceMappingURL=index-6c1324ea.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