@backstage/plugin-search-react 1.8.0-next.1 → 1.8.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,43 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9d66d8c: Make use of the `useApp` hook to retrieve the specified search icon in the SearchBar
8
+
9
+ ### Patch Changes
10
+
11
+ - fec8b57: Updated exports to use the new type parameters for extensions and extension blueprints.
12
+ - f26ff99: Slight type tweak to match newer React versions better
13
+ - dbbd93e: Internal update to match recent React types
14
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
15
+ - 5446061: The `/alpha` export no longer export extension creators for the new frontend system, existing usage should be switched to use the equivalent extension blueprint instead. For more information see the [new frontend system 1.30 migration documentation](https://backstage.io/docs/frontend-system/architecture/migrations#130).
16
+ - a159180: Added missing items to `overridableComponents`
17
+ - Updated dependencies
18
+ - @backstage/core-components@0.15.0
19
+ - @backstage/frontend-plugin-api@0.8.0
20
+ - @backstage/core-plugin-api@1.9.4
21
+ - @backstage/theme@0.5.7
22
+ - @backstage/version-bridge@1.0.9
23
+ - @backstage/types@1.1.1
24
+ - @backstage/plugin-search-common@1.2.14
25
+
26
+ ## 1.8.0-next.2
27
+
28
+ ### Patch Changes
29
+
30
+ - dbbd93e: Internal update to match recent React types
31
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
32
+ - Updated dependencies
33
+ - @backstage/core-components@0.14.11-next.1
34
+ - @backstage/core-plugin-api@1.9.4-next.0
35
+ - @backstage/frontend-plugin-api@0.8.0-next.2
36
+ - @backstage/theme@0.5.7-next.0
37
+ - @backstage/version-bridge@1.0.9-next.0
38
+ - @backstage/types@1.1.1
39
+ - @backstage/plugin-search-common@1.2.14
40
+
3
41
  ## 1.8.0-next.1
4
42
 
5
43
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react__alpha",
3
- "version": "1.8.0-next.1",
3
+ "version": "1.8.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightedSearchResultText.esm.js","sources":["../../../src/components/HighlightedSearchResultText/HighlightedSearchResultText.tsx"],"sourcesContent":["/*\n * Copyright 2022 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, { useMemo } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(\n () => ({\n highlight: {},\n }),\n { name: 'BackstageHighlightedSearchResultText' },\n);\n\n/**\n * Props for {@link HighlightedSearchResultText}.\n *\n * @public\n */\nexport type HighlightedSearchResultTextProps = {\n text: string;\n preTag: string;\n postTag: string;\n};\n\n/**\n * @public\n */\nexport const HighlightedSearchResultText = (\n props: HighlightedSearchResultTextProps,\n) => {\n const { text, preTag, postTag } = props;\n\n const classes = useStyles();\n const terms = useMemo(\n () => text.split(new RegExp(`(${preTag}.+?${postTag})`)),\n [postTag, preTag, text],\n );\n\n return (\n <>\n {terms.map((t, idx) =>\n t.includes(preTag) ? (\n <mark className={classes.highlight} key={idx}>\n {t.replace(new RegExp(`${preTag}|${postTag}`, 'g'), '')}\n </mark>\n ) : (\n t\n ),\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;AAmBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,OAAO;AAAA,IACL,WAAW,EAAC;AAAA,GACd,CAAA;AAAA,EACA,EAAE,MAAM,sCAAuC,EAAA;AACjD,CAAA,CAAA;AAgBa,MAAA,2BAAA,GAA8B,CACzC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AAElC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MAAM,IAAK,CAAA,KAAA,CAAM,IAAI,MAAA,CAAO,IAAI,MAAM,CAAA,GAAA,EAAM,OAAO,CAAA,CAAA,CAAG,CAAC,CAAA;AAAA,IACvD,CAAC,OAAS,EAAA,MAAA,EAAQ,IAAI,CAAA;AAAA,GACxB,CAAA;AAEA,EAAA,iEAEK,KAAM,CAAA,GAAA;AAAA,IAAI,CAAC,CAAG,EAAA,GAAA,KACb,CAAE,CAAA,QAAA,CAAS,MAAM,CAAA,mBACd,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,SAAW,EAAA,GAAA,EAAK,GACtC,EAAA,EAAA,CAAA,CAAE,OAAQ,CAAA,IAAI,MAAO,CAAA,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA,EAAI,GAAG,CAAA,EAAG,EAAE,CACxD,CAEA,GAAA,CAAA;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HighlightedSearchResultText.esm.js","sources":["../../../src/components/HighlightedSearchResultText/HighlightedSearchResultText.tsx"],"sourcesContent":["/*\n * Copyright 2022 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, { useMemo } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\n/** @public */\nexport type HighlightedSearchResultTextClassKey = 'highlight';\n\nconst useStyles = makeStyles(\n () => ({\n highlight: {},\n }),\n { name: 'BackstageHighlightedSearchResultText' },\n);\n\n/**\n * Props for {@link HighlightedSearchResultText}.\n *\n * @public\n */\nexport type HighlightedSearchResultTextProps = {\n text: string;\n preTag: string;\n postTag: string;\n};\n\n/**\n * @public\n */\nexport const HighlightedSearchResultText = (\n props: HighlightedSearchResultTextProps,\n) => {\n const { text, preTag, postTag } = props;\n\n const classes = useStyles();\n const terms = useMemo(\n () => text.split(new RegExp(`(${preTag}.+?${postTag})`)),\n [postTag, preTag, text],\n );\n\n return (\n <>\n {terms.map((t, idx) =>\n t.includes(preTag) ? (\n <mark className={classes.highlight} key={idx}>\n {t.replace(new RegExp(`${preTag}|${postTag}`, 'g'), '')}\n </mark>\n ) : (\n t\n ),\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;AAsBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,OAAO;AAAA,IACL,WAAW,EAAC;AAAA,GACd,CAAA;AAAA,EACA,EAAE,MAAM,sCAAuC,EAAA;AACjD,CAAA,CAAA;AAgBa,MAAA,2BAAA,GAA8B,CACzC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AAElC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MAAM,IAAK,CAAA,KAAA,CAAM,IAAI,MAAA,CAAO,IAAI,MAAM,CAAA,GAAA,EAAM,OAAO,CAAA,CAAA,CAAG,CAAC,CAAA;AAAA,IACvD,CAAC,OAAS,EAAA,MAAA,EAAQ,IAAI,CAAA;AAAA,GACxB,CAAA;AAEA,EAAA,iEAEK,KAAM,CAAA,GAAA;AAAA,IAAI,CAAC,CAAG,EAAA,GAAA,KACb,CAAE,CAAA,QAAA,CAAS,MAAM,CAAA,mBACd,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,SAAW,EAAA,GAAA,EAAK,GACtC,EAAA,EAAA,CAAA,CAAE,OAAQ,CAAA,IAAI,MAAO,CAAA,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA,EAAI,GAAG,CAAA,EAAG,EAAE,CACxD,CAEA,GAAA,CAAA;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
@@ -6,156 +6,149 @@ import Button from '@material-ui/core/Button';
6
6
  import DefaultSearchIcon from '@material-ui/icons/Search';
7
7
  import React, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
8
8
  import useDebounce from 'react-use/esm/useDebounce';
9
- import { useSearch, SearchContextProvider } from '../../context/SearchContext.esm.js';
9
+ import { SearchContextProvider, useSearch } from '../../context/SearchContext.esm.js';
10
10
 
11
- function withContext(Component) {
12
- return forwardRef((props, ref) => /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(Component, { ...props, ref })));
13
- }
14
- const SearchBarBase = withContext(
15
- forwardRef((props, ref) => {
16
- const {
17
- onChange,
18
- onKeyDown = () => {
19
- },
20
- onClear = () => {
21
- },
22
- onSubmit = () => {
23
- },
24
- debounceTime = 200,
25
- clearButton = true,
26
- fullWidth = true,
27
- value: defaultValue,
28
- label,
29
- placeholder,
30
- inputProps = {},
31
- InputProps = {},
32
- endAdornment,
33
- ...rest
34
- } = props;
35
- const configApi = useApi(configApiRef);
36
- const [value, setValue] = useState("");
37
- const forwardedValueRef = useRef("");
38
- useEffect(() => {
39
- setValue((prevValue) => {
40
- if (prevValue === forwardedValueRef.current) {
41
- return String(defaultValue);
11
+ const SearchBarBase = forwardRef((props, ref) => {
12
+ const {
13
+ onChange,
14
+ onKeyDown = () => {
15
+ },
16
+ onClear = () => {
17
+ },
18
+ onSubmit = () => {
19
+ },
20
+ debounceTime = 200,
21
+ clearButton = true,
22
+ fullWidth = true,
23
+ value: defaultValue,
24
+ label,
25
+ placeholder,
26
+ inputProps = {},
27
+ InputProps = {},
28
+ endAdornment,
29
+ ...rest
30
+ } = props;
31
+ const configApi = useApi(configApiRef);
32
+ const [value, setValue] = useState("");
33
+ const forwardedValueRef = useRef("");
34
+ useEffect(() => {
35
+ setValue((prevValue) => {
36
+ if (prevValue === forwardedValueRef.current) {
37
+ return String(defaultValue);
38
+ }
39
+ return prevValue;
40
+ });
41
+ }, [defaultValue, forwardedValueRef]);
42
+ useDebounce(
43
+ () => {
44
+ forwardedValueRef.current = value;
45
+ onChange(value);
46
+ },
47
+ debounceTime,
48
+ [value]
49
+ );
50
+ const handleChange = useCallback(
51
+ (e) => {
52
+ setValue(e.target.value);
53
+ },
54
+ [setValue]
55
+ );
56
+ const handleKeyDown = useCallback(
57
+ (e) => {
58
+ if (onKeyDown) onKeyDown(e);
59
+ if (onSubmit && e.key === "Enter") {
60
+ onSubmit();
61
+ }
62
+ },
63
+ [onKeyDown, onSubmit]
64
+ );
65
+ const handleClear = useCallback(() => {
66
+ forwardedValueRef.current = "";
67
+ onChange("");
68
+ setValue("");
69
+ if (onClear) {
70
+ onClear();
71
+ }
72
+ }, [onChange, onClear]);
73
+ const ariaLabel = label ? void 0 : "Search";
74
+ const inputPlaceholder = placeholder ?? `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
75
+ const SearchIcon = useApp().getSystemIcon("search") || DefaultSearchIcon;
76
+ const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Query", size: "small", disabled: true }, /* @__PURE__ */ React.createElement(SearchIcon, null)));
77
+ const clearButtonEndAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
78
+ Button,
79
+ {
80
+ "aria-label": "Clear",
81
+ size: "small",
82
+ onClick: handleClear,
83
+ onKeyDown: (event) => {
84
+ if (event.key === "Enter") {
85
+ event.stopPropagation();
42
86
  }
43
- return prevValue;
44
- });
45
- }, [defaultValue, forwardedValueRef]);
46
- useDebounce(
47
- () => {
48
- forwardedValueRef.current = value;
49
- onChange(value);
50
- },
51
- debounceTime,
52
- [value]
53
- );
54
- const handleChange = useCallback(
55
- (e) => {
56
- setValue(e.target.value);
87
+ }
88
+ },
89
+ "Clear"
90
+ ));
91
+ return /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(
92
+ TextField,
93
+ {
94
+ id: "search-bar-text-field",
95
+ "data-testid": "search-bar-next",
96
+ variant: "outlined",
97
+ margin: "normal",
98
+ inputRef: ref,
99
+ value,
100
+ label,
101
+ placeholder: inputPlaceholder,
102
+ InputProps: {
103
+ startAdornment,
104
+ endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,
105
+ ...InputProps
57
106
  },
58
- [setValue]
59
- );
60
- const handleKeyDown = useCallback(
61
- (e) => {
62
- if (onKeyDown) onKeyDown(e);
63
- if (onSubmit && e.key === "Enter") {
64
- onSubmit();
65
- }
107
+ inputProps: {
108
+ "aria-label": ariaLabel,
109
+ ...inputProps
66
110
  },
67
- [onKeyDown, onSubmit]
68
- );
69
- const handleClear = useCallback(() => {
70
- forwardedValueRef.current = "";
71
- onChange("");
72
- setValue("");
73
- if (onClear) {
74
- onClear();
111
+ fullWidth,
112
+ onChange: handleChange,
113
+ onKeyDown: handleKeyDown,
114
+ ...rest
115
+ }
116
+ ));
117
+ });
118
+ const SearchBar = forwardRef((props, ref) => {
119
+ const { value: initialValue = "", onChange, ...rest } = props;
120
+ const { term, setTerm } = useSearch();
121
+ useEffect(() => {
122
+ if (initialValue) {
123
+ setTerm(String(initialValue));
124
+ }
125
+ }, [initialValue, setTerm]);
126
+ const handleChange = useCallback(
127
+ (newValue) => {
128
+ if (onChange) {
129
+ onChange(newValue);
130
+ } else {
131
+ setTerm(newValue);
75
132
  }
76
- }, [onChange, onClear]);
77
- const ariaLabel = label ? void 0 : "Search";
78
- const inputPlaceholder = placeholder ?? `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
79
- const SearchIcon = useApp().getSystemIcon("search") || DefaultSearchIcon;
80
- const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Query", size: "small", disabled: true }, /* @__PURE__ */ React.createElement(SearchIcon, null)));
81
- const clearButtonEndAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
82
- Button,
133
+ },
134
+ [onChange, setTerm]
135
+ );
136
+ return /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(
137
+ AnalyticsContext,
138
+ {
139
+ attributes: { pluginId: "search", extension: "SearchBar" }
140
+ },
141
+ /* @__PURE__ */ React.createElement(
142
+ SearchBarBase,
83
143
  {
84
- "aria-label": "Clear",
85
- size: "small",
86
- onClick: handleClear,
87
- onKeyDown: (event) => {
88
- if (event.key === "Enter") {
89
- event.stopPropagation();
90
- }
91
- }
92
- },
93
- "Clear"
94
- ));
95
- return /* @__PURE__ */ React.createElement(
96
- TextField,
97
- {
98
- id: "search-bar-text-field",
99
- "data-testid": "search-bar-next",
100
- variant: "outlined",
101
- margin: "normal",
102
- inputRef: ref,
103
- value,
104
- label,
105
- placeholder: inputPlaceholder,
106
- InputProps: {
107
- startAdornment,
108
- endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,
109
- ...InputProps
110
- },
111
- inputProps: {
112
- "aria-label": ariaLabel,
113
- ...inputProps
114
- },
115
- fullWidth,
116
- onChange: handleChange,
117
- onKeyDown: handleKeyDown,
118
- ...rest
119
- }
120
- );
121
- })
122
- );
123
- const SearchBar = withContext(
124
- forwardRef((props, ref) => {
125
- const { value: initialValue = "", onChange, ...rest } = props;
126
- const { term, setTerm } = useSearch();
127
- useEffect(() => {
128
- if (initialValue) {
129
- setTerm(String(initialValue));
144
+ ...rest,
145
+ ref,
146
+ value: term,
147
+ onChange: handleChange
130
148
  }
131
- }, [initialValue, setTerm]);
132
- const handleChange = useCallback(
133
- (newValue) => {
134
- if (onChange) {
135
- onChange(newValue);
136
- } else {
137
- setTerm(newValue);
138
- }
139
- },
140
- [onChange, setTerm]
141
- );
142
- return /* @__PURE__ */ React.createElement(
143
- AnalyticsContext,
144
- {
145
- attributes: { pluginId: "search", extension: "SearchBar" }
146
- },
147
- /* @__PURE__ */ React.createElement(
148
- SearchBarBase,
149
- {
150
- ...rest,
151
- ref,
152
- value: term,
153
- onChange: handleChange
154
- }
155
- )
156
- );
157
- })
158
- );
149
+ )
150
+ ));
151
+ });
159
152
 
160
153
  export { SearchBar, SearchBarBase };
161
154
  //# sourceMappingURL=SearchBar.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n useApp,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport DefaultSearchIcon from '@material-ui/icons/Search';\nimport React, {\n ChangeEvent,\n ComponentType,\n forwardRef,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\n\nimport { SearchContextProvider, useSearch } from '../../context';\n\nfunction withContext<T>(Component: ComponentType<T>) {\n return forwardRef<HTMLDivElement, T>((props, ref) => (\n <SearchContextProvider inheritParentContextIfAvailable>\n <Component {...props} ref={ref} />\n </SearchContextProvider>\n ));\n}\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: React.ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase = withContext(\n forwardRef<HTMLDivElement, SearchBarBaseProps>((props, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n );\n }),\n);\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar = withContext(\n forwardRef<HTMLDivElement, SearchBarProps>((props, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n );\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,SAAS,YAAe,SAA6B,EAAA;AACnD,EAAA,OAAO,UAA8B,CAAA,CAAC,KAAO,EAAA,GAAA,yCAC1C,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,KAAO,EAAA,GAAA,EAAU,CAClC,CACD,CAAA,CAAA;AACH,CAAA;AAuBO,MAAM,aAAgB,GAAA,WAAA;AAAA,EAC3B,UAAA,CAA+C,CAAC,KAAA,EAAO,GAAQ,KAAA;AAC7D,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,YAAY,MAAM;AAAA,OAAC;AAAA,MACnB,UAAU,MAAM;AAAA,OAAC;AAAA,MACjB,WAAW,MAAM;AAAA,OAAC;AAAA,MAClB,YAAe,GAAA,GAAA;AAAA,MACf,WAAc,GAAA,IAAA;AAAA,MACd,SAAY,GAAA,IAAA;AAAA,MACZ,KAAO,EAAA,YAAA;AAAA,MACP,KAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAa,EAAC;AAAA,MACd,aAAa,EAAC;AAAA,MACd,YAAA;AAAA,MACA,GAAG,IAAA;AAAA,KACD,GAAA,KAAA,CAAA;AAEJ,IAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,IAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAiB,EAAE,CAAA,CAAA;AAC7C,IAAM,MAAA,iBAAA,GAAoB,OAAe,EAAE,CAAA,CAAA;AAE3C,IAA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QACC,UAAY,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,WAAW,WAAY,EAAA;AAAA,OAAA;AAAA,sBAEzD,KAAA,CAAA,aAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACE,GAAG,IAAA;AAAA,UACJ,GAAA;AAAA,UACA,KAAO,EAAA,IAAA;AAAA,UACP,QAAU,EAAA,YAAA;AAAA,SAAA;AAAA,OACZ;AAAA,KACF,CAAA;AAAA,GAEH,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n useApp,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport DefaultSearchIcon from '@material-ui/icons/Search';\nimport React, {\n ChangeEvent,\n forwardRef,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { SearchContextProvider, useSearch } from '../../context';\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: React.ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase = forwardRef((props: SearchBarBaseProps, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n </SearchContextProvider>\n );\n});\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar = forwardRef((props: SearchBarProps, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n </SearchContextProvider>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;AA6DO,MAAM,aAAgB,GAAA,UAAA,CAAW,CAAC,KAAA,EAA2B,GAAQ,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA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AAA;AAExD,EAAA,MAAM,EAAE,IAAA,EAAM,OAAQ,EAAA,GAAI,SAAU,EAAA,CAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAc,EAAA;AAChB,MAAQ,OAAA,CAAA,MAAA,CAAO,YAAY,CAAC,CAAA,CAAA;AAAA,KAC9B;AAAA,GACC,EAAA,CAAC,YAAc,EAAA,OAAO,CAAC,CAAA,CAAA;AAE1B,EAAA,MAAM,YAAe,GAAA,WAAA;AAAA,IACnB,CAAC,QAAqB,KAAA;AACpB,MAAA,IAAI,QAAU,EAAA;AACZ,QAAA,QAAA,CAAS,QAAQ,CAAA,CAAA;AAAA,OACZ,MAAA;AACL,QAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAAA,OAClB;AAAA,KACF;AAAA,IACA,CAAC,UAAU,OAAO,CAAA;AAAA,GACpB,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,WAAW,WAAY,EAAA;AAAA,KAAA;AAAA,oBAEzD,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QACA,KAAO,EAAA,IAAA;AAAA,QACP,QAAU,EAAA,YAAA;AAAA,OAAA;AAAA,KACZ;AAAA,GAEJ,CAAA,CAAA;AAEJ,CAAC;;;;"}
package/dist/index.d.ts CHANGED
@@ -90,6 +90,8 @@ type SearchResultListItemExtensionsProps = Omit<ListProps, 'results'> & {
90
90
  */
91
91
  declare const SearchResultListItemExtensions: (props: SearchResultListItemExtensionsProps) => React.JSX.Element;
92
92
 
93
+ /** @public */
94
+ type HighlightedSearchResultTextClassKey = 'highlight';
93
95
  /**
94
96
  * Props for {@link HighlightedSearchResultText}.
95
97
  *
@@ -125,7 +127,7 @@ type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {
125
127
  *
126
128
  * @public
127
129
  */
128
- declare const SearchBarBase: React.ForwardRefExoticComponent<Omit<Omit<SearchBarBaseProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
130
+ declare const SearchBarBase: React.ForwardRefExoticComponent<Omit<SearchBarBaseProps, "ref"> & React.RefAttributes<unknown>>;
129
131
  /**
130
132
  * Props for {@link SearchBar}.
131
133
  *
@@ -137,7 +139,7 @@ type SearchBarProps = Partial<SearchBarBaseProps>;
137
139
  *
138
140
  * @public
139
141
  */
140
- declare const SearchBar: React.ForwardRefExoticComponent<Omit<Omit<Partial<SearchBarBaseProps>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
142
+ declare const SearchBar: React.ForwardRefExoticComponent<Omit<Partial<SearchBarBaseProps>, "ref"> & React.RefAttributes<unknown>>;
141
143
 
142
144
  /**
143
145
  * Props for {@link SearchAutocomplete}.
@@ -757,4 +759,4 @@ type SearchContextProviderProps = PropsWithChildren<{
757
759
  */
758
760
  declare const SearchContextProvider: (props: SearchContextProviderProps) => React.JSX.Element;
759
761
 
760
- export { AutocompleteFilter, CheckboxFilter, HigherOrderDefaultResultListItem as DefaultResultListItem, type DefaultResultListItemProps, HighlightedSearchResultText, type HighlightedSearchResultTextProps, MockSearchApi, type SearchApi, SearchAutocomplete, type SearchAutocompleteComponent, SearchAutocompleteDefaultOption, type SearchAutocompleteDefaultOptionProps, type SearchAutocompleteFilterProps, type SearchAutocompleteProps, SearchBar, SearchBarBase, type SearchBarBaseProps, type SearchBarProps, SearchContextProvider, type SearchContextProviderProps, type SearchContextState, type SearchContextValue, SearchFilter, type SearchFilterComponentProps, type SearchFilterWrapperProps, SearchPagination, SearchPaginationBase, type SearchPaginationBaseProps, type SearchPaginationLimitOption, type SearchPaginationLimitText, type SearchPaginationProps, SearchResult, SearchResultApi, type SearchResultApiProps, SearchResultComponent, SearchResultContext, type SearchResultContextProps, SearchResultGroup, SearchResultGroupFilterFieldLayout, type SearchResultGroupFilterFieldLayoutProps, type SearchResultGroupFilterFieldPropsWith, SearchResultGroupLayout, type SearchResultGroupLayoutProps, type SearchResultGroupProps, SearchResultGroupSelectFilterField, type SearchResultGroupSelectFilterFieldProps, SearchResultGroupTextFilterField, type SearchResultGroupTextFilterFieldProps, SearchResultList, type SearchResultListItemExtensionOptions, type SearchResultListItemExtensionProps, SearchResultListItemExtensions, type SearchResultListItemExtensionsProps, SearchResultListLayout, type SearchResultListLayoutProps, type SearchResultListProps, SearchResultPager, type SearchResultProps, SearchResultState, type SearchResultStateProps, SelectFilter, createSearchResultListItemExtension, searchApiRef, useSearch, useSearchContextCheck, useSearchResultListItemExtensions };
762
+ export { AutocompleteFilter, CheckboxFilter, HigherOrderDefaultResultListItem as DefaultResultListItem, type DefaultResultListItemProps, HighlightedSearchResultText, type HighlightedSearchResultTextClassKey, type HighlightedSearchResultTextProps, MockSearchApi, type SearchApi, SearchAutocomplete, type SearchAutocompleteComponent, SearchAutocompleteDefaultOption, type SearchAutocompleteDefaultOptionProps, type SearchAutocompleteFilterProps, type SearchAutocompleteProps, SearchBar, SearchBarBase, type SearchBarBaseProps, type SearchBarProps, SearchContextProvider, type SearchContextProviderProps, type SearchContextState, type SearchContextValue, SearchFilter, type SearchFilterComponentProps, type SearchFilterWrapperProps, SearchPagination, SearchPaginationBase, type SearchPaginationBaseProps, type SearchPaginationLimitOption, type SearchPaginationLimitText, type SearchPaginationProps, SearchResult, SearchResultApi, type SearchResultApiProps, SearchResultComponent, SearchResultContext, type SearchResultContextProps, SearchResultGroup, SearchResultGroupFilterFieldLayout, type SearchResultGroupFilterFieldLayoutProps, type SearchResultGroupFilterFieldPropsWith, SearchResultGroupLayout, type SearchResultGroupLayoutProps, type SearchResultGroupProps, SearchResultGroupSelectFilterField, type SearchResultGroupSelectFilterFieldProps, SearchResultGroupTextFilterField, type SearchResultGroupTextFilterFieldProps, SearchResultList, type SearchResultListItemExtensionOptions, type SearchResultListItemExtensionProps, SearchResultListItemExtensions, type SearchResultListItemExtensionsProps, SearchResultListLayout, type SearchResultListLayoutProps, type SearchResultListProps, SearchResultPager, type SearchResultProps, SearchResultState, type SearchResultStateProps, SelectFilter, createSearchResultListItemExtension, searchApiRef, useSearch, useSearchContextCheck, useSearchResultListItemExtensions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.8.0-next.1",
3
+ "version": "1.8.0",
4
4
  "backstage": {
5
5
  "role": "web-library",
6
6
  "pluginId": "search",
@@ -55,13 +55,13 @@
55
55
  "test": "backstage-cli package test"
56
56
  },
57
57
  "dependencies": {
58
- "@backstage/core-components": "^0.14.11-next.0",
59
- "@backstage/core-plugin-api": "^1.9.3",
60
- "@backstage/frontend-plugin-api": "^0.8.0-next.1",
58
+ "@backstage/core-components": "^0.15.0",
59
+ "@backstage/core-plugin-api": "^1.9.4",
60
+ "@backstage/frontend-plugin-api": "^0.8.0",
61
61
  "@backstage/plugin-search-common": "^1.2.14",
62
- "@backstage/theme": "^0.5.6",
62
+ "@backstage/theme": "^0.5.7",
63
63
  "@backstage/types": "^1.1.1",
64
- "@backstage/version-bridge": "^1.0.8",
64
+ "@backstage/version-bridge": "^1.0.9",
65
65
  "@material-ui/core": "^4.12.2",
66
66
  "@material-ui/icons": "^4.9.1",
67
67
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -71,14 +71,14 @@
71
71
  "react-use": "^17.3.2"
72
72
  },
73
73
  "devDependencies": {
74
- "@backstage/cli": "^0.27.1-next.1",
75
- "@backstage/core-app-api": "^1.14.2",
76
- "@backstage/frontend-app-api": "^0.9.0-next.1",
77
- "@backstage/frontend-test-utils": "^0.2.0-next.1",
78
- "@backstage/test-utils": "^1.6.0-next.0",
74
+ "@backstage/cli": "^0.27.1",
75
+ "@backstage/core-app-api": "^1.15.0",
76
+ "@backstage/frontend-app-api": "^0.9.0",
77
+ "@backstage/frontend-test-utils": "^0.2.0",
78
+ "@backstage/test-utils": "^1.6.0",
79
79
  "@testing-library/dom": "^10.0.0",
80
80
  "@testing-library/jest-dom": "^6.0.0",
81
- "@testing-library/react": "^15.0.0",
81
+ "@testing-library/react": "^16.0.0",
82
82
  "@testing-library/user-event": "^14.0.0"
83
83
  },
84
84
  "peerDependencies": {