@backstage/plugin-search 0.5.1 → 0.5.2

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,28 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3d98955c8a: Add Optional Props to Override Icon for SidebarSearch and SidebarSearchModal Component
8
+ - 49a696d720: Standardizes the component used as a search box in the search modal and in the composable home page.
9
+
10
+ After these changes, all search boxes exported by the search plugin are based on the `<SearchBarBase />` component, and this one is based on the `<InputBase />` component of the Material UI. This means that when you use SearchBarBase or one of its derived components (like `SearchBar` and `HomePageSearchBar`) you can pass all properties accepted by InputBase that have not been replaced by the props type of those components.
11
+
12
+ For example:
13
+
14
+ ```jsx
15
+ <SearchInputBase color="secondary" debouceTime={500} />
16
+ ```
17
+
18
+ The `color` property is inherited from `InputBaseProps` type and `debouceTime` defined by `SearchBarBaseProps`.
19
+
20
+ - 7a4bd2ceac: Prefer using `Link` from `@backstage/core-components` rather than material-UI.
21
+ - Updated dependencies
22
+ - @backstage/core-plugin-api@0.4.0
23
+ - @backstage/plugin-catalog-react@0.6.8
24
+ - @backstage/core-components@0.8.2
25
+
3
26
  ## 0.5.1
4
27
 
5
28
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- export { S as SearchPage } from './index-893ec2f5.esm.js';
1
+ export { S as SearchPage } from './index-655809db.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-04d32ed0.esm.js.map
23
+ //# sourceMappingURL=index-0a2fab21.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-0a2fab21.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { D as DefaultResultListItem } from './index-893ec2f5.esm.js';
1
+ export { D as DefaultResultListItem } from './index-655809db.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-e9bf7392.esm.js.map
23
+ //# sourceMappingURL=index-18219c65.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-18219c65.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { c as SearchResult } from './index-893ec2f5.esm.js';
1
+ export { c as SearchResult } from './index-655809db.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-3cbe4558.esm.js.map
23
+ //# sourceMappingURL=index-2a318193.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-2a318193.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -22,8 +22,7 @@ import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
22
22
  import { useNavigate } from 'react-router-dom';
23
23
 
24
24
  const searchApiRef = createApiRef({
25
- id: "plugin.search.queryservice",
26
- description: "Used to make requests against the search API"
25
+ id: "plugin.search.queryservice"
27
26
  });
28
27
  class SearchClient {
29
28
  constructor(options) {
@@ -62,7 +61,7 @@ const DefaultResultListItem$1 = ({
62
61
  }, secondaryAction)), /* @__PURE__ */ React__default.createElement(Divider, null));
63
62
  };
64
63
 
