@react-fabric/searchbar 1.0.0-beta.19 → 1.0.0-beta.21

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.
@@ -211,6 +211,7 @@ var FilterForm = function FilterForm(_ref) {
211
211
  name: "field",
212
212
  children: /*#__PURE__*/jsxRuntime.jsx(form.Select, {
213
213
  required: true,
214
+ searchable: true,
214
215
  ref: inputRef,
215
216
  label: t("label.field"),
216
217
  options: fields,
@@ -52,6 +52,10 @@ var SearchBar = function SearchBar(_ref) {
52
52
  return multiple ? utilities.EMPTY_ARRAY : "";
53
53
  }, [multiple]);
54
54
  var fireSearch = core.useDebounce(function (query, filters) {
55
+ dispatch({
56
+ type: "dirty",
57
+ dirty: false
58
+ });
55
59
  onSearch === null || onSearch === void 0 || onSearch({
56
60
  query: query,
57
61
  filters: filters
@@ -60,6 +64,7 @@ var SearchBar = function SearchBar(_ref) {
60
64
  var _useReducer = react.useReducer(function (state, action) {
61
65
  if (action.type === "reset") {
62
66
  return _objectSpread(_objectSpread({}, state), {}, {
67
+ dirty: false,
63
68
  query: action.query,
64
69
  filters: action.filters
65
70
  });
@@ -211,6 +211,7 @@ var FilterForm = function FilterForm(_ref) {
211
211
  name: "field",
212
212
  children: /*#__PURE__*/jsx(Select, {
213
213
  required: true,
214
+ searchable: true,
214
215
  ref: inputRef,
215
216
  label: t("label.field"),
216
217
  options: fields,
@@ -52,6 +52,10 @@ var SearchBar = function SearchBar(_ref) {
52
52
  return multiple ? EMPTY_ARRAY : "";
53
53
  }, [multiple]);
54
54
  var fireSearch = useDebounce(function (query, filters) {
55
+ dispatch({
56
+ type: "dirty",
57
+ dirty: false
58
+ });
55
59
  onSearch === null || onSearch === void 0 || onSearch({
56
60
  query: query,
57
61
  filters: filters
@@ -60,6 +64,7 @@ var SearchBar = function SearchBar(_ref) {
60
64
  var _useReducer = useReducer(function (state, action) {
61
65
  if (action.type === "reset") {
62
66
  return _objectSpread(_objectSpread({}, state), {}, {
67
+ dirty: false,
63
68
  query: action.query,
64
69
  filters: action.filters
65
70
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/searchbar",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.21",
4
4
  "description": "RUF: Searchbar with filters package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@floating-ui/react": "^0.26.24",
37
- "@react-fabric/core": "^1.0.0-beta.19",
38
- "@react-fabric/date": "^1.0.0-beta.19",
39
- "@react-fabric/form": "^1.0.0-beta.19",
40
- "@react-fabric/monaco": "^1.0.0-beta.19",
41
- "@react-fabric/utilities": "^1.0.0-beta.19",
37
+ "@react-fabric/core": "^1.0.0-beta.21",
38
+ "@react-fabric/date": "^1.0.0-beta.21",
39
+ "@react-fabric/form": "^1.0.0-beta.21",
40
+ "@react-fabric/monaco": "^1.0.0-beta.21",
41
+ "@react-fabric/utilities": "^1.0.0-beta.21",
42
42
  "classnames": "^2.5.1",
43
43
  "react-hook-form": "^7.52.1"
44
44
  },
@@ -52,5 +52,5 @@
52
52
  "node": ">=18.12.0",
53
53
  "npm": ">=8.19.0"
54
54
  },
55
- "gitHead": "1757660f7f30590d1bf5c7f2bd3526f6052dccd5"
55
+ "gitHead": "31c3d5c19bce7df519a62bd43efd1c9e6341be04"
56
56
  }
@@ -237,6 +237,7 @@ export const FilterForm = ({
237
237
  <Controller name="field">
238
238
  <Select<FilterField>
239
239
  required
240
+ searchable
240
241
  ref={inputRef}
241
242
  label={t("label.field")}
242
243
  options={fields}
@@ -76,6 +76,7 @@ export const SearchBar = ({
76
76
 
77
77
  const fireSearch = useDebounce(
78
78
  (query: AnyObject, filters: FilterObject[]) => {
79
+ dispatch({ type: "dirty", dirty: false });
79
80
  onSearch?.({
80
81
  query,
81
82
  filters,
@@ -87,7 +88,12 @@ export const SearchBar = ({
87
88
  const [state, dispatch] = useReducer(
88
89
  (state: SearchState, action: SearchActions) => {
89
90
  if (action.type === "reset") {
90
- return { ...state, query: action.query, filters: action.filters };
91
+ return {
92
+ ...state,
93
+ dirty: false,
94
+ query: action.query,
95
+ filters: action.filters,
96
+ };
91
97
  }
92
98
  if (action.type === "dirty") {
93
99
  return { ...state, dirty: action.dirty };