@usereactify/search 4.4.1 → 5.0.0-beta.0
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 +38 -0
- package/dist/package.json +6 -8
- package/dist/src/components/context/ReactifySearchBase.d.ts +42 -0
- package/dist/src/components/context/ReactifySearchBase.js +140 -0
- package/dist/src/components/context/index.d.ts +1 -0
- package/dist/src/components/context/index.js +13 -0
- package/dist/src/components/example/ExampleFilterList.d.ts +4 -0
- package/dist/src/components/example/ExampleFilterList.js +19 -0
- package/dist/src/components/example/ExampleFilterRange.d.ts +4 -0
- package/dist/src/components/example/ExampleFilterRange.js +21 -0
- package/dist/src/components/example/ExampleFilterSlider.d.ts +4 -0
- package/dist/src/components/example/ExampleFilterSlider.js +20 -0
- package/dist/src/components/example/ExampleFilterStack.d.ts +4 -0
- package/dist/src/components/example/ExampleFilterStack.js +12 -0
- package/dist/src/components/example/ExampleResultCardCallout.d.ts +4 -0
- package/dist/src/components/example/ExampleResultCardCallout.js +21 -0
- package/dist/src/components/example/ExampleResultCardProduct.d.ts +4 -0
- package/dist/src/components/example/ExampleResultCardProduct.js +18 -0
- package/dist/src/components/example/ExampleResultPaginationLoadMore.d.ts +4 -0
- package/dist/src/components/example/ExampleResultPaginationLoadMore.js +11 -0
- package/dist/src/components/example/ExampleResultPaginationNextPrev.d.ts +4 -0
- package/dist/src/components/example/ExampleResultPaginationNextPrev.js +13 -0
- package/dist/src/components/example/ExampleResultPaginationNumbered.d.ts +4 -0
- package/dist/src/components/example/ExampleResultPaginationNumbered.js +26 -0
- package/dist/src/components/example/ExampleSortby.d.ts +4 -0
- package/dist/src/components/example/ExampleSortby.js +12 -0
- package/dist/src/components/example/index.d.ts +10 -0
- package/dist/src/components/example/index.js +22 -0
- package/dist/src/components/filter/Filter.d.ts +20 -0
- package/dist/src/components/filter/Filter.js +89 -0
- package/dist/src/components/filter/FilterStack.d.ts +7 -0
- package/dist/src/components/filter/FilterStack.js +16 -0
- package/dist/src/{filter → components/filter}/index.d.ts +0 -1
- package/dist/src/{filter → components/filter}/index.js +0 -1
- package/dist/src/components/index.d.ts +8 -0
- package/dist/src/components/index.js +20 -0
- package/dist/src/components/result/ResultCardCallout.d.ts +12 -0
- package/dist/src/{result → components/result}/ResultCardCallout.js +15 -22
- package/dist/src/components/result/ResultCardProduct.d.ts +13 -0
- package/dist/src/{result/ResultCard.js → components/result/ResultCardProduct.js} +19 -22
- package/dist/src/components/result/ResultPaginationLoadMore.d.ts +7 -0
- package/dist/src/components/result/ResultPaginationLoadMore.js +16 -0
- package/dist/src/components/result/ResultPaginationNextPrev.d.ts +7 -0
- package/dist/src/components/result/ResultPaginationNextPrev.js +16 -0
- package/dist/src/components/result/ResultPaginationNumbered.d.ts +7 -0
- package/dist/src/components/result/ResultPaginationNumbered.js +19 -0
- package/dist/src/components/result/ResultStack.d.ts +40 -0
- package/dist/src/components/result/ResultStack.js +107 -0
- package/dist/src/components/result/ResultStateProvider.d.ts +6 -0
- package/dist/src/{result → components/result}/ResultStateProvider.js +0 -0
- package/dist/src/components/result/index.d.ts +7 -0
- package/dist/src/{result → components/result}/index.js +5 -4
- package/dist/src/components/search/SearchInput.d.ts +8 -0
- package/dist/src/{search → components/search}/SearchInput.js +2 -2
- package/dist/src/{search → components/search}/index.d.ts +0 -0
- package/dist/src/{search → components/search}/index.js +0 -0
- package/dist/src/{sensor → components/sensor}/SensorCollection.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorCollection.js +8 -5
- package/dist/src/{sensor → components/sensor}/SensorInventoryAvailable.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorInventoryAvailable.js +1 -1
- package/dist/src/{sensor → components/sensor}/SensorPublished.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorPublished.js +0 -0
- package/dist/src/{sensor → components/sensor}/SensorSearch.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorSearch.js +3 -3
- package/dist/src/{sensor → components/sensor}/SensorSort.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorSort.js +4 -5
- package/dist/src/{sensor → components/sensor}/SensorSortScore.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/SensorSortScore.js +0 -0
- package/dist/src/components/sensor/SensorStack.d.ts +3 -0
- package/dist/src/{sensor → components/sensor}/SensorStack.js +3 -3
- package/dist/src/{sensor → components/sensor}/index.d.ts +0 -0
- package/dist/src/{sensor → components/sensor}/index.js +0 -0
- package/dist/src/components/sortby/Sortby.d.ts +7 -0
- package/dist/src/components/sortby/Sortby.js +16 -0
- package/dist/src/components/sortby/index.d.ts +1 -0
- package/dist/src/components/sortby/index.js +13 -0
- package/dist/src/{utility → components/utility}/UtilityAuthenticatedReactiveBase.d.ts +0 -0
- package/dist/src/{utility → components/utility}/UtilityAuthenticatedReactiveBase.js +2 -2
- package/dist/src/components/utility/index.d.ts +1 -0
- package/dist/src/components/utility/index.js +13 -0
- package/dist/src/hooks/index.d.ts +5 -5
- package/dist/src/hooks/index.js +5 -5
- package/dist/src/hooks/reactivesearch/index.d.ts +4 -1
- package/dist/src/hooks/reactivesearch/index.js +4 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +7 -7
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +5 -7
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +29 -30
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +9 -4
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +9 -94
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +70 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +21 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.d.ts +67 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +105 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.d.ts +68 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +21 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +8 -8
- package/dist/src/hooks/reactivesearch/{useReactiveResultListProps.d.ts → useReactiveResultStackProps.d.ts} +2 -4
- package/dist/src/hooks/reactivesearch/{useReactiveResultListProps.js → useReactiveResultStackProps.js} +7 -8
- package/dist/src/hooks/useAnalytics.js +4 -4
- package/dist/src/hooks/useConfig.d.ts +4 -1
- package/dist/src/hooks/useConfig.js +77 -2
- package/dist/src/hooks/useCuration.d.ts +2 -1
- package/dist/src/hooks/useCuration.js +48 -2
- package/dist/src/hooks/useFilterListProps.d.ts +4 -14
- package/dist/src/hooks/useFilterStack.d.ts +2 -1
- package/dist/src/hooks/useFilterStack.js +42 -2
- package/dist/src/hooks/useFilters.d.ts +4 -1
- package/dist/src/hooks/useFilters.js +10 -5
- package/dist/src/hooks/usePagination.d.ts +14 -0
- package/dist/src/hooks/{usePages.js → usePagination.js} +30 -30
- package/dist/src/hooks/usePaginationLoadMore.d.ts +14 -0
- package/dist/src/hooks/usePaginationLoadMore.js +35 -0
- package/dist/src/hooks/useProductPrice.d.ts +3 -5
- package/dist/src/hooks/useProductPrice.js +42 -40
- package/dist/src/hooks/useReactifySearchContext.d.ts +78 -0
- package/dist/src/hooks/useReactifySearchContext.js +10 -0
- package/dist/src/hooks/useSearch.d.ts +4 -4
- package/dist/src/hooks/useSearch.js +28 -8
- package/dist/src/hooks/useSortby.d.ts +6 -0
- package/dist/src/hooks/useSortby.js +41 -0
- package/dist/src/index.d.ts +2 -8
- package/dist/src/index.js +2 -8
- package/dist/src/types/config.d.ts +1 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/index.js +15 -0
- package/package.json +6 -8
- package/dist/src/filter/Filter.d.ts +0 -12
- package/dist/src/filter/Filter.js +0 -71
- package/dist/src/filter/FilterList.d.ts +0 -4
- package/dist/src/filter/FilterList.js +0 -15
- package/dist/src/filter/FilterStack.d.ts +0 -11
- package/dist/src/filter/FilterStack.js +0 -25
- package/dist/src/hooks/useCollection.d.ts +0 -1
- package/dist/src/hooks/useCollection.js +0 -6
- package/dist/src/hooks/useLiveConfig.d.ts +0 -4
- package/dist/src/hooks/useLiveConfig.js +0 -74
- package/dist/src/hooks/usePages.d.ts +0 -10
- package/dist/src/hooks/useSort.d.ts +0 -5
- package/dist/src/hooks/useSort.js +0 -24
- package/dist/src/provider.d.ts +0 -78
- package/dist/src/provider.js +0 -287
- package/dist/src/result/ResultCard.d.ts +0 -14
- package/dist/src/result/ResultCardCallout.d.ts +0 -13
- package/dist/src/result/ResultList.d.ts +0 -34
- package/dist/src/result/ResultList.js +0 -93
- package/dist/src/result/ResultLoadMoreButton.d.ts +0 -10
- package/dist/src/result/ResultLoadMoreButton.js +0 -61
- package/dist/src/result/ResultPagination.d.ts +0 -10
- package/dist/src/result/ResultPagination.js +0 -60
- package/dist/src/result/ResultPaginationNextPrev.d.ts +0 -8
- package/dist/src/result/ResultPaginationNextPrev.js +0 -30
- package/dist/src/result/ResultStateProvider.d.ts +0 -7
- package/dist/src/result/index.d.ts +0 -6
- package/dist/src/search/SearchInput.d.ts +0 -9
- package/dist/src/sensor/SensorStack.d.ts +0 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Filter = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const MultiList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/list/MultiList"));
|
|
20
|
+
const SingleList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/list/SingleList"));
|
|
21
|
+
const hooks_1 = require("../../hooks");
|
|
22
|
+
const components_1 = require("../../components");
|
|
23
|
+
const Filter = (props) => {
|
|
24
|
+
if ("single" === props.filter.displayType) {
|
|
25
|
+
return (react_1.default.createElement(FilterSingleList, Object.assign({}, props)));
|
|
26
|
+
}
|
|
27
|
+
if ("multi" === props.filter.displayType) {
|
|
28
|
+
return (react_1.default.createElement(FilterMultiList, Object.assign({}, props)));
|
|
29
|
+
}
|
|
30
|
+
if ("range" === props.filter.displayType) {
|
|
31
|
+
return (react_1.default.createElement(FilterRange, Object.assign({}, props)));
|
|
32
|
+
}
|
|
33
|
+
if ("slider" === props.filter.displayType) {
|
|
34
|
+
return (react_1.default.createElement(FilterSlider, Object.assign({}, props)));
|
|
35
|
+
}
|
|
36
|
+
console.log(`filter with display type "${props.filter.displayType}" not yet supported`);
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
exports.Filter = Filter;
|
|
40
|
+
const FilterSingleList = (props) => {
|
|
41
|
+
const reactiveFilterListProps = (0, hooks_1.useReactiveFilterListProps)(props.filter);
|
|
42
|
+
return (react_1.default.createElement(SingleList_1.default, Object.assign({}, reactiveFilterListProps, { render: (reactivesearchFilterProps) => (react_1.default.createElement(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
|
|
43
|
+
};
|
|
44
|
+
const FilterMultiList = (props) => {
|
|
45
|
+
const reactiveFilterListProps = (0, hooks_1.useReactiveFilterListProps)(props.filter);
|
|
46
|
+
return (react_1.default.createElement(MultiList_1.default, Object.assign({}, reactiveFilterListProps, { render: (reactivesearchFilterProps) => (react_1.default.createElement(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
|
|
47
|
+
};
|
|
48
|
+
const FilterRange = (props) => {
|
|
49
|
+
const reactiveFilterRangeProps = (0, hooks_1.useReactiveFilterRangeProps)(props.filter);
|
|
50
|
+
if (props.renderFilterRange) {
|
|
51
|
+
const Component = props.renderFilterRange;
|
|
52
|
+
return (react_1.default.createElement(Component, Object.assign({}, props, { reactiveFilterRangeProps: reactiveFilterRangeProps })));
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
const FilterSlider = (props) => {
|
|
57
|
+
const reactiveFilterSliderProps = (0, hooks_1.useReactiveFilterSliderProps)(props.filter);
|
|
58
|
+
if (props.renderFilterSlider) {
|
|
59
|
+
const Component = props.renderFilterSlider;
|
|
60
|
+
return (react_1.default.createElement(Component, Object.assign({}, props, { reactiveFilterSliderProps: reactiveFilterSliderProps })));
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
};
|
|
64
|
+
// inner component exists only so we can use memos in reactivesearch render functions
|
|
65
|
+
const FilterListInner = (props) => {
|
|
66
|
+
const { filter, renderFilterList, reactivesearchFilterProps } = props, otherProps = __rest(props, ["filter", "renderFilterList", "reactivesearchFilterProps"]);
|
|
67
|
+
const { track } = (0, hooks_1.useAnalytics)();
|
|
68
|
+
const _a = (0, hooks_1.useFilterListProps)(filter, reactivesearchFilterProps), { handleChange } = _a, filterListProps = __rest(_a, ["handleChange"]);
|
|
69
|
+
const handleFilterChange = react_1.default.useCallback((value) => {
|
|
70
|
+
handleChange(value);
|
|
71
|
+
track({
|
|
72
|
+
eventName: "filterChange",
|
|
73
|
+
payload: {
|
|
74
|
+
name: filter.name,
|
|
75
|
+
value: value,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}, [filterListProps]);
|
|
79
|
+
const updatedFilterListProps = Object.assign(Object.assign({}, filterListProps), { handleChange: handleFilterChange });
|
|
80
|
+
// hide entire filter when no options available
|
|
81
|
+
if (0 === filterListProps.options.length) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
if (renderFilterList) {
|
|
85
|
+
const Component = renderFilterList;
|
|
86
|
+
return (react_1.default.createElement(Component, Object.assign({ filterListProps: updatedFilterListProps, filter: filter }, otherProps)));
|
|
87
|
+
}
|
|
88
|
+
return (react_1.default.createElement(components_1.ExampleFilterList, Object.assign({ filterListProps: updatedFilterListProps, filter: filter }, otherProps)));
|
|
89
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useFilters } from "../../hooks";
|
|
3
|
+
export declare type FilterStackProps = {
|
|
4
|
+
/** Render method called once for all filters */
|
|
5
|
+
renderFilters?: React.FC<ReturnType<typeof useFilters>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const FilterStack: React.FC<FilterStackProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FilterStack = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const FilterStack = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const filtersHook = (0, hooks_1.useFilters)();
|
|
13
|
+
const RenderFiltersComponent = (_a = props.renderFilters) !== null && _a !== void 0 ? _a : components_1.ExampleFilterStack;
|
|
14
|
+
return (react_1.default.createElement(RenderFiltersComponent, Object.assign({}, filtersHook)));
|
|
15
|
+
};
|
|
16
|
+
exports.FilterStack = FilterStack;
|
|
@@ -11,5 +11,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./Filter"), exports);
|
|
14
|
-
__exportStar(require("./FilterList"), exports);
|
|
15
14
|
__exportStar(require("./FilterStack"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./context"), exports);
|
|
14
|
+
__exportStar(require("./example"), exports);
|
|
15
|
+
__exportStar(require("./filter"), exports);
|
|
16
|
+
__exportStar(require("./result"), exports);
|
|
17
|
+
__exportStar(require("./search"), exports);
|
|
18
|
+
__exportStar(require("./sensor"), exports);
|
|
19
|
+
__exportStar(require("./sortby"), exports);
|
|
20
|
+
__exportStar(require("./utility"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ElasticCallout } from "../../types";
|
|
3
|
+
export declare type ResultCardCalloutProps = {
|
|
4
|
+
pagePosition: number;
|
|
5
|
+
document: ElasticCallout;
|
|
6
|
+
callout: ElasticCallout["callout"];
|
|
7
|
+
render?: React.FC<Omit<ResultCardCalloutProps, "render"> & {
|
|
8
|
+
itemRef: (node?: Element | null) => void;
|
|
9
|
+
handleClick: () => void;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export declare const ResultCardCallout: React.FC<ResultCardCalloutProps>;
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ResultCardCallout = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_intersection_observer_1 = require("react-intersection-observer");
|
|
9
|
-
const hooks_1 = require("
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const __1 = require("..");
|
|
10
11
|
const ResultCardCallout = (props) => {
|
|
11
|
-
const { callout, render } = props;
|
|
12
12
|
const { track } = (0, hooks_1.useAnalytics)();
|
|
13
13
|
const { ref, inView } = (0, react_intersection_observer_1.useInView)({
|
|
14
14
|
threshold: 0.5,
|
|
@@ -18,36 +18,29 @@ const ResultCardCallout = (props) => {
|
|
|
18
18
|
track({
|
|
19
19
|
eventName: "clickPromotion",
|
|
20
20
|
payload: {
|
|
21
|
-
link: callout.link,
|
|
22
|
-
title: callout.title,
|
|
21
|
+
link: props.callout.link,
|
|
22
|
+
title: props.callout.title,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
|
-
}, [track, callout]);
|
|
25
|
+
}, [track, props.callout]);
|
|
26
26
|
const handleView = react_1.default.useCallback(() => {
|
|
27
27
|
track({
|
|
28
28
|
eventName: "viewPromotion",
|
|
29
29
|
payload: {
|
|
30
|
-
link: callout.link,
|
|
31
|
-
title: callout.title,
|
|
30
|
+
link: props.callout.link,
|
|
31
|
+
title: props.callout.title,
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
|
-
}, [track, callout]);
|
|
34
|
+
}, [track, props.callout]);
|
|
35
35
|
react_1.default.useEffect(() => {
|
|
36
|
-
if (inView)
|
|
36
|
+
if (inView) {
|
|
37
37
|
handleView();
|
|
38
|
+
}
|
|
38
39
|
}, [inView]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return ({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
}, [callout]);
|
|
46
|
-
if (render)
|
|
47
|
-
return render(Object.assign(Object.assign({}, props), { itemRef: ref, handleClick }));
|
|
48
|
-
return (react_1.default.createElement("article", { ref: ref, style: styleProp },
|
|
49
|
-
react_1.default.createElement("a", { href: callout.link, onClick: handleClick },
|
|
50
|
-
callout.desktopImage && (react_1.default.createElement("img", { src: callout.desktopImage, width: "100%" })),
|
|
51
|
-
callout.title)));
|
|
40
|
+
if (props.render) {
|
|
41
|
+
const Component = props.render;
|
|
42
|
+
return (react_1.default.createElement(Component, Object.assign({}, props, { itemRef: ref, handleClick: handleClick })));
|
|
43
|
+
}
|
|
44
|
+
return (react_1.default.createElement(__1.ExampleResultCardCallout, Object.assign({}, props, { itemRef: ref, handleClick: handleClick })));
|
|
52
45
|
};
|
|
53
46
|
exports.ResultCardCallout = ResultCardCallout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ElasticProduct } from "../../types";
|
|
3
|
+
import { useProductPrice } from "../../hooks";
|
|
4
|
+
export declare type ResultCardProductProps = {
|
|
5
|
+
pagePosition: number;
|
|
6
|
+
product: ElasticProduct;
|
|
7
|
+
document: ElasticProduct;
|
|
8
|
+
render?: React.FC<Omit<ResultCardProductProps, "render"> & ReturnType<typeof useProductPrice> & {
|
|
9
|
+
itemRef: (node?: Element | null) => void;
|
|
10
|
+
handleClick: () => void;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export declare const ResultCardProduct: React.FC<ResultCardProductProps>;
|
|
@@ -14,15 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.ResultCardProduct = void 0;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const react_intersection_observer_1 = require("react-intersection-observer");
|
|
20
|
-
const hooks_1 = require("
|
|
21
|
-
const
|
|
20
|
+
const hooks_1 = require("../../hooks");
|
|
21
|
+
const components_1 = require("../../components");
|
|
22
|
+
const ResultCardProduct = (_a) => {
|
|
22
23
|
var { render } = _a, props = __rest(_a, ["render"]);
|
|
23
|
-
const
|
|
24
|
-
const productPrice = (0, hooks_1.useProductPrice)(product);
|
|
25
|
-
const { formattedPrice, formattedCompareAtPrice, onSale } = productPrice;
|
|
24
|
+
const productPrice = (0, hooks_1.useProductPrice)(props.product);
|
|
26
25
|
const { track } = (0, hooks_1.useAnalytics)();
|
|
27
26
|
const { ref, inView } = (0, react_intersection_observer_1.useInView)({
|
|
28
27
|
threshold: 0.5,
|
|
@@ -33,34 +32,32 @@ const ResultCard = (_a) => {
|
|
|
33
32
|
eventName: "clickProduct",
|
|
34
33
|
payload: {
|
|
35
34
|
elasticProduct: {
|
|
36
|
-
id: product.id,
|
|
37
|
-
title: product.title,
|
|
35
|
+
id: props.product.id,
|
|
36
|
+
title: props.product.title,
|
|
38
37
|
},
|
|
39
38
|
},
|
|
40
39
|
});
|
|
41
|
-
}, [track, product]);
|
|
40
|
+
}, [track, props.product]);
|
|
42
41
|
const handleView = react_1.default.useCallback(() => {
|
|
43
42
|
track({
|
|
44
43
|
eventName: "viewProduct",
|
|
45
44
|
payload: {
|
|
46
45
|
elasticProduct: {
|
|
47
|
-
id: product.id,
|
|
48
|
-
title: product.title,
|
|
46
|
+
id: props.product.id,
|
|
47
|
+
title: props.product.title,
|
|
49
48
|
},
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
|
-
}, [track, product]);
|
|
51
|
+
}, [track, props.product]);
|
|
53
52
|
react_1.default.useEffect(() => {
|
|
54
|
-
if (inView)
|
|
53
|
+
if (inView) {
|
|
55
54
|
handleView();
|
|
55
|
+
}
|
|
56
56
|
}, [inView]);
|
|
57
|
-
if (render)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
product.title),
|
|
63
|
-
react_1.default.createElement("span", null, formattedPrice),
|
|
64
|
-
onSale && (react_1.default.createElement("span", { style: { textDecoration: "line-through" } }, formattedCompareAtPrice))));
|
|
57
|
+
if (render) {
|
|
58
|
+
const Component = render;
|
|
59
|
+
return (react_1.default.createElement(Component, Object.assign({}, props, productPrice, { itemRef: ref, handleClick: handleClick })));
|
|
60
|
+
}
|
|
61
|
+
return (react_1.default.createElement(components_1.ExampleResultCardProduct, Object.assign({}, props, productPrice, { itemRef: ref, handleClick: handleClick })));
|
|
65
62
|
};
|
|
66
|
-
exports.
|
|
63
|
+
exports.ResultCardProduct = ResultCardProduct;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactivesearchResultProps } from "../../types";
|
|
3
|
+
import { usePaginationLoadMore } from "../../hooks";
|
|
4
|
+
export declare type ResultPaginationLoadMoreProps = ReactivesearchResultProps & {
|
|
5
|
+
render?: React.FC<ReturnType<typeof usePaginationLoadMore>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ResultPaginationLoadMore: React.FC<ResultPaginationLoadMoreProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResultPaginationLoadMore = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const ResultPaginationLoadMore = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const paginationLoadMoreHook = (0, hooks_1.usePaginationLoadMore)(props);
|
|
13
|
+
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationLoadMore;
|
|
14
|
+
return (react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationLoadMoreHook)));
|
|
15
|
+
};
|
|
16
|
+
exports.ResultPaginationLoadMore = ResultPaginationLoadMore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { usePagination } from "../../hooks";
|
|
3
|
+
import { ReactivesearchPaginationProps } from "../../types";
|
|
4
|
+
export declare type ResultPaginationNextPrevProps = ReactivesearchPaginationProps & {
|
|
5
|
+
render?: React.FC<ReturnType<typeof usePagination>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ResultPaginationNextPrev: React.FC<ResultPaginationNextPrevProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResultPaginationNextPrev = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const ResultPaginationNextPrev = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const paginationHook = (0, hooks_1.usePagination)(props);
|
|
13
|
+
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationNextPrev;
|
|
14
|
+
return (react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationHook)));
|
|
15
|
+
};
|
|
16
|
+
exports.ResultPaginationNextPrev = ResultPaginationNextPrev;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactivesearchPaginationProps } from "../../types";
|
|
3
|
+
import { usePagination } from "../../hooks";
|
|
4
|
+
export declare type ResultPaginationNumberedProps = ReactivesearchPaginationProps & {
|
|
5
|
+
render?: React.FC<ReturnType<typeof usePagination>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ResultPaginationNumbered: React.FC<ResultPaginationNumberedProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResultPaginationNumbered = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const ResultPaginationNumbered = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const paginationHook = (0, hooks_1.usePagination)(props);
|
|
13
|
+
if (!paginationHook.totalPages) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationNumbered;
|
|
17
|
+
return (react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationHook)));
|
|
18
|
+
};
|
|
19
|
+
exports.ResultPaginationNumbered = ResultPaginationNumbered;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultCardCallout } from "./ResultCardCallout";
|
|
3
|
+
import { ResultCardProduct } from "./ResultCardProduct";
|
|
4
|
+
import { ResultPaginationNumbered } from "./ResultPaginationNumbered";
|
|
5
|
+
import { ResultPaginationLoadMore } from "./ResultPaginationLoadMore";
|
|
6
|
+
import { ResultPaginationNextPrev } from "./ResultPaginationNextPrev";
|
|
7
|
+
import { ElasticCallout, ElasticProduct, ReactivesearchError, ReactivesearchResultProps } from "../../types";
|
|
8
|
+
export declare type ResultProps = ReactivesearchResultProps & {
|
|
9
|
+
callouts: ElasticCallout[];
|
|
10
|
+
products: ElasticProduct[];
|
|
11
|
+
};
|
|
12
|
+
export declare type ResultStackProps = {
|
|
13
|
+
/** Style prop for the list wrapper */
|
|
14
|
+
listStyle?: React.HTMLAttributes<HTMLElement>["style"];
|
|
15
|
+
/** Classname prop for the list wrapper */
|
|
16
|
+
listClassName?: string;
|
|
17
|
+
/** Render method called when an error occurs */
|
|
18
|
+
renderError?: React.FC<{
|
|
19
|
+
error: ReactivesearchError;
|
|
20
|
+
}>;
|
|
21
|
+
/** Render method called while loading for the first time */
|
|
22
|
+
renderLoading?: React.FC;
|
|
23
|
+
/** Render method called when no results are found */
|
|
24
|
+
renderNoResults?: React.FC;
|
|
25
|
+
/** Render method called once for each product result */
|
|
26
|
+
renderResultCardProduct?: React.ComponentProps<typeof ResultCardProduct>["render"];
|
|
27
|
+
/** Render method called once for each callout result */
|
|
28
|
+
renderResultCardCallout?: React.ComponentProps<typeof ResultCardCallout>["render"];
|
|
29
|
+
/** Render method called for pagination type "pagination" */
|
|
30
|
+
renderPaginationNumbered?: React.ComponentProps<typeof ResultPaginationNumbered>["render"];
|
|
31
|
+
/** Render method called for pagination type "next_prev" */
|
|
32
|
+
renderPaginationNextPrev?: React.ComponentProps<typeof ResultPaginationNextPrev>["render"];
|
|
33
|
+
/** Render method called for pagination type "load_more" */
|
|
34
|
+
renderPaginationLoadMore?: React.ComponentProps<typeof ResultPaginationLoadMore>["render"];
|
|
35
|
+
/** Render method called for pagination type "infinite_scroll" */
|
|
36
|
+
renderPaginationInfiniteScroll?: React.ComponentProps<typeof ResultPaginationLoadMore>["render"];
|
|
37
|
+
/** Advanced Usage: Override the default amount of results per page */
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
};
|
|
40
|
+
export declare const ResultStack: React.FC<ResultStackProps>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResultStack = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/result/ReactiveList"));
|
|
9
|
+
const ResultCardCallout_1 = require("./ResultCardCallout");
|
|
10
|
+
const ResultCardProduct_1 = require("./ResultCardProduct");
|
|
11
|
+
const ResultPaginationNumbered_1 = require("./ResultPaginationNumbered");
|
|
12
|
+
const ResultPaginationLoadMore_1 = require("./ResultPaginationLoadMore");
|
|
13
|
+
const ResultPaginationNextPrev_1 = require("./ResultPaginationNextPrev");
|
|
14
|
+
const hooks_1 = require("../../hooks");
|
|
15
|
+
const types_1 = require("../../types");
|
|
16
|
+
const ResultStack = (props) => {
|
|
17
|
+
const reactiveResultStackProps = (0, hooks_1.useReactiveResultStackProps)({
|
|
18
|
+
pageSize: props.pageSize,
|
|
19
|
+
});
|
|
20
|
+
return (react_1.default.createElement(ReactiveList_1.default, Object.assign({}, reactiveResultStackProps, { render: (reactivesearchResultProps) => (react_1.default.createElement(ResultStackInner, Object.assign({}, props, { reactivesearchResultProps: reactivesearchResultProps }))), renderPagination: (reactivesearchPaginationProps) => (react_1.default.createElement(ResultStackPaginationStack, Object.assign({}, props, reactivesearchPaginationProps))) })));
|
|
21
|
+
};
|
|
22
|
+
exports.ResultStack = ResultStack;
|
|
23
|
+
const ResultStackRenderErrorComponent = (props) => {
|
|
24
|
+
return (react_1.default.createElement("div", null,
|
|
25
|
+
"Error: ",
|
|
26
|
+
props.error.statusText));
|
|
27
|
+
};
|
|
28
|
+
const ResultStackRenderLoadingComponent = () => {
|
|
29
|
+
return (react_1.default.createElement("div", null, "Loading"));
|
|
30
|
+
};
|
|
31
|
+
const ResultStackRenderNoResultsComponent = () => {
|
|
32
|
+
return (react_1.default.createElement("div", null, "No results"));
|
|
33
|
+
};
|
|
34
|
+
const ResultStackInner = (props) => {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
const { track } = (0, hooks_1.useAnalytics)();
|
|
37
|
+
const { searchQuery } = (0, hooks_1.useSearch)();
|
|
38
|
+
const initialSearchHasRun = react_1.default.useMemo(() => "undefined" !==
|
|
39
|
+
typeof props.reactivesearchResultProps.resultStats.numberOfResults, [props.reactivesearchResultProps]);
|
|
40
|
+
const listStyle = react_1.default.useMemo(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
return (_a = props.listStyle) !== null && _a !== void 0 ? _a : {
|
|
43
|
+
display: "grid",
|
|
44
|
+
gap: "8px",
|
|
45
|
+
gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
|
|
46
|
+
};
|
|
47
|
+
}, [props.listStyle]);
|
|
48
|
+
if (props.reactivesearchResultProps.error) {
|
|
49
|
+
const RenderErrorComponent = (_a = props.renderError) !== null && _a !== void 0 ? _a : ResultStackRenderErrorComponent;
|
|
50
|
+
return (react_1.default.createElement(RenderErrorComponent, { error: props.reactivesearchResultProps.error }));
|
|
51
|
+
}
|
|
52
|
+
if (!initialSearchHasRun) {
|
|
53
|
+
const RenderLoadingComponent = (_b = props.renderLoading) !== null && _b !== void 0 ? _b : ResultStackRenderLoadingComponent;
|
|
54
|
+
return (react_1.default.createElement(RenderLoadingComponent, null));
|
|
55
|
+
}
|
|
56
|
+
if (!props.reactivesearchResultProps.resultStats.numberOfResults) {
|
|
57
|
+
if (searchQuery) {
|
|
58
|
+
track({
|
|
59
|
+
eventName: "zeroResults",
|
|
60
|
+
payload: {
|
|
61
|
+
searchTerm: searchQuery,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const RenderNoResultsComponent = (_c = props.renderNoResults) !== null && _c !== void 0 ? _c : ResultStackRenderNoResultsComponent;
|
|
66
|
+
return (react_1.default.createElement(RenderNoResultsComponent, null));
|
|
67
|
+
}
|
|
68
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
69
|
+
react_1.default.createElement("section", { style: listStyle, className: props.listClassName }, props.reactivesearchResultProps.data.map((item, key) => {
|
|
70
|
+
// @todo result.type is missing in v1 indexes, this check ensures that they are assumed to be products
|
|
71
|
+
if (types_1.ElasticDocumentType.Product === item.type || !item.type) {
|
|
72
|
+
return (react_1.default.createElement(ResultCardProduct_1.ResultCardProduct, { key: item._id, product: item, document: item, pagePosition: key + 1, render: props.renderResultCardProduct }));
|
|
73
|
+
}
|
|
74
|
+
if (types_1.ElasticDocumentType.Callout === item.type) {
|
|
75
|
+
return (react_1.default.createElement(ResultCardCallout_1.ResultCardCallout, { key: item._id, document: item, pagePosition: key + 1, callout: item.callout, render: props.renderResultCardCallout }));
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
})),
|
|
79
|
+
react_1.default.createElement(ResultStackPaginationStackLoadMore, Object.assign({}, props, props.reactivesearchResultProps))));
|
|
80
|
+
};
|
|
81
|
+
/** Handles rendering pagination for types that use "pagination props" */
|
|
82
|
+
const ResultStackPaginationStack = (props) => {
|
|
83
|
+
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
84
|
+
const filterStack = (0, hooks_1.useFilterStack)();
|
|
85
|
+
if (options.mode === "instant-search") {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if ("pagination" === (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType)) {
|
|
89
|
+
return (react_1.default.createElement(ResultPaginationNumbered_1.ResultPaginationNumbered, Object.assign({}, props, { render: props.renderPaginationNumbered })));
|
|
90
|
+
}
|
|
91
|
+
if ("next_prev" === (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType)) {
|
|
92
|
+
return (react_1.default.createElement(ResultPaginationNextPrev_1.ResultPaginationNextPrev, Object.assign({}, props, { render: props.renderPaginationNextPrev })));
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
/** Handles rendering pagination for types that use "result props" */
|
|
97
|
+
const ResultStackPaginationStackLoadMore = (props) => {
|
|
98
|
+
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
99
|
+
const filterStack = (0, hooks_1.useFilterStack)();
|
|
100
|
+
if (options.mode === "instant-search") {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if ("load_more" === (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType)) {
|
|
104
|
+
return (react_1.default.createElement(ResultPaginationLoadMore_1.ResultPaginationLoadMore, Object.assign({}, props.reactivesearchResultProps, { render: props.renderPaginationLoadMore })));
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactivesearchSearchStatePage } from "../../types";
|
|
3
|
+
export declare type ResultStateProvidedProps = {
|
|
4
|
+
render: (props: ReactivesearchSearchStatePage) => JSX.Element | null;
|
|
5
|
+
};
|
|
6
|
+
export declare const ResultStateProvider: React.FC<ResultStateProvidedProps>;
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./ResultStack";
|
|
2
|
+
export * from "./ResultCardCallout";
|
|
3
|
+
export * from "./ResultCardProduct";
|
|
4
|
+
export * from "./ResultStateProvider";
|
|
5
|
+
export * from "./ResultPaginationNumbered";
|
|
6
|
+
export * from "./ResultPaginationLoadMore";
|
|
7
|
+
export * from "./ResultPaginationNextPrev";
|
|
@@ -10,9 +10,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./
|
|
15
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./ResultStack"), exports);
|
|
14
|
+
__exportStar(require("./ResultCardCallout"), exports);
|
|
15
|
+
__exportStar(require("./ResultCardProduct"), exports);
|
|
16
16
|
__exportStar(require("./ResultStateProvider"), exports);
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./ResultPaginationNumbered"), exports);
|
|
18
|
+
__exportStar(require("./ResultPaginationLoadMore"), exports);
|
|
18
19
|
__exportStar(require("./ResultPaginationNextPrev"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DataSearch from "@appbaseio/reactivesearch/lib/components/search/DataSearch";
|
|
3
|
+
export declare type SearchInputProps = Omit<React.ComponentProps<typeof DataSearch>, "componentId"> & {
|
|
4
|
+
debounce?: number;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
inputClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const SearchInput: React.FC<SearchInputProps>;
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SearchInput = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
|
|
9
|
-
const hooks_1 = require("
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
10
|
const SearchInput = (props) => {
|
|
11
11
|
const { debounce, placeholder, inputClassName } = props;
|
|
12
12
|
const reactiveDataSearchProps = (0, hooks_1.useReactiveDataSearchProps)(Object.assign({ debounce,
|
|
13
13
|
placeholder,
|
|
14
14
|
inputClassName }, props));
|
|
15
|
-
return react_1.default.createElement(DataSearch_1.default, Object.assign({}, reactiveDataSearchProps));
|
|
15
|
+
return (react_1.default.createElement(DataSearch_1.default, Object.assign({}, reactiveDataSearchProps)));
|
|
16
16
|
};
|
|
17
17
|
exports.SearchInput = SearchInput;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|