@backstage/plugin-search-react 1.2.2-next.0 → 1.3.0-next.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 +29 -0
- package/dist/index.esm.js +441 -399
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -9
package/dist/index.esm.js
CHANGED
|
@@ -45,10 +45,7 @@ const HighlightedSearchResultText = ({
|
|
|
45
45
|
[postTag, preTag, text]
|
|
46
46
|
);
|
|
47
47
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, terms.map(
|
|
48
|
-
(t, idx) => t.includes(preTag) ? /* @__PURE__ */ React.createElement("mark", {
|
|
49
|
-
className: classes.highlight,
|
|
50
|
-
key: idx
|
|
51
|
-
}, t.replace(new RegExp(`${preTag}|${postTag}`, "g"), "")) : t
|
|
48
|
+
(t, idx) => t.includes(preTag) ? /* @__PURE__ */ React.createElement("mark", { className: classes.highlight, key: idx }, t.replace(new RegExp(`${preTag}|${postTag}`, "g"), "")) : t
|
|
52
49
|
));
|
|
53
50
|
};
|
|
54
51
|
|
|
@@ -139,38 +136,43 @@ const useSearchContextValue = (initialValue = searchInitialState) => {
|
|
|
139
136
|
const LocalSearchContext = (props) => {
|
|
140
137
|
const { initialState, children } = props;
|
|
141
138
|
const value = useSearchContextValue(initialState);
|
|
142
|
-
return /* @__PURE__ */ React.createElement(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
return /* @__PURE__ */ React.createElement(
|
|
140
|
+
AnalyticsContext,
|
|
141
|
+
{
|
|
142
|
+
attributes: { searchTypes: value.types.sort().join(",") }
|
|
143
|
+
},
|
|
144
|
+
/* @__PURE__ */ React.createElement(SearchContext.Provider, { value: createVersionedValueMap({ 1: value }) }, children)
|
|
145
|
+
);
|
|
147
146
|
};
|
|
148
147
|
const SearchContextProvider = (props) => {
|
|
149
148
|
const { initialState, inheritParentContextIfAvailable, children } = props;
|
|
150
149
|
const hasParentContext = useSearchContextCheck();
|
|
151
|
-
return hasParentContext && inheritParentContextIfAvailable ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : /* @__PURE__ */ React.createElement(LocalSearchContext, {
|
|
152
|
-
initialState
|
|
153
|
-
}, children);
|
|
150
|
+
return hasParentContext && inheritParentContextIfAvailable ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : /* @__PURE__ */ React.createElement(LocalSearchContext, { initialState }, children);
|
|
154
151
|
};
|
|
155
152
|
|
|
156
153
|
const TrackSearch = ({ children }) => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const useHasChanged = (value) => {
|
|
156
|
+
const previousVal = usePrevious(value);
|
|
157
|
+
return previousVal !== value;
|
|
158
|
+
};
|
|
157
159
|
const analytics = useAnalytics();
|
|
158
|
-
const { term } = useSearch();
|
|
160
|
+
const { term, result } = useSearch();
|
|
161
|
+
const numberOfResults = (_b = (_a = result.value) == null ? void 0 : _a.numberOfResults) != null ? _b : void 0;
|
|
162
|
+
const hasStartedLoading = useHasChanged(result.loading);
|
|
163
|
+
const hasFinishedLoading = hasStartedLoading && !result.loading;
|
|
159
164
|
useEffect(() => {
|
|
160
|
-
if (term) {
|
|
161
|
-
analytics.captureEvent("search", term
|
|
165
|
+
if (term && hasFinishedLoading) {
|
|
166
|
+
analytics.captureEvent("search", term, {
|
|
167
|
+
value: numberOfResults
|
|
168
|
+
});
|
|
162
169
|
}
|
|
163
|
-
}, [analytics, term]);
|
|
170
|
+
}, [analytics, term, numberOfResults, hasFinishedLoading]);
|
|
164
171
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
165
172
|
};
|
|
166
173
|
|
|
167
174
|
function withContext$1(Component) {
|
|
168
|
-
return forwardRef((props, ref) => /* @__PURE__ */ React.createElement(SearchContextProvider, {
|
|
169
|
-
inheritParentContextIfAvailable: true
|
|
170
|
-
}, /* @__PURE__ */ React.createElement(Component, {
|
|
171
|
-
...props,
|
|
172
|
-
ref
|
|
173
|
-
})));
|
|
175
|
+
return forwardRef((props, ref) => /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(Component, { ...props, ref })));
|
|
174
176
|
}
|
|
175
177
|
const SearchBarBase = withContext$1(
|
|
176
178
|
forwardRef((props, ref) => {
|
|
@@ -222,33 +224,24 @@ const SearchBarBase = withContext$1(
|
|
|
222
224
|
}
|
|
223
225
|
}, [onChange, onClear]);
|
|
224
226
|
const placeholder = defaultPlaceholder != null ? defaultPlaceholder : `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
|
|
225
|
-
const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
placeholder,
|
|
244
|
-
startAdornment,
|
|
245
|
-
endAdornment: clearButton ? endAdornment : defaultEndAdornment,
|
|
246
|
-
inputProps: { "aria-label": "Search", ...defaultInputProps },
|
|
247
|
-
fullWidth,
|
|
248
|
-
onChange: handleChange,
|
|
249
|
-
onKeyDown: handleKeyDown,
|
|
250
|
-
...rest
|
|
251
|
-
}));
|
|
227
|
+
const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Query", size: "small", disabled: true }, /* @__PURE__ */ React.createElement(SearchIcon, null)));
|
|
228
|
+
const endAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Clear", size: "small", onClick: handleClear }, /* @__PURE__ */ React.createElement(ClearButton, null)));
|
|
229
|
+
return /* @__PURE__ */ React.createElement(TrackSearch, null, /* @__PURE__ */ React.createElement(
|
|
230
|
+
InputBase,
|
|
231
|
+
{
|
|
232
|
+
"data-testid": "search-bar-next",
|
|
233
|
+
ref,
|
|
234
|
+
value,
|
|
235
|
+
placeholder,
|
|
236
|
+
startAdornment,
|
|
237
|
+
endAdornment: clearButton ? endAdornment : defaultEndAdornment,
|
|
238
|
+
inputProps: { "aria-label": "Search", ...defaultInputProps },
|
|
239
|
+
fullWidth,
|
|
240
|
+
onChange: handleChange,
|
|
241
|
+
onKeyDown: handleKeyDown,
|
|
242
|
+
...rest
|
|
243
|
+
}
|
|
244
|
+
));
|
|
252
245
|
})
|
|
253
246
|
);
|
|
254
247
|
const SearchBar = withContext$1(
|
|
@@ -270,23 +263,26 @@ const SearchBar = withContext$1(
|
|
|
270
263
|
},
|
|
271
264
|
[onChange, setTerm]
|
|
272
265
|
);
|
|
273
|
-
return /* @__PURE__ */ React.createElement(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
266
|
+
return /* @__PURE__ */ React.createElement(
|
|
267
|
+
AnalyticsContext,
|
|
268
|
+
{
|
|
269
|
+
attributes: { pluginId: "search", extension: "SearchBar" }
|
|
270
|
+
},
|
|
271
|
+
/* @__PURE__ */ React.createElement(
|
|
272
|
+
SearchBarBase,
|
|
273
|
+
{
|
|
274
|
+
...rest,
|
|
275
|
+
ref,
|
|
276
|
+
value: term,
|
|
277
|
+
onChange: handleChange
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
);
|
|
281
281
|
})
|
|
282
282
|
);
|
|
283
283
|
|
|
284
284
|
const withContext = (Component) => {
|
|
285
|
-
return (props) => /* @__PURE__ */ React.createElement(SearchContextProvider, {
|
|
286
|
-
inheritParentContextIfAvailable: true
|
|
287
|
-
}, /* @__PURE__ */ React.createElement(Component, {
|
|
288
|
-
...props
|
|
289
|
-
}));
|
|
285
|
+
return (props) => /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(Component, { ...props }));
|
|
290
286
|
};
|
|
291
287
|
const SearchAutocomplete = withContext(
|
|
292
288
|
function SearchAutocompleteComponent(props) {
|
|
@@ -332,33 +328,42 @@ const SearchAutocomplete = withContext(
|
|
|
332
328
|
InputProps: { ref, endAdornment },
|
|
333
329
|
InputLabelProps,
|
|
334
330
|
...params
|
|
335
|
-
}) => /* @__PURE__ */ React.createElement(
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
331
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
332
|
+
SearchBar,
|
|
333
|
+
{
|
|
334
|
+
...params,
|
|
335
|
+
ref,
|
|
336
|
+
clearButton: false,
|
|
337
|
+
value: inputValue,
|
|
338
|
+
placeholder: inputPlaceholder,
|
|
339
|
+
debounceTime: inputDebounceTime,
|
|
340
|
+
endAdornment: loading ? /* @__PURE__ */ React.createElement(
|
|
341
|
+
CircularProgress,
|
|
342
|
+
{
|
|
343
|
+
"data-testid": "search-autocomplete-progressbar",
|
|
344
|
+
color: "inherit",
|
|
345
|
+
size: 20
|
|
346
|
+
}
|
|
347
|
+
) : endAdornment
|
|
348
|
+
}
|
|
349
|
+
),
|
|
348
350
|
[loading, inputValue, inputPlaceholder, inputDebounceTime]
|
|
349
351
|
);
|
|
350
|
-
return /* @__PURE__ */ React.createElement(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
352
|
+
return /* @__PURE__ */ React.createElement(
|
|
353
|
+
Autocomplete,
|
|
354
|
+
{
|
|
355
|
+
...rest,
|
|
356
|
+
"data-testid": dataTestId,
|
|
357
|
+
value,
|
|
358
|
+
onChange: handleChange,
|
|
359
|
+
options,
|
|
360
|
+
getOptionLabel,
|
|
361
|
+
renderInput,
|
|
362
|
+
freeSolo,
|
|
363
|
+
fullWidth,
|
|
364
|
+
clearOnBlur
|
|
365
|
+
}
|
|
366
|
+
);
|
|
362
367
|
}
|
|
363
368
|
);
|
|
364
369
|
|
|
@@ -369,13 +374,16 @@ const SearchAutocompleteDefaultOption = ({
|
|
|
369
374
|
secondaryText,
|
|
370
375
|
secondaryTextTypographyProps,
|
|
371
376
|
disableTextTypography
|
|
372
|
-
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, icon ? /* @__PURE__ */ React.createElement(ListItemIcon, null, icon) : null, /* @__PURE__ */ React.createElement(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, icon ? /* @__PURE__ */ React.createElement(ListItemIcon, null, icon) : null, /* @__PURE__ */ React.createElement(
|
|
378
|
+
ListItemText,
|
|
379
|
+
{
|
|
380
|
+
primary: primaryText,
|
|
381
|
+
primaryTypographyProps: primaryTextTypographyProps,
|
|
382
|
+
secondary: secondaryText,
|
|
383
|
+
secondaryTypographyProps: secondaryTextTypographyProps,
|
|
384
|
+
disableTypography: disableTextTypography
|
|
385
|
+
}
|
|
386
|
+
));
|
|
379
387
|
|
|
380
388
|
const useAsyncFilterValues = (fn, inputValue, defaultValues = [], debounce = 250) => {
|
|
381
389
|
const valuesMemo = useRef({});
|
|
@@ -455,32 +463,34 @@ const AutocompleteFilter = (props) => {
|
|
|
455
463
|
return { ...others };
|
|
456
464
|
});
|
|
457
465
|
};
|
|
458
|
-
const renderInput = (params) => /* @__PURE__ */ React.createElement(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
466
|
+
const renderInput = (params) => /* @__PURE__ */ React.createElement(
|
|
467
|
+
TextField,
|
|
468
|
+
{
|
|
469
|
+
...params,
|
|
470
|
+
name: "search",
|
|
471
|
+
variant: "outlined",
|
|
472
|
+
label,
|
|
473
|
+
fullWidth: true
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
const renderTags = (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ React.createElement(Chip, { label: option, color: "primary", ...getTagProps({ index }) }));
|
|
477
|
+
return /* @__PURE__ */ React.createElement(
|
|
478
|
+
Autocomplete,
|
|
479
|
+
{
|
|
480
|
+
filterSelectedOptions,
|
|
481
|
+
limitTags,
|
|
482
|
+
multiple,
|
|
483
|
+
className,
|
|
484
|
+
id: `${multiple ? "multi-" : ""}select-filter-${name}--select`,
|
|
485
|
+
options: values || [],
|
|
486
|
+
loading,
|
|
487
|
+
value: filterValue,
|
|
488
|
+
onChange: handleChange,
|
|
489
|
+
onInputChange: (_, newValue) => setInputValue(newValue),
|
|
490
|
+
renderInput,
|
|
491
|
+
renderTags
|
|
492
|
+
}
|
|
493
|
+
);
|
|
484
494
|
};
|
|
485
495
|
|
|
486
496
|
const useStyles$2 = makeStyles({
|
|
@@ -519,29 +529,38 @@ const CheckboxFilter = (props) => {
|
|
|
519
529
|
return items.length ? { ...others, [name]: items } : others;
|
|
520
530
|
});
|
|
521
531
|
};
|
|
522
|
-
return /* @__PURE__ */ React.createElement(
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
532
|
+
return /* @__PURE__ */ React.createElement(
|
|
533
|
+
FormControl,
|
|
534
|
+
{
|
|
535
|
+
className,
|
|
536
|
+
disabled: loading,
|
|
537
|
+
fullWidth: true,
|
|
538
|
+
"data-testid": "search-checkboxfilter-next"
|
|
539
|
+
},
|
|
540
|
+
label ? /* @__PURE__ */ React.createElement(FormLabel, { className: classes.label }, label) : null,
|
|
541
|
+
values.map((value) => {
|
|
542
|
+
var _a;
|
|
543
|
+
return /* @__PURE__ */ React.createElement(
|
|
544
|
+
FormControlLabel,
|
|
545
|
+
{
|
|
546
|
+
key: value,
|
|
547
|
+
control: /* @__PURE__ */ React.createElement(
|
|
548
|
+
Checkbox,
|
|
549
|
+
{
|
|
550
|
+
color: "primary",
|
|
551
|
+
tabIndex: -1,
|
|
552
|
+
inputProps: { "aria-labelledby": value },
|
|
553
|
+
value,
|
|
554
|
+
name: value,
|
|
555
|
+
onChange: handleChange,
|
|
556
|
+
checked: ((_a = filters[name]) != null ? _a : []).includes(value)
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
label: value
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
})
|
|
563
|
+
);
|
|
545
564
|
};
|
|
546
565
|
const SelectFilter = (props) => {
|
|
547
566
|
const {
|
|
@@ -572,44 +591,35 @@ const SelectFilter = (props) => {
|
|
|
572
591
|
return value ? { ...others, [name]: value } : others;
|
|
573
592
|
});
|
|
574
593
|
};
|
|
575
|
-
return /* @__PURE__ */ React.createElement(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
+
return /* @__PURE__ */ React.createElement(
|
|
595
|
+
FormControl,
|
|
596
|
+
{
|
|
597
|
+
disabled: loading,
|
|
598
|
+
className,
|
|
599
|
+
variant: "filled",
|
|
600
|
+
fullWidth: true,
|
|
601
|
+
"data-testid": "search-selectfilter-next"
|
|
602
|
+
},
|
|
603
|
+
label ? /* @__PURE__ */ React.createElement(InputLabel, { className: classes.label, margin: "dense" }, label) : null,
|
|
604
|
+
/* @__PURE__ */ React.createElement(
|
|
605
|
+
Select,
|
|
606
|
+
{
|
|
607
|
+
variant: "outlined",
|
|
608
|
+
value: filters[name] || "",
|
|
609
|
+
onChange: handleChange
|
|
610
|
+
},
|
|
611
|
+
/* @__PURE__ */ React.createElement(MenuItem, { value: "" }, /* @__PURE__ */ React.createElement("em", null, "All")),
|
|
612
|
+
values.map((value) => /* @__PURE__ */ React.createElement(MenuItem, { key: value, value }, value))
|
|
613
|
+
)
|
|
614
|
+
);
|
|
594
615
|
};
|
|
595
616
|
const SearchFilter = ({
|
|
596
617
|
component: Element,
|
|
597
618
|
...props
|
|
598
|
-
}) => /* @__PURE__ */ React.createElement(Element, {
|
|
599
|
-
|
|
600
|
-
});
|
|
601
|
-
SearchFilter.
|
|
602
|
-
...props,
|
|
603
|
-
component: CheckboxFilter
|
|
604
|
-
});
|
|
605
|
-
SearchFilter.Select = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
606
|
-
...props,
|
|
607
|
-
component: SelectFilter
|
|
608
|
-
});
|
|
609
|
-
SearchFilter.Autocomplete = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
610
|
-
...props,
|
|
611
|
-
component: AutocompleteFilter
|
|
612
|
-
});
|
|
619
|
+
}) => /* @__PURE__ */ React.createElement(Element, { ...props });
|
|
620
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React.createElement(SearchFilter, { ...props, component: CheckboxFilter });
|
|
621
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React.createElement(SearchFilter, { ...props, component: SelectFilter });
|
|
622
|
+
SearchFilter.Autocomplete = (props) => /* @__PURE__ */ React.createElement(SearchFilter, { ...props, component: AutocompleteFilter });
|
|
613
623
|
|
|
614
624
|
const SearchResultContext = (props) => {
|
|
615
625
|
const { children } = props;
|
|
@@ -628,41 +638,39 @@ const SearchResultApi = (props) => {
|
|
|
628
638
|
};
|
|
629
639
|
const SearchResultState = (props) => {
|
|
630
640
|
const { query, children } = props;
|
|
631
|
-
return query ? /* @__PURE__ */ React.createElement(SearchResultApi, {
|
|
632
|
-
query
|
|
633
|
-
}, children) : /* @__PURE__ */ React.createElement(SearchResultContext, null, children);
|
|
641
|
+
return query ? /* @__PURE__ */ React.createElement(SearchResultApi, { query }, children) : /* @__PURE__ */ React.createElement(SearchResultContext, null, children);
|
|
634
642
|
};
|
|
635
643
|
const SearchResultComponent = (props) => {
|
|
636
644
|
const { query, children } = props;
|
|
637
|
-
return /* @__PURE__ */ React.createElement(SearchResultState, {
|
|
638
|
-
query
|
|
639
|
-
}, ({ loading, error, value }) => {
|
|
645
|
+
return /* @__PURE__ */ React.createElement(SearchResultState, { query }, ({ loading, error, value }) => {
|
|
640
646
|
if (loading) {
|
|
641
647
|
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
642
648
|
}
|
|
643
649
|
if (error) {
|
|
644
|
-
return /* @__PURE__ */ React.createElement(
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
650
|
+
return /* @__PURE__ */ React.createElement(
|
|
651
|
+
ResponseErrorPanel,
|
|
652
|
+
{
|
|
653
|
+
title: "Error encountered while fetching search results",
|
|
654
|
+
error
|
|
655
|
+
}
|
|
656
|
+
);
|
|
648
657
|
}
|
|
649
658
|
if (!(value == null ? void 0 : value.results.length)) {
|
|
650
|
-
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
651
|
-
missing: "data",
|
|
652
|
-
title: "Sorry, no results were found"
|
|
653
|
-
});
|
|
659
|
+
return /* @__PURE__ */ React.createElement(EmptyState, { missing: "data", title: "Sorry, no results were found" });
|
|
654
660
|
}
|
|
655
661
|
return children(value);
|
|
656
662
|
});
|
|
657
663
|
};
|
|
658
|
-
const SearchResult = (props) => /* @__PURE__ */ React.createElement(
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
664
|
+
const SearchResult = (props) => /* @__PURE__ */ React.createElement(
|
|
665
|
+
AnalyticsContext,
|
|
666
|
+
{
|
|
667
|
+
attributes: {
|
|
668
|
+
pluginId: "search",
|
|
669
|
+
extension: "SearchResult"
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
/* @__PURE__ */ React.createElement(SearchResultComponent, { ...props })
|
|
673
|
+
);
|
|
666
674
|
|
|
667
675
|
const useStyles$1 = makeStyles((theme) => ({
|
|
668
676
|
root: {
|
|
@@ -678,20 +686,25 @@ const SearchResultPager = () => {
|
|
|
678
686
|
if (!fetchNextPage && !fetchPreviousPage) {
|
|
679
687
|
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
680
688
|
}
|
|
681
|
-
return /* @__PURE__ */ React.createElement("nav", {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
689
|
+
return /* @__PURE__ */ React.createElement("nav", { "aria-label": "pagination navigation", className: classes.root }, /* @__PURE__ */ React.createElement(
|
|
690
|
+
Button,
|
|
691
|
+
{
|
|
692
|
+
"aria-label": "previous page",
|
|
693
|
+
disabled: !fetchPreviousPage,
|
|
694
|
+
onClick: fetchPreviousPage,
|
|
695
|
+
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIosIcon, null)
|
|
696
|
+
},
|
|
697
|
+
"Previous"
|
|
698
|
+
), /* @__PURE__ */ React.createElement(
|
|
699
|
+
Button,
|
|
700
|
+
{
|
|
701
|
+
"aria-label": "next page",
|
|
702
|
+
disabled: !fetchNextPage,
|
|
703
|
+
onClick: fetchNextPage,
|
|
704
|
+
endIcon: /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, null)
|
|
705
|
+
},
|
|
706
|
+
"Next"
|
|
707
|
+
));
|
|
695
708
|
};
|
|
696
709
|
|
|
697
710
|
const encodePageCursor = (pageCursor) => {
|
|
@@ -728,28 +741,34 @@ const SearchPaginationBase = (props) => {
|
|
|
728
741
|
},
|
|
729
742
|
[onPageLimitChange]
|
|
730
743
|
);
|
|
731
|
-
return /* @__PURE__ */ React.createElement(
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
744
|
+
return /* @__PURE__ */ React.createElement(
|
|
745
|
+
TablePagination,
|
|
746
|
+
{
|
|
747
|
+
...rest,
|
|
748
|
+
component: "div",
|
|
749
|
+
count,
|
|
750
|
+
page,
|
|
751
|
+
onPageChange: handlePageChange,
|
|
752
|
+
rowsPerPage,
|
|
753
|
+
labelRowsPerPage,
|
|
754
|
+
labelDisplayedRows,
|
|
755
|
+
rowsPerPageOptions,
|
|
756
|
+
onRowsPerPageChange: handleRowsPerPageChange
|
|
757
|
+
}
|
|
758
|
+
);
|
|
743
759
|
};
|
|
744
760
|
const SearchPagination = (props) => {
|
|
745
761
|
const { pageLimit, setPageLimit, pageCursor, setPageCursor } = useSearch();
|
|
746
|
-
return /* @__PURE__ */ React.createElement(
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
762
|
+
return /* @__PURE__ */ React.createElement(
|
|
763
|
+
SearchPaginationBase,
|
|
764
|
+
{
|
|
765
|
+
...props,
|
|
766
|
+
limit: pageLimit,
|
|
767
|
+
onLimitChange: setPageLimit,
|
|
768
|
+
cursor: pageCursor,
|
|
769
|
+
onCursorChange: setPageCursor
|
|
770
|
+
}
|
|
771
|
+
);
|
|
753
772
|
};
|
|
754
773
|
|
|
755
774
|
const DefaultResultListItemComponent = ({
|
|
@@ -767,44 +786,51 @@ const DefaultResultListItemComponent = ({
|
|
|
767
786
|
value: rank
|
|
768
787
|
});
|
|
769
788
|
};
|
|
770
|
-
return /* @__PURE__ */ React.createElement(
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
789
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ListItem, { alignItems: "center" }, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement(
|
|
790
|
+
ListItemText,
|
|
791
|
+
{
|
|
792
|
+
primaryTypographyProps: { variant: "h6" },
|
|
793
|
+
primary: /* @__PURE__ */ React.createElement(Link, { noTrack: true, to: result.location, onClick: handleClick }, (highlight == null ? void 0 : highlight.fields.title) ? /* @__PURE__ */ React.createElement(
|
|
794
|
+
HighlightedSearchResultText,
|
|
795
|
+
{
|
|
796
|
+
text: (highlight == null ? void 0 : highlight.fields.title) || "",
|
|
797
|
+
preTag: (highlight == null ? void 0 : highlight.preTag) || "",
|
|
798
|
+
postTag: (highlight == null ? void 0 : highlight.postTag) || ""
|
|
799
|
+
}
|
|
800
|
+
) : result.title),
|
|
801
|
+
secondary: /* @__PURE__ */ React.createElement(
|
|
802
|
+
"span",
|
|
803
|
+
{
|
|
804
|
+
style: {
|
|
805
|
+
display: "-webkit-box",
|
|
806
|
+
WebkitBoxOrient: "vertical",
|
|
807
|
+
WebkitLineClamp: lineClamp,
|
|
808
|
+
overflow: "hidden"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
(highlight == null ? void 0 : highlight.fields.text) ? /* @__PURE__ */ React.createElement(
|
|
812
|
+
HighlightedSearchResultText,
|
|
813
|
+
{
|
|
814
|
+
text: highlight.fields.text,
|
|
815
|
+
preTag: highlight.preTag,
|
|
816
|
+
postTag: highlight.postTag
|
|
817
|
+
}
|
|
818
|
+
) : result.text
|
|
819
|
+
)
|
|
820
|
+
}
|
|
821
|
+
), secondaryAction && /* @__PURE__ */ React.createElement(Box, { alignItems: "flex-end" }, secondaryAction)), /* @__PURE__ */ React.createElement(Divider, null));
|
|
798
822
|
};
|
|
799
823
|
const HigherOrderDefaultResultListItem = (props) => {
|
|
800
|
-
return /* @__PURE__ */ React.createElement(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
824
|
+
return /* @__PURE__ */ React.createElement(
|
|
825
|
+
AnalyticsContext,
|
|
826
|
+
{
|
|
827
|
+
attributes: {
|
|
828
|
+
pluginId: "search",
|
|
829
|
+
extension: "DefaultResultListItem"
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
/* @__PURE__ */ React.createElement(DefaultResultListItemComponent, { ...props })
|
|
833
|
+
);
|
|
808
834
|
};
|
|
809
835
|
|
|
810
836
|
const SearchResultListLayout = (props) => {
|
|
@@ -812,44 +838,50 @@ const SearchResultListLayout = (props) => {
|
|
|
812
838
|
loading,
|
|
813
839
|
error,
|
|
814
840
|
resultItems,
|
|
815
|
-
renderResultItem = (resultItem) => /* @__PURE__ */ React.createElement(
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
}),
|
|
841
|
+
renderResultItem = (resultItem) => /* @__PURE__ */ React.createElement(
|
|
842
|
+
HigherOrderDefaultResultListItem,
|
|
843
|
+
{
|
|
844
|
+
key: resultItem.document.location,
|
|
845
|
+
result: resultItem.document
|
|
846
|
+
}
|
|
847
|
+
),
|
|
848
|
+
noResultsComponent = /* @__PURE__ */ React.createElement(EmptyState, { missing: "data", title: "Sorry, no results were found" }),
|
|
823
849
|
...rest
|
|
824
850
|
} = props;
|
|
825
|
-
return /* @__PURE__ */ React.createElement(List, {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
851
|
+
return /* @__PURE__ */ React.createElement(List, { ...rest }, loading ? /* @__PURE__ */ React.createElement(Progress, null) : null, !loading && error ? /* @__PURE__ */ React.createElement(
|
|
852
|
+
ResponseErrorPanel,
|
|
853
|
+
{
|
|
854
|
+
title: "Error encountered while fetching search results",
|
|
855
|
+
error
|
|
856
|
+
}
|
|
857
|
+
) : null, !loading && !error && (resultItems == null ? void 0 : resultItems.length) ? resultItems.map(renderResultItem) : null, !loading && !error && !(resultItems == null ? void 0 : resultItems.length) ? /* @__PURE__ */ React.createElement(ListItem, null, noResultsComponent) : null);
|
|
831
858
|
};
|
|
832
859
|
const SearchResultList = (props) => {
|
|
833
860
|
const { query, disableRenderingWithNoResults, ...rest } = props;
|
|
834
|
-
return /* @__PURE__ */ React.createElement(
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
861
|
+
return /* @__PURE__ */ React.createElement(
|
|
862
|
+
AnalyticsContext,
|
|
863
|
+
{
|
|
864
|
+
attributes: {
|
|
865
|
+
pluginId: "search",
|
|
866
|
+
extension: "SearchResultList"
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
/* @__PURE__ */ React.createElement(SearchResultState, { query }, ({ loading, error, value }) => {
|
|
870
|
+
var _a;
|
|
871
|
+
if (!((_a = value == null ? void 0 : value.results) == null ? void 0 : _a.length) && disableRenderingWithNoResults) {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
return /* @__PURE__ */ React.createElement(
|
|
875
|
+
SearchResultListLayout,
|
|
876
|
+
{
|
|
877
|
+
...rest,
|
|
878
|
+
loading,
|
|
879
|
+
error,
|
|
880
|
+
resultItems: value == null ? void 0 : value.results
|
|
881
|
+
}
|
|
882
|
+
);
|
|
883
|
+
})
|
|
884
|
+
);
|
|
853
885
|
};
|
|
854
886
|
|
|
855
887
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -883,12 +915,15 @@ const useStyles = makeStyles((theme) => ({
|
|
|
883
915
|
const SearchResultGroupFilterFieldLayout = (props) => {
|
|
884
916
|
const classes = useStyles();
|
|
885
917
|
const { label, children, ...rest } = props;
|
|
886
|
-
return /* @__PURE__ */ React.createElement(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
918
|
+
return /* @__PURE__ */ React.createElement(
|
|
919
|
+
Chip,
|
|
920
|
+
{
|
|
921
|
+
...rest,
|
|
922
|
+
className: classes.listSubheaderFilter,
|
|
923
|
+
variant: "outlined",
|
|
924
|
+
label: /* @__PURE__ */ React.createElement(React.Fragment, null, label, ": ", children)
|
|
925
|
+
}
|
|
926
|
+
);
|
|
892
927
|
};
|
|
893
928
|
const NullIcon = () => null;
|
|
894
929
|
const useSearchResultGroupTextFilterStyles = makeStyles((theme) => ({
|
|
@@ -916,17 +951,18 @@ const SearchResultGroupTextFilterField = (props) => {
|
|
|
916
951
|
},
|
|
917
952
|
[onChange]
|
|
918
953
|
);
|
|
919
|
-
return /* @__PURE__ */ React.createElement(SearchResultGroupFilterFieldLayout, {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
954
|
+
return /* @__PURE__ */ React.createElement(SearchResultGroupFilterFieldLayout, { label, onDelete }, /* @__PURE__ */ React.createElement(
|
|
955
|
+
Typography,
|
|
956
|
+
{
|
|
957
|
+
role: "textbox",
|
|
958
|
+
component: "span",
|
|
959
|
+
className: classes.root,
|
|
960
|
+
onChange: handleChange,
|
|
961
|
+
contentEditable: true,
|
|
962
|
+
suppressContentEditableWarning: true
|
|
963
|
+
},
|
|
964
|
+
value
|
|
965
|
+
));
|
|
930
966
|
};
|
|
931
967
|
const useSearchResultGroupSelectFilterStyles = makeStyles((theme) => ({
|
|
932
968
|
root: {
|
|
@@ -955,18 +991,18 @@ const SearchResultGroupSelectFilterField = (props) => {
|
|
|
955
991
|
},
|
|
956
992
|
[onChange]
|
|
957
993
|
);
|
|
958
|
-
return /* @__PURE__ */ React.createElement(SearchResultGroupFilterFieldLayout, {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
994
|
+
return /* @__PURE__ */ React.createElement(SearchResultGroupFilterFieldLayout, { label, onDelete }, /* @__PURE__ */ React.createElement(
|
|
995
|
+
Select,
|
|
996
|
+
{
|
|
997
|
+
className: classes.root,
|
|
998
|
+
value,
|
|
999
|
+
onChange: handleChange,
|
|
1000
|
+
input: /* @__PURE__ */ React.createElement(InputBase, null),
|
|
1001
|
+
IconComponent: NullIcon
|
|
1002
|
+
},
|
|
1003
|
+
/* @__PURE__ */ React.createElement(MenuItem, { value: "none" }, "None"),
|
|
1004
|
+
children
|
|
1005
|
+
));
|
|
970
1006
|
};
|
|
971
1007
|
function SearchResultGroupLayout(props) {
|
|
972
1008
|
const classes = useStyles();
|
|
@@ -977,26 +1013,21 @@ function SearchResultGroupLayout(props) {
|
|
|
977
1013
|
icon,
|
|
978
1014
|
title,
|
|
979
1015
|
titleProps = {},
|
|
980
|
-
link = /* @__PURE__ */ React.createElement(React.Fragment, null, "See all", /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, {
|
|
981
|
-
className: classes.listSubheaderLinkIcon
|
|
982
|
-
})),
|
|
1016
|
+
link = /* @__PURE__ */ React.createElement(React.Fragment, null, "See all", /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, { className: classes.listSubheaderLinkIcon })),
|
|
983
1017
|
linkProps = {},
|
|
984
1018
|
filterOptions,
|
|
985
|
-
renderFilterOption = (filterOption) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
986
|
-
key: String(filterOption),
|
|
987
|
-
value: String(filterOption)
|
|
988
|
-
}, filterOption),
|
|
1019
|
+
renderFilterOption = (filterOption) => /* @__PURE__ */ React.createElement(MenuItem, { key: String(filterOption), value: String(filterOption) }, filterOption),
|
|
989
1020
|
filterFields,
|
|
990
1021
|
renderFilterField,
|
|
991
1022
|
resultItems,
|
|
992
|
-
renderResultItem = (resultItem) => /* @__PURE__ */ React.createElement(
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}),
|
|
1023
|
+
renderResultItem = (resultItem) => /* @__PURE__ */ React.createElement(
|
|
1024
|
+
HigherOrderDefaultResultListItem,
|
|
1025
|
+
{
|
|
1026
|
+
key: resultItem.document.location,
|
|
1027
|
+
result: resultItem.document
|
|
1028
|
+
}
|
|
1029
|
+
),
|
|
1030
|
+
noResultsComponent = /* @__PURE__ */ React.createElement(EmptyState, { missing: "data", title: "Sorry, no results were found" }),
|
|
1000
1031
|
...rest
|
|
1001
1032
|
} = props;
|
|
1002
1033
|
const handleClick = useCallback((e) => {
|
|
@@ -1005,43 +1036,49 @@ function SearchResultGroupLayout(props) {
|
|
|
1005
1036
|
const handleClose = useCallback(() => {
|
|
1006
1037
|
setAnchorEl(null);
|
|
1007
1038
|
}, []);
|
|
1008
|
-
return /* @__PURE__ */ React.createElement(List, {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1039
|
+
return /* @__PURE__ */ React.createElement(List, { ...rest }, /* @__PURE__ */ React.createElement(ListSubheader, { className: classes.listSubheader }, icon, /* @__PURE__ */ React.createElement(
|
|
1040
|
+
Typography,
|
|
1041
|
+
{
|
|
1042
|
+
className: classes.listSubheaderName,
|
|
1043
|
+
component: "strong",
|
|
1044
|
+
...titleProps
|
|
1045
|
+
},
|
|
1046
|
+
title
|
|
1047
|
+
), filterOptions ? /* @__PURE__ */ React.createElement(
|
|
1048
|
+
Chip,
|
|
1049
|
+
{
|
|
1050
|
+
className: classes.listSubheaderChip,
|
|
1051
|
+
component: "button",
|
|
1052
|
+
icon: /* @__PURE__ */ React.createElement(AddIcon, null),
|
|
1053
|
+
variant: "outlined",
|
|
1054
|
+
label: "Add filter",
|
|
1055
|
+
"aria-controls": "filters-menu",
|
|
1056
|
+
"aria-haspopup": "true",
|
|
1057
|
+
onClick: handleClick
|
|
1058
|
+
}
|
|
1059
|
+
) : null, filterOptions ? /* @__PURE__ */ React.createElement(
|
|
1060
|
+
Menu,
|
|
1061
|
+
{
|
|
1062
|
+
id: "filters-menu",
|
|
1063
|
+
anchorEl,
|
|
1064
|
+
open: Boolean(anchorEl),
|
|
1065
|
+
onClose: handleClose,
|
|
1066
|
+
onClick: handleClose,
|
|
1067
|
+
keepMounted: true
|
|
1068
|
+
},
|
|
1069
|
+
filterOptions.map(renderFilterOption)
|
|
1070
|
+
) : null, filterFields == null ? void 0 : filterFields.map(
|
|
1033
1071
|
(filterField) => {
|
|
1034
1072
|
var _a;
|
|
1035
1073
|
return (_a = renderFilterField == null ? void 0 : renderFilterField(filterField)) != null ? _a : null;
|
|
1036
1074
|
}
|
|
1037
|
-
), /* @__PURE__ */ React.createElement(Link, {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}) : null, !loading && !error && (resultItems == null ? void 0 : resultItems.length) ? resultItems.map(renderResultItem) : null, !loading && !error && !(resultItems == null ? void 0 : resultItems.length) ? /* @__PURE__ */ React.createElement(ListItem, null, noResultsComponent) : null);
|
|
1075
|
+
), /* @__PURE__ */ React.createElement(Link, { className: classes.listSubheaderLink, to: "/search", ...linkProps }, link)), loading ? /* @__PURE__ */ React.createElement(Progress, null) : null, !loading && error ? /* @__PURE__ */ React.createElement(
|
|
1076
|
+
ResponseErrorPanel,
|
|
1077
|
+
{
|
|
1078
|
+
title: "Error encountered while fetching search results",
|
|
1079
|
+
error
|
|
1080
|
+
}
|
|
1081
|
+
) : null, !loading && !error && (resultItems == null ? void 0 : resultItems.length) ? resultItems.map(renderResultItem) : null, !loading && !error && !(resultItems == null ? void 0 : resultItems.length) ? /* @__PURE__ */ React.createElement(ListItem, null, noResultsComponent) : null);
|
|
1045
1082
|
}
|
|
1046
1083
|
function SearchResultGroup(props) {
|
|
1047
1084
|
const {
|
|
@@ -1059,27 +1096,32 @@ function SearchResultGroup(props) {
|
|
|
1059
1096
|
},
|
|
1060
1097
|
{ arrayFormat: "brackets" }
|
|
1061
1098
|
)}`;
|
|
1062
|
-
return /* @__PURE__ */ React.createElement(
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1099
|
+
return /* @__PURE__ */ React.createElement(
|
|
1100
|
+
AnalyticsContext,
|
|
1101
|
+
{
|
|
1102
|
+
attributes: {
|
|
1103
|
+
pluginId: "search",
|
|
1104
|
+
extension: "SearchResultGroup"
|
|
1105
|
+
}
|
|
1106
|
+
},
|
|
1107
|
+
/* @__PURE__ */ React.createElement(SearchResultState, { query }, ({ loading, error, value }) => {
|
|
1108
|
+
var _a, _b;
|
|
1109
|
+
if (!((_a = value == null ? void 0 : value.results) == null ? void 0 : _a.length) && disableRenderingWithNoResults) {
|
|
1110
|
+
return null;
|
|
1111
|
+
}
|
|
1112
|
+
return /* @__PURE__ */ React.createElement(
|
|
1113
|
+
SearchResultGroupLayout,
|
|
1114
|
+
{
|
|
1115
|
+
...rest,
|
|
1116
|
+
loading,
|
|
1117
|
+
error,
|
|
1118
|
+
linkProps: { to, ...linkProps },
|
|
1119
|
+
resultItems: value == null ? void 0 : value.results,
|
|
1120
|
+
filterFields: Object.keys((_b = query.filters) != null ? _b : {})
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
})
|
|
1124
|
+
);
|
|
1083
1125
|
}
|
|
1084
1126
|
|
|
1085
1127
|
export { AutocompleteFilter, CheckboxFilter, HigherOrderDefaultResultListItem as DefaultResultListItem, HighlightedSearchResultText, MockSearchApi, SearchAutocomplete, SearchAutocompleteDefaultOption, SearchBar, SearchBarBase, SearchContextProvider, SearchFilter, SearchPagination, SearchPaginationBase, SearchResult, SearchResultApi, SearchResultComponent, SearchResultContext, SearchResultGroup, SearchResultGroupFilterFieldLayout, SearchResultGroupLayout, SearchResultGroupSelectFilterField, SearchResultGroupTextFilterField, SearchResultList, SearchResultListLayout, SearchResultPager, SearchResultState, SelectFilter, searchApiRef, useSearch, useSearchContextCheck };
|