@react-fabric/searchbar 1.0.0-beta.5 → 1.0.0-beta.52

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.
Files changed (40) hide show
  1. package/dist/cjs/filterbar/FilterBar.js +9 -5
  2. package/dist/cjs/filterbar/FilterForm.js +138 -33
  3. package/dist/cjs/filterbar/FilterMenu.js +16 -4
  4. package/dist/cjs/filterbar/FilterTag.js +9 -4
  5. package/dist/cjs/filterbar/FilterView.js +5 -1
  6. package/dist/cjs/filterbar/QueryForm.js +8 -5
  7. package/dist/cjs/i18n/ar.json.js +42 -39
  8. package/dist/cjs/i18n/en.json.js +43 -39
  9. package/dist/cjs/searchbar/SearchBar.js +58 -4
  10. package/dist/cjs/types/index.js +12 -4
  11. package/dist/esm/filterbar/FilterBar.js +9 -5
  12. package/dist/esm/filterbar/FilterForm.js +139 -34
  13. package/dist/esm/filterbar/FilterMenu.js +16 -4
  14. package/dist/esm/filterbar/FilterTag.js +9 -4
  15. package/dist/esm/filterbar/FilterView.js +5 -1
  16. package/dist/esm/filterbar/QueryForm.js +8 -5
  17. package/dist/esm/i18n/ar.json.js +42 -39
  18. package/dist/esm/i18n/en.json.js +43 -39
  19. package/dist/esm/searchbar/SearchBar.js +59 -5
  20. package/dist/esm/types/index.js +12 -4
  21. package/dist/types/filterbar/Context.d.ts +2 -3
  22. package/dist/types/filterbar/FilterBar.d.ts +27 -1
  23. package/dist/types/filterbar/FilterMenu.d.ts +2 -1
  24. package/dist/types/filterbar/FilterTag.d.ts +2 -1
  25. package/dist/types/index.d.ts +1 -1
  26. package/dist/types/searchbar/SearchBar.d.ts +35 -1
  27. package/dist/types/types/index.d.ts +19 -10
  28. package/package.json +15 -13
  29. package/src/filterbar/Context.tsx +4 -1
  30. package/src/filterbar/FilterBar.tsx +48 -6
  31. package/src/filterbar/FilterForm.tsx +107 -22
  32. package/src/filterbar/FilterMenu.tsx +30 -3
  33. package/src/filterbar/FilterTag.tsx +25 -6
  34. package/src/filterbar/FilterView.tsx +4 -1
  35. package/src/filterbar/QueryForm.tsx +10 -4
  36. package/src/i18n/ar.json +42 -39
  37. package/src/i18n/en.json +43 -39
  38. package/src/index.ts +6 -1
  39. package/src/searchbar/SearchBar.tsx +52 -2
  40. package/src/types/index.ts +57 -34
