@usereactify/search 5.0.0-beta.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 +7 -0
- package/dist/package.json +66 -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/components/Filter/index.d.ts +2 -0
- package/dist/src/components/Filter/index.js +14 -0
- 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/components/Result/ResultCardCallout.js +46 -0
- package/dist/src/components/Result/ResultCardProduct.d.ts +13 -0
- package/dist/src/components/Result/ResultCardProduct.js +63 -0
- 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/components/Result/ResultStateProvider.js +10 -0
- package/dist/src/components/Result/index.d.ts +7 -0
- package/dist/src/components/Result/index.js +19 -0
- package/dist/src/components/Search/SearchInput.d.ts +8 -0
- package/dist/src/components/Search/SearchInput.js +17 -0
- package/dist/src/components/Search/index.d.ts +1 -0
- package/dist/src/components/Search/index.js +13 -0
- package/dist/src/components/Sensor/SensorCollection.d.ts +2 -0
- package/dist/src/components/Sensor/SensorCollection.js +44 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.d.ts +2 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +52 -0
- package/dist/src/components/Sensor/SensorPublished.d.ts +2 -0
- package/dist/src/components/Sensor/SensorPublished.js +16 -0
- package/dist/src/components/Sensor/SensorSearch.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSearch.js +82 -0
- package/dist/src/components/Sensor/SensorSort.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSort.js +204 -0
- package/dist/src/components/Sensor/SensorSortScore.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSortScore.js +12 -0
- package/dist/src/components/Sensor/SensorStack.d.ts +3 -0
- package/dist/src/components/Sensor/SensorStack.js +31 -0
- package/dist/src/components/Sensor/index.d.ts +8 -0
- package/dist/src/components/Sensor/index.js +29 -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/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +2 -0
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js +14 -0
- 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 +14 -0
- package/dist/src/hooks/index.js +26 -0
- package/dist/src/hooks/reactivesearch/index.d.ts +8 -0
- package/dist/src/hooks/reactivesearch/index.js +20 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +7 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +43 -0
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +26 -0
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +70 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +73 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +21 -0
- 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.d.ts +3 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +25 -0
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.d.ts +17 -0
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js +31 -0
- package/dist/src/hooks/useAnalytics.d.ts +95 -0
- package/dist/src/hooks/useAnalytics.js +110 -0
- package/dist/src/hooks/useConfig.d.ts +4 -0
- package/dist/src/hooks/useConfig.js +81 -0
- package/dist/src/hooks/useCuration.d.ts +2 -0
- package/dist/src/hooks/useCuration.js +52 -0
- package/dist/src/hooks/useFilterCollapsedState.d.ts +8 -0
- package/dist/src/hooks/useFilterCollapsedState.js +27 -0
- package/dist/src/hooks/useFilterListProps.d.ts +12 -0
- package/dist/src/hooks/useFilterListProps.js +35 -0
- package/dist/src/hooks/useFilterStack.d.ts +2 -0
- package/dist/src/hooks/useFilterStack.js +46 -0
- package/dist/src/hooks/useFilters.d.ts +4 -0
- package/dist/src/hooks/useFilters.js +22 -0
- package/dist/src/hooks/usePagination.d.ts +14 -0
- package/dist/src/hooks/usePagination.js +97 -0
- package/dist/src/hooks/usePaginationLoadMore.d.ts +15 -0
- package/dist/src/hooks/usePaginationLoadMore.js +37 -0
- package/dist/src/hooks/useProductPrice.d.ts +10 -0
- package/dist/src/hooks/useProductPrice.js +63 -0
- package/dist/src/hooks/useReactifySearchContext.d.ts +78 -0
- package/dist/src/hooks/useReactifySearchContext.js +10 -0
- package/dist/src/hooks/useSearch.d.ts +8 -0
- package/dist/src/hooks/useSearch.js +36 -0
- package/dist/src/hooks/useSortby.d.ts +6 -0
- package/dist/src/hooks/useSortby.js +41 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +18 -0
- package/dist/src/types/config.d.ts +26 -0
- package/dist/src/types/config.js +2 -0
- package/dist/src/types/elastic.d.ts +209 -0
- package/dist/src/types/elastic.js +18 -0
- package/dist/src/types/firestore.d.ts +280 -0
- package/dist/src/types/firestore.js +18 -0
- package/dist/src/types/graphql.d.ts +26545 -0
- package/dist/src/types/graphql.js +4687 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/index.js +15 -0
- package/dist/src/types/reactivesearch.d.ts +73 -0
- package/dist/src/types/reactivesearch.js +2 -0
- package/dist/src/types/shopify.d.ts +21 -0
- package/dist/src/types/shopify.js +27 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.0.0-beta.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/v5.0.0-beta.1...v5.0.0-beta.2) (2022-07-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* use correct glob pattern for artifacts ([9f35c7c](https://bitbucket.org/usereactify/reactify-search-ui/commit/9f35c7ccea4f957a94b172fe7ac62b53faf73b32))
|
|
11
|
+
|
|
5
12
|
## [5.0.0-beta.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2022-07-26)
|
|
6
13
|
|
|
7
14
|
## [5.0.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.1...v5.0.0-beta.0) (2022-07-25)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usereactify/search",
|
|
3
|
+
"description": "React UI library for Reactify Search",
|
|
4
|
+
"version": "5.0.0-beta.2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"CHANGELOG.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"watch": "tsc --watch",
|
|
15
|
+
"release": "standard-version --prerelease rc",
|
|
16
|
+
"release:beta": "standard-version --prerelease beta",
|
|
17
|
+
"prebuild": "rimraf dist",
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"prettier": "prettier --write .",
|
|
20
|
+
"storybook": "start-storybook -p 6006"
|
|
21
|
+
},
|
|
22
|
+
"husky": {
|
|
23
|
+
"hooks": {
|
|
24
|
+
"pre-commit": "pretty-quick --staged",
|
|
25
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"commitlint": {
|
|
29
|
+
"extends": [
|
|
30
|
+
"@commitlint/config-conventional"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@sentry/react": "7.7.0",
|
|
35
|
+
"@sentry/tracing": "7.7.0",
|
|
36
|
+
"ahooks": "2.10.11",
|
|
37
|
+
"axios": "0.26.1",
|
|
38
|
+
"currency.js": "2.0.4",
|
|
39
|
+
"debug": "4.3.2",
|
|
40
|
+
"react-intersection-observer": "9.1.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@appbaseio/reactivesearch": "^3.14.0",
|
|
44
|
+
"react": "^17.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@appbaseio/reactivesearch": "^3.14.0",
|
|
48
|
+
"@commitlint/cli": "13.2.0",
|
|
49
|
+
"@commitlint/config-conventional": "13.2.0",
|
|
50
|
+
"@storybook/addon-actions": "6.3.10",
|
|
51
|
+
"@storybook/addon-essentials": "6.3.10",
|
|
52
|
+
"@storybook/addon-links": "6.3.10",
|
|
53
|
+
"@storybook/react": "6.3.10",
|
|
54
|
+
"@types/debug": "4.1.7",
|
|
55
|
+
"@types/react": "17.0.27",
|
|
56
|
+
"babel-loader": "8.2.2",
|
|
57
|
+
"husky": "4.3.8",
|
|
58
|
+
"prettier": "2.4.1",
|
|
59
|
+
"pretty-quick": "3.1.1",
|
|
60
|
+
"react": "17.0.2",
|
|
61
|
+
"react-dom": "17.0.2",
|
|
62
|
+
"rimraf": "3.0.2",
|
|
63
|
+
"standard-version": "9.3.1",
|
|
64
|
+
"typescript": "4.4.3"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -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.ExampleFilterList = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleFilterList = (props) => {
|
|
9
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
10
|
+
react_1.default.createElement("h1", null, props.filter.name),
|
|
11
|
+
react_1.default.createElement("ul", null, props.filterListProps.options.map((option) => (react_1.default.createElement("li", { key: option.key },
|
|
12
|
+
react_1.default.createElement("label", null,
|
|
13
|
+
react_1.default.createElement("input", { value: option.key, type: "checkbox", checked: option.checked, onChange: ({ target: { value } }) => props.filterListProps.handleChange(value) }),
|
|
14
|
+
option.key,
|
|
15
|
+
" (",
|
|
16
|
+
option.doc_count,
|
|
17
|
+
")")))))));
|
|
18
|
+
};
|
|
19
|
+
exports.ExampleFilterList = ExampleFilterList;
|
|
@@ -0,0 +1,21 @@
|
|
|
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.ExampleFilterRange = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const reactivesearch_1 = require("@appbaseio/reactivesearch");
|
|
9
|
+
const ExampleFilterRange = (props) => {
|
|
10
|
+
if (props.filter.handle === "price") {
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement("h1", null, props.filter.name),
|
|
13
|
+
react_1.default.createElement(reactivesearch_1.SingleRange, Object.assign({ data: [
|
|
14
|
+
{ start: "0", label: "All prices" },
|
|
15
|
+
{ start: "0", end: "99", label: "Under $100" },
|
|
16
|
+
{ start: "0", end: "49", label: "Under $50" },
|
|
17
|
+
] }, props.reactiveFilterRangeProps))));
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
exports.ExampleFilterRange = ExampleFilterRange;
|
|
@@ -0,0 +1,20 @@
|
|
|
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.ExampleFilterSlider = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const reactivesearch_1 = require("@appbaseio/reactivesearch");
|
|
9
|
+
const ExampleFilterSlider = (props) => {
|
|
10
|
+
if (props.filter.handle === "price") {
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement("h1", null, props.filter.name),
|
|
13
|
+
react_1.default.createElement(reactivesearch_1.RangeSlider, Object.assign({ range: {
|
|
14
|
+
start: 0,
|
|
15
|
+
end: 500
|
|
16
|
+
} }, props.reactiveFilterSliderProps))));
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
exports.ExampleFilterSlider = ExampleFilterSlider;
|
|
@@ -0,0 +1,12 @@
|
|
|
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.ExampleFilterStack = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const components_1 = require("../../components");
|
|
9
|
+
const ExampleFilterStack = (props) => {
|
|
10
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, props.filters.map((filter) => (react_1.default.createElement(components_1.Filter, Object.assign({ key: filter.id, filter: filter }, props))))));
|
|
11
|
+
};
|
|
12
|
+
exports.ExampleFilterStack = ExampleFilterStack;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultCardCalloutProps } from "../../components";
|
|
3
|
+
export declare type ExampleResultCardCalloutProps = Parameters<Required<ResultCardCalloutProps>["render"]>[0];
|
|
4
|
+
export declare const ExampleResultCardCallout: React.FC<ExampleResultCardCalloutProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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.ExampleResultCardCallout = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleResultCardCallout = (props) => {
|
|
9
|
+
const styleProp = react_1.default.useMemo(() => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return ({
|
|
12
|
+
gridRow: `span ${(_a = props.callout.displayRows) !== null && _a !== void 0 ? _a : 1}`,
|
|
13
|
+
gridColumn: `span ${(_b = props.callout.displayColumns) !== null && _b !== void 0 ? _b : 1}`,
|
|
14
|
+
});
|
|
15
|
+
}, [props.callout]);
|
|
16
|
+
return (react_1.default.createElement("article", { ref: props.itemRef, style: styleProp },
|
|
17
|
+
react_1.default.createElement("a", { href: props.callout.link, onClick: props.handleClick },
|
|
18
|
+
props.callout.desktopImage && (react_1.default.createElement("img", { src: props.callout.desktopImage, width: "100%" })),
|
|
19
|
+
props.callout.title)));
|
|
20
|
+
};
|
|
21
|
+
exports.ExampleResultCardCallout = ExampleResultCardCallout;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultCardProductProps } from "../../components";
|
|
3
|
+
export declare type ExampleResultCardProductProps = Parameters<Required<ResultCardProductProps>["render"]>[0];
|
|
4
|
+
export declare const ExampleResultCardProduct: React.FC<ExampleResultCardProductProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.ExampleResultCardProduct = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleResultCardProduct = (props) => {
|
|
9
|
+
return (react_1.default.createElement("article", { ref: props.itemRef },
|
|
10
|
+
react_1.default.createElement("a", { onClick: props.handleClick, href: `/products/${props.product.handle}` },
|
|
11
|
+
props.product.image && (react_1.default.createElement("img", { src: props.product.image, width: "100%" })),
|
|
12
|
+
props.product.title),
|
|
13
|
+
react_1.default.createElement("span", null, props.formattedPrice),
|
|
14
|
+
props.onSale && (react_1.default.createElement("span", { style: {
|
|
15
|
+
textDecoration: "line-through"
|
|
16
|
+
} }, props.formattedCompareAtPrice))));
|
|
17
|
+
};
|
|
18
|
+
exports.ExampleResultCardProduct = ExampleResultCardProduct;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultPaginationLoadMoreProps } from "../../components";
|
|
3
|
+
export declare type ExampleResultPaginationLoadMoreProps = Parameters<Required<ResultPaginationLoadMoreProps>["render"]>[0];
|
|
4
|
+
export declare const ExampleResultPaginationLoadMore: React.FC<ExampleResultPaginationLoadMoreProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
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.ExampleResultPaginationLoadMore = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleResultPaginationLoadMore = (props) => {
|
|
9
|
+
return (react_1.default.createElement("button", { onClick: () => props.handleLoadMore() }, "Load more"));
|
|
10
|
+
};
|
|
11
|
+
exports.ExampleResultPaginationLoadMore = ExampleResultPaginationLoadMore;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultPaginationNextPrevProps } from "../../components";
|
|
3
|
+
export declare type ExampleResultPaginationNextPrevProps = Parameters<Required<ResultPaginationNextPrevProps>["render"]>[0];
|
|
4
|
+
export declare const ExampleResultPaginationNextPrev: React.FC<ExampleResultPaginationNextPrevProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.ExampleResultPaginationNextPrev = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleResultPaginationNextPrev = (props) => {
|
|
9
|
+
return (react_1.default.createElement("nav", null,
|
|
10
|
+
props.hasPreviousPage && (react_1.default.createElement("a", { rel: "prev", onClick: props.handlePreviousPage, href: props.buildPagePath(props.actualCurrentPage - 1) }, "Prev")),
|
|
11
|
+
props.hasNextPage && (react_1.default.createElement("a", { rel: "next", onClick: props.handleNextPage, href: props.buildPagePath(props.actualCurrentPage + 1) }, "Next"))));
|
|
12
|
+
};
|
|
13
|
+
exports.ExampleResultPaginationNextPrev = ExampleResultPaginationNextPrev;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultPaginationNumberedProps } from "../../components";
|
|
3
|
+
export declare type ExampleResultPaginationNumberedProps = Parameters<Required<ResultPaginationNumberedProps>["render"]>[0];
|
|
4
|
+
export declare const ExampleResultPaginationNumbered: React.FC<ExampleResultPaginationNumberedProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.ExampleResultPaginationNumbered = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleResultPaginationNumbered = (props) => {
|
|
9
|
+
return (react_1.default.createElement("nav", null,
|
|
10
|
+
props.currentPage > 0 && (react_1.default.createElement("a", { rel: "prev", href: props.buildPagePath(props.currentPage), onClick: (event) => props.handlePageChange(props.currentPage - 1, event) }, "Prev")),
|
|
11
|
+
!props.pagesToShow.includes(0) && (react_1.default.createElement("a", { href: props.buildPagePath(1), onClick: (event) => props.handlePageChange(0, event), rel: 0 === props.currentPage - 1 ? `prev` : undefined }, "1")),
|
|
12
|
+
!props.pagesToShow.includes(1) && react_1.default.createElement("span", null, "..."),
|
|
13
|
+
props.pagesToShow.map((page) => page === props.currentPage ? (react_1.default.createElement("span", { key: page + 1 }, page + 1)) : (react_1.default.createElement("a", { key: page + 1, href: props.buildPagePath(page + 1), onClick: (event) => props.handlePageChange(page, event), rel: page === props.currentPage + 1
|
|
14
|
+
? `next`
|
|
15
|
+
: page === props.currentPage - 1
|
|
16
|
+
? `prev`
|
|
17
|
+
: undefined }, page + 1))),
|
|
18
|
+
!props.pagesToShow.includes(props.totalPages - 2) && react_1.default.createElement("span", null, "..."),
|
|
19
|
+
!props.pagesToShow.includes(props.totalPages - 1) && (react_1.default.createElement("a", { href: props.buildPagePath(props.totalPages), onClick: (event) => props.handlePageChange(props.totalPages - 1, event), rel: props.totalPages - 1 === props.currentPage + 1
|
|
20
|
+
? `next`
|
|
21
|
+
: props.totalPages - 1 === props.currentPage - 1
|
|
22
|
+
? `prev`
|
|
23
|
+
: undefined }, props.totalPages)),
|
|
24
|
+
props.currentPage + 1 < props.totalPages && (react_1.default.createElement("a", { rel: "next", href: props.buildPagePath(props.currentPage + 2), onClick: (event) => props.handlePageChange(props.currentPage + 1, event) }, "Next"))));
|
|
25
|
+
};
|
|
26
|
+
exports.ExampleResultPaginationNumbered = ExampleResultPaginationNumbered;
|
|
@@ -0,0 +1,12 @@
|
|
|
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.ExampleSortby = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ExampleSortby = (props) => {
|
|
9
|
+
var _a;
|
|
10
|
+
return (react_1.default.createElement("select", { value: (_a = props.sortOption) === null || _a === void 0 ? void 0 : _a.handle, onChange: (event) => props.setSortOption(event.target.value) }, props.sortOptions.map((sortOption) => (react_1.default.createElement("option", { key: sortOption.handle, value: sortOption.handle }, sortOption.name)))));
|
|
11
|
+
};
|
|
12
|
+
exports.ExampleSortby = ExampleSortby;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./ExampleFilterList";
|
|
2
|
+
export * from "./ExampleFilterRange";
|
|
3
|
+
export * from "./ExampleFilterSlider";
|
|
4
|
+
export * from "./ExampleFilterStack";
|
|
5
|
+
export * from "./ExampleResultCardCallout";
|
|
6
|
+
export * from "./ExampleResultCardProduct";
|
|
7
|
+
export * from "./ExampleResultPaginationNumbered";
|
|
8
|
+
export * from "./ExampleResultPaginationLoadMore";
|
|
9
|
+
export * from "./ExampleResultPaginationNextPrev";
|
|
10
|
+
export * from "./ExampleSortby";
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./ExampleFilterList"), exports);
|
|
14
|
+
__exportStar(require("./ExampleFilterRange"), exports);
|
|
15
|
+
__exportStar(require("./ExampleFilterSlider"), exports);
|
|
16
|
+
__exportStar(require("./ExampleFilterStack"), exports);
|
|
17
|
+
__exportStar(require("./ExampleResultCardCallout"), exports);
|
|
18
|
+
__exportStar(require("./ExampleResultCardProduct"), exports);
|
|
19
|
+
__exportStar(require("./ExampleResultPaginationNumbered"), exports);
|
|
20
|
+
__exportStar(require("./ExampleResultPaginationLoadMore"), exports);
|
|
21
|
+
__exportStar(require("./ExampleResultPaginationNextPrev"), exports);
|
|
22
|
+
__exportStar(require("./ExampleSortby"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ConfigFilterOption } from "../../types";
|
|
3
|
+
import { useFilterListProps, useReactiveFilterRangeProps, useReactiveFilterSliderProps } from "../../hooks";
|
|
4
|
+
export declare type FilterProps = {
|
|
5
|
+
/** The filter option being rendered */
|
|
6
|
+
filter: ConfigFilterOption;
|
|
7
|
+
/** Render method for List filters */
|
|
8
|
+
renderFilterList?: React.FC<Omit<FilterProps, "renderFilterList"> & {
|
|
9
|
+
filterListProps: ReturnType<typeof useFilterListProps>;
|
|
10
|
+
}>;
|
|
11
|
+
/** Render method for Range filters */
|
|
12
|
+
renderFilterRange?: React.FC<Omit<FilterProps, "renderFilterRange"> & {
|
|
13
|
+
reactiveFilterRangeProps: ReturnType<typeof useReactiveFilterRangeProps>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Render method for Slider filters */
|
|
16
|
+
renderFilterSlider?: React.FC<Omit<FilterProps, "renderFilterSlider"> & {
|
|
17
|
+
reactiveFilterSliderProps: ReturnType<typeof useReactiveFilterSliderProps>;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export declare const Filter: React.FC<FilterProps>;
|
|
@@ -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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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("./Filter"), exports);
|
|
14
|
+
__exportStar(require("./FilterStack"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type ReactifySearchBaseProps = {
|
|
3
|
+
/** The search area the provider will be used in */
|
|
4
|
+
mode: "search" | "collection" | "instant-search";
|
|
5
|
+
/** Shopify store domain used to resolve the site configuration */
|
|
6
|
+
shopifyPermanentDomain: string;
|
|
7
|
+
/** Specific filter group handle, used to override automated logic */
|
|
8
|
+
filterStackHandle?: string;
|
|
9
|
+
/** Callback function for redirects, suitable for headless sites to avoid full page refresh */
|
|
10
|
+
onRedirect?: (type: "redirect" | "search", url: string) => void;
|
|
11
|
+
/** Render method to display a component when the config is loading */
|
|
12
|
+
renderBooting?: () => JSX.Element | null;
|
|
13
|
+
/** Advanced usage: Allows you to wrap the ReactifySearchBase in your own ReactiveBase component */
|
|
14
|
+
noReactiveBase?: boolean;
|
|
15
|
+
/** Advanced usage: Array of additional component IDs managed outside of Reactify Search */
|
|
16
|
+
additionalComponentHandles?: string[];
|
|
17
|
+
/** Advanced usage: Override the default Elasticsearch index */
|
|
18
|
+
index?: string;
|
|
19
|
+
/** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */
|
|
20
|
+
configId?: string;
|
|
21
|
+
/** Advanced usage: Override the default Elasticsearch credentials */
|
|
22
|
+
credentials?: {
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
endpoint: string;
|
|
26
|
+
};
|
|
27
|
+
/** Advanced usage: Override the default ReactiveBase theme */
|
|
28
|
+
theme?: Record<string, unknown>;
|
|
29
|
+
} & ({
|
|
30
|
+
mode: "search";
|
|
31
|
+
} | {
|
|
32
|
+
mode: "collection";
|
|
33
|
+
/** Collection object that includes the handle, used to find curations */
|
|
34
|
+
collection: {
|
|
35
|
+
id: number;
|
|
36
|
+
title: string;
|
|
37
|
+
handle: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
mode: "instant-search";
|
|
41
|
+
});
|
|
42
|
+
export declare const ReactifySearchBase: React.FC<ReactifySearchBaseProps>;
|