@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.
|
@@ -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
|
});
|
|
@@ -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.
|
|
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.
|
|
38
|
-
"@react-fabric/date": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
40
|
-
"@react-fabric/monaco": "^1.0.0-beta.
|
|
41
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
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": "
|
|
55
|
+
"gitHead": "31c3d5c19bce7df519a62bd43efd1c9e6341be04"
|
|
56
56
|
}
|
|
@@ -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 {
|
|
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 };
|