@backstage/plugin-search 0.5.2 → 0.5.3

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,18 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6d8e3a9651: Internal cleanup of the exports structure
8
+ - 8b532a6c02: Introduces a `<SearchType.Accordion />` variant, which operates on the same part of a search query as the existing `<SearchType />`, but in a more opinionated way (as a single-select control surface suitable for faceted search UIs).
9
+
10
+ Check the [search plugin storybook](https://backstage.io/storybook/?path=/story/plugins-search-searchtype--accordion) to see how it can be used.
11
+
12
+ - af4980fb5d: Captures the search term entered in the SearchBarBase as a `search` event.
13
+ - Updated dependencies
14
+ - @backstage/plugin-catalog-react@0.6.9
15
+
3
16
  ## 0.5.2
4
17
 
5
18
  ### Patch Changes
@@ -1,15 +1,15 @@
1
- export { H as HomePageSearchBar } from './index-655809db.esm.js';
1
+ export { a as SearchBar, b as SearchBarBase } from './index-ee953592.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
5
5
  import 'react';
6
- import '@material-ui/core';
7
- import '@backstage/core-components';
8
6
  import '@material-ui/icons/FilterList';
7
+ import '@material-ui/core';
9
8
  import 'react-use';
10
9
  import '@material-ui/icons/Search';
11
10
  import '@material-ui/icons/Clear';
12
11
  import '@material-ui/core/styles';
12
+ import '@backstage/core-components';
13
13
  import '@material-ui/icons/ArrowBackIos';
14
14
  import '@material-ui/icons/ArrowForwardIos';
15
15
  import '@material-ui/core/utils';
@@ -19,5 +19,7 @@ import '@material-ui/core/IconButton';
19
19
  import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
+ import '@material-ui/icons/ExpandMore';
23
+ import '@material-ui/icons/FontDownload';
22
24
  import 'react-router-dom';
23
- //# sourceMappingURL=index-a71e930d.esm.js.map
25
+ //# sourceMappingURL=index-00a7ba84.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-00a7ba84.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,66 @@
1
+ import React__default, { useCallback, useState } from 'react';
2
+ import { makeStyles } from '@material-ui/core/styles';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-ee953592.esm.js';
4
+ import qs from 'qs';
5
+ import { useNavigate } from 'react-router-dom';
6
+ import { useRouteRef } from '@backstage/core-plugin-api';
7
+ import '@backstage/errors';
8
+ import '@material-ui/icons/FilterList';
9
+ import '@material-ui/core';
10
+ import 'react-use';
11
+ import '@material-ui/icons/Search';
12
+ import '@material-ui/icons/Clear';
13
+ import '@backstage/core-components';
14
+ import '@material-ui/icons/ArrowBackIos';
15
+ import '@material-ui/icons/ArrowForwardIos';
16
+ import '@material-ui/core/utils';
17
+ import 'react-router';
18
+ import '@material-ui/core/InputBase';
19
+ import '@material-ui/core/IconButton';
20
+ import '@material-ui/lab';
21
+ import '@backstage/plugin-catalog-react';
22
+ import '@backstage/catalog-model';
23
+ import '@material-ui/icons/ExpandMore';
24
+ import '@material-ui/icons/FontDownload';
25
+
26
+ const useNavigateToQuery = () => {
27
+ const searchRoute = useRouteRef(rootRouteRef);
28
+ const navigate = useNavigate();
29
+ return useCallback(({ query }) => {
30
+ const queryString = qs.stringify({ query }, { addQueryPrefix: true });
31
+ navigate(`${searchRoute()}${queryString}`);
32
+ }, [navigate, searchRoute]);
33
+ };
34
+
35
+ const useStyles = makeStyles({
36
+ searchBar: {
37
+ border: "1px solid #555",
38
+ borderRadius: "6px",
39
+ fontSize: "1.5em"
40
+ }
41
+ });
42
+ const HomePageSearchBar = ({
43
+ className: defaultClassName,
44
+ ...props
45
+ }) => {
46
+ const classes = useStyles();
47
+ const [query, setQuery] = useState("");
48
+ const handleSearch = useNavigateToQuery();
49
+ const className = defaultClassName ? `${classes.searchBar} ${defaultClassName}` : classes.searchBar;
50
+ const handleSubmit = () => {
51
+ handleSearch({ query });
52
+ };
53
+ const handleChange = useCallback((value) => {
54
+ setQuery(value);
55
+ }, [setQuery]);
56
+ return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
57
+ className,
58
+ value: query,
59
+ onSubmit: handleSubmit,
60
+ onChange: handleChange,
61
+ ...props
62
+ });
63
+ };
64
+
65
+ export { HomePageSearchBar };
66
+ //# sourceMappingURL=index-384f7bcf.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-384f7bcf.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';\n\nimport { SearchBarBase, SearchBarBaseProps } from '../SearchBar';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBar: {\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 = ({\n className: defaultClassName,\n ...props\n}: HomePageSearchBarProps) => {\n const classes = useStyles();\n const [query, setQuery] = useState('');\n const handleSearch = useNavigateToQuery();\n\n const className = defaultClassName\n ? `${classes.searchBar} ${defaultClassName}`\n : classes.searchBar;\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 className={className}\n value={query}\n onSubmit={handleSubmit}\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,EAAE,YAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB;AAE9D,aAAS,GAAG,gBAAgB;AAAA,KAE9B,CAAC,UAAU;AAAA;;ACTf,MAAM,YAAY,WAAW;AAAA,EAC3B,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA;AAAA;MAkBD,oBAAoB,CAAC;AAAA,EAChC,WAAW;AAAA,KACR;AAAA,MACyB;AAC5B,QAAM,UAAU;AAChB,QAAM,CAAC,OAAO,YAAY,SAAS;AACnC,QAAM,eAAe;AAErB,QAAM,YAAY,mBACd,GAAG,QAAQ,aAAa,qBACxB,QAAQ;AAEZ,QAAM,eAAe,MAAM;AACzB,iBAAa,EAAE;AAAA;AAGjB,QAAM,eAAe,YACnB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,sDACG,eAAD;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,OACN;AAAA;AAAA;;;;"}
@@ -1,15 +1,15 @@
1
- export { c as SearchResult } from './index-655809db.esm.js';
1
+ export { c as SearchResult } from './index-ee953592.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
5
5
  import 'react';
