@homecode/ui 5.20.7 → 5.20.8

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.
@@ -28,7 +28,10 @@ function normalize(text) {
28
28
  function matchesSearch(option, query) {
29
29
  if (!query)
30
30
  return true;
31
- return normalize(option.label).includes(normalize(query));
31
+ const q = normalize(query);
32
+ if (normalize(option.label).includes(q))
33
+ return true;
34
+ return (option.searchText !== undefined && normalize(option.searchText).includes(q));
32
35
  }
33
36
  function isSelectable(option) {
34
37
  return Boolean(option) && !option.isGroupHeader;
@@ -9,6 +9,8 @@ export type Option = {
9
9
  isGroupHeader?: boolean;
10
10
  parentId?: Id;
11
11
  label: string;
12
+ /** Extra text that search matches besides `label` (e.g. an id or alias). */
13
+ searchText?: string;
12
14
  sortingKey?: string | number;
13
15
  children?: Option[];
14
16
  render?: (label: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "5.20.7",
3
+ "version": "5.20.8",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "tests": "jest",