65
- const useStyles$9 = makeStyles((theme) => ({
64
+ const useStyles$a = makeStyles((theme) => ({
66
65
  filters: {
67
66
  width: "250px",
68
67
  display: "flex"
@@ -75,7 +74,7 @@ const FiltersButton$1 = ({
75
74
  numberOfSelectedFilters,
76
75
  handleToggleFilters
77
76
  }) => {
78
- const classes = useStyles$9();
77
+ const classes = useStyles$a();
79
78
  return /* @__PURE__ */ React__default.createElement("div", {
80
79
  className: classes.filters
81
80
  }, /* @__PURE__ */ React__default.createElement(IconButton, {
@@ -87,7 +86,7 @@ const FiltersButton$1 = ({
87
86
  }, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
88
87
  };
89
88
 
90
- const useStyles$8 = makeStyles((theme) => ({
89
+ const useStyles$9 = makeStyles((theme) => ({
91
90
  filters: {
92
91
  background: "transparent",
93
92
  boxShadow: "0px 0px 0px 0px"
@@ -106,7 +105,7 @@ const Filters$1 = ({
106
105
  updateSelected,
107
106
  updateChecked
108
107
  }) => {
109
- const classes = useStyles$8();
108
+ const classes = useStyles$9();
110
109
  return /* @__PURE__ */ React__default.createElement(Card, {
111
110
  className: classes.filters
112
111
  }, /* @__PURE__ */ React__default.createElement(CardHeader, {
@@ -229,77 +228,77 @@ const useSearch = () => {
229
228
  };
230
229
 
231
230
  const SearchBarBase = ({
232
- autoFocus,
233
- value,
234
231
  onChange,
232
+ onKeyDown,
235
233
  onSubmit,
236
- className,
237
- placeholder: overridePlaceholder,
238
- clearButton = true
234
+ debounceTime = 200,
235
+ clearButton = true,
236
+ fullWidth = true,
237
+ value: defaultValue,
238
+ inputProps: defaultInputProps = {},
239
+ endAdornment: defaultEndAdornment,
240
+ ...props
239
241
  }) => {
240
242
  const configApi = useApi(configApiRef);
241
- const onKeyDown = React__default.useCallback((e) => {
243
+ const [value, setValue] = useState(defaultValue);
244
+ useEffect(() => {
245
+ setValue((prevValue) => prevValue !== defaultValue ? defaultValue : prevValue);
246
+ }, [defaultValue]);
247
+ useDebounce(() => onChange(value), debounceTime, [value]);
248
+ const handleChange = useCallback((e) => {
249
+ setValue(e.target.value);
250
+ }, [setValue]);
251
+ const handleKeyDown = useCallback((e) => {
252
+ if (onKeyDown)
253
+ onKeyDown(e);
242
254
  if (onSubmit && e.key === "Enter") {
243
255
  onSubmit();
244
256
  }
245
- }, [onSubmit]);
246
- const handleClear = React__default.useCallback(() => {
257
+ }, [onKeyDown, onSubmit]);
258
+ const handleClear = useCallback(() => {
247
259
  onChange("");
248
260
  }, [onChange]);
249
- const placeholder = overridePlaceholder != null ? overridePlaceholder : `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
261
+ const placeholder = `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
262
+ const startAdornment = /* @__PURE__ */ React__default.createElement(InputAdornment, {
263
+ position: "start"
264
+ }, /* @__PURE__ */ React__default.createElement(IconButton, {
265
+ "aria-label": "Query",
266
+ disabled: true
267
+ }, /* @__PURE__ */ React__default.createElement(SearchIcon, null)));
268
+ const endAdornment = /* @__PURE__ */ React__default.createElement(InputAdornment, {
269
+ position: "end"
270
+ }, /* @__PURE__ */ React__default.createElement(IconButton, {
271
+ "aria-label": "Clear",
272
+ onClick: handleClear
273
+ }, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
250
274
  return /* @__PURE__ */ React__default.createElement(InputBase, {
251
- autoFocus,
252
275
  "data-testid": "search-bar-next",
253
- fullWidth: true,
254
- placeholder,
255
276
  value,
256
- onChange: (e) => onChange(e.target.value),
257
- inputProps: { "aria-label": "Search" },
258
- startAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
259
- position: "start"
260
- }, /* @__PURE__ */ React__default.createElement(IconButton, {
261
- "aria-label": "Query",
262
- disabled: true
263
- }, /* @__PURE__ */ React__default.createElement(SearchIcon, null))),
264
- endAdornment: clearButton && /* @__PURE__ */ React__default.createElement(InputAdornment, {
265
- position: "end"
266
- }, /* @__PURE__ */ React__default.createElement(IconButton, {
267
- "aria-label": "Clear",
268
- onClick: handleClear
269
- }, /* @__PURE__ */ React__default.createElement(ClearButton, null))),
270
- ...className && { className },
271
- ...onSubmit && { onKeyDown }
277
+ placeholder,
278
+ startAdornment,
279
+ endAdornment: clearButton ? endAdornment : defaultEndAdornment,
280
+ inputProps: { "aria-label": "Search", ...defaultInputProps },
281
+ fullWidth,
282
+ onChange: handleChange,
283
+ onKeyDown: handleKeyDown,
284
+ ...props
272
285
  });
273
286
  };
274
- const SearchBar$1 = ({
275
- autoFocus,
276
- className,
277
- debounceTime = 0,
278
- placeholder,
279
- clearButton = true
280
- }) => {
287
+ const SearchBar$1 = ({ onChange, ...props }) => {
281
288
  const { term, setTerm } = useSearch();
282
- const [value, setValue] = useState(term);
283
- useEffect(() => {
284
- setValue((prevValue) => prevValue !== term ? term : prevValue);
285
- }, [term]);
286
- useDebounce(() => setTerm(value), debounceTime, [value]);
287
- const handleQuery = (newValue) => {
288
- setValue(newValue);
289
+ const handleChange = (newValue) => {
290
+ setTerm(newValue);
291
+ if (onChange)
292
+ onChange(newValue);
289
293
  };
290
- const handleClear = () => setValue("");
291
294
  return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
292
- autoFocus,
293
- className,
294
- value,
295
- onChange: handleQuery,
296
- onClear: handleClear,
297
- placeholder,
298
- clearButton
295
+ value: term,
296
+ onChange: handleChange,
297
+ ...props
299
298
  });
300
299
  };
301
300
 
302
- const useStyles$7 = makeStyles({
301
+ const useStyles$8 = makeStyles({
303
302
  label: {
304
303
  textTransform: "capitalize"
305
304
  }
@@ -310,7 +309,7 @@ const CheckboxFilter = ({
310
309
  defaultValue,
311
310
  values = []
312
311
  }) => {
313
- const classes = useStyles$7();
312
+ const classes = useStyles$8();
314
313
  const { filters, setFilters } = useSearch();
315
314
  useEffect(() => {
316
315
  if (Array.isArray(defaultValue)) {
@@ -360,7 +359,7 @@ const SelectFilter = ({
360
359
  defaultValue,
361
360
  values = []
362
361
  }) => {
363
- const classes = useStyles$7();
362
+ const classes = useStyles$8();
364
363
  const { filters, setFilters } = useSearch();
365
364
  useEffect(() => {
366
365
  if (typeof defaultValue === "string") {
@@ -437,7 +436,7 @@ const SearchResultComponent = ({ children }) => {
437
436
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children({ results: value.results }));
438
437
  };
439
438
 
440
- const useStyles$6 = makeStyles((theme) => ({
439
+ const useStyles$7 = makeStyles((theme) => ({
441
440
  root: {
442
441
  display: "flex",
443
442
  justifyContent: "space-between",
@@ -447,7 +446,7 @@ const useStyles$6 = makeStyles((theme) => ({
447
446
  }));
448
447
  const SearchResultPager = () => {
449
448
  const { fetchNextPage, fetchPreviousPage } = useSearch();
450
- const classes = useStyles$6();
449
+ const classes = useStyles$7();
451
450
  if (!fetchNextPage && !fetchPreviousPage) {
452
451
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
453
452
  }
@@ -491,58 +490,58 @@ const searchPlugin = createPlugin({
491
490
  });
492
491
  const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
493
492
  name: "SearchPage",
494
- component: () => import('./index-04d32ed0.esm.js').then((m) => m.SearchPage),
493
+ component: () => import('./index-0a2fab21.esm.js').then((m) => m.SearchPage),
495
494
  mountPoint: rootRouteRef
496
495
  }));
497
496
  const SearchPageNext = searchPlugin.provide(createRoutableExtension({
498
497
  name: "SearchPageNext",
499
- component: () => import('./index-04d32ed0.esm.js').then((m) => m.SearchPage),
498
+ component: () => import('./index-0a2fab21.esm.js').then((m) => m.SearchPage),
500
499
  mountPoint: rootNextRouteRef
501
500
  }));
502
501
  searchPlugin.provide(createComponentExtension({
503
502
  name: "SearchBar",
504
503
  component: {
505
- lazy: () => import('./index-bfe6f2c6.esm.js').then((m) => m.SearchBar)
504
+ lazy: () => import('./index-d5ddea91.esm.js').then((m) => m.SearchBar)
506
505
  }
507
506
  }));
508
507
  const SearchBarNext = searchPlugin.provide(createComponentExtension({
509
508
  name: "SearchBarNext",
510
509
  component: {
511
- lazy: () => import('./index-bfe6f2c6.esm.js').then((m) => m.SearchBar)
510
+ lazy: () => import('./index-d5ddea91.esm.js').then((m) => m.SearchBar)
512
511
  }
513
512
  }));
514
513
  const SearchResult$1 = searchPlugin.provide(createComponentExtension({
515
514
  name: "SearchResult",
516
515
  component: {
517
- lazy: () => import('./index-3cbe4558.esm.js').then((m) => m.SearchResult)
516
+ lazy: () => import('./index-2a318193.esm.js').then((m) => m.SearchResult)
518
517
  }
519
518
  }));
520
519
  searchPlugin.provide(createComponentExtension({
521
520
  name: "SearchResultNext",
522
521
  component: {
523
- lazy: () => import('./index-3cbe4558.esm.js').then((m) => m.SearchResult)
522
+ lazy: () => import('./index-2a318193.esm.js').then((m) => m.SearchResult)
524
523
  }
525
524
  }));
526
525
  const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
527
526
  name: "SidebarSearchModal",
528
527
  component: {
529
- lazy: () => import('./index-ca07a7cd.esm.js').then((m) => m.SidebarSearchModal)
528
+ lazy: () => import('./index-af05ea86.esm.js').then((m) => m.SidebarSearchModal)
530
529
  }
531
530
  }));
532
531
  const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
533
532
  name: "DefaultResultListItem",
534
533
  component: {
535
- lazy: () => import('./index-e9bf7392.esm.js').then((m) => m.DefaultResultListItem)
534
+ lazy: () => import('./index-18219c65.esm.js').then((m) => m.DefaultResultListItem)
536
535
  }
537
536
  }));
538
- const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
537
+ const HomePageSearchBar$1 = searchPlugin.provide(createComponentExtension({
539
538
  name: "HomePageSearchBar",
540
539
  component: {
541
- lazy: () => import('./index-bc274d46.esm.js').then((m) => m.HomePageSearchBar)
540
+ lazy: () => import('./index-a71e930d.esm.js').then((m) => m.HomePageSearchBar)
542
541
  }
543
542
  }));
544
543
 
545
- const useStyles$5 = makeStyles$1((theme) => ({
544
+ const useStyles$6 = makeStyles$1((theme) => ({
546
545
  container: {
547
546
  borderRadius: 30,
548
547
  display: "flex",
@@ -557,20 +556,10 @@ const useStyles$5 = makeStyles$1((theme) => ({
557
556
  }));
558
557
  const Modal = ({ open = true, toggleModal }) => {
559
558
  const getSearchLink = useRouteRef(rootRouteRef);
560
- const classes = useStyles$5();
561
- const { term, setTerm } = useSearch();
562
- const [value, setValue] = useState(term);
563
- useEffect(() => {
564
- setValue((prevValue) => prevValue !== term ? term : prevValue);
565
- }, [term]);
566
- useDebounce(() => setTerm(value), 500, [value]);
567
- const handleQuery = (newValue) => {
568
- setValue(newValue);
569
- };
570
- const handleClear = () => setValue("");
559
+ const classes = useStyles$6();
560
+ const { term } = useSearch();
571
561
  const handleResultClick = () => {
572
562
  toggleModal();
573
- handleClear();
574
563
  };
575
564
  const handleKeyPress = () => {
576
565
  handleResultClick();
@@ -586,11 +575,8 @@ const Modal = ({ open = true, toggleModal }) => {
586
575
  maxWidth: "lg"
587
576
  }, /* @__PURE__ */ React__default.createElement(DialogTitle, null, /* @__PURE__ */ React__default.createElement(Paper, {
588
577
  className: classes.container
589
- }, /* @__PURE__ */ React__default.createElement(SearchBarBase, {
590
- className: classes.input,
591
- value,
592
- onChange: handleQuery,
593
- onClear: handleClear
578
+ }, /* @__PURE__ */ React__default.createElement(SearchBar$1, {
579
+ className: classes.input
594
580
  }))), /* @__PURE__ */ React__default.createElement(DialogContent, null, /* @__PURE__ */ React__default.createElement(Grid, {
595
581
  container: true,
596
582
  direction: "row-reverse",
@@ -600,7 +586,7 @@ const Modal = ({ open = true, toggleModal }) => {
600
586
  item: true
601
587
  }, /* @__PURE__ */ React__default.createElement(Link, {
602
588
  onClick: toggleModal,
603
- to: `${getSearchLink()}?query=${value}`
589
+ to: `${getSearchLink()}?query=${term}`
604
590
  }, /* @__PURE__ */ React__default.createElement("span", {
605
591
  className: classes.viewResultsLink
606
592
  }, "View Full Results"), /* @__PURE__ */ React__default.createElement(Launch, {
@@ -631,7 +617,7 @@ const SearchModal = ({ open = true, toggleModal }) => {
631
617
  }));
632
618
  };
633
619
 
634
- const useStyles$4 = makeStyles$1(() => ({
620
+ const useStyles$5 = makeStyles$1(() => ({
635
621
  root: {
636
622
  display: "flex",
637
623
  alignItems: "center"
@@ -645,7 +631,7 @@ const SearchBar = ({
645
631
  handleSearch,
646
632
  handleClearSearchBar
647
633
  }) => {
648
- const classes = useStyles$4();
634
+ const classes = useStyles$5();
649
635
  return /* @__PURE__ */ React__default.createElement(Paper, {
650
636
  component: "form",
651
637
  onSubmit: (e) => handleSearch(e),
@@ -666,7 +652,7 @@ const SearchBar = ({
666
652
  }, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
667
653
  };
668
654
 
669
- const useStyles$3 = makeStyles((theme) => ({
655
+ const useStyles$4 = makeStyles((theme) => ({
670
656
  filters: {
671
657
  width: "250px",
672
658
  display: "flex"
@@ -679,7 +665,7 @@ const FiltersButton = ({
679
665
  numberOfSelectedFilters,
680
666
  handleToggleFilters
681
667
  }) => {
682
- const classes = useStyles$3();
668
+ const classes = useStyles$4();
683
669
  return /* @__PURE__ */ React__default.createElement("div", {
684
670
  className: classes.filters
685
671
  }, /* @__PURE__ */ React__default.createElement(IconButton, {
@@ -691,7 +677,7 @@ const FiltersButton = ({
691
677
  }, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
692
678
  };
693
679
 
694
- const useStyles$2 = makeStyles((theme) => ({
680
+ const useStyles$3 = makeStyles((theme) => ({
695
681
  filters: {
696
682
  background: "transparent",
697
683
  boxShadow: "0px 0px 0px 0px"
@@ -710,7 +696,7 @@ const Filters = ({
710
696
  updateSelected,
711
697
  updateChecked
712
698
  }) => {
713
- const classes = useStyles$2();
699
+ const classes = useStyles$3();
714
700
  return /* @__PURE__ */ React__default.createElement(Card, {
715
701
  className: classes.filters
716
702
  }, /* @__PURE__ */ React__default.createElement(CardHeader, {
@@ -764,7 +750,7 @@ const Filters = ({
764
750
  }))))));
765
751
  };
766
752
 
767
- const useStyles$1 = makeStyles((theme) => ({
753
+ const useStyles$2 = makeStyles((theme) => ({
768
754
  searchQuery: {
769
755
  color: theme.palette.text.primary,
770
756
  background: theme.palette.background.default,
@@ -812,7 +798,7 @@ const TableHeader = ({
812
798
  numberOfResults,
813
799
  handleToggleFilters
814
800
  }) => {
815
- const classes = useStyles$1();
801
+ const classes = useStyles$2();
816
802
  return /* @__PURE__ */ React__default.createElement("div", {
817
803
  className: classes.tableHeader
818
804
  }, /* @__PURE__ */ React__default.createElement(FiltersButton, {
@@ -1038,7 +1024,7 @@ const SearchPage = () => {
1038
1024
  return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React__default.createElement(LegacySearchPage, null));
1039
1025
  };
1040
1026
 
1041
- const useStyles = makeStyles((theme) => ({
1027
+ const useStyles$1 = makeStyles((theme) => ({
1042
1028
  label: {
1043
1029
  textTransform: "capitalize"
1044
1030
  },
@@ -1057,7 +1043,7 @@ const SearchType = ({
1057
1043
  name,
1058
1044
  defaultValue
1059
1045
  }) => {
1060
- const classes = useStyles();
1046
+ const classes = useStyles$1();
1061
1047
  const { types, setTypes } = useSearch();
1062
1048
  useEffectOnce(() => {
1063
1049
  if (!types.length) {
@@ -1104,7 +1090,7 @@ const SearchType = ({
1104
1090
  })))));
1105
1091
  };
1106
1092
 
1107
- const SidebarSearch = () => {
1093
+ const SidebarSearch = (props) => {
1108
1094
  const searchRoute = useRouteRef(rootRouteRef);
1109
1095
  const navigate = useNavigate();
1110
1096
  const handleSearch = useCallback((query) => {
@@ -1112,10 +1098,50 @@ const SidebarSearch = () => {
1112
1098
  navigate(`${searchRoute()}${queryString}`);
1113
1099
  }, [navigate, searchRoute]);
1114
1100
  return /* @__PURE__ */ React__default.createElement(SidebarSearchField, {
1101
+ icon: props.icon,
1115
1102
  onSearch: handleSearch,
1116
1103
  to: "/search"
1117
1104
  });
1118
1105
  };
1119
1106
 
1120
- export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchContextProvider as f, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, SearchBarNext as m, SearchPage$1 as n, SearchPageNext as o, searchPlugin as p, SearchResult$1 as q, rootRouteRef as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
1121
- //# sourceMappingURL=index-893ec2f5.esm.js.map
1107
+ const useNavigateToQuery = () => {
1108
+ const searchRoute = useRouteRef(rootRouteRef);
1109
+ const navigate = useNavigate();
1110
+ return useCallback(({ query }) => {
1111
+ const queryString = qs.stringify({ query }, { addQueryPrefix: true });
1112
+ navigate(`${searchRoute()}${queryString}`);
1113
+ }, [navigate, searchRoute]);
1114
+ };
1115
+
1116
+ const useStyles = makeStyles$1({
1117
+ searchBar: {
1118
+ border: "1px solid #555",
1119
+ borderRadius: "6px",
1120
+ fontSize: "1.5em"
1121
+ }
1122
+ });
1123
+ const HomePageSearchBar = ({
1124
+ className: defaultClassName,
1125
+ ...props
1126
+ }) => {
1127
+ const classes = useStyles();
1128
+ const [query, setQuery] = useState("");
1129
+ const handleSearch = useNavigateToQuery();
1130
+ const className = defaultClassName ? `${classes.searchBar} ${defaultClassName}` : classes.searchBar;
1131
+ const handleSubmit = () => {
1132
+ handleSearch({ query });
1133
+ };
1134
+ const handleChange = useCallback((value) => {
1135
+ setQuery(value);
1136
+ }, [setQuery]);
1137
+ return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
1138
+ className,
1139
+ value: query,
1140
+ onSubmit: handleSubmit,
1141
+ onChange: handleChange,
1142
+ ...props
1143
+ });
1144
+ };
1145
+
1146
+ export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchContextProvider as f, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, HomePageSearchBar$1 as m, SearchBarNext as n, SearchPage$1 as o, SearchPageNext as p, searchPlugin as q, SearchResult$1 as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
1147
+ //# sourceMappingURL=index-655809db.esm.js.map