@backstage/plugin-search 0.8.1-next.0 → 0.8.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.
@@ -1,7 +1,7 @@
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-a995a1ca.esm.js';
4
+ import { d as SearchModalProvider, u as useSearchModal, e as SearchModal } from './index-489028c1.esm.js';
5
5
  import '@material-ui/icons/FilterList';
6
6
  import '@material-ui/core';
7
7
  import 'react-use/lib/useDebounce';
@@ -12,11 +12,11 @@ import '@material-ui/lab';
12
12
  import 'react-use/lib/useAsyncFn';
13
13
  import '@material-ui/icons/Launch';
14
14
  import '@material-ui/core/styles';
15
- import 'react-text-truncate';
16
15
  import '@material-ui/icons/ArrowBackIos';
17
16
  import '@material-ui/icons/ArrowForwardIos';
18
17
  import '@backstage/errors';
19
18
  import 'qs';
19
+ import '@backstage/version-bridge';
20
20
  import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
@@ -29,7 +29,7 @@ import '@material-ui/icons/ExpandMore';
29
29
  import '@material-ui/icons/FontDownload';
30
30
  import 'react-router-dom';
31
31
 
32
- const SidebarSearchModal = (props) => {
32
+ const SidebarSearchModalContent = (props) => {
33
33
  const { state, toggleModal } = useSearchModal();
34
34
  const Icon = props.icon ? props.icon : SearchIcon;
35
35
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SidebarItem, {
@@ -43,6 +43,11 @@ const SidebarSearchModal = (props) => {
43
43
  children: props.children
44
44
  }));
45
45
  };
46
+ const SidebarSearchModal = (props) => {
47
+ return /* @__PURE__ */ React.createElement(SearchModalProvider, null, /* @__PURE__ */ React.createElement(SidebarSearchModalContent, {
48
+ ...props
49
+ }));
50
+ };
46
51
 
47
52
  export { SidebarSearchModal };
48
- //# sourceMappingURL=index-87731096.esm.js.map
53
+ //# sourceMappingURL=index-5896ef53.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-5896ef53.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\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,4 +1,4 @@
1
- export { c as SearchResult } from './index-a995a1ca.esm.js';
1
+ export { S as SearchPage } from './index-489028c1.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/icons/FilterList';
4
4
  import '@material-ui/core';
@@ -12,11 +12,11 @@ import 'react-use/lib/useAsyncFn';
12
12
  import '@material-ui/icons/Launch';
13
13
  import '@material-ui/core/styles';
14
14
  import '@backstage/core-components';
15
- import 'react-text-truncate';
16
15
  import '@material-ui/icons/ArrowBackIos';
17
16
  import '@material-ui/icons/ArrowForwardIos';
18
17
  import '@backstage/errors';
19
18
  import 'qs';
19
+ import '@backstage/version-bridge';
20
20
  import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
@@ -28,4 +28,4 @@ import 'react-use/lib/useEffectOnce';
28
28
  import '@material-ui/icons/ExpandMore';
29
29
  import '@material-ui/icons/FontDownload';
30
30
  import 'react-router-dom';
31
- //# sourceMappingURL=index-e3f876bf.esm.js.map
31
+ //# sourceMappingURL=index-67b1c480.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-67b1c480.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { D as DefaultResultListItem } from './index-a995a1ca.esm.js';
1
+ export { D as DefaultResultListItem } from './index-489028c1.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/icons/FilterList';
4
4
  import '@material-ui/core';
@@ -12,11 +12,11 @@ import 'react-use/lib/useAsyncFn';
12
12
  import '@material-ui/icons/Launch';
13
13
  import '@material-ui/core/styles';
14
14
  import '@backstage/core-components';
15
- import 'react-text-truncate';
16
15
  import '@material-ui/icons/ArrowBackIos';
17
16
  import '@material-ui/icons/ArrowForwardIos';
18
17
  import '@backstage/errors';
19
18
  import 'qs';
19
+ import '@backstage/version-bridge';
20
20
  import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
@@ -28,4 +28,4 @@ import 'react-use/lib/useEffectOnce';
28
28
  import '@material-ui/icons/ExpandMore';
29
29
  import '@material-ui/icons/FontDownload';
30
30
  import 'react-router-dom';