@@ -60,7 +60,7 @@ export const QueryForm = ({
60
60
  }) => {
61
61
  const { t } = useTranslation("searchbar");
62
62
  const tree = useFloatingTree();
63
- const { defaultQuery = "", querySchema } = useFilterContext();
63
+ const { defaultQuery = "", querySchema, queryLanguage } = useFilterContext();
64
64
  const inputRef = useRef<HTMLInputElement>(null);
65
65
 
66
66
  const filterValue = useMemo(() => {
@@ -112,7 +112,7 @@ export const QueryForm = ({
112
112
  />
113
113
  </Controller>
114
114
  <Controller name="query">
115
- {({ checked, error, invalid, ...field }) => (
115
+ {({ checked, error, invalid, ref, ...field }) => (
116
116
  <div className="my-2">
117
117
  <label
118
118
  className={classNames("block px-2", invalid && "text-danger-600")}
@@ -125,12 +125,18 @@ export const QueryForm = ({
125
125
  gridTemplate: '"content" 1fr/1fr',
126
126
  }}
127
127
  >
128
- <CodeEditor minimal required {...field} schema={querySchema} />
128
+ <CodeEditor
129
+ language={queryLanguage ?? "text"}
130
+ minimal
131
+ required
132
+ {...field}
133
+ schema={querySchema}
134
+ />
129
135
  </div>
130
136
  </div>
131
137
  )}
132
138
  </Controller>
133
- <div className="flex justify-end gap-1">
139
+ <div className="flex mt-4 justify-end gap-1 sticky bottom-1 bg-base">
134
140
  {onRemove && (
135
141
  <div className="flex-1">
136
142
  <Button
package/src/i18n/ar.json CHANGED
@@ -1,68 +1,71 @@
1
1
  {
2
2
  "label": {
3
- "filters": "المرشحات",
3
+ "add": "إضافة عامل تصفية",
4
4
  "all_filters": "جميع المرشحات",
5
+ "apply": "يتقدم",
6
+ "basicFilter": "الفلتر الأساسي",
7
+ "cancel": "يلغي",
8
+ "customQuery": "استعلام مخصص",
9
+ "delete": "يمسح",
10
+ "disable": "إبطال",
11
+ "disableAll": "تعطيل الكل",
12
+ "edit": "يحرر",
13
+ "enable": "يُمكَِن",
14
+ "enableAll": "تمكين الكل",
15
+ "exclude": "استبعاد",
16
+ "excludeAll": "استبعاد الكل",
5
17
  "field": "مجال",
6
- "operator": "المشغل",
7
- "value": "قيمة",
18
+ "filters": "المرشحات",
19
+ "forAdvanced": "للمستخدمين المتقدمين فقط!",
20
+ "include": "يشمل",
21
+ "includeAll": "تضمين الكل",
22
+ "invertAll": "عكس التضمين/الاستبعاد",
8
23
  "label": "ملصق",
24
+ "operator": "المشغل",
9
25
  "optional": "خياري",
10
- "add": "إضافة عامل تصفية",
11
- "edit": "يحرر",
12
- "view": "منظر",
13
26
  "pin": "مثبت",
14
- "unpin": "غير مثبت",
15
- "includeAll": "تضمين الكل",
16
- "excludeAll": "استبعاد الكل",
17
- "invertAll": "عكس التضمين/الاستبعاد",
27
+ "query": "استفسار",
28
+ "refresh": "ينعش",
29
+ "remove": "يزيل",
18
30
  "removeAll": "إزالة الكل",
19
- "enableAll": "تمكين الكل",
20
- "disableAll": "تعطيل الكل",
21
31
  "toggleDisable": "عكس تعطيل/تمكين",
22
- "remove": "يزيل",
23
- "enable": "يُمكَِن",
24
- "disable": "إبطال",
25
- "exclude": "استبعاد",
26
- "include": "يشمل",
27
- "refresh": "ينعش",
32
+ "unpin": "غير مثبت",
28
33
  "update": "تحديث",
29
- "query": "استفسار",
30
- "apply": "يتقدم",
31
- "cancel": "يلغي",
32
- "delete": "يمسح",
33
- "basicFilter": "الفلتر الأساسي",
34
- "customQuery": "استعلام مخصص",
35
- "forAdvanced": "للمستخدمين المتقدمين فقط!"
34
+ "value": "قيمة",
35
+ "view": "منظر",
36
+ "matchAll": "تطابق كل شيء",
37
+ "matchAny": "تطابق أي"
36
38
  },
37
39
  "operator": {
40
+ "ALL": "كل",
41
+ "ANY": "أي من",
42
+ "BETWEEN": "بين هذا وذاك",
43
+ "ENDS": "ينتهي مع",
38
44
  "EXISTS": "موجود",
45
+ "GT": ">",
46
+ "GTE": "≥",
39
47
  "IS": "يكون",
40
- "IN": "في",
48
+ "LIKE": "يحب",
41
49
  "LT": "<",
42
- "GT": ">",
43
50
  "LTE": "≤",
44
- "GTE": "≥",
45
- "INCLUDES": "يشمل",
46
51
  "STARTS": "ابدا ب",
47
- "ENDS": "ينتهي مع",
48
- "WITHIN": "في غضون",
49
- "BETWEEN": "بين هذا وذاك"
52
+ "WITHIN": "في غضون"
50
53
  },
51
54
  "placeholder": "مصطلح البحث...",
52
55
  "type": {
53
- "STRING": "سلسلة",
54
- "NUMBER": "كثافة العمليات",
55
- "DECIMAL": "يطفو",
56
56
  "BOOLEAN": "رقم",
57
57
  "DATE": "منطقي",
58
58
  "DATETIME": "تاريخ",
59
- "GEO": "GeoJSON"
59
+ "DECIMAL": "يطفو",
60
+ "GEO": "GeoJSON",
61
+ "NUMBER": "كثافة العمليات",
62
+ "STRING": "سلسلة"
60
63
  },
61
64
  "validate": {
65
+ "compare": "مقارنة الحقل المطلوب",
62
66
  "field": "حقل مطلوب",
67
+ "label": "التصنيف مطلوب",
63
68
  "operator": "عامل مطلوب",
64
- "value": "القيمة المطلوبة",
65
- "compare": "مقارنة الحقل المطلوب",
66
- "label": "التصنيف مطلوب"
69
+ "value": "القيمة المطلوبة"
67
70
  }
68
71
  }
package/src/i18n/en.json CHANGED
@@ -1,68 +1,72 @@
1
1
  {
2
2
  "label": {
3
- "filters": "Filters",
3
+ "add": "Add Filter",
4
4
  "all_filters": "All Filters",
5
+ "apply": "Apply",
6
+ "basicFilter": "Basic Filter",
7
+ "cancel": "Cancel",
8
+ "customQuery": "Custom Query",
9
+ "delete": "Delete",
10
+ "disable": "Disable",
11
+ "disableAll": "Disable All",
12
+ "edit": "Edit",
13
+ "enable": "Enable",
14
+ "enableAll": "Enable All",
15
+ "exclude": "Exclude",
16
+ "excludeAll": "Exclude All",
5
17
  "field": "Field",
6
- "operator": "Operator",
7
- "value": "Value",
18
+ "filters": "Filters",
19
+ "forAdvanced": "For advanced users only!",
20
+ "include": "Include",
21
+ "includeAll": "Include All",
22
+ "invertAll": "Invert Include/Exclude",
8
23
  "label": "Label",
24
+ "matchAll": "Match All",
25
+ "matchAny": "Match Any",
26
+ "operator": "Operator",
9
27
  "optional": "Optional",
10
- "add": "Add Filter",
11
- "edit": "Edit",
12
- "view": "View",
13
28
  "pin": "Pinned",
14
- "unpin": "Unpinned",
15
- "includeAll": "Include All",
16
- "excludeAll": "Exclude All",
17
- "invertAll": "Invert Include/Exclude",
29
+ "query": "Query",
30
+ "refresh": "Refresh",
31
+ "remove": "Remove",
18
32
  "removeAll": "Remove All",
19
- "enableAll": "Enable All",
20
- "disableAll": "Disable All",
21
33
  "toggleDisable": "Invert Disable/Enable",
22
- "remove": "Remove",
23
- "enable": "Enable",
24
- "disable": "Disable",
25
- "exclude": "Exclude",
26
- "include": "Include",
27
- "refresh": "Refresh",
34
+ "unpin": "Unpinned",
28
35
  "update": "Update",
29
- "query": "Query",
30
- "apply": "Apply",
31
- "cancel": "Cancel",
32
- "delete": "Delete",
33
- "basicFilter": "Basic Filter",
34
- "customQuery": "Custom Query",
35
- "forAdvanced": "For advanced users only!"
36
+ "value": "Value",
37
+ "view": "View"
36
38
  },
37
39
  "operator": {
40
+ "ALL": "All of",
41
+ "ANY": "Any of",
42
+ "BETWEEN": "Between",
43
+ "ENDS": "Ends with",
44
+ "EQ": "=",
38
45
  "EXISTS": "Exists",
46
+ "GT": ">",
47
+ "GTE": "≥",
39
48
  "IS": "Is",
40
- "IN": "In",
49
+ "LIKE": "Like",
41
50
  "LT": "<",
42
- "GT": ">",
43
51
  "LTE": "≤",
44
- "GTE": "≥",
45
- "INCLUDES": "Includes",
46
52
  "STARTS": "Starts with",
47
- "ENDS": "Ends with",
48
- "WITHIN": "Within",
49
- "BETWEEN": "Between"
53
+ "WITHIN": "Within"
50
54
  },
51
55
  "placeholder": "Search term...",
52
56
  "type": {
53
- "STRING": "String",
54
- "NUMBER": "Number",
55
- "DECIMAL": "Decimal",
56
57
  "BOOLEAN": "Bool",
57
58
  "DATE": "Date",
58
59
  "DATETIME": "Date Time",
59
- "GEO": "GeoJSON"
60
+ "DECIMAL": "Decimal",
61
+ "GEO": "GeoJSON",
62
+ "NUMBER": "Number",
63
+ "STRING": "String"
60
64
  },
61
65
  "validate": {
66
+ "compare": "Compare field required",
62
67
  "field": "Field required",
68
+ "label": "Label required",
63
69
  "operator": "Operator required",
64
- "value": "Value required",
65
- "compare": "Compare field required",
66
- "label": "Label required"
70
+ "value": "Value required"
67
71
  }
68
72
  }
package/src/index.ts CHANGED
@@ -25,4 +25,9 @@ import "./i18n";
25
25
 
26
26
  export { FilterBar } from "./filterbar/FilterBar";
27
27
  export { SearchBar } from "./searchbar/SearchBar";
28
- export { FIELD_TYPE, OPERATOR, type FilterObject } from "./types";
28
+ export {
29
+ FIELD_TYPE,
30
+ OPERATOR,
31
+ type FilterObject,
32
+ type SearchObject,
33
+ } from "./types";
@@ -24,7 +24,7 @@
24
24
  import { Button, useDebounce, useLocalStorage } from "@react-fabric/core";
25
25
  import { AutoComplete, Field } from "@react-fabric/form";
26
26
  import { dedupe, EMPTY_ARRAY, isArray } from "@react-fabric/utilities";
27
- import { useMemo, useReducer, useState } from "react";
27
+ import { useEffect, useMemo, useReducer, useState } from "react";
28
28
  import { useTranslation } from "react-i18next";
29
29
  import { FilterBar } from "../filterbar/FilterBar";
30
30
  import {
@@ -40,10 +40,45 @@ interface SearchState {
40
40
  }
41
41
 
42
42
  type SearchActions =
43
+ | { type: "reset"; query: string | string[]; filters: FilterObject[] }
43
44
  | { type: "dirty"; dirty: boolean }
44
45
  | { type: "query"; query: string | string[] }
45
46
  | { type: "filter"; filters: FilterObject[] };
46
47
 
48
+ /**
49
+ * This component provides a search input with autocomplete functionality,
50
+ * a button to trigger search, and an optional filter bar.
51
+ * It supports history of search queries, multiple selection, and custom decorations.
52
+ * It can be collapsed to hide filters and has options for customization.
53
+ *
54
+ * @param {SearchBarProps} props - The properties for the SearchBar component.
55
+ * @returns {JSX.Element} The rendered SearchBar component.
56
+ *
57
+ * @example
58
+ * ```jsx
59
+ * <SearchBar
60
+ * historyKey="myApp:searchHistory"
61
+ * historyCount={10}
62
+ * defaultQueryList={["example", "test"]}
63
+ * prepend={<span>Prepend</span>}
64
+ * append={<span>Append</span>}
65
+ * decorateEnd={<span>End Decoration</span>}
66
+ * decorateStart={<span>Start Decoration</span>}
67
+ * hideFilters={false}
68
+ * defaultCollapsed={false}
69
+ * disabled={false}
70
+ * onCollapsed={(collapsed) => console.log("Collapsed:", collapsed)}
71
+ * onQuery={(query) => console.log("Query:", query)}
72
+ * onSearch={({ query, filters }) => console.log("Search:", query, filters)}
73
+ * query={""}
74
+ * ref={searchInputRef}
75
+ * multiple={false}
76
+ * filters={[{ name: "filter1", value: "value1" }]}
77
+ * />
78
+ * ```
79
+ *
80
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/searchbar-searchbar--search-bar} for more details on the properties.
81
+ */
47
82
  export const SearchBar = ({
48
83
  historyKey = "ruf:search",
49
84
  historyCount = 20,
@@ -60,6 +95,7 @@ export const SearchBar = ({
60
95
  onQuery,
61
96
  onSearch,
62
97
  query,
98
+ ref,
63
99
  multiple,
64
100
  filters = EMPTY_ARRAY,
65
101
  ...filterProps
@@ -75,6 +111,7 @@ export const SearchBar = ({
75
111
 
76
112
  const fireSearch = useDebounce(
77
113
  (query: AnyObject, filters: FilterObject[]) => {
114
+ dispatch({ type: "dirty", dirty: false });
78
115
  onSearch?.({
79
116
  query,
80
117
  filters,
@@ -85,6 +122,14 @@ export const SearchBar = ({
85
122
 
86
123
  const [state, dispatch] = useReducer(
87
124
  (state: SearchState, action: SearchActions) => {
125
+ if (action.type === "reset") {
126
+ return {
127
+ ...state,
128
+ dirty: false,
129
+ query: action.query,
130
+ filters: action.filters,
131
+ };
132
+ }
88
133
  if (action.type === "dirty") {
89
134
  return { ...state, dirty: action.dirty };
90
135
  }
@@ -105,6 +150,10 @@ export const SearchBar = ({
105
150
  },
106
151
  );
107
152
 
153
+ useEffect(() => {
154
+ dispatch({ type: "reset", filters, query });
155
+ }, [filters, query]);
156
+
108
157
  const updateHistory = (value: string | string[]) => {
109
158
  const historyEntry = isArray(value) ? value : [value];
110
159
  setHistory(dedupe([...historyEntry, ...history]).slice(0, historyCount));
@@ -132,6 +181,7 @@ export const SearchBar = ({
132
181
  <AutoComplete
133
182
  allowClear
134
183
  expandOnEdit
184
+ ref={ref}
135
185
  multiple={multiple}
136
186
  history={history}
137
187
  value={state.query}
@@ -139,7 +189,7 @@ export const SearchBar = ({
139
189
  decorateStart={decorateStart}
140
190
  onInput={() => dispatch({ type: "dirty", dirty: true })}
141
191
  onSelect={updateHistory}
142
- onQuery={onQuery}
192
+ data-ref="searchbarInput"
143
193
  onEnterPressed={() => fireSearch(state.query, state.filters)}
144
194
  />
145
195
  {append}
@@ -21,17 +21,21 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { type ChildrenProp } from "@react-fabric/core/dist/types/types";
24
+ import {
25
+ type ChildrenProp,
26
+ type RefProp,
27
+ } from "@react-fabric/core/dist/types/types";
25
28
  import { type ReactElement } from "react";
26
29
 
27
30
  export enum FIELD_TYPE {
28
31
  ID = "ID",
29
32
  STRING = "STRING",
33
+ TEXT = "TEXT",
30
34
  NUMBER = "NUMBER",
31
35
  DECIMAL = "DECIMAL",
32
36
  BOOLEAN = "BOOLEAN",
33
- // DATE = "DATE",
34
- // DATETIME = "DATETIME",
37
+ DATE = "DATE",
38
+ DATETIME = "DATETIME",
35
39
  // GEO = "GEO",
36
40
  NONE = "NONE",
37
41
  }
@@ -39,12 +43,14 @@ export enum FIELD_TYPE {
39
43
  export enum OPERATOR {
40
44
  EXISTS = "EXISTS",
41
45
  IS = "IS",
42
- IN = "IN",
46
+ ALL = "ALL",
47
+ ANY = "ANY",
48
+ EQ = "EQ",
43
49
  LT = "LT",
44
50
  GT = "GT",
45
51
  LTE = "LTE",
46
52
  GTE = "GTE",
47
- INCLUDES = "INCLUDES",
53
+ LIKE = "LIKE",
48
54
  STARTS = "STARTS",
49
55
  ENDS = "ENDS",
50
56
  WITHIN = "WITHIN",
@@ -55,18 +61,22 @@ export enum OPERATOR {
55
61
  * @internal
56
62
  */
57
63
  export const TypeOperators: { [key in FIELD_TYPE]: OPERATOR[] } = {
58
- [FIELD_TYPE.ID]: [OPERATOR.IS, OPERATOR.IN],
64
+ [FIELD_TYPE.ID]: [OPERATOR.IS, OPERATOR.ANY],
59
65
  [FIELD_TYPE.STRING]: [
60
66
  OPERATOR.EXISTS,
61
67
  OPERATOR.IS,
62
- OPERATOR.IN,
63
- OPERATOR.INCLUDES,
68
+ OPERATOR.ANY,
69
+ OPERATOR.ALL,
70
+ ],
71
+ [FIELD_TYPE.TEXT]: [
72
+ OPERATOR.EXISTS,
73
+ OPERATOR.LIKE,
64
74
  OPERATOR.STARTS,
65
75
  OPERATOR.ENDS,
66
76
  ],
67
77
  [FIELD_TYPE.NUMBER]: [
68
78
  OPERATOR.EXISTS,
69
- OPERATOR.IS,
79
+ OPERATOR.EQ,
70
80
  OPERATOR.BETWEEN,
71
81
  OPERATOR.LT,
72
82
  OPERATOR.GT,
@@ -75,46 +85,55 @@ export const TypeOperators: { [key in FIELD_TYPE]: OPERATOR[] } = {
75
85
  ],
76
86
  [FIELD_TYPE.DECIMAL]: [
77
87
  OPERATOR.EXISTS,
78
- OPERATOR.IS,
88
+ OPERATOR.EQ,
89
+ OPERATOR.BETWEEN,
90
+ OPERATOR.LT,
91
+ OPERATOR.GT,
92
+ OPERATOR.LTE,
93
+ OPERATOR.GTE,
94
+ ],
95
+ [FIELD_TYPE.BOOLEAN]: [OPERATOR.EXISTS, OPERATOR.EQ],
96
+ [FIELD_TYPE.DATE]: [
97
+ OPERATOR.EXISTS,
98
+ OPERATOR.EQ,
99
+ OPERATOR.BETWEEN,
100
+ OPERATOR.LT,
101
+ OPERATOR.GT,
102
+ OPERATOR.LTE,
103
+ OPERATOR.GTE,
104
+ ],
105
+ [FIELD_TYPE.DATETIME]: [
106
+ OPERATOR.EXISTS,
107
+ OPERATOR.EQ,
79
108
  OPERATOR.BETWEEN,
80
109
  OPERATOR.LT,
81
110
  OPERATOR.GT,
82
111
  OPERATOR.LTE,
83
112
  OPERATOR.GTE,
84
113
  ],
85
- [FIELD_TYPE.BOOLEAN]: [OPERATOR.EXISTS, OPERATOR.IS],
86
- // [FIELD_TYPE.DATE]: [
87
- // OPERATOR.BETWEEN,
88
- // OPERATOR.LT,
89
- // OPERATOR.GT,
90
- // OPERATOR.LTE,
91
- // OPERATOR.GTE,
92
- // ],
93
- // [FIELD_TYPE.DATETIME]: [
94
- // OPERATOR.BETWEEN,
95
- // OPERATOR.LT,
96
- // OPERATOR.GT,
97
- // OPERATOR.LTE,
98
- // OPERATOR.GTE,
99
- // ],
100
114
  // [FIELD_TYPE.GEO]: [],
101
115
  [FIELD_TYPE.NONE]: [OPERATOR.EXISTS],
102
116
  };
103
117
 
104
118
  /**
105
119
  * @internal
120
+ * 0 single value
121
+ * 1 many values
122
+ * 2 two values
106
123
  */
107
124
  export const OperatorValueType: {
108
125
  [key in OPERATOR]: 0 | 1 | 2;
109
126
  } = {
110
127
  [OPERATOR.EXISTS]: 0,
111
128
  [OPERATOR.IS]: 0,
112
- [OPERATOR.IN]: 1,
129
+ [OPERATOR.ANY]: 1,
130
+ [OPERATOR.ALL]: 1,
113
131
  [OPERATOR.BETWEEN]: 2,
114
132
  [OPERATOR.WITHIN]: 0,
115
133
  [OPERATOR.STARTS]: 0,
116
134
  [OPERATOR.ENDS]: 0,
117
- [OPERATOR.INCLUDES]: 0,
135
+ [OPERATOR.LIKE]: 0,
136
+ [OPERATOR.EQ]: 0,
118
137
  [OPERATOR.LT]: 0,
119
138
  [OPERATOR.GT]: 0,
120
139
  [OPERATOR.LTE]: 0,
@@ -140,12 +159,10 @@ interface BaseFilter {
140
159
  color?: string;
141
160
  value?: FilterValue;
142
161
  pinned?: boolean;
143
- negate?: boolean;
144
162
  disabled?: boolean;
145
163
  required?: boolean;
146
164
  canPin?: boolean;
147
165
  canEdit?: boolean;
148
- canInvert?: boolean;
149
166
  canDisable?: boolean;
150
167
  }
151
168
 
@@ -153,16 +170,18 @@ export type FilterObject = BaseFilter &
153
170
  (
154
171
  | {
155
172
  field: string;
156
- type?: FIELD_TYPE;
157
173
  operator: OPERATOR;
158
174
  value?: FilterValue;
175
+ negate?: boolean;
176
+ canInvert?: boolean;
159
177
  query?: never;
178
+ type?: string;
160
179
  }
161
180
  | {
162
181
  field?: never;
163
- type?: never;
164
182
  operator?: never;
165
183
  label: string;
184
+ canInvert?: false;
166
185
  query: string;
167
186
  }
168
187
  );
@@ -185,7 +204,9 @@ export interface FilterField {
185
204
  onSearch?: (q: string) => Promise<FieldValue[]> | FieldValue[];
186
205
  }
187
206
 
188
- interface BaseSearchBarProps extends Partial<ChildrenProp> {
207
+ interface BaseSearchBarProps
208
+ extends Partial<ChildrenProp>,
209
+ RefProp<HTMLInputElement> {
189
210
  /**
190
211
  * Query string
191
212
  */
@@ -291,12 +312,12 @@ export interface FilterBarProps {
291
312
  /**
292
313
  * Editable filters
293
314
  */
294
- isEditable?: boolean;
315
+ editable?: boolean;
295
316
 
296
317
  /**
297
318
  * Disable component
298
319
  */
299
- isDisabled?: boolean;
320
+ disabled?: boolean;
300
321
 
301
322
  /**
302
323
  * Message for empty field list
@@ -313,6 +334,8 @@ export interface FilterBarProps {
313
334
  excludedColor?: string;
314
335
 
315
336
  allowAdd?: boolean;
337
+
338
+ queryLanguage?: "text" | "json";
316
339
  querySchema?: Array<{ uri: string; schema: KeyValue }>;
317
340
  defaultQuery?: string;
318
341