6
- import '@material-ui/core';
7
- import '@backstage/core-components';
8
6
  import '@material-ui/icons/FilterList';
7
+ import '@material-ui/core';
9
8
  import 'react-use';
10
9
  import '@material-ui/icons/Search';
11
10
  import '@material-ui/icons/Clear';
12
11
  import '@material-ui/core/styles';
12
+ import '@backstage/core-components';
13
13
  import '@material-ui/icons/ArrowBackIos';
14
14
  import '@material-ui/icons/ArrowForwardIos';
15
15
  import '@material-ui/core/utils';
@@ -19,5 +19,7 @@ import '@material-ui/core/IconButton';
19
19
  import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
+ import '@material-ui/icons/ExpandMore';
23
+ import '@material-ui/icons/FontDownload';
22
24
  import 'react-router-dom';
23
- //# sourceMappingURL=index-2a318193.esm.js.map
25
+ //# sourceMappingURL=index-c6d67b32.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-c6d67b32.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,12 +1,12 @@
1
1
  import React__default from 'react';
2
2
  import SearchIcon from '@material-ui/icons/Search';
3
3
  import { SidebarItem } from '@backstage/core-components';
4
- import { u as useSearch, d as SearchModal } from './index-655809db.esm.js';
4
+ import { u as useSearch, d as SearchModal } from './index-ee953592.esm.js';
5
5
  import '@backstage/core-plugin-api';
6
6
  import '@backstage/errors';
7
7
  import 'qs';
8
- import '@material-ui/core';
9
8
  import '@material-ui/icons/FilterList';
9
+ import '@material-ui/core';
10
10
  import 'react-use';
