@backstage/plugin-search 0.5.6 → 0.6.2-next.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,63 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.6.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - faf49ba82f: Modify modal search to clamp result length to 5 rows.
8
+ - Updated dependencies
9
+ - @backstage/core-components@0.8.8-next.0
10
+ - @backstage/plugin-catalog-react@0.6.14-next.0
11
+
12
+ ## 0.6.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @backstage/core-components@0.8.7
18
+ - @backstage/plugin-catalog-react@0.6.13
19
+
20
+ ## 0.6.1-next.0
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+ - @backstage/core-components@0.8.7-next.0
26
+ - @backstage/plugin-catalog-react@0.6.13-next.0
27
+
28
+ ## 0.6.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 2f0d3d3278: Forwarding classes to HomePageSearchBar instead of using className prop. For custom styles of the HomePageSearchBar, use classes prop instead:
33
+
34
+ ```diff
35
+ <HomePageSearchBar
36
+ - className={searchBar}
37
+ + classes={{ root: classes.searchBar }}
38
+ placeholder="Search"
39
+ />
40
+ ```
41
+
42
+ - 1dbe63ec39: The way labels are controlled on both the `<SearchFilter.Checkbox />` and
43
+ `<SearchFilter.Select />` components has changed. Previously, the string passed
44
+ on the `name` prop (which controls the field being filtered on) was also
45
+ rendered as the field label. Now, if you want a label rendered, it must be
46
+ passed on the new `label` prop. If no `label` is provided, no label will be
47
+ rendered.
48
+
49
+ ### Patch Changes
50
+
51
+ - 4aca2a5307: Introduces a `<SearchFilter.Autocomplete />` variant, which can be used as either a single- or multi-select autocomplete filter.
52
+
53
+ This variant, as well as `<SearchFilter.Select />`, now also supports loading allowed values asynchronously by passing a function that resolves the list of values to the `values` prop. (An optional `valuesDebounceMs` prop may also be provided to control the debounce time).
54
+
55
+ Check the [search plugin storybook](https://backstage.io/storybook/?path=/story/plugins-search-searchfilter) to see how to leverage these new additions.
56
+
57
+ - Updated dependencies
58
+ - @backstage/core-components@0.8.6
59
+ - @backstage/search-common@0.2.2
60
+
3
61
  ## 0.5.6
4
62
 
5
63
  ### Patch Changes
@@ -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-1333c262.esm.js';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-43516303.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';
@@ -12,14 +12,16 @@ import '@material-ui/icons/Search';
12
12
  import '@material-ui/icons/Clear';
13
13
  import 'react-use/lib/useAsync';
14
14
  import 'react-use/lib/usePrevious';
15
+ import '@material-ui/lab';
16
+ import 'react-use/lib/useAsyncFn';
15
17
  import '@material-ui/icons/Launch';
16
18
  import '@backstage/core-components';
19
+ import 'react-text-truncate';
17
20
  import '@material-ui/icons/ArrowBackIos';
18
21
  import '@material-ui/icons/ArrowForwardIos';
19
22
  import 'react-router';
20
23
  import '@material-ui/core/InputBase';
21
24
  import '@material-ui/core/IconButton';
22
- import '@material-ui/lab';
23
25
  import '@backstage/plugin-catalog-react';
24
26
  import '@backstage/catalog-model';
25
27
  import 'react-use/lib/useEffectOnce';
@@ -36,20 +38,16 @@ const useNavigateToQuery = () => {
36
38
  };
37
39
 
38
40
  const useStyles = makeStyles({
39
- searchBar: {
41
+ root: {
40
42
  border: "1px solid #555",
41
43
  borderRadius: "6px",
42
44
  fontSize: "1.5em"
43
45
  }
44
46
  });
45
- const HomePageSearchBar = ({
46
- className: defaultClassName,
47
- ...props
48
- }) => {
49
- const classes = useStyles();
47
+ const HomePageSearchBar = ({ ...props }) => {
48
+ const classes = useStyles(props);
50
49
  const [query, setQuery] = useState("");
51
50
  const handleSearch = useNavigateToQuery();
52
- const className = defaultClassName ? `${classes.searchBar} ${defaultClassName}` : classes.searchBar;
53
51
  const handleSubmit = () => {
54
52
  handleSearch({ query });
55
53
  };
@@ -57,7 +55,7 @@ const HomePageSearchBar = ({
57
55
  setQuery(value);
58
56
  }, [setQuery]);
59
57
  return /* @__PURE__ */ React.createElement(SearchBarBase, {
60
- className,
58
+ classes: { root: classes.root },
61
59
  value: query,
62
60
  onSubmit: handleSubmit,
63
61
  onChange: handleChange,
@@ -66,4 +64,4 @@ const HomePageSearchBar = ({
66
64
  };
67
65
 
68
66
  export { HomePageSearchBar };
69
- //# sourceMappingURL=index-207ebc98.esm.js.map
67
+ //# sourceMappingURL=index-00471071.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-207ebc98.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';\n\nimport { SearchBarBase, SearchBarBaseProps } from '../SearchBar';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBar: {\n border: '1px solid #555',\n borderRadius: '6px',\n fontSize: '1.5em',\n },\n});\n\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 = ({\n className: defaultClassName,\n ...props\n}: HomePageSearchBarProps) => {\n const classes = useStyles();\n const [query, setQuery] = useState('');\n const handleSearch = useNavigateToQuery();\n\n const className = defaultClassName\n ? `${classes.searchBar} ${defaultClassName}`\n : classes.searchBar;\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 className={className}\n value={query}\n onSubmit={handleSubmit}\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,EAAE,YAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB;AAE9D,aAAS,GAAG,gBAAgB;AAAA,KAE9B,CAAC,UAAU;AAAA;;ACTf,MAAM,YAAY,WAAW;AAAA,EAC3B,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA;AAAA;MAkBD,oBAAoB,CAAC;AAAA,EAChC,WAAW;AAAA,KACR;AAAA,MACyB;AAC5B,QAAM,UAAU;AAChB,QAAM,CAAC,OAAO,YAAY,SAAS;AACnC,QAAM,eAAe;AAErB,QAAM,YAAY,mBACd,GAAG,QAAQ,aAAa,qBACxB,QAAQ;AAEZ,QAAM,eAAe,MAAM;AACzB,iBAAa,EAAE;AAAA;AAGjB,QAAM,eAAe,YACnB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,6CACG,eAAD;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,OACN;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index-00471071.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';\n\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,EAAE,YAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB;AAE9D,aAAS,GAAG,gBAAgB;AAAA,KAE9B,CAAC,UAAU;AAAA;;ACTf,MAAM,YAAY,WAAW;AAAA,EAC3B,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA;AAAA;MAkBD,oBAAoB,CAAC,KAAK,YAAoC;AACzE,QAAM,UAAU,UAAU;AAC1B,QAAM,CAAC,OAAO,YAAY,SAAS;AACnC,QAAM,eAAe;AAErB,QAAM,eAAe,MAAM;AACzB,iBAAa,EAAE;AAAA;AAGjB,QAAM,eAAe,YACnB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,6CACG,eAAD;AAAA,IACE,SAAS,EAAE,MAAM,QAAQ;AAAA,IACzB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,OACN;AAAA;AAAA;;;;"}
@@ -1,4 +1,4 @@
1
- export { S as SearchPage } from './index-1333c262.esm.js';
1
+ export { a as SearchBar, b as SearchBarBase } from './index-43516303.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -10,19 +10,21 @@ import '@material-ui/icons/Search';
10
10
  import '@material-ui/icons/Clear';
11
11
  import 'react-use/lib/useAsync';
12
12
  import 'react-use/lib/usePrevious';
13
+ import '@material-ui/lab';
14
+ import 'react-use/lib/useAsyncFn';
13
15
  import '@material-ui/icons/Launch';
14
16
  import '@material-ui/core/styles';
15
17
  import '@backstage/core-components';
18
+ import 'react-text-truncate';
16
19
  import '@material-ui/icons/ArrowBackIos';
17
20
  import '@material-ui/icons/ArrowForwardIos';
18
21
  import 'react-router';
19
22
  import '@material-ui/core/InputBase';
20
23
  import '@material-ui/core/IconButton';
21
- import '@material-ui/lab';
22
24
  import '@backstage/plugin-catalog-react';
23
25
  import '@backstage/catalog-model';
24
26
  import 'react-use/lib/useEffectOnce';
25
27
  import '@material-ui/icons/ExpandMore';
26
28
  import '@material-ui/icons/FontDownload';
27
29
  import 'react-router-dom';
28
- //# sourceMappingURL=index-cdb6d423.esm.js.map
30
+ //# sourceMappingURL=index-1096ac2f.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-1096ac2f.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,23 +1,25 @@
1
1
  import { createApiRef, useApi, AnalyticsContext, useAnalytics, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
2
2
  import { ResponseError } from '@backstage/errors';
3
3
  import qs from 'qs';
4
- import React, { createContext, useState, useCallback, useEffect, useContext, Fragment, cloneElement } from 'react';
4
+ import React, { createContext, useState, useCallback, useEffect, useContext, useRef, Fragment, cloneElement } from 'react';
5
5
  import FilterListIcon from '@material-ui/icons/FilterList';
6
- import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, useTheme, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Tabs, Tab, Chip } from '@material-ui/core';
6
+ import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, TextField, Chip, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, useTheme, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Tabs, Tab } from '@material-ui/core';
7
7
  import useDebounce from 'react-use/lib/useDebounce';
8
8
  import SearchIcon from '@material-ui/icons/Search';
9
9
  import ClearButton from '@material-ui/icons/Clear';
10
10
  import useAsync from 'react-use/lib/useAsync';
11
11
  import usePrevious from 'react-use/lib/usePrevious';
12
+ import { Autocomplete, Alert } from '@material-ui/lab';
13
+ import useAsyncFn from 'react-use/lib/useAsyncFn';
12
14
  import LaunchIcon from '@material-ui/icons/Launch';
13
15
  import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
14
16
  import { Link, Progress, ResponseErrorPanel, EmptyState, useContent, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
17
+ import TextTruncate from 'react-text-truncate';
15
18
  import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
16
19
  import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
17
20
  import { useOutlet, useLocation } from 'react-router';
18
21
  import InputBase$1 from '@material-ui/core/InputBase';
19
22
  import IconButton$1 from '@material-ui/core/IconButton';
20
- import { Alert } from '@material-ui/lab';
21
23
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
22
24
  import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
23
25
  import useEffectOnce from 'react-use/lib/useEffectOnce';
@@ -305,27 +307,123 @@ const SearchBar$1 = ({ onChange, ...props }) => {
305
307
  });
306
308
  };
307
309
 
308
- const useStyles$9 = makeStyles({
309
- label: {
310
- textTransform: "capitalize"
310
+ const useAsyncFilterValues = (fn, inputValue, defaultValues = [], debounce = 250) => {
311
+ const valuesMemo = useRef({});
312
+ const definiteFn = fn || (() => Promise.resolve([]));
313
+ const [state, callback] = useAsyncFn(definiteFn, [inputValue], {
314
+ loading: true
315
+ });
316
+ useDebounce(() => {
317
+ if (valuesMemo.current[inputValue] === void 0) {
318
+ valuesMemo.current[inputValue] = callback(inputValue).then((values) => {
319
+ valuesMemo.current[inputValue] = values;
320
+ return values;
321
+ });
322
+ }
323
+ }, debounce, [callback, inputValue]);
324
+ if (defaultValues.length) {
325
+ return {
326
+ loading: false,
327
+ value: defaultValues
328
+ };
311
329
  }
312
- });
313
- const CheckboxFilter = ({
314
- className,
315
- name,
316
- defaultValue,
317
- values = []
318
- }) => {
319
- const classes = useStyles$9();
320
- const { filters, setFilters } = useSearch();
330
+ const possibleValue = valuesMemo.current[inputValue];
331
+ if (Array.isArray(possibleValue)) {
332
+ return {
333
+ loading: false,
334
+ value: possibleValue
335
+ };
336
+ }
337
+ return state;
338
+ };
339
+ const useDefaultFilterValue = (name, defaultValue) => {
340
+ const { setFilters } = useSearch();
321
341
  useEffect(() => {
322
- if (Array.isArray(defaultValue)) {
342
+ if (defaultValue && [defaultValue].flat().length > 0) {
323
343
  setFilters((prevFilters) => ({
324
344
  ...prevFilters,
325
345
  [name]: defaultValue
326
346
  }));
327
347
  }
328
348
  }, []);
349
+ };
350
+
351
+ const AutocompleteFilter = (props) => {
352
+ const {
353
+ className,
354
+ defaultValue,
355
+ name,
356
+ values: givenValues,
357
+ valuesDebounceMs,
358
+ label,
359
+ filterSelectedOptions,
360
+ limitTags,
361
+ multiple
362
+ } = props;
363
+ const [inputValue, setInputValue] = useState("");
364
+ useDefaultFilterValue(name, defaultValue);
365
+ const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
366
+ const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
367
+ const { value: values, loading } = useAsyncFilterValues(asyncValues, inputValue, defaultValues, valuesDebounceMs);
368
+ const { filters, setFilters } = useSearch();
369
+ const filterValue = filters[name] || (multiple ? [] : null);
370
+ const handleChange = (_, newValue) => {
371
+ setFilters((prevState) => {
372
+ const { [name]: filter, ...others } = prevState;
373
+ if (newValue) {
374
+ return { ...others, [name]: newValue };
375
+ }
376
+ return { ...others };
377
+ });
378
+ };
379
+ const renderInput = (params) => /* @__PURE__ */ React.createElement(TextField, {
380
+ ...params,
381
+ name: "search",
382
+ variant: "outlined",
383
+ label,
384
+ fullWidth: true
385
+ });
386
+ const renderTags = (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ React.createElement(Chip, {
387
+ label: option,
388
+ color: "primary",
389
+ ...getTagProps({ index })
390
+ }));
391
+ return /* @__PURE__ */ React.createElement(Autocomplete, {
392
+ filterSelectedOptions,
393
+ limitTags,
394
+ multiple,
395
+ className,
396
+ id: `${multiple ? "multi-" : ""}select-filter-${name}--select`,
397
+ options: values || [],
398
+ loading,
399
+ value: filterValue,
400
+ onChange: handleChange,
401
+ onInputChange: (_, newValue) => setInputValue(newValue),
402
+ renderInput,
403
+ renderTags
404
+ });
405
+ };
406
+
407
+ const useStyles$9 = makeStyles({
408
+ label: {
409
+ textTransform: "capitalize"
410
+ }
411
+ });
412
+ const CheckboxFilter = (props) => {
413
+ const {
414
+ className,
415
+ defaultValue,
416
+ label,
417
+ name,
418
+ values: givenValues = [],
419
+ valuesDebounceMs
420
+ } = props;
421
+ const classes = useStyles$9();
422
+ const { filters, setFilters } = useSearch();
423
+ useDefaultFilterValue(name, defaultValue);
424
+ const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
425
+ const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
426
+ const { value: values = [], loading } = useAsyncFilterValues(asyncValues, "", defaultValues, valuesDebounceMs);
329
427
  const handleChange = (e) => {
330
428
  const {
331
429
  target: { value, checked }
@@ -339,11 +437,12 @@ const CheckboxFilter = ({
339
437
  };
340
438
  return /* @__PURE__ */ React.createElement(FormControl, {
341
439
  className,
440
+ disabled: loading,
342
441
  fullWidth: true,
343
442
  "data-testid": "search-checkboxfilter-next"
344
- }, /* @__PURE__ */ React.createElement(FormLabel, {
443
+ }, label ? /* @__PURE__ */ React.createElement(FormLabel, {
345
444
  className: classes.label
346
- }, name), values.map((value) => {
445
+ }, label) : null, values.map((value) => {
347
446
  var _a;
348
447
  return /* @__PURE__ */ React.createElement(FormControlLabel, {
349
448
  key: value,
@@ -360,22 +459,21 @@ const CheckboxFilter = ({
360
459
  });
361
460
  }));
362
461
  };
363
- const SelectFilter = ({
364
- className,
365
- name,
366
- defaultValue,
367
- values = []
368
- }) => {
462
+ const SelectFilter = (props) => {
463
+ const {
464
+ className,
465
+ defaultValue,
466
+ label,
467
+ name,
468
+ values: givenValues,
469
+ valuesDebounceMs
470
+ } = props;
369
471
  const classes = useStyles$9();
472
+ useDefaultFilterValue(name, defaultValue);
473
+ const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
474
+ const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
475
+ const { value: values = [], loading } = useAsyncFilterValues(asyncValues, "", defaultValues, valuesDebounceMs);
370
476
  const { filters, setFilters } = useSearch();
371
- useEffect(() => {
372
- if (typeof defaultValue === "string") {
373
- setFilters((prevFilters) => ({
374
- ...prevFilters,
375
- [name]: defaultValue
376
- }));
377
- }
378
- }, []);
379
477
  const handleChange = (e) => {
380
478
  const {
381
479
  target: { value }
@@ -386,14 +484,15 @@ const SelectFilter = ({
386
484
  });
387
485
  };
388
486
  return /* @__PURE__ */ React.createElement(FormControl, {
487
+ disabled: loading,
389
488
  className,
390
489
  variant: "filled",
391
490
  fullWidth: true,
392
491
  "data-testid": "search-selectfilter-next"
393
- }, /* @__PURE__ */ React.createElement(InputLabel, {
492
+ }, label ? /* @__PURE__ */ React.createElement(InputLabel, {
394
493
  className: classes.label,
395
494
  margin: "dense"
396
- }, name), /* @__PURE__ */ React.createElement(Select, {
495
+ }, label) : null, /* @__PURE__ */ React.createElement(Select, {
397
496
  variant: "outlined",
398
497
  value: filters[name] || "",
399
498
  onChange: handleChange
@@ -404,7 +503,10 @@ const SelectFilter = ({
404
503
  value
405
504
  }, value))));
406
505
  };
407
- const SearchFilter = ({ component: Element, ...props }) => /* @__PURE__ */ React.createElement(Element, {
506
+ const SearchFilter = ({
507
+ component: Element,
508
+ ...props
509
+ }) => /* @__PURE__ */ React.createElement(Element, {
408
510
  ...props
409
511
  });
410
512
  SearchFilter.Checkbox = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
@@ -415,12 +517,17 @@ SearchFilter.Select = (props) => /* @__PURE__ */ React.createElement(SearchFilte
415
517
  ...props,
416
518
  component: SelectFilter
417
519
  });
520
+ SearchFilter.Autocomplete = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
521
+ ...props,
522
+ component: AutocompleteFilter
523
+ });
418
524
  const SearchFilterNext = SearchFilter;
419
525
 
420
526
  const DefaultResultListItem$1 = ({
421
527
  result,
422
528
  icon,
423
- secondaryAction
529
+ secondaryAction,
530
+ lineClamp = 5
424
531
  }) => {
425
532
  return /* @__PURE__ */ React.createElement(Link, {
426
533
  to: result.location
@@ -429,7 +536,12 @@ const DefaultResultListItem$1 = ({
429
536
  }, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement(ListItemText, {
430
537
  primaryTypographyProps: { variant: "h6" },
431
538
  primary: result.title,
432
- secondary: result.text
539
+ secondary: /* @__PURE__ */ React.createElement(TextTruncate, {
540
+ line: lineClamp,
541
+ truncateText: "\u2026",
542
+ text: result.text,
543
+ element: "span"
544
+ })
433
545
  }), secondaryAction && /* @__PURE__ */ React.createElement(Box, {
434
546
  alignItems: "flex-end"
435
547
  }, secondaryAction)), /* @__PURE__ */ React.createElement(Divider, null));
@@ -511,54 +623,54 @@ const searchPlugin = createPlugin({
511
623
  });
512
624
  const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
513
625
  name: "SearchPage",
514
- component: () => import('./index-cdb6d423.esm.js').then((m) => m.SearchPage),
626
+ component: () => import('./index-cc49076c.esm.js').then((m) => m.SearchPage),
515
627
  mountPoint: rootRouteRef
516
628
  }));
517
629
  const SearchPageNext = searchPlugin.provide(createRoutableExtension({
518
630
  name: "SearchPageNext",
519
- component: () => import('./index-cdb6d423.esm.js').then((m) => m.SearchPage),
631
+ component: () => import('./index-cc49076c.esm.js').then((m) => m.SearchPage),
520
632
  mountPoint: rootNextRouteRef
521
633
  }));
522
634
  searchPlugin.provide(createComponentExtension({
523
635
  name: "SearchBar",
524
636
  component: {
525
- lazy: () => import('./index-573ac81a.esm.js').then((m) => m.SearchBar)
637
+ lazy: () => import('./index-1096ac2f.esm.js').then((m) => m.SearchBar)
526
638
  }
527
639
  }));
528
640
  const SearchBarNext = searchPlugin.provide(createComponentExtension({
529
641
  name: "SearchBarNext",
530
642
  component: {
531
- lazy: () => import('./index-573ac81a.esm.js').then((m) => m.SearchBar)
643
+ lazy: () => import('./index-1096ac2f.esm.js').then((m) => m.SearchBar)
532
644
  }
533
645
  }));
534
646
  const SearchResult$1 = searchPlugin.provide(createComponentExtension({
535
647
  name: "SearchResult",
536
648
  component: {
537
- lazy: () => import('./index-4d972deb.esm.js').then((m) => m.SearchResult)
649
+ lazy: () => import('./index-4a4bbd0b.esm.js').then((m) => m.SearchResult)
538
650
  }
539
651
  }));
540
652
  searchPlugin.provide(createComponentExtension({
541
653
  name: "SearchResultNext",
542
654
  component: {
543
- lazy: () => import('./index-4d972deb.esm.js').then((m) => m.SearchResult)
655
+ lazy: () => import('./index-4a4bbd0b.esm.js').then((m) => m.SearchResult)
544
656
  }
545
657
  }));
546
658
  const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
547
659
  name: "SidebarSearchModal",
548
660
  component: {
549
- lazy: () => import('./index-b4c3fd6c.esm.js').then((m) => m.SidebarSearchModal)
661
+ lazy: () => import('./index-ef4eb7dd.esm.js').then((m) => m.SidebarSearchModal)
550
662
  }
551
663
  }));
552
664
  const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
553
665
  name: "DefaultResultListItem",
554
666
  component: {
555
- lazy: () => import('./index-a64e73f4.esm.js').then((m) => m.DefaultResultListItem)
667
+ lazy: () => import('./index-e3d9d53e.esm.js').then((m) => m.DefaultResultListItem)
556
668
  }
557
669
  }));
558
670
  const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
559
671
  name: "HomePageSearchBar",
560
672
  component: {
561
- lazy: () => import('./index-207ebc98.esm.js').then((m) => m.HomePageSearchBar)
673
+ lazy: () => import('./index-00471071.esm.js').then((m) => m.HomePageSearchBar)
562
674
  }
563
675
  }));
564
676
 
@@ -1290,4 +1402,4 @@ const SidebarSearch = (props) => {
1290
1402
  };
1291
1403
 
1292
1404
  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 };
1293
- //# sourceMappingURL=index-1333c262.esm.js.map
1405
+ //# sourceMappingURL=index-43516303.esm.js.map