@backstage/plugin-search 0.8.2-next.2 → 0.9.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,58 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.9.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 509c4092f0: To allow people to use a global search context in the search modal, the code for the search modal has been changed to only create a local search context if there is no parent context already defined.
8
+
9
+ If you want to continue using a local context even if you define a global one, you will have to wrap the modal in a new local context manually:
10
+
11
+ ```tsx
12
+ <SearchContextProvider>
13
+ <SearchModal toggleModal={toggleModal} />
14
+ </SearchContextProvider>
15
+ ```
16
+
17
+ - Updated dependencies
18
+ - @backstage/core-components@0.9.6-next.1
19
+ - @backstage/catalog-model@1.1.0-next.1
20
+ - @backstage/errors@1.1.0-next.0
21
+ - @backstage/theme@0.2.16-next.0
22
+ - @backstage/plugin-catalog-react@1.1.2-next.1
23
+ - @backstage/plugin-search-common@0.3.6-next.0
24
+ - @backstage/plugin-search-react@0.2.2-next.1
25
+
26
+ ## 0.9.1-next.0
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies
31
+ - @backstage/catalog-model@1.1.0-next.0
32
+ - @backstage/core-components@0.9.6-next.0
33
+ - @backstage/plugin-catalog-react@1.1.2-next.0
34
+ - @backstage/plugin-search-react@0.2.2-next.0
35
+
36
+ ## 0.9.0
37
+
38
+ ### Minor Changes
39
+
40
+ - 2dc4818541: The pre-alpha `<SearchPageNext>`, `<SearchBarNext>`, `etc...` components have been removed. In the unlikely event you were still using/referencing them, please update to using their non-`*Next` equivalents from either `@backstage/plugin-search-react` or `@backstage/plugin-search`.
41
+
42
+ ### Patch Changes
43
+
44
+ - 8809159148: Components `<DefaultResultListItem>`, `<SearchBar>` (including `<SearchBarBase>`), `<SearchFilter>` (including `.Checkbox`, `.Select`, and `.Autocomplete` static prop components), `<SearchResult>`, and `<SearchResultPager>` are now exported from `@backstage/plugin-search-react`. They are now deprecated in `@backstage/plugin-search` and will be removed in a future release.
45
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
46
+ - 5388e6bdc5: Fixed a bug that could cause analytics events in other parts of Backstage to capture nonsensical values resembling search modal state under some circumstances.
47
+ - 915700f64f: In order to simplify analytics on top of the search experience in Backstage, the provided `<*ResultListItem />` component now captures a `discover` analytics event instead of a `click` event. This event includes the result rank as its `value` and, like a click, the URL/path clicked to as its `to` attribute.
48
+ - Updated dependencies
49
+ - @backstage/plugin-catalog-react@1.1.1
50
+ - @backstage/plugin-search-common@0.3.5
51
+ - @backstage/plugin-search-react@0.2.1
52
+ - @backstage/core-components@0.9.5
53
+ - @backstage/core-plugin-api@1.0.3
54
+ - @backstage/catalog-model@1.0.3
55
+
3
56
  ## 0.8.2-next.2
4
57
 
5
58
  ### Patch Changes