31
- //# sourceMappingURL=index-48917ac5.esm.js.map
31
+ //# sourceMappingURL=index-8376e63d.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-8376e63d.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { a as SearchBar, b as SearchBarBase } from './index-a995a1ca.esm.js';
1
+ export { a as SearchBar, b as SearchBarBase } from './index-489028c1.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/icons/FilterList';
4
4
  import '@material-ui/core';
@@ -12,11 +12,11 @@ import 'react-use/lib/useAsyncFn';
12
12
  import '@material-ui/icons/Launch';
13
13
  import '@material-ui/core/styles';
14
14
  import '@backstage/core-components';
15
- import 'react-text-truncate';
16
15
  import '@material-ui/icons/ArrowBackIos';
17
16
  import '@material-ui/icons/ArrowForwardIos';
18
17
  import '@backstage/errors';
19
18
  import 'qs';
19
+ import '@backstage/version-bridge';
20
20
  import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
@@ -28,4 +28,4 @@ import 'react-use/lib/useEffectOnce';
28
28
  import '@material-ui/icons/ExpandMore';
29
29
  import '@material-ui/icons/FontDownload';
30
30
  import 'react-router-dom';
31
- //# sourceMappingURL=index-03e76ebf.esm.js.map
31
+ //# sourceMappingURL=index-f5d48e31.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-f5d48e31.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
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-a995a1ca.esm.js';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-489028c1.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';
@@ -14,10 +14,10 @@ import '@material-ui/lab';
14
14
  import 'react-use/lib/useAsyncFn';
15
15
  import '@material-ui/icons/Launch';
16
16
  import '@backstage/core-components';
17
- import 'react-text-truncate';
18
17
  import '@material-ui/icons/ArrowBackIos';
19
18
  import '@material-ui/icons/ArrowForwardIos';
20
19
  import '@backstage/errors';
20
+ import '@backstage/version-bridge';
21
21
  import 'react-use/lib/usePrevious';
22
22
  import 'react-router';
23
23
  import '@material-ui/core/InputBase';
@@ -65,4 +65,4 @@ const HomePageSearchBar = ({ ...props }) => {
65
65
  };
66
66
 
67
67
  export { HomePageSearchBar };
