@usereactify/search 4.4.1 → 5.0.0-beta.2
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 +47 -0
- package/dist/package.json +8 -9
- 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/ReactifySearchBase/ReactifySearchBase.d.ts +42 -0
- package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js +140 -0
- package/dist/src/components/ReactifySearchBase/index.d.ts +1 -0
- package/dist/src/components/ReactifySearchBase/index.js +13 -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/components/index.d.ts +8 -0
- package/dist/src/components/index.js +20 -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 +15 -0
- package/dist/src/hooks/usePaginationLoadMore.js +37 -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 +8 -9
- 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,140 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ReactifySearchBase = void 0;
|
|
26
|
+
const react_1 = __importDefault(require("react"));
|
|
27
|
+
const Sentry = __importStar(require("@sentry/react"));
|
|
28
|
+
const tracing_1 = require("@sentry/tracing");
|
|
29
|
+
const hooks_1 = require("../../hooks");
|
|
30
|
+
const components_1 = require("../../components");
|
|
31
|
+
const debug = require("debug")("reactify-search:ReactifySearchBase");
|
|
32
|
+
Sentry.init({
|
|
33
|
+
dsn: "https://cd8abf47496c4956bd061e461f857319@o301775.ingest.sentry.io/6600694",
|
|
34
|
+
integrations: [new tracing_1.BrowserTracing()],
|
|
35
|
+
tracesSampleRate: 1.0,
|
|
36
|
+
});
|
|
37
|
+
const ReactifySearchBase = (props) => {
|
|
38
|
+
react_1.default.useEffect(() => {
|
|
39
|
+
debug("variable[props]", props);
|
|
40
|
+
}, [props]);
|
|
41
|
+
return (react_1.default.createElement(Sentry.ErrorBoundary, { fallback: react_1.default.createElement("p", null, "An error has occurred"), beforeCapture: (scope) => {
|
|
42
|
+
scope.setTag("index", props.index);
|
|
43
|
+
scope.setTag("shop", props.shopifyPermanentDomain);
|
|
44
|
+
scope.setTag("mode", props.mode);
|
|
45
|
+
if (props.mode === "collection") {
|
|
46
|
+
scope.setTag("collection", props.collection.handle);
|
|
47
|
+
}
|
|
48
|
+
if (props.filterStackHandle) {
|
|
49
|
+
scope.setTag("filter", props.filterStackHandle);
|
|
50
|
+
}
|
|
51
|
+
debug("set sentry scope");
|
|
52
|
+
} },
|
|
53
|
+
react_1.default.createElement(ReactifySearchInner, Object.assign({}, props))));
|
|
54
|
+
};
|
|
55
|
+
exports.ReactifySearchBase = ReactifySearchBase;
|
|
56
|
+
const ReactifySearchInner = (props) => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const { config } = (0, hooks_1.useConfig)(props.shopifyPermanentDomain, props.configId);
|
|
59
|
+
const [searchQuery, setSearchQuery] = react_1.default.useState("");
|
|
60
|
+
const [instantSearchVisible, setInstantSearchVisible] = react_1.default.useState(false);
|
|
61
|
+
const [sortOption, setSortOption] = react_1.default.useState("");
|
|
62
|
+
const credentials = (_a = props.credentials) !== null && _a !== void 0 ? _a : {
|
|
63
|
+
username: "guest",
|
|
64
|
+
password: "password",
|
|
65
|
+
endpoint: "https://api.search.reactify.app",
|
|
66
|
+
};
|
|
67
|
+
const theme = (_b = props.theme) !== null && _b !== void 0 ? _b : {
|
|
68
|
+
typography: {
|
|
69
|
+
fontFamily: "inherit",
|
|
70
|
+
fontSize: "inherit",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
const searchQueryFromURL = react_1.default.useMemo(() => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (typeof window === "undefined")
|
|
76
|
+
return undefined;
|
|
77
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
78
|
+
return (_a = urlParams.get("q")) !== null && _a !== void 0 ? _a : undefined;
|
|
79
|
+
}, [window.location.search]);
|
|
80
|
+
const searchSortFromURL = react_1.default.useMemo(() => {
|
|
81
|
+
var _a;
|
|
82
|
+
if (typeof window === "undefined")
|
|
83
|
+
return undefined;
|
|
84
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
85
|
+
return (_a = urlParams.get("sort")) !== null && _a !== void 0 ? _a : undefined;
|
|
86
|
+
}, [window.location.search]);
|
|
87
|
+
react_1.default.useEffect(() => {
|
|
88
|
+
if (searchQueryFromURL && searchQuery !== searchQueryFromURL) {
|
|
89
|
+
setSearchQuery(searchQueryFromURL);
|
|
90
|
+
}
|
|
91
|
+
}, [searchQueryFromURL]);
|
|
92
|
+
react_1.default.useEffect(() => {
|
|
93
|
+
if (searchSortFromURL && sortOption !== searchSortFromURL) {
|
|
94
|
+
setSortOption(searchSortFromURL);
|
|
95
|
+
}
|
|
96
|
+
}, [searchSortFromURL]);
|
|
97
|
+
react_1.default.useEffect(() => {
|
|
98
|
+
if (window.location.search === "" && sortOption) {
|
|
99
|
+
setSortOption(sortOption);
|
|
100
|
+
}
|
|
101
|
+
}, [window.location.href]);
|
|
102
|
+
const contextValue = react_1.default.useMemo(() => {
|
|
103
|
+
var _a;
|
|
104
|
+
if (!config) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
;
|
|
108
|
+
return {
|
|
109
|
+
config: config,
|
|
110
|
+
options: Object.assign(Object.assign({}, props), { index: (_a = props.index) !== null && _a !== void 0 ? _a : config.index, filterStackHandle: props.filterStackHandle, credentials: credentials, theme: theme }),
|
|
111
|
+
search: {
|
|
112
|
+
searchQuery: searchQuery,
|
|
113
|
+
setSearchQuery: setSearchQuery,
|
|
114
|
+
instantSearchVisible: instantSearchVisible,
|
|
115
|
+
setInstantSearchVisible: setInstantSearchVisible,
|
|
116
|
+
},
|
|
117
|
+
sortby: {
|
|
118
|
+
sortOption: sortOption,
|
|
119
|
+
setSortOption: setSortOption,
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}, [
|
|
123
|
+
config,
|
|
124
|
+
props,
|
|
125
|
+
searchQuery,
|
|
126
|
+
instantSearchVisible,
|
|
127
|
+
sortOption,
|
|
128
|
+
]);
|
|
129
|
+
if (!contextValue) {
|
|
130
|
+
if (props.renderBooting) {
|
|
131
|
+
return props.renderBooting();
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
if (props.noReactiveBase) {
|
|
136
|
+
return (react_1.default.createElement(hooks_1.ReactifySearchContext.Provider, { value: contextValue }, props.children));
|
|
137
|
+
}
|
|
138
|
+
return (react_1.default.createElement(hooks_1.ReactifySearchContext.Provider, { value: contextValue },
|
|
139
|
+
react_1.default.createElement(components_1.UtilityAuthenticatedReactiveBase, null, props.children)));
|
|
140
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ReactifySearchBase";
|
|
@@ -0,0 +1,13 @@
|
|
|
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("./ReactifySearchBase"), 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
|