package/README.md CHANGED
@@ -13,14 +13,17 @@ Run `yarn dev` in the root directory, and then navigate to [/search](http://loca
13
13
  This search plugin is primarily responsible for the following:
14
14
 
15
15
  - Providing a `<SearchPage />` routable extension.
16
- - Exposing various search-related components (like `<SearchBar />`,
17
- `<SearchFilter />`, etc), which can be composed by a Backstage App or by
16
+ - Exposing various search-related components (like `<SearchModal />`,
17
+ `<SidebarSearch />`, etc), which can be composed by a Backstage App or by
18
18
  other Backstage Plugins to power search experiences of all kinds.
19
- - Exposing a `<SearchContextProvider />`, which manages search state and API
20
- communication with the Backstage backend.
21
19
 
22
- Don't forget, a lot of functionality is available in backend plugins:
20
+ Don't forget, a lot of functionality is available in web libraries and backend plugins:
23
21
 
22
+ - `@backstage/plugin-search-react`, which is responsible for:
23
+ - Exposing a `<SearchContextProvider />`, which manages search state and API
24
+ communication with the Backstage backend.
25
+ - Exposing the `SearchApi` and its corresponding ref.
26
+ - Exposing reusable components, such as `<SearchBar>` and `<SearchFilter>`, etc.
24
27
  - `@backstage/plugin-search-backend-node`, which is responsible for the search
25
28
  index management
26
29
  - `@backstage/plugin-search-backend`, which is responsible for query processing
@@ -1,31 +1,30 @@
1
- export { S as SearchPage } from './index-c59424ea.esm.js';
1
+ export { S as SearchPage } from './index-5187be91.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/icons/FilterList';
4
4
  import '@material-ui/core';
5
- import 'react-use/lib/useDebounce';
6
- import '@backstage/core-plugin-api';
7
- import '@material-ui/icons/Search';
8
- import '@material-ui/icons/Clear';
9
5
  import '@backstage/plugin-search-react';
10
- import '@material-ui/lab';
11
- import 'react-use/lib/useAsyncFn';
12
6
  import '@material-ui/icons/Launch';
13
7
  import '@material-ui/core/styles';
8
+ import '@backstage/core-plugin-api';
14
9
  import '@backstage/core-components';
15
- import '@material-ui/icons/ArrowBackIos';
16
- import '@material-ui/icons/ArrowForwardIos';
17
10
  import '@backstage/errors';
18
11
  import 'qs';
19
12
  import '@backstage/version-bridge';
20
13
  import 'react-use/lib/usePrevious';
21
14
  import 'react-router';
15
+ import 'react-use/lib/useDebounce';
22
16
  import '@material-ui/core/InputBase';
23
17
  import '@material-ui/core/IconButton';
18
+ import '@material-ui/icons/Search';
19
+ import '@material-ui/icons/Clear';
20
+ import '@material-ui/lab';
24
21
  import 'react-use/lib/useAsync';
25
22
  import '@backstage/plugin-catalog-react';
26
23
  import '@backstage/catalog-model';
24
+ import '@material-ui/icons/ArrowBackIos';
25
+ import '@material-ui/icons/ArrowForwardIos';
27
26
  import 'react-use/lib/useEffectOnce';
28
27
  import '@material-ui/icons/ExpandMore';
29
28
  import '@material-ui/icons/FontDownload';
30
29
  import 'react-router-dom';
31
- //# sourceMappingURL=index-b9062edb.esm.js.map
30
+ //# sourceMappingURL=index-2e41707a.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-2e41707a.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,29 +1,28 @@
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 { d as SearchModalProvider, u as useSearchModal, e as SearchModal } from './index-c59424ea.esm.js';
4
+ import { a as SearchModalProvider, u as useSearchModal, b as SearchModal } from './index-5187be91.esm.js';
5
5
  import '@material-ui/icons/FilterList';
6
6
  import '@material-ui/core';
7
- import 'react-use/lib/useDebounce';
8
- import '@backstage/core-plugin-api';
9
- import '@material-ui/icons/Clear';
10
7
  import '@backstage/plugin-search-react';
11
- import '@material-ui/lab';
12
- import 'react-use/lib/useAsyncFn';
13
8
  import '@material-ui/icons/Launch';
14
9
  import '@material-ui/core/styles';
15
- import '@material-ui/icons/ArrowBackIos';
16
- import '@material-ui/icons/ArrowForwardIos';
10
+ import '@backstage/core-plugin-api';
17
11
  import '@backstage/errors';
18
12
  import 'qs';
19
13
  import '@backstage/version-bridge';
20
14
  import 'react-use/lib/usePrevious';
21
15
  import 'react-router';
16
+ import 'react-use/lib/useDebounce';
22
17
  import '@material-ui/core/InputBase';
23
18
  import '@material-ui/core/IconButton';
19
+ import '@material-ui/icons/Clear';
20
+ import '@material-ui/lab';
24
21
  import 'react-use/lib/useAsync';
25
22
  import '@backstage/plugin-catalog-react';
26
23
  import '@backstage/catalog-model';
24
+ import '@material-ui/icons/ArrowBackIos';
25
+ import '@material-ui/icons/ArrowForwardIos';
27
26
  import 'react-use/lib/useEffectOnce';
28
27
  import '@material-ui/icons/ExpandMore';
29
28
  import '@material-ui/icons/FontDownload';
@@ -50,4 +49,4 @@ const SidebarSearchModal = (props) => {
50
49
  };
51
50
 
52
51
  export { SidebarSearchModal };
53
- //# sourceMappingURL=index-1c96b52b.esm.js.map
52
+ //# sourceMappingURL=index-30f1f9c5.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-30f1f9c5.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 SearchModalProvider,\n useSearchModal,\n} from '../SearchModal';\n\n/**\n * Props for {@link SidebarSearchModal}.\n *\n * @public\n */\nexport type SidebarSearchModalProps = {\n icon?: IconComponent;\n children?: (props: SearchModalChildrenProps) => JSX.Element;\n};\n\nconst SidebarSearchModalContent = (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\nexport const SidebarSearchModal = (props: SidebarSearchModalProps) => {\n return (\n <SearchModalProvider>\n <SidebarSearchModalContent {...props} />\n </SearchModalProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,yBAAyB,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,CAAC,CAAC;AACU,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,yBAAyB,EAAE;AACvI,IAAI,GAAG,KAAK;AACZ,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
@@ -1,30 +1,29 @@
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-c59424ea.esm.js';
3
+ import { SearchBarBase } from '@backstage/plugin-search-react';
4
4
  import qs from 'qs';
5
5
  import { useNavigate } from 'react-router-dom';
6
+ import { r as rootRouteRef } from './index-5187be91.esm.js';
6
7
  import { useRouteRef } from '@backstage/core-plugin-api';
7
8
  import '@material-ui/icons/FilterList';
8
9
  import '@material-ui/core';
9
- import 'react-use/lib/useDebounce';
10
- import '@material-ui/icons/Search';
11
- import '@material-ui/icons/Clear';
12
- import '@backstage/plugin-search-react';
13
- import '@material-ui/lab';
14
- import 'react-use/lib/useAsyncFn';
15
10
  import '@material-ui/icons/Launch';
16
11
  import '@backstage/core-components';
17
- import '@material-ui/icons/ArrowBackIos';
18
- import '@material-ui/icons/ArrowForwardIos';
19
12
  import '@backstage/errors';
20
13
  import '@backstage/version-bridge';
21
14
  import 'react-use/lib/usePrevious';
22
15
  import 'react-router';
16
+ import 'react-use/lib/useDebounce';
23
17
  import '@material-ui/core/InputBase';
24
18
  import '@material-ui/core/IconButton';
19
+ import '@material-ui/icons/Search';
20
+ import '@material-ui/icons/Clear';
21
+ import '@material-ui/lab';
25
22
  import 'react-use/lib/useAsync';
26
23
  import '@backstage/plugin-catalog-react';
27
24
  import '@backstage/catalog-model';
25
+ import '@material-ui/icons/ArrowBackIos';
26
+ import '@material-ui/icons/ArrowForwardIos';
28
27
  import 'react-use/lib/useEffectOnce';
29
28
  import '@material-ui/icons/ExpandMore';
30
29
  import '@material-ui/icons/FontDownload';
@@ -65,4 +64,4 @@ const HomePageSearchBar = ({ ...props }) => {
65
64
  };
66
65
 
67
66
  export { HomePageSearchBar };
68
- //# sourceMappingURL=index-c08cd99a.esm.js.map
67
+ //# sourceMappingURL=index-50da964c.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-50da964c.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 {\n SearchBarBase,\n SearchBarBaseProps,\n} from '@backstage/plugin-search-react';\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 */\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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