68
- //# sourceMappingURL=index-8bd3badc.esm.js.map
68
+ //# sourceMappingURL=index-fdbbcb7c.esm.js.map
@@ -1 +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
+ {"version":3,"file":"index-fdbbcb7c.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;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { InputBaseProps } from '@material-ui/core';
3
3
  import * as react from 'react';
4
- import { ReactElement } from 'react';
4
+ import { ReactElement, ReactNode } from 'react';
5
5
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
6
6
  import { IconComponent } from '@backstage/core-plugin-api';
7
7
  import * as _backstage_plugin_search_common from '@backstage/plugin-search-common';
@@ -172,16 +172,12 @@ interface SearchModalProps {
172
172
  declare const SearchModal: ({ open, hidden, toggleModal, children, }: SearchModalProps) => JSX.Element;
173
173
 
174
174
  /**
175
- * Use this hook to manage the state of {@link SearchModal}
176
- * and change its visibility.
175
+ * The state of the search modal, as well as functions for changing the modal's
176
+ * visibility.
177
177
  *
178
178
  * @public
179
- *
180
- * @param initialState - pass `true` to make the modal initially visible
181
- * @returns an object containing the state of the modal together with
182
- * functions for changing the visibility of the modal.
183
179
  */
184
- declare function useSearchModal(initialState?: boolean): {
180
+ declare type SearchModalValue = {
185
181
  state: {
186
182
  hidden: boolean;
187
183
  open: boolean;
@@ -189,6 +185,61 @@ declare function useSearchModal(initialState?: boolean): {
189
185
  toggleModal: () => void;
190
186
  setOpen: (open: boolean) => void;
191
187
  };
188
+ /**
189
+ * Props for the SearchModalProvider.
190
+ * @public
191
+ */
192
+ declare type SearchModalProviderProps = {
193
+ /**
194
+ * Children which should have access to the SearchModal context and the
195
+ * associated useSearchModal() hook.
196
+ */
197
+ children: ReactNode;
198
+ /**
199
+ * Pass true if the modal should be rendered initially.
200
+ */
201
+ showInitially?: boolean;
202
+ };
203
+ /**
204
+ * A context provider responsible for storing and managing state related to the
205
+ * search modal.
206
+ *
207
+ * @remarks
208
+ * If you need to control visibility of the search toggle outside of the modal
209
+ * itself, you can optionally place this higher up in the react tree where your
210
+ * custom code and the search modal share the same context.
211
+ *
212
+ * @example
213
+ * ```tsx
214
+ * import {
215
+ * SearchModalProvider,
216
+ * SidebarSearchModal,
217
+ * } from '@backstage/plugin-search';
218
+ *
219
+ * // ...
220
+ *
221
+ * <SearchModalProvider>
222
+ * <KeyboardShortcutSearchToggler />
223
+ * <SidebarSearchModal>
224
+ * {({ toggleModal }) => <SearchModal toggleModal={toggleModal} />}
225
+ * </SidebarSearchModal>
226
+ * </SearchModalProvider>
227
+ * ```
228
+ *
229
+ * @public
230
+ */
231
+ declare const SearchModalProvider: ({ children, showInitially, }: SearchModalProviderProps) => JSX.Element;
232
+ /**
233
+ * Use this hook to manage the state of {@link SearchModal}
234
+ * and change its visibility.
235
+ *
236
+ * @public
237
+ *
238
+ * @param initialState - pass `true` to make the modal initially visible
239
+ * @returns an object containing the state of the modal together with
240
+ * functions for changing the visibility of the modal.
241
+ */
242
+ declare function useSearchModal(initialState?: boolean): SearchModalValue;
192
243
 
193
244
  declare const SearchPage$1: () => JSX.Element;
194
245
 
@@ -278,12 +329,13 @@ declare const SearchResult: ({ children }: {
278
329
  }) => JSX.Element;
279
330
  }) => JSX.Element;
280
331
  declare const SidebarSearchModal: (props: SidebarSearchModalProps) => JSX.Element;
281
- declare const DefaultResultListItem: ({ result, icon, secondaryAction, lineClamp, }: {
332
+ declare const DefaultResultListItem: ({ result, highlight, icon, secondaryAction, lineClamp, }: {
282
333
  icon?: react.ReactNode;
283
334
  secondaryAction?: react.ReactNode;
284
335
  result: _backstage_plugin_search_common.SearchDocument;
336
+ highlight?: _backstage_plugin_search_common.ResultHighlight | undefined;
285
337
  lineClamp?: number | undefined;
286
338
  }) => JSX.Element;
287
339
  declare const HomePageSearchBar: ({ ...props }: Partial<Omit<SearchBarBaseProps, "onChange" | "onSubmit">>) => JSX.Element;
288
340
 
289
- export { DefaultResultListItem, Filters, FiltersButton, FiltersState, HomePageSearchBar, HomePageSearchBarProps, SearchPage$1 as Router, SearchAutocompleteFilterProps, SearchBar, SearchBarBase, SearchBarBaseProps, SearchBarNext, SearchBarProps, SearchFilter, SearchFilterComponentProps, SearchFilterNext, SearchFilterWrapperProps, SearchModal, SearchModalChildrenProps, SearchModalProps, SearchPage, SearchPageNext, SearchResult, SearchResultPager, SearchType, SearchTypeAccordionProps, SearchTypeProps, SearchTypeTabsProps, SidebarSearch, SidebarSearchModal, SidebarSearchModalProps, SidebarSearchProps, searchPlugin as plugin, searchPlugin, useSearchModal };
341
+ export { DefaultResultListItem, Filters, FiltersButton, FiltersState, HomePageSearchBar, HomePageSearchBarProps, SearchPage$1 as Router, SearchAutocompleteFilterProps, SearchBar, SearchBarBase, SearchBarBaseProps, SearchBarNext, SearchBarProps, SearchFilter, SearchFilterComponentProps, SearchFilterNext, SearchFilterWrapperProps, SearchModal, SearchModalChildrenProps, SearchModalProps, SearchModalProvider, SearchModalProviderProps, SearchModalValue, SearchPage, SearchPageNext, SearchResult, SearchResultPager, SearchType, SearchTypeAccordionProps, SearchTypeProps, SearchTypeTabsProps, SidebarSearch, SidebarSearchModal, SidebarSearchModalProps, SidebarSearchProps, searchPlugin as plugin, searchPlugin, useSearchModal };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { k as DefaultResultListItem, F as Filters, e as FiltersButton, H as HomePageSearchBar, S as Router, a as SearchBar, b as SearchBarBase, l as SearchBarNext, f as SearchFilter, g as SearchFilterNext, d as SearchModal, m as SearchPage, n as SearchPageNext, o as SearchResult, h as SearchResultPager, i as SearchType, j as SidebarSearch, p as SidebarSearchModal, s as plugin, s as searchPlugin, u as useSearchModal } from './esm/index-a995a1ca.esm.js';
1
+ export { l as DefaultResultListItem, F as Filters, f as FiltersButton, H as HomePageSearchBar, S as Router, a as SearchBar, b as SearchBarBase, m as SearchBarNext, g as SearchFilter, h as SearchFilterNext, e as SearchModal, d as SearchModalProvider, n as SearchPage, o as SearchPageNext, p as SearchResult, i as SearchResultPager, j as SearchType, k as SidebarSearch, q as SidebarSearchModal, s as plugin, s as searchPlugin, u as useSearchModal } from './esm/index-489028c1.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/icons/FilterList';
4
4
  import '@material-ui/core';
@@ -12,11 +12,11 @@ import 'react-use/lib/useAsyncFn';
12
12
  import '@material-ui/icons/Launch';
13
13
  import '@material-ui/core/styles';
14
14
  import '@backstage/core-components';
15
- import 'react-text-truncate';
16
15
  import '@material-ui/icons/ArrowBackIos';
17
16
  import '@material-ui/icons/ArrowForwardIos';
18
17
  import '@backstage/errors';
19
18
  import 'qs';
19
+ import '@backstage/version-bridge';
20
20
  import 'react-use/lib/usePrevious';
21
21
  import 'react-router';
22
22
  import '@material-ui/core/InputBase';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search",
3
3
  "description": "The Backstage plugin that provides your backstage app with search",
4
- "version": "0.8.1-next.0",
4
+ "version": "0.8.1",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,23 +33,23 @@
33
33
  "clean": "backstage-cli package clean"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/catalog-model": "^1.0.1",
37
- "@backstage/config": "^1.0.0",
38
- "@backstage/core-components": "^0.9.3",
39
- "@backstage/core-plugin-api": "^1.0.1",
36
+ "@backstage/catalog-model": "^1.0.2",
37
+ "@backstage/config": "^1.0.1",
38
+ "@backstage/core-components": "^0.9.4",
39
+ "@backstage/core-plugin-api": "^1.0.2",
40
40
  "@backstage/errors": "^1.0.0",
41
- "@backstage/plugin-catalog-react": "^1.1.0-next.0",
42
- "@backstage/plugin-search-common": "^0.3.3",
43
- "@backstage/plugin-search-react": "^0.1.1-next.0",
41
+ "@backstage/plugin-catalog-react": "^1.1.0",
42
+ "@backstage/plugin-search-common": "^0.3.4",
43
+ "@backstage/plugin-search-react": "^0.2.0",
44
44
  "@backstage/theme": "^0.2.15",
45
45
  "@backstage/types": "^1.0.0",
46
+ "@backstage/version-bridge": "^1.0.1",
46
47
  "@material-ui/core": "^4.12.2",
47
48
  "@material-ui/icons": "^4.9.1",
48
49
  "@material-ui/lab": "4.0.0-alpha.57",
49
50
  "qs": "^6.9.4",
50
51
  "react-router": "6.0.0-beta.0",
51
52
  "react-router-dom": "6.0.0-beta.0",
52
- "react-text-truncate": "^0.18.0",
53
53
  "react-use": "^17.2.4"
54
54
  },
55
55
  "peerDependencies": {
@@ -57,10 +57,10 @@
57
57
  "react": "^16.13.1 || ^17.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@backstage/cli": "^0.17.1-next.0",
61
- "@backstage/core-app-api": "^1.0.1",
62
- "@backstage/dev-utils": "^1.0.2-next.0",
63
- "@backstage/test-utils": "^1.0.2-next.0",
60
+ "@backstage/cli": "^0.17.1",
61
+ "@backstage/core-app-api": "^1.0.2",
62
+ "@backstage/dev-utils": "^1.0.2",
63
+ "@backstage/test-utils": "^1.1.0",
64
64
  "@testing-library/jest-dom": "^5.10.1",
65
65
  "@testing-library/react": "^12.1.3",
66
66
  "@testing-library/react-hooks": "^8.0.0",
@@ -73,5 +73,5 @@
73
73
  "files": [
74
74
  "dist"
75
75
  ],
76
- "gitHead": "88ee375f5ee44b7a7917297785ddf88691fe3381"
76
+ "gitHead": "96323f280ba32ee526c5b151cda42260aee927c9"
77
77
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-03e76ebf.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-48917ac5.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
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;;;;"}