@backstage/plugin-search 0.4.15 → 0.5.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,84 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c5b6045f36: Search Modal now relies on the Search Context to access state and state setter. If you use the SidebarSearchModal as described in the [getting started documentation](https://backstage.io/docs/features/search/getting-started#using-the-search-modal), make sure to update your code with the SearchContextProvider.
8
+
9
+ ```diff
10
+ export const Root = ({ children }: PropsWithChildren<{}>) => (
11
+ <SidebarPage>
12
+ <Sidebar>
13
+ <SidebarLogo />
14
+ - <SidebarSearchModal />
15
+ + <SearchContextProvider>
16
+ + <SidebarSearchModal />
17
+ + </SearchContextProvider>
18
+ <SidebarDivider />
19
+ ...
20
+ ```
21
+
22
+ ### Patch Changes
23
+
24
+ - f06ecd09a7: Add optional icon and secondaryAction properties for DefaultResultListItem component
25
+ - c5941d5c30: Add a new optional clearButton property to the SearchBar component. The default value for this new property is true.
26
+ - Updated dependencies
27
+ - @backstage/core-components@0.7.6
28
+ - @backstage/theme@0.2.14
29
+ - @backstage/core-plugin-api@0.2.2
30
+
31
+ ## 0.4.18
32
+
33
+ ### Patch Changes
34
+
35
+ - a125278b81: Refactor out the deprecated path and icon from RouteRefs
36
+ - 704b267e1c: Smaller UX improvements to search components such as optional autoFocus prop to SearchBar components, decreased debounce value and closing modal on link click of SearchModal, terminology updates of SearchResultPager.
37
+ - Updated dependencies
38
+ - @backstage/catalog-model@0.9.7
39
+ - @backstage/plugin-catalog-react@0.6.4
40
+ - @backstage/core-components@0.7.4
41
+ - @backstage/core-plugin-api@0.2.0
42
+
43
+ ## 0.4.17
44
+
45
+ ### Patch Changes
46
+
47
+ - 5dcea2586c: Added `SearchModal` component.
48
+
49
+ Now you can import `SearchModal` in your apps:
50
+
51
+ ```js
52
+ import { SearchModal } from '@backstage/plugin-search';
53
+ ```
54
+
55
+ You can also use the `SidebarSearchModal` component to integrate it into the sidebar of your sample apps:
56
+
57
+ ```js
58
+ import { SidebarSearchModal } from '@backstage/plugin-search';
59
+ ```
60
+
61
+ - Updated dependencies
62
+ - @backstage/core-components@0.7.3
63
+ - @backstage/theme@0.2.13
64
+ - @backstage/core-plugin-api@0.1.13
65
+ - @backstage/plugin-catalog-react@0.6.3
66
+
67
+ ## 0.4.16
68
+
69
+ ### Patch Changes
70
+
71
+ - 10615525f3: Switch to use the json and observable types from `@backstage/types`
72
+ - Updated dependencies
73
+ - @backstage/config@0.1.11
74
+ - @backstage/theme@0.2.12
75
+ - @backstage/errors@0.1.4
76
+ - @backstage/core-components@0.7.2
77
+ - @backstage/plugin-catalog-react@0.6.2
78
+ - @backstage/catalog-model@0.9.6
79
+ - @backstage/search-common@0.2.1
80
+ - @backstage/core-plugin-api@0.1.12
81
+
3
82
  ## 0.4.15
4
83
 
5
84
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- export { a as SearchBar, b as SearchBarBase } from './index-9c0d67e6.esm.js';
1
+ export { S as SearchPage } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -9,14 +9,15 @@ import '@material-ui/icons/FilterList';
9
9
  import 'react-use';
10
10
  import '@material-ui/icons/Search';
11
11
  import '@material-ui/icons/Clear';
12
- import 'react-router';
13
12
  import '@material-ui/core/styles';
13
+ import '@material-ui/icons/ArrowBackIos';
14
+ import '@material-ui/icons/ArrowForwardIos';
15
+ import '@material-ui/core/utils';
16
+ import 'react-router';
14
17
  import '@material-ui/core/InputBase';
15
18
  import '@material-ui/core/IconButton';
16
19
  import '@material-ui/lab';
17
20
  import '@backstage/plugin-catalog-react';
18
21
  import '@backstage/catalog-model';
19
- import '@material-ui/icons/ArrowBackIos';
20
- import '@material-ui/icons/ArrowForwardIos';
21
22
  import 'react-router-dom';
22
- //# sourceMappingURL=index-6f14e751.esm.js.map
23
+ //# sourceMappingURL=index-09bfa46d.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-09bfa46d.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,23 @@
1
+ export { a as SearchBar, b as SearchBarBase } from './index-8e7d7ce9.esm.js';
2
+ import '@backstage/core-plugin-api';
3
+ import '@backstage/errors';
4
+ import 'qs';
5
+ import 'react';
6
+ import '@material-ui/core';
7
+ import '@backstage/core-components';
8
+ import '@material-ui/icons/FilterList';
9
+ import 'react-use';
10
+ import '@material-ui/icons/Search';
11
+ import '@material-ui/icons/Clear';
12
+ import '@material-ui/core/styles';
13
+ import '@material-ui/icons/ArrowBackIos';
14
+ import '@material-ui/icons/ArrowForwardIos';
15
+ import '@material-ui/core/utils';
16
+ import 'react-router';
17
+ import '@material-ui/core/InputBase';
18
+ import '@material-ui/core/IconButton';
19
+ import '@material-ui/lab';
20
+ import '@backstage/plugin-catalog-react';
21
+ import '@backstage/catalog-model';
22
+ import 'react-router-dom';
23
+ //# sourceMappingURL=index-1f69649c.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-1f69649c.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { S as SearchPage } from './index-9c0d67e6.esm.js';
1
+ export { c as SearchResult } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -9,14 +9,15 @@ import '@material-ui/icons/FilterList';
9
9
  import 'react-use';
10
10
  import '@material-ui/icons/Search';
11
11
  import '@material-ui/icons/Clear';
12
- import 'react-router';
13
12
  import '@material-ui/core/styles';
13
+ import '@material-ui/icons/ArrowBackIos';
14
+ import '@material-ui/icons/ArrowForwardIos';
15
+ import '@material-ui/core/utils';
16
+ import 'react-router';
14
17
  import '@material-ui/core/InputBase';
15
18
  import '@material-ui/core/IconButton';
16
19
  import '@material-ui/lab';
17
20
  import '@backstage/plugin-catalog-react';
18
21
  import '@backstage/catalog-model';
19
- import '@material-ui/icons/ArrowBackIos';
20
- import '@material-ui/icons/ArrowForwardIos';
21
22
  import 'react-router-dom';
22
- //# sourceMappingURL=index-4ef7a5c8.esm.js.map
23
+ //# sourceMappingURL=index-49a2f5d1.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-49a2f5d1.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
- import React, { useCallback } from 'react';
1
+ import React__default, { useCallback } from 'react';
2
2
  import { makeStyles } from '@material-ui/core/styles';
3
- import { r as rootRouteRef, b as SearchBarBase } from './index-9c0d67e6.esm.js';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-8e7d7ce9.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';
@@ -11,14 +11,15 @@ import '@material-ui/icons/FilterList';
11
11
  import 'react-use';
12
12
  import '@material-ui/icons/Search';
13
13
  import '@material-ui/icons/Clear';
14
+ import '@material-ui/icons/ArrowBackIos';
15
+ import '@material-ui/icons/ArrowForwardIos';
16
+ import '@material-ui/core/utils';
14
17
  import 'react-router';
15
18
  import '@material-ui/core/InputBase';
16
19
  import '@material-ui/core/IconButton';
17
20
  import '@material-ui/lab';
18
21
  import '@backstage/plugin-catalog-react';
19
22
  import '@backstage/catalog-model';
20
- import '@material-ui/icons/ArrowBackIos';
21
- import '@material-ui/icons/ArrowForwardIos';
22
23
 
23
24
  const useNavigateToQuery = () => {
24
25
  const searchRoute = useRouteRef(rootRouteRef);
@@ -37,16 +38,16 @@ const useStyles = makeStyles({
37
38
  }
38
39
  });
39
40
  const HomePageSearchBar = ({placeholder}) => {
40
- const [query, setQuery] = React.useState("");
41
+ const [query, setQuery] = React__default.useState("");
41
42
  const handleSearch = useNavigateToQuery();
42
43
  const classes = useStyles();
43
44
  const handleSubmit = () => {
44
45
  handleSearch({query});
45
46
  };
46
- const handleChange = React.useCallback((value) => {
47
+ const handleChange = React__default.useCallback((value) => {
47
48
  setQuery(value);
48
49
  }, [setQuery]);
49
- return /* @__PURE__ */ React.createElement(SearchBarBase, {
50
+ return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
50
51
  onSubmit: handleSubmit,
51
52
  onChange: handleChange,
52
53
  value: query,
@@ -56,4 +57,4 @@ const HomePageSearchBar = ({placeholder}) => {
56
57
  };
57
58
 
58
59
  export { HomePageSearchBar };
59
- //# sourceMappingURL=index-3eebaa65.esm.js.map
60
+ //# sourceMappingURL=index-58cc0fcf.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-3eebaa65.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 from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { SearchBarBase } 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\ntype Props = {\n placeholder?: string;\n};\n\nexport const HomePageSearchBar = ({ placeholder }: Props) => {\n const [query, setQuery] = React.useState('');\n const handleSearch = useNavigateToQuery();\n const classes = useStyles();\n\n const handleSubmit = () => {\n handleSearch({ query });\n };\n\n const handleChange = React.useCallback(\n value => {\n setQuery(value);\n },\n [setQuery],\n );\n\n return (\n <SearchBarBase\n onSubmit={handleSubmit}\n onChange={handleChange}\n value={query}\n className={classes.searchBar}\n placeholder={placeholder}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,CAAE,WAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,CAAE,QAAS,CAAE,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;MAQD,oBAAoB,CAAC,CAAE,iBAAyB;AAC3D,QAAM,CAAC,OAAO,YAAY,MAAM,SAAS;AACzC,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,eAAe,MAAM;AACzB,iBAAa,CAAE;AAAA;AAGjB,QAAM,eAAe,MAAM,YACzB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,6CACG,eAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW,QAAQ;AAAA,IACnB;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index-58cc0fcf.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 from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { SearchBarBase } 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\ntype Props = {\n placeholder?: string;\n};\n\nexport const HomePageSearchBar = ({ placeholder }: Props) => {\n const [query, setQuery] = React.useState('');\n const handleSearch = useNavigateToQuery();\n const classes = useStyles();\n\n const handleSubmit = () => {\n handleSearch({ query });\n };\n\n const handleChange = React.useCallback(\n value => {\n setQuery(value);\n },\n [setQuery],\n );\n\n return (\n <SearchBarBase\n onSubmit={handleSubmit}\n onChange={handleChange}\n value={query}\n className={classes.searchBar}\n placeholder={placeholder}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,CAAE,WAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,CAAE,QAAS,CAAE,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;MAQD,oBAAoB,CAAC,CAAE,iBAAyB;AAC3D,QAAM,CAAC,OAAO,YAAYA,eAAM,SAAS;AACzC,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,eAAe,MAAM;AACzB,iBAAa,CAAE;AAAA;AAGjB,QAAM,eAAeA,eAAM,YACzB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,sDACG,eAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW,QAAQ;AAAA,IACnB;AAAA;AAAA;;;;"}
@@ -0,0 +1,38 @@
1
+ import React__default from 'react';
2
+ import SearchIcon from '@material-ui/icons/Search';
3
+ import { SidebarItem } from '@backstage/core-components';
4
+ import { u as useSearch, d as SearchModal } from './index-8e7d7ce9.esm.js';
5
+ import '@backstage/core-plugin-api';
6
+ import '@backstage/errors';
7
+ import 'qs';
8
+ import '@material-ui/core';
9
+ import '@material-ui/icons/FilterList';
10
+ import 'react-use';
11
+ import '@material-ui/icons/Clear';
12
+ import '@material-ui/core/styles';
13
+ import '@material-ui/icons/ArrowBackIos';
14
+ import '@material-ui/icons/ArrowForwardIos';
15
+ import '@material-ui/core/utils';
16
+ import 'react-router';
17
+ import '@material-ui/core/InputBase';
18
+ import '@material-ui/core/IconButton';
19
+ import '@material-ui/lab';
20
+ import '@backstage/plugin-catalog-react';
21
+ import '@backstage/catalog-model';
22
+ import 'react-router-dom';
23
+
24
+ const SidebarSearchModal = () => {
25
+ const {open, toggleModal} = useSearch();
26
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(SidebarItem, {
27
+ className: "search-icon",
28
+ icon: SearchIcon,
29
+ text: "Search",
30
+ onClick: toggleModal
31
+ }), /* @__PURE__ */ React__default.createElement(SearchModal, {
32
+ open,
33
+ toggleModal
34
+ }));
35
+ };
36
+
37
+ export { SidebarSearchModal };
38
+ //# sourceMappingURL=index-859ff534.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-859ff534.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 { SearchModal } from '../SearchModal';\nimport { useSearch } from '../SearchContext';\n\nexport const SidebarSearchModal = () => {\n const { open, toggleModal } = useSearch();\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={SearchIcon}\n text=\"Search\"\n onClick={toggleModal}\n />\n <SearchModal open={open} toggleModal={toggleModal} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAqBa,qBAAqB,MAAM;AACtC,QAAM,CAAE,MAAM,eAAgB;AAE9B,kIAEK,aAAD;AAAA,IACE,WAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAS;AAAA,mDAEV,aAAD;AAAA,IAAa;AAAA,IAAY;AAAA;AAAA;;;;"}