11
11
  import '@material-ui/icons/Clear';
12
12
  import '@material-ui/core/styles';
@@ -19,6 +19,8 @@ import '@material-ui/core/IconButton';
19
19
  import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
+ import '@material-ui/icons/ExpandMore';
23
+ import '@material-ui/icons/FontDownload';
22
24
  import 'react-router-dom';
23
25
 
24
26
  const SidebarSearchModal = (props) => {
@@ -36,4 +38,4 @@ const SidebarSearchModal = (props) => {
36
38
  };
37
39
 
38
40
  export { SidebarSearchModal };
39
- //# sourceMappingURL=index-af05ea86.esm.js.map
41
+ //# sourceMappingURL=index-e62dadc4.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-af05ea86.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 { SearchModal } from '../SearchModal';\nimport { useSearch } from '../SearchContext';\n\nexport type SidebarSearchModalProps = {\n icon?: IconComponent;\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n const { open, toggleModal } = useSearch();\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 open={open} toggleModal={toggleModal} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MA0Ba,qBAAqB,CAAC,UAAmC;AACpE,QAAM,EAAE,MAAM,gBAAgB;AAC9B,QAAM,OAAO,MAAM,OAAO,MAAM,OAAO;AAEvC,kIAEK,aAAD;AAAA,IACE,WAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAS;AAAA,mDAEV,aAAD;AAAA,IAAa;AAAA,IAAY;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index-e62dadc4.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 { SearchModal } from '../SearchModal';\nimport { useSearch } from '../SearchContext';\n\nexport type SidebarSearchModalProps = {\n icon?: IconComponent;\n};\n\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n const { open, toggleModal } = useSearch();\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 open={open} toggleModal={toggleModal} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MA0Ba,qBAAqB,CAAC,UAAmC;AACpE,QAAM,EAAE,MAAM,gBAAgB;AAC9B,QAAM,OAAO,MAAM,OAAO,MAAM,OAAO;AAEvC,kIAEK,aAAD;AAAA,IACE,WAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAS;AAAA,mDAEV,aAAD;AAAA,IAAa;AAAA,IAAY;AAAA;AAAA;;;;"}
@@ -1,15 +1,15 @@
1
- import { createApiRef, useApi, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
1
+ import { createApiRef, useApi, AnalyticsContext, useAnalytics, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
2
2
  import { ResponseError } from '@backstage/errors';
3
3
  import qs from 'qs';
4
4
  import * as React from 'react';
5
- import React__default, { createContext, useState, useCallback, useEffect, useContext } from 'react';
6
- import { ListItem, ListItemIcon, ListItemText, Box, Divider, makeStyles, IconButton, Typography, Card, CardHeader, Button, CardContent, Select, MenuItem, List, Checkbox, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Chip } from '@material-ui/core';
7
- import { Link, Progress, ResponseErrorPanel, EmptyState, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
5
+ import React__default, { createContext, useState, useCallback, useEffect, useContext, Fragment, cloneElement } from 'react';
8
6
  import FilterListIcon from '@material-ui/icons/FilterList';
7
+ import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Chip } from '@material-ui/core';
9
8
  import { usePrevious, useAsync, useDebounce, useEffectOnce } from 'react-use';
10
9
  import SearchIcon from '@material-ui/icons/Search';
11
10
  import ClearButton from '@material-ui/icons/Clear';
12
11
  import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
12
+ import { Link, Progress, ResponseErrorPanel, EmptyState, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
13
13
  import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
14
14
  import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
15
15
  import { createSvgIcon } from '@material-ui/core/utils';
@@ -19,6 +19,8 @@ import IconButton$1 from '@material-ui/core/IconButton';
19
19
  import { Alert } from '@material-ui/lab';
20
20
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
21
21
  import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
22
+ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
23
+ import AllIcon from '@material-ui/icons/FontDownload';
22
24
  import { useNavigate } from 'react-router-dom';
23
25
 
24
26
  const searchApiRef = createApiRef({
@@ -43,24 +45,6 @@ class SearchClient {
43
45
  }
44
46
  }
45
47
 
46
- const DefaultResultListItem$1 = ({
47
- result,
48
- icon,
49
- secondaryAction
50
- }) => {
51
- return /* @__PURE__ */ React__default.createElement(Link, {
52
- to: result.location
53
- }, /* @__PURE__ */ React__default.createElement(ListItem, {
54
- alignItems: "center"
55
- }, icon && /* @__PURE__ */ React__default.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React__default.createElement(ListItemText, {
56
- primaryTypographyProps: { variant: "h6" },
57
- primary: result.title,
58
- secondary: result.text
59
- }), secondaryAction && /* @__PURE__ */ React__default.createElement(Box, {
60
- alignItems: "flex-end"
61
- }, secondaryAction)), /* @__PURE__ */ React__default.createElement(Divider, null));
62
- };
63
-
64
48
  const useStyles$a = makeStyles((theme) => ({
65
49
  filters: {
66
50
  width: "250px",
@@ -214,10 +198,12 @@ const SearchContextProvider = ({
214
198
  fetchNextPage: hasNextPage ? fetchNextPage : void 0,
215
199
  fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : void 0
216
200
  };
217
- return /* @__PURE__ */ React__default.createElement(SearchContext.Provider, {
201
+ return /* @__PURE__ */ React__default.createElement(AnalyticsContext, {
202
+ attributes: { searchTypes: types.sort().join(",") }
203
+ }, /* @__PURE__ */ React__default.createElement(SearchContext.Provider, {
218
204
  value,
219
205
  children
220
- });
206
+ }));
221
207
  };
222
208
  const useSearch = () => {
223
209
  const context = useContext(SearchContext);
@@ -227,6 +213,17 @@ const useSearch = () => {
227
213
  return context;
228
214
  };
229
215
 
216
+ const TrackSearch = ({ children }) => {
217
+ const analytics = useAnalytics();
218
+ const { term } = useSearch();
219
+ useEffect(() => {
220
+ if (term) {
221
+ analytics.captureEvent("search", term);
222
+ }
223
+ }, [analytics, term]);
224
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
225
+ };
226
+
230
227
  const SearchBarBase = ({
231
228
  onChange,
232
229
  onKeyDown,
@@ -271,7 +268,7 @@ const SearchBarBase = ({
271
268
  "aria-label": "Clear",
272
269
  onClick: handleClear
273
270
  }, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
274
- return /* @__PURE__ */ React__default.createElement(InputBase, {
271
+ return /* @__PURE__ */ React__default.createElement(TrackSearch, null, /* @__PURE__ */ React__default.createElement(InputBase, {
275
272
  "data-testid": "search-bar-next",
276
273
  value,
277
274
  placeholder,
@@ -282,14 +279,16 @@ const SearchBarBase = ({
282
279
  onChange: handleChange,
283
280
  onKeyDown: handleKeyDown,
284
281
  ...props
285
- });
282
+ }));
286
283
  };
287
284
  const SearchBar$1 = ({ onChange, ...props }) => {
288
285
  const { term, setTerm } = useSearch();
289
286
  const handleChange = (newValue) => {
290
- setTerm(newValue);
291
- if (onChange)
287
+ if (onChange) {
292
288
  onChange(newValue);
289
+ } else {
290
+ setTerm(newValue);
291
+ }
293
292
  };
294
293
  return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
295
294
  value: term,
@@ -414,6 +413,24 @@ var Launch = createSvgIcon( /*#__PURE__*/React.createElement("path", {
414
413
  d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
415
414
  }), 'Launch');
416
415
 
416
+ const DefaultResultListItem$1 = ({
417
+ result,
418
+ icon,
419
+ secondaryAction
420
+ }) => {
421
+ return /* @__PURE__ */ React__default.createElement(Link, {
422
+ to: result.location
423
+ }, /* @__PURE__ */ React__default.createElement(ListItem, {
424
+ alignItems: "center"
425
+ }, icon && /* @__PURE__ */ React__default.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React__default.createElement(ListItemText, {
426
+ primaryTypographyProps: { variant: "h6" },
427
+ primary: result.title,
428
+ secondary: result.text
429
+ }), secondaryAction && /* @__PURE__ */ React__default.createElement(Box, {
430
+ alignItems: "flex-end"
431
+ }, secondaryAction)), /* @__PURE__ */ React__default.createElement(Divider, null));
432
+ };
433
+
417
434
  const SearchResultComponent = ({ children }) => {
418
435
  const {
419
436
  result: { loading, error, value }
@@ -490,54 +507,54 @@ const searchPlugin = createPlugin({
490
507
  });
491
508
  const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
492
509
  name: "SearchPage",
493
- component: () => import('./index-0a2fab21.esm.js').then((m) => m.SearchPage),
510
+ component: () => import('./index-ff0c1c1c.esm.js').then((m) => m.SearchPage),
494
511
  mountPoint: rootRouteRef
495
512
  }));
496
513
  const SearchPageNext = searchPlugin.provide(createRoutableExtension({
497
514
  name: "SearchPageNext",
498
- component: () => import('./index-0a2fab21.esm.js').then((m) => m.SearchPage),
515
+ component: () => import('./index-ff0c1c1c.esm.js').then((m) => m.SearchPage),
499
516
  mountPoint: rootNextRouteRef
500
517
  }));
501
518
  searchPlugin.provide(createComponentExtension({
502
519
  name: "SearchBar",
503
520
  component: {
504
- lazy: () => import('./index-d5ddea91.esm.js').then((m) => m.SearchBar)
521
+ lazy: () => import('./index-00a7ba84.esm.js').then((m) => m.SearchBar)
505
522
  }
506
523
  }));
507
524
  const SearchBarNext = searchPlugin.provide(createComponentExtension({
508
525
  name: "SearchBarNext",
509
526
  component: {
510
- lazy: () => import('./index-d5ddea91.esm.js').then((m) => m.SearchBar)
527
+ lazy: () => import('./index-00a7ba84.esm.js').then((m) => m.SearchBar)
511
528
  }
512
529
  }));
513
530
  const SearchResult$1 = searchPlugin.provide(createComponentExtension({
514
531
  name: "SearchResult",
515
532
  component: {
516
- lazy: () => import('./index-2a318193.esm.js').then((m) => m.SearchResult)
533
+ lazy: () => import('./index-c6d67b32.esm.js').then((m) => m.SearchResult)
517
534
  }
518
535
  }));
519
536
  searchPlugin.provide(createComponentExtension({
520
537
  name: "SearchResultNext",
521
538
  component: {
522
- lazy: () => import('./index-2a318193.esm.js').then((m) => m.SearchResult)
539
+ lazy: () => import('./index-c6d67b32.esm.js').then((m) => m.SearchResult)
523
540
  }
524
541
  }));
525
542
  const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
526
543
  name: "SidebarSearchModal",
527
544
  component: {
528
- lazy: () => import('./index-af05ea86.esm.js').then((m) => m.SidebarSearchModal)
545
+ lazy: () => import('./index-e62dadc4.esm.js').then((m) => m.SidebarSearchModal)
529
546
  }
530
547
  }));
531
548
  const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
532
549
  name: "DefaultResultListItem",
533
550
  component: {
534
- lazy: () => import('./index-18219c65.esm.js').then((m) => m.DefaultResultListItem)
551
+ lazy: () => import('./index-fbbcf308.esm.js').then((m) => m.DefaultResultListItem)
535
552
  }
536
553
  }));
537
- const HomePageSearchBar$1 = searchPlugin.provide(createComponentExtension({
554
+ const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
538
555
  name: "HomePageSearchBar",
539
556
  component: {
540
- lazy: () => import('./index-a71e930d.esm.js').then((m) => m.HomePageSearchBar)
557
+ lazy: () => import('./index-384f7bcf.esm.js').then((m) => m.HomePageSearchBar)
541
558
  }
542
559
  }));
543
560
 
@@ -1025,6 +1042,110 @@ const SearchPage = () => {
1025
1042
  };
1026
1043
 
1027
1044
  const useStyles$1 = makeStyles((theme) => ({
1045
+ card: {
1046
+ backgroundColor: "rgba(0, 0, 0, .11)"
1047
+ },
1048
+ cardContent: {
1049
+ paddingTop: theme.spacing(1)
1050
+ },
1051
+ icon: {
1052
+ color: theme.palette.common.black
1053
+ },
1054
+ list: {
1055
+ width: "100%"
1056
+ },
1057
+ listItemIcon: {
1058
+ width: "24px",
1059
+ height: "24px"
1060
+ },
1061
+ accordion: {
1062
+ backgroundColor: theme.palette.background.paper
1063
+ },
1064
+ accordionSummary: {
1065
+ minHeight: "auto",
1066
+ "&.Mui-expanded": {
1067
+ minHeight: "auto"
1068
+ }
1069
+ },
1070
+ accordionSummaryContent: {
1071
+ margin: theme.spacing(2, 0),
1072
+ "&.Mui-expanded": {
1073
+ margin: theme.spacing(2, 0)
1074
+ }
1075
+ },
1076
+ accordionDetails: {
1077
+ padding: theme.spacing(0, 0, 1)
1078
+ }
1079
+ }));
1080
+ const SearchTypeAccordion = (props) => {
1081
+ const classes = useStyles$1();
1082
+ const { setPageCursor, setTypes, types } = useSearch();
1083
+ const [expanded, setExpanded] = useState(true);
1084
+ const { defaultValue, name, types: givenTypes } = props;
1085
+ const toggleExpanded = () => setExpanded((prevState) => !prevState);
1086
+ const handleClick = (type) => {
1087
+ return () => {
1088
+ setTypes(type !== "" ? [type] : []);
1089
+ setPageCursor(void 0);
1090
+ setExpanded(false);
1091
+ };
1092
+ };
1093
+ useEffect(() => {
1094
+ if (defaultValue) {
1095
+ setTypes([defaultValue]);
1096
+ }
1097
+ }, []);
1098
+ const definedTypes = [
1099
+ {
1100
+ value: "",
1101
+ name: "All",
1102
+ icon: /* @__PURE__ */ React__default.createElement(AllIcon, null)
1103
+ },
1104
+ ...givenTypes
1105
+ ];
1106
+ const selected = types[0] || "";
1107
+ return /* @__PURE__ */ React__default.createElement(Card, {
1108
+ className: classes.card
1109
+ }, /* @__PURE__ */ React__default.createElement(CardHeader, {
1110
+ title: name,
1111
+ titleTypographyProps: { variant: "overline" }
1112
+ }), /* @__PURE__ */ React__default.createElement(CardContent, {
1113
+ className: classes.cardContent
1114
+ }, /* @__PURE__ */ React__default.createElement(Accordion, {
1115
+ className: classes.accordion,
1116
+ expanded,
1117
+ onChange: toggleExpanded
1118
+ }, /* @__PURE__ */ React__default.createElement(AccordionSummary, {
1119
+ classes: {
1120
+ root: classes.accordionSummary,
1121
+ content: classes.accordionSummaryContent
1122
+ },
1123
+ expandIcon: /* @__PURE__ */ React__default.createElement(ExpandMoreIcon, {
1124
+ className: classes.icon
1125
+ }),
1126
+ IconButtonProps: { size: "small" }
1127
+ }, expanded ? "Collapse" : definedTypes.filter((t) => t.value === selected)[0].name), /* @__PURE__ */ React__default.createElement(AccordionDetails, {
1128
+ classes: { root: classes.accordionDetails }
1129
+ }, /* @__PURE__ */ React__default.createElement(List, {
1130
+ className: classes.list,
1131
+ component: "nav",
1132
+ "aria-label": "filter by type",
1133
+ disablePadding: true,
1134
+ dense: true
1135
+ }, definedTypes.map((type) => /* @__PURE__ */ React__default.createElement(Fragment, {
1136
+ key: type.value
1137
+ }, /* @__PURE__ */ React__default.createElement(Divider, null), /* @__PURE__ */ React__default.createElement(ListItem, {
1138
+ selected: types[0] === type.value || types.length === 0 && type.value === "",
1139
+ onClick: handleClick(type.value),
1140
+ button: true
1141
+ }, /* @__PURE__ */ React__default.createElement(ListItemIcon, null, cloneElement(type.icon, {
1142
+ className: classes.listItemIcon
1143
+ })), /* @__PURE__ */ React__default.createElement(ListItemText, {
1144
+ primary: type.name
1145
+ })))))))));
1146
+ };
1147
+
1148
+ const useStyles = makeStyles((theme) => ({
1028
1149
  label: {
1029
1150
  textTransform: "capitalize"
1030
1151
  },
@@ -1037,13 +1158,9 @@ const useStyles$1 = makeStyles((theme) => ({
1037
1158
  margin: 2
1038
1159
  }
1039
1160
  }));
1040
- const SearchType = ({
1041
- values = [],
1042
- className,
1043
- name,
1044
- defaultValue
1045
- }) => {
1046
- const classes = useStyles$1();
1161
+ const SearchType = (props) => {
1162
+ const { className, defaultValue, name, values = [] } = props;
1163
+ const classes = useStyles();
1047
1164
  const { types, setTypes } = useSearch();
1048
1165
  useEffectOnce(() => {
1049
1166
  if (!types.length) {
@@ -1089,6 +1206,11 @@ const SearchType = ({
1089
1206
  primary: value
1090
1207
  })))));
1091
1208
  };
1209
+ SearchType.Accordion = (props) => {
1210
+ return /* @__PURE__ */ React__default.createElement(SearchTypeAccordion, {
1211
+ ...props
1212
+ });
1213
+ };
1092
1214
 
1093
1215
  const SidebarSearch = (props) => {
1094
1216
  const searchRoute = useRouteRef(rootRouteRef);
@@ -1104,44 +1226,5 @@ const SidebarSearch = (props) => {
1104
1226
  });
1105
1227
  };
1106
1228
 
1107
- const useNavigateToQuery = () => {
1108
- const searchRoute = useRouteRef(rootRouteRef);
1109
- const navigate = useNavigate();
1110
- return useCallback(({ query }) => {
1111
- const queryString = qs.stringify({ query }, { addQueryPrefix: true });
1112
- navigate(`${searchRoute()}${queryString}`);
1113
- }, [navigate, searchRoute]);
1114
- };
1115
-
1116
- const useStyles = makeStyles$1({
1117
- searchBar: {
1118
- border: "1px solid #555",
1119
- borderRadius: "6px",
1120
- fontSize: "1.5em"
1121
- }
1122
- });
1123
- const HomePageSearchBar = ({
1124
- className: defaultClassName,
1125
- ...props
1126
- }) => {
1127
- const classes = useStyles();
1128
- const [query, setQuery] = useState("");
1129
- const handleSearch = useNavigateToQuery();
1130
- const className = defaultClassName ? `${classes.searchBar} ${defaultClassName}` : classes.searchBar;
1131
- const handleSubmit = () => {
1132
- handleSearch({ query });
1133
- };
1134
- const handleChange = useCallback((value) => {
1135
- setQuery(value);
1136
- }, [setQuery]);
1137
- return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
1138
- className,
1139
- value: query,
1140
- onSubmit: handleSubmit,
1141
- onChange: handleChange,
1142
- ...props
1143
- });
1144
- };
1145
-
1146
- 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, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, HomePageSearchBar$1 as m, SearchBarNext as n, SearchPage$1 as o, SearchPageNext as p, searchPlugin as q, SearchResult$1 as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
1147
- //# sourceMappingURL=index-655809db.esm.js.map
1229
+ 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, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, SearchBarNext as m, SearchPage$1 as n, SearchPageNext as o, searchPlugin as p, SearchResult$1 as q, rootRouteRef as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
1230
+ //# sourceMappingURL=index-ee953592.esm.js.map