@usereactify/search 5.26.1 → 5.26.5
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 +22 -1
- package/dist/package.json +10 -11
- package/dist/src/components/ClearAll/ClearAll.js +31 -3
- package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterRange.js +3 -1
- package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterSlider.js +24 -7
- package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
- package/dist/src/components/Example/ExampleFilters.d.ts +1 -3
- package/dist/src/components/Example/ExampleFilters.js +8 -4
- package/dist/src/components/Example/ExampleFilters.js.map +1 -1
- package/dist/src/components/Example/ExampleFiltersSelected.js +24 -10
- package/dist/src/components/Example/ExampleFiltersSelected.js.map +1 -1
- package/dist/src/components/Example/ExampleHookUseResults.d.ts +2 -0
- package/dist/src/components/Example/ExampleHookUseResults.js +25 -0
- package/dist/src/components/Example/ExampleHookUseResults.js.map +1 -0
- package/dist/src/components/Example/ExampleSuggestions.d.ts +4 -0
- package/dist/src/components/Example/ExampleSuggestions.js +16 -0
- package/dist/src/components/Example/ExampleSuggestions.js.map +1 -0
- package/dist/src/components/Example/index.d.ts +3 -0
- package/dist/src/components/Example/index.js +3 -0
- package/dist/src/components/Example/index.js.map +1 -1
- package/dist/src/components/Filter/Filter.d.ts +2 -2
- package/dist/src/components/Filter/Filter.js +91 -18
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/components/Filter/Filters.d.ts +17 -3
- package/dist/src/components/Filter/Filters.js +1 -2
- package/dist/src/components/Filter/Filters.js.map +1 -1
- package/dist/src/components/Filter/FiltersSelected.d.ts +7 -2
- package/dist/src/components/Filter/FiltersSelected.js +45 -2
- package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +5 -7
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +42 -24
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
- package/dist/src/components/Result/Results.js +24 -9
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/components/Sensor/SensorCollection.js +4 -0
- package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +17 -7
- package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
- package/dist/src/components/Sensor/SensorPublished.js +13 -6
- package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
- package/dist/src/components/Sensor/SensorSearchTerm.js +92 -66
- package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
- package/dist/src/components/Sensor/SensorSort.js +75 -65
- package/dist/src/components/Sensor/SensorSort.js.map +1 -1
- package/dist/src/components/Sensor/Sensors.js +1 -7
- package/dist/src/components/Sensor/Sensors.js.map +1 -1
- package/dist/src/components/Sensor/index.d.ts +0 -1
- package/dist/src/components/Sensor/index.js +0 -2
- package/dist/src/components/Sensor/index.js.map +1 -1
- package/dist/src/components/Suggestions/Suggestions.d.ts +12 -0
- package/dist/src/components/Suggestions/Suggestions.js +44 -0
- package/dist/src/components/Suggestions/Suggestions.js.map +1 -0
- package/dist/src/components/Suggestions/index.d.ts +1 -0
- package/dist/src/components/Suggestions/index.js +14 -0
- package/dist/src/components/Suggestions/index.js.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/hooks/index.d.ts +3 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/react-slider/useReactSliderProps.d.ts +4 -0
- package/dist/src/hooks/react-slider/useReactSliderProps.js +28 -0
- package/dist/src/hooks/react-slider/useReactSliderProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +2 -7
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +10 -3
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +3 -5
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +3 -5
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +1 -3
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.d.ts +2 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +8 -3
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
- package/dist/src/hooks/useAnalytics.js +23 -3
- package/dist/src/hooks/useAnalytics.js.map +1 -1
- package/dist/src/hooks/useConfig.js +9 -27
- package/dist/src/hooks/useConfig.js.map +1 -1
- package/dist/src/hooks/useCuration.js +12 -1
- package/dist/src/hooks/useCuration.js.map +1 -1
- package/dist/src/hooks/useFilterListProps.js +15 -2
- package/dist/src/hooks/useFilterListProps.js.map +1 -1
- package/dist/src/hooks/useFilterRangeProps.d.ts +1 -10
- package/dist/src/hooks/useFilterRangeProps.js +36 -47
- package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/useFilterSliderProps.d.ts +6 -8
- package/dist/src/hooks/useFilterSliderProps.js +31 -10
- package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/useFilters.js +0 -3
- package/dist/src/hooks/useFilters.js.map +1 -1
- package/dist/src/hooks/useFlags.d.ts +21 -0
- package/dist/src/hooks/useFlags.js +49 -0
- package/dist/src/hooks/useFlags.js.map +1 -0
- package/dist/src/hooks/useIndices.d.ts +5 -0
- package/dist/src/hooks/useIndices.js +49 -0
- package/dist/src/hooks/useIndices.js.map +1 -0
- package/dist/src/hooks/useReactifySearchContext.d.ts +19 -11
- package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
- package/dist/src/hooks/useResults.d.ts +21 -0
- package/dist/src/hooks/useResults.js +19 -0
- package/dist/src/hooks/useResults.js.map +1 -0
- package/dist/src/hooks/useSearch.js +4 -2
- package/dist/src/hooks/useSearch.js.map +1 -1
- package/dist/src/hooks/useSortBy.js +5 -1
- package/dist/src/hooks/useSortBy.js.map +1 -1
- package/dist/src/types/config.d.ts +11 -5
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/elastic.d.ts +53 -17
- package/dist/src/types/elastic.js.map +1 -1
- package/dist/src/types/firestore.d.ts +3 -0
- package/dist/src/types/firestore.js.map +1 -1
- package/dist/src/types/reactivesearch.d.ts +1 -1
- package/dist/src/types/reactivesearch.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/components/Sensor/SensorSortScore.d.ts +0 -2
- package/dist/src/components/Sensor/SensorSortScore.js +0 -13
- package/dist/src/components/Sensor/SensorSortScore.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +0 -27
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +0 -71
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +0 -1
- package/dist/src/hooks/usePaginationLoadMore.d.ts +0 -15
- package/dist/src/hooks/usePaginationLoadMore.js +0 -38
- package/dist/src/hooks/usePaginationLoadMore.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
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.26.
|
|
5
|
+
### [5.26.5](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.26.4...release-v5.26.5) (2023-08-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* bump lockfile ([949edd7](https://bitbucket.org/usereactify/reactify-search-ui/commit/949edd710fa1bfba38f2fbe96091da74589af9bc))
|
|
11
|
+
|
|
12
|
+
### [5.26.4](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.26.3...release-v5.26.4) (2023-08-09)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* add inventory sensor to instant search, disable callouts for instant search ([1cbf550](https://bitbucket.org/usereactify/reactify-search-ui/commit/1cbf550b83b59aea8df2f081e3027403b8451a6c))
|
|
18
|
+
|
|
19
|
+
### [5.26.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.26.2...release-v5.26.3) (2023-08-09)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* use filter group when mode is instant-search ([0d5cb86](https://bitbucket.org/usereactify/reactify-search-ui/commit/0d5cb86766257387060b4c7515b660908464906f))
|
|
25
|
+
|
|
26
|
+
### [5.26.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.26.1...release-v5.26.2) (2023-08-09)
|
|
6
27
|
|
|
7
28
|
|
|
8
29
|
### Bug Fixes
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usereactify/search",
|
|
3
3
|
"description": "React UI library for Reactify Search",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.26.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"README.md",
|
|
11
11
|
"CHANGELOG.md"
|
|
12
12
|
],
|
|
13
|
+
"packageManager": "pnpm@7.9.5",
|
|
13
14
|
"scripts": {
|
|
14
15
|
"watch": "tsc --watch",
|
|
15
16
|
"release": "standard-version --tag-prefix release-v",
|
|
@@ -17,16 +18,11 @@
|
|
|
17
18
|
"prebuild": "rimraf dist",
|
|
18
19
|
"build": "tsc",
|
|
19
20
|
"prettier": "prettier --write .",
|
|
20
|
-
"
|
|
21
|
+
"start": "start-storybook -p 6006",
|
|
21
22
|
"sentry:release:new": "sentry-cli releases new $npm_package_version",
|
|
22
23
|
"sentry:release:upload": "sentry-cli releases files $npm_package_version upload-sourcemaps dist",
|
|
23
|
-
"sentry:release:finalize": "sentry-cli releases finalize $npm_package_version"
|
|
24
|
-
|
|
25
|
-
"husky": {
|
|
26
|
-
"hooks": {
|
|
27
|
-
"pre-commit": "pretty-quick --staged",
|
|
28
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
29
|
-
}
|
|
24
|
+
"sentry:release:finalize": "sentry-cli releases finalize $npm_package_version",
|
|
25
|
+
"prepare": "husky install"
|
|
30
26
|
},
|
|
31
27
|
"commitlint": {
|
|
32
28
|
"extends": [
|
|
@@ -40,7 +36,9 @@
|
|
|
40
36
|
"axios": "0.26.1",
|
|
41
37
|
"currency.js": "2.0.4",
|
|
42
38
|
"debug": "4.3.2",
|
|
43
|
-
"
|
|
39
|
+
"ga-gtag": "1.1.5",
|
|
40
|
+
"react-intersection-observer": "9.1.0",
|
|
41
|
+
"react-slider": "2.0.4"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
44
|
"@appbaseio/reactivesearch": "3.14.0",
|
|
@@ -61,8 +59,9 @@
|
|
|
61
59
|
"@types/debug": "4.1.7",
|
|
62
60
|
"@types/react": "18.0.19",
|
|
63
61
|
"@types/react-dom": "18.0.6",
|
|
62
|
+
"@types/react-slider": "1.3.1",
|
|
64
63
|
"babel-loader": "8.2.2",
|
|
65
|
-
"husky": "
|
|
64
|
+
"husky": "^8.0.0",
|
|
66
65
|
"prettier": "2.4.1",
|
|
67
66
|
"pretty-quick": "3.1.1",
|
|
68
67
|
"react": "18.2.0",
|
|
@@ -7,11 +7,13 @@ exports.ClearAll = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const SelectedFilters_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/SelectedFilters"));
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
10
11
|
const ClearAll = (props) => {
|
|
11
12
|
var _a;
|
|
12
13
|
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleClearAll;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const filtersHook = (0, hooks_1.useFilters)();
|
|
15
|
+
return (react_1.default.createElement(SelectedFilters_1.default, { render: (renderProps) => {
|
|
16
|
+
const selectedFilters = Object.values(renderProps.selectedValues)
|
|
15
17
|
.map((value) => value)
|
|
16
18
|
.filter((item) => {
|
|
17
19
|
var _a, _b;
|
|
@@ -19,10 +21,36 @@ const ClearAll = (props) => {
|
|
|
19
21
|
(item === null || item === void 0 ? void 0 : item.showFilter) &&
|
|
20
22
|
(!!((_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.label));
|
|
21
23
|
});
|
|
24
|
+
const handleClearAll = () => {
|
|
25
|
+
var _a;
|
|
26
|
+
for (const filter of (_a = filtersHook.filters) !== null && _a !== void 0 ? _a : []) {
|
|
27
|
+
if (filter.displayType === "slider") {
|
|
28
|
+
const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
|
|
29
|
+
detail: {
|
|
30
|
+
handle: filter.handle,
|
|
31
|
+
value: [],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
window.dispatchEvent(event);
|
|
35
|
+
}
|
|
36
|
+
if (filter.displayType === "multi") {
|
|
37
|
+
if (filter.displayView === "range") {
|
|
38
|
+
const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
|
|
39
|
+
detail: {
|
|
40
|
+
handle: filter.handle,
|
|
41
|
+
value: [],
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
window.dispatchEvent(event);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
renderProps.clearValues();
|
|
49
|
+
};
|
|
22
50
|
if (!selectedFilters.length) {
|
|
23
51
|
return null;
|
|
24
52
|
}
|
|
25
|
-
return react_1.default.createElement(RenderComponent, { clearAll:
|
|
53
|
+
return react_1.default.createElement(RenderComponent, { clearAll: handleClearAll });
|
|
26
54
|
} }));
|
|
27
55
|
};
|
|
28
56
|
exports.ClearAll = ClearAll;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAAmD;
|
|
1
|
+
{"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAAmD;AACnD,uCAAyC;AASlC,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;;IACzD,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAe,CAAC;IAExD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;YACtB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC;iBAC9D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;iBACrB,MAAM,CACL,CAAC,IAAS,EAAE,EAAE;;gBACZ,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD,CAAC;YAEJ,MAAM,cAAc,GAAG,GAAG,EAAE;;gBAC1B,KAAK,MAAM,MAAM,IAAI,MAAA,WAAW,CAAC,OAAO,mCAAI,EAAE,EAAE;oBAC9C,IAAI,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;wBACnC,MAAM,KAAK,GAAG,IAAI,WAAW,CAG1B,8BAA8B,MAAM,CAAC,MAAM,SAAS,EAAE;4BACvD,MAAM,EAAE;gCACN,MAAM,EAAE,MAAM,CAAC,MAAM;gCACrB,KAAK,EAAE,EAAE;6BACV;yBACF,CAAC,CAAC;wBACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;qBAC7B;oBACD,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,EAAE;wBAClC,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,EAAE;4BAClC,MAAM,KAAK,GAAG,IAAI,WAAW,CAG1B,8BAA8B,MAAM,CAAC,MAAM,SAAS,EAAE;gCACvD,MAAM,EAAE;oCACN,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,KAAK,EAAE,EAAE;iCACV;6BACF,CAAC,CAAC;4BACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;yBAC7B;qBACF;iBACF;gBACD,WAAW,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,cAAc,GAAI,CAAC;QACvD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,QAAQ,YAyDnB","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@appbaseio/reactivesearch/lib/components/basic/SelectedFilters\";\n\nimport { ExampleClearAll } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const RenderComponent = props.render ?? ExampleClearAll;\n\n const filtersHook = useFilters();\n\n return (\n <SelectedFilters\n render={(renderProps) => {\n const selectedFilters = Object.values(renderProps.selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n const handleClearAll = () => {\n for (const filter of filtersHook.filters ?? []) {\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n }\n }\n renderProps.clearValues();\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={handleClearAll} />;\n }}\n />\n );\n};\n"]}
|
|
@@ -10,7 +10,9 @@ const ExampleFilterRange = (props) => {
|
|
|
10
10
|
react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
|
|
11
11
|
react_1.default.createElement("ul", { className: "rs__filter__list" }, props.filterRangeProps.options.map((option) => (react_1.default.createElement("li", { key: option.key, className: "rs__filter__list-item" },
|
|
12
12
|
react_1.default.createElement("label", { className: "rs__filter__list-item-label" },
|
|
13
|
-
react_1.default.createElement("input", { className: "rs__filter__list-item-input", value: option.key, type: "
|
|
13
|
+
react_1.default.createElement("input", { className: "rs__filter__list-item-input", value: option.key, type: "multi" === props.filterRangeProps.filter.displayType
|
|
14
|
+
? "checkbox"
|
|
15
|
+
: "radio", checked: option.checked, onChange: (event) => props.filterRangeProps.handleChange(event.target.value) }),
|
|
14
16
|
react_1.default.createElement("span", { className: "rs__filter__list-item-key" }, option.label))))))));
|
|
15
17
|
};
|
|
16
18
|
exports.ExampleFilterRange = ExampleFilterRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC9C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,
|
|
1
|
+
{"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC9C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,EACF,OAAO,KAAK,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW;wBACnD,CAAC,CAAC,UAAU;wBACZ,CAAC,CAAC,OAAO,EAEb,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAEzD;gBACF,wCAAM,SAAS,EAAC,2BAA2B,IAAE,MAAM,CAAC,KAAK,CAAQ,CAC3D,CACL,CACN,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,kBAAkB,sBA8B7B","sourcesContent":["import React from \"react\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterRangeProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterRange\"]>\n>;\n\nexport const ExampleFilterRange: React.FC<ExampleFilterRangeProps> = (\n props\n) => {\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <ul className=\"rs__filter__list\">\n {props.filterRangeProps.options.map((option) => (\n <li key={option.key} className=\"rs__filter__list-item\">\n <label className=\"rs__filter__list-item-label\">\n <input\n className=\"rs__filter__list-item-input\"\n value={option.key}\n type={\n \"multi\" === props.filterRangeProps.filter.displayType\n ? \"checkbox\"\n : \"radio\"\n }\n checked={option.checked}\n onChange={(event) =>\n props.filterRangeProps.handleChange(event.target.value)\n }\n />\n <span className=\"rs__filter__list-item-key\">{option.label}</span>\n </label>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"]}
|
|
@@ -5,16 +5,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ExampleFilterSlider = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const
|
|
9
|
-
const hooks_1 = require("../../hooks");
|
|
8
|
+
const react_slider_1 = __importDefault(require("react-slider"));
|
|
10
9
|
const ExampleFilterSlider = (props) => {
|
|
11
|
-
const
|
|
10
|
+
const trackStyleEnds = {
|
|
11
|
+
top: "10px",
|
|
12
|
+
height: "8px",
|
|
13
|
+
background: "rgb(239, 239, 239)",
|
|
14
|
+
border: "1px solid rgb(179, 179, 179)",
|
|
15
|
+
borderRadius: "4px",
|
|
16
|
+
};
|
|
17
|
+
const trackStyleMiddle = Object.assign(Object.assign({}, trackStyleEnds), { background: "rgb(2, 117, 255)", border: "1px solid rgb(74, 117, 187)" });
|
|
12
18
|
return (react_1.default.createElement("div", { className: "rs__filter" },
|
|
13
19
|
react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
|
|
14
|
-
react_1.default.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
react_1.default.createElement("div", { className: "rs__filter__slider", style: {
|
|
21
|
+
maxWidth: "300px",
|
|
22
|
+
height: "26px",
|
|
23
|
+
margin: "auto",
|
|
24
|
+
top: "6px",
|
|
25
|
+
} },
|
|
26
|
+
react_1.default.createElement(react_slider_1.default, Object.assign({ thumbClassName: "rs__filter__slider__thumb" }, props.filterSliderProps.reactSliderProps, { renderTrack: (props, state) => (react_1.default.createElement("div", Object.assign({}, props, { style: Object.assign(Object.assign({}, (state.index === 1 ? trackStyleMiddle : trackStyleEnds)), props.style) }))), renderThumb: (renderProps, state) => (react_1.default.createElement("div", Object.assign({}, renderProps, { style: Object.assign({ cursor: "grab", background: "rgb(2, 117, 255)", top: "6px", width: "16px", height: "16px", borderRadius: "100%", outline: "none" }, renderProps.style) }),
|
|
27
|
+
react_1.default.createElement("span", { style: {
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: "-24px",
|
|
30
|
+
left: "-50%",
|
|
31
|
+
} },
|
|
32
|
+
props.filter.displaySliderPrefix,
|
|
33
|
+
state.valueNow,
|
|
34
|
+
props.filter.displaySliderSuffix))) })))));
|
|
18
35
|
};
|
|
19
36
|
exports.ExampleFilterSlider = ExampleFilterSlider;
|
|
20
37
|
//# sourceMappingURL=ExampleFilterSlider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gEAAuC;AAOhC,MAAM,mBAAmB,GAAuC,CACrE,KAAK,EACL,EAAE;IACF,MAAM,cAAc,GAAG;QACrB,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,oBAAoB;QAChC,MAAM,EAAE,8BAA8B;QACtC,YAAY,EAAE,KAAK;KACpB,CAAC;IACF,MAAM,gBAAgB,mCACjB,cAAc,KACjB,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,6BAA6B,GACtC,CAAC;IAEF,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,uCACE,SAAS,EAAC,oBAAoB,EAC9B,KAAK,EAAE;gBACL,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,KAAK;aACX;YAED,8BAAC,sBAAW,kBACV,cAAc,EAAC,2BAA2B,IACtC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,IAC5C,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7B,uDACM,KAAK,IACT,KAAK,kCACA,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC,GACvD,KAAK,CAAC,KAAK,KAEX,CACR,EACD,WAAW,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CACnC,uDACM,WAAW,IACf,KAAK,kBACH,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,EAC9B,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,IACZ,WAAW,CAAC,KAAK;oBAGtB,wCACE,KAAK,EAAE;4BACL,QAAQ,EAAE,UAAU;4BACpB,GAAG,EAAE,OAAO;4BACZ,IAAI,EAAE,MAAM;yBACb;wBAEA,KAAK,CAAC,MAAM,CAAC,mBAAmB;wBAChC,KAAK,CAAC,QAAQ;wBACd,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAC5B,CACH,CACP,IACD,CACE,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAvEW,QAAA,mBAAmB,uBAuE9B","sourcesContent":["import React from \"react\";\nimport ReactSlider from \"react-slider\";\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterSliderProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterSlider\"]>\n>;\n\nexport const ExampleFilterSlider: React.FC<ExampleFilterSliderProps> = (\n props\n) => {\n const trackStyleEnds = {\n top: \"10px\",\n height: \"8px\",\n background: \"rgb(239, 239, 239)\",\n border: \"1px solid rgb(179, 179, 179)\",\n borderRadius: \"4px\",\n };\n const trackStyleMiddle = {\n ...trackStyleEnds,\n background: \"rgb(2, 117, 255)\",\n border: \"1px solid rgb(74, 117, 187)\",\n };\n\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <div\n className=\"rs__filter__slider\"\n style={{\n maxWidth: \"300px\",\n height: \"26px\",\n margin: \"auto\",\n top: \"6px\",\n }}\n >\n <ReactSlider\n thumbClassName=\"rs__filter__slider__thumb\"\n {...props.filterSliderProps.reactSliderProps}\n renderTrack={(props, state) => (\n <div\n {...props}\n style={{\n ...(state.index === 1 ? trackStyleMiddle : trackStyleEnds),\n ...props.style,\n }}\n ></div>\n )}\n renderThumb={(renderProps, state) => (\n <div\n {...renderProps}\n style={{\n cursor: \"grab\",\n background: \"rgb(2, 117, 255)\",\n top: \"6px\",\n width: \"16px\",\n height: \"16px\",\n borderRadius: \"100%\",\n outline: \"none\",\n ...renderProps.style,\n }}\n >\n <span\n style={{\n position: \"absolute\",\n top: \"-24px\",\n left: \"-50%\",\n }}\n >\n {props.filter.displaySliderPrefix}\n {state.valueNow}\n {props.filter.displaySliderSuffix}\n </span>\n </div>\n )}\n />\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
export declare type ExampleFiltersProps = React.ComponentProps<NonNullable<FiltersProps["render"]>>;
|
|
4
|
-
export declare const ExampleFilters: React.FC<ExampleFiltersProps>;
|
|
2
|
+
export declare const ExampleFilters: React.FC;
|
|
@@ -5,10 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ExampleFilters = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const Filter_1 = require("../Filter");
|
|
9
|
+
const ExampleFilterList_1 = require("./ExampleFilterList");
|
|
10
|
+
const ExampleFilterRange_1 = require("./ExampleFilterRange");
|
|
11
|
+
const ExampleFilterSlider_1 = require("./ExampleFilterSlider");
|
|
12
|
+
const ExampleFilters = () => {
|
|
13
|
+
return (react_1.default.createElement("div", null,
|
|
14
|
+
react_1.default.createElement("h3", null, "Filters"),
|
|
15
|
+
react_1.default.createElement(Filter_1.Filters, { renderFilterList: ExampleFilterList_1.ExampleFilterList, renderFilterRange: ExampleFilterRange_1.ExampleFilterRange, renderFilterSlider: ExampleFilterSlider_1.ExampleFilterSlider })));
|
|
12
16
|
};
|
|
13
17
|
exports.ExampleFilters = ExampleFilters;
|
|
14
18
|
//# sourceMappingURL=ExampleFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFilters.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilters.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"ExampleFilters.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilters.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sCAAoC;AAEpC,2DAAwD;AACxD,6DAA0D;AAC1D,+DAA4D;AAErD,MAAM,cAAc,GAAa,GAAG,EAAE;IAC3C,OAAO,CACL;QACE,0CAAK,SAAS,CAAM;QACpB,8BAAC,gBAAO,IACN,gBAAgB,EAAE,qCAAiB,EACnC,iBAAiB,EAAE,uCAAkB,EACrC,kBAAkB,EAAE,yCAAmB,GACvC,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,cAAc,kBAWzB","sourcesContent":["import React from \"react\";\nimport { Filters } from \"../Filter\";\n\nimport { ExampleFilterList } from \"./ExampleFilterList\";\nimport { ExampleFilterRange } from \"./ExampleFilterRange\";\nimport { ExampleFilterSlider } from \"./ExampleFilterSlider\";\n\nexport const ExampleFilters: React.FC = () => {\n return (\n <div>\n <h3>{\"Filters\"}</h3>\n <Filters\n renderFilterList={ExampleFilterList}\n renderFilterRange={ExampleFilterRange}\n renderFilterSlider={ExampleFilterSlider}\n />\n </div>\n );\n};\n"]}
|
|
@@ -5,19 +5,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ExampleFiltersSelected = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
8
9
|
const ExampleFiltersSelected = (props) => {
|
|
9
10
|
return (react_1.default.createElement("div", { className: "rs__filters-selected" },
|
|
10
11
|
react_1.default.createElement("h3", { className: "rs__filters-selected__name" }, "Filters Selected"),
|
|
11
|
-
react_1.default.createElement("ul", { className: "rs__filters-selected__list" }, props.selectedFilters.map((selectedFilter) => (react_1.default.createElement(
|
|
12
|
-
react_1.default.createElement("label", { className: "rs__filters-selected__list-item-label", onClick: () => props.handleRemove(selectedFilter.key) },
|
|
13
|
-
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-label" },
|
|
14
|
-
selectedFilter.label,
|
|
15
|
-
": "),
|
|
16
|
-
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, Array.isArray(selectedFilter.value)
|
|
17
|
-
? selectedFilter.value.join(", ")
|
|
18
|
-
: typeof selectedFilter.value !== "string"
|
|
19
|
-
? `${selectedFilter.value.start}-${selectedFilter.value.end}`
|
|
20
|
-
: selectedFilter.value))))))));
|
|
12
|
+
react_1.default.createElement("ul", { className: "rs__filters-selected__list" }, props.selectedFilters.map((selectedFilter) => (react_1.default.createElement(ExampleFiltersSelectedItem, { selectedFilter: selectedFilter, handleRemove: props.handleRemove }))))));
|
|
21
13
|
};
|
|
22
14
|
exports.ExampleFiltersSelected = ExampleFiltersSelected;
|
|
15
|
+
const ExampleFiltersSelectedItem = (props) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const filtersHook = (0, hooks_1.useFilters)();
|
|
18
|
+
const filter = (_a = filtersHook.filters) === null || _a === void 0 ? void 0 : _a.find((filter) => filter.handle === props.selectedFilter.key);
|
|
19
|
+
return (react_1.default.createElement("li", { key: props.selectedFilter.key, className: "rs__filters-selected__list-item" },
|
|
20
|
+
react_1.default.createElement("label", { className: "rs__filters-selected__list-item-label" },
|
|
21
|
+
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-label", onClick: () => props.handleRemove(props.selectedFilter.key) },
|
|
22
|
+
props.selectedFilter.label,
|
|
23
|
+
": "),
|
|
24
|
+
(filter === null || filter === void 0 ? void 0 : filter.displayType) === "single" && filter.displayView === "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" },
|
|
25
|
+
react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [
|
|
26
|
+
props.selectedFilter.value.label,
|
|
27
|
+
]) }, props.selectedFilter.value.label))),
|
|
28
|
+
(filter === null || filter === void 0 ? void 0 : filter.displayType) === "single" && filter.displayView !== "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" },
|
|
29
|
+
react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [
|
|
30
|
+
props.selectedFilter.value,
|
|
31
|
+
]) }, props.selectedFilter.value))),
|
|
32
|
+
(filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView === "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [value.label]) }, value.label))))),
|
|
33
|
+
(filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView !== "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [value]) }, value))))),
|
|
34
|
+
(filter === null || filter === void 0 ? void 0 : filter.displayType) === "slider" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" },
|
|
35
|
+
react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [""]) }, `${filter.displaySliderPrefix}${props.selectedFilter.value[0]} to ${filter.displaySliderPrefix}${props.selectedFilter.value[1]}`))))));
|
|
36
|
+
};
|
|
23
37
|
//# sourceMappingURL=ExampleFiltersSelected.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from \"react\";\n\nimport { FiltersSelectedProps } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ExampleFiltersSelectedProps = React.ComponentProps<\n NonNullable<FiltersSelectedProps[\"render\"]>\n>;\n\nexport const ExampleFiltersSelected: React.FC<ExampleFiltersSelectedProps> = (\n props\n) => {\n return (\n <div className=\"rs__filters-selected\">\n <h3 className=\"rs__filters-selected__name\">{\"Filters Selected\"}</h3>\n <ul className=\"rs__filters-selected__list\">\n {props.selectedFilters.map((selectedFilter) => (\n <ExampleFiltersSelectedItem\n selectedFilter={selectedFilter}\n handleRemove={props.handleRemove}\n />\n ))}\n </ul>\n </div>\n );\n};\n\ntype ExampleFiltersSelectedItemProps = {\n selectedFilter: ExampleFiltersSelectedProps[\"selectedFilters\"][number];\n handleRemove: ExampleFiltersSelectedProps[\"handleRemove\"];\n};\n\nconst ExampleFiltersSelectedItem: React.FC<ExampleFiltersSelectedItemProps> = (\n props\n) => {\n const filtersHook = useFilters();\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === props.selectedFilter.key\n );\n\n return (\n <li\n key={props.selectedFilter.key}\n className=\"rs__filters-selected__list-item\"\n >\n <label className=\"rs__filters-selected__list-item-label\">\n <span\n className=\"rs__filters-selected__list-item-label\"\n onClick={() => props.handleRemove(props.selectedFilter.key)}\n >\n {props.selectedFilter.label}\n {\": \"}\n </span>\n\n {filter?.displayType === \"single\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n (props.selectedFilter.value as { label: string }).label,\n ])\n }\n >\n {(props.selectedFilter.value as { label: string }).label}\n </span>\n </span>\n )}\n {filter?.displayType === \"single\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n props.selectedFilter.value as string,\n ])\n }\n >\n {props.selectedFilter.value as string}\n </span>\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<{ label: string }>).map(\n (value) => (\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value.label])\n }\n >\n {value.label}\n </span>\n )\n )}\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<string>).map((value) => (\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value])\n }\n >\n {value}\n </span>\n ))}\n </span>\n )}\n {filter?.displayType === \"slider\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() => props.handleRemove(props.selectedFilter.key, [\"\"])}\n >\n {`${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[0]\n } to ${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[1]\n }`}\n </span>\n </span>\n )}\n </label>\n </li>\n );\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
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.ExampleHookUseResults = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const types_1 = require("../../types");
|
|
10
|
+
const ExampleHookUseResults = () => {
|
|
11
|
+
const resultsHook = (0, hooks_1.useResults)();
|
|
12
|
+
const collections = resultsHook.results
|
|
13
|
+
.map((result) => {
|
|
14
|
+
if (result.type === types_1.ElasticDocumentType.Product) {
|
|
15
|
+
return result.collections;
|
|
16
|
+
}
|
|
17
|
+
return [];
|
|
18
|
+
})
|
|
19
|
+
.flat()
|
|
20
|
+
.filter((item, index, self) => self.findIndex((itemNested) => (itemNested === null || itemNested === void 0 ? void 0 : itemNested.id) === (item === null || item === void 0 ? void 0 : item.id)) === index);
|
|
21
|
+
return (react_1.default.createElement("ul", null, collections.map((collection) => (react_1.default.createElement("li", null,
|
|
22
|
+
react_1.default.createElement("a", { href: `/collections/${collection === null || collection === void 0 ? void 0 : collection.handle}` }, collection === null || collection === void 0 ? void 0 : collection.title))))));
|
|
23
|
+
};
|
|
24
|
+
exports.ExampleHookUseResults = ExampleHookUseResults;
|
|
25
|
+
//# sourceMappingURL=ExampleHookUseResults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleHookUseResults.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleHookUseResults.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAyC;AACzC,uCAAkD;AAE3C,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAClD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO;SACpC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACd,IAAI,MAAM,CAAC,IAAI,KAAK,2BAAmB,CAAC,OAAO,EAAE;YAC/C,OAAO,MAAM,CAAC,WAAW,CAAC;SAC3B;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;SACD,IAAI,EAAE;SACN,MAAM,CACL,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE,OAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,CAAC,KAAK,KAAK,CACxE,CAAC;IAEJ,OAAO,CACL,0CACG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAC/B;QACE,qCAAG,IAAI,EAAE,gBAAgB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAE,IAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAK,CACnE,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,qBAAqB,yBA0BhC","sourcesContent":["import React from \"react\";\n\nimport { useResults } from \"../../hooks\";\nimport { ElasticDocumentType } from \"../../types\";\n\nexport const ExampleHookUseResults: React.FC = () => {\n const resultsHook = useResults();\n\n const collections = resultsHook.results\n .map((result) => {\n if (result.type === ElasticDocumentType.Product) {\n return result.collections;\n }\n\n return [];\n })\n .flat()\n .filter(\n (item, index, self) =>\n self.findIndex((itemNested) => itemNested?.id === item?.id) === index\n );\n\n return (\n <ul>\n {collections.map((collection) => (\n <li>\n <a href={`/collections/${collection?.handle}`}>{collection?.title}</a>\n </li>\n ))}\n </ul>\n );\n};\n"]}
|
|
@@ -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.ExampleSuggestions = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const ExampleSuggestions = (props) => {
|
|
10
|
+
const { setSearchTerm } = (0, hooks_1.useSearch)();
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement("h3", null, "Suggestions"),
|
|
13
|
+
react_1.default.createElement("ul", null, props.suggestions.map((suggestion) => (react_1.default.createElement("li", { onClick: () => setSearchTerm(suggestion.text) }, suggestion.text))))));
|
|
14
|
+
};
|
|
15
|
+
exports.ExampleSuggestions = ExampleSuggestions;
|
|
16
|
+
//# sourceMappingURL=ExampleSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleSuggestions.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleSuggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAwC;AAMjC,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEtC,OAAO,CACL;QACE,wDAAoB;QACpB,0CACG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CACrC,sCAAI,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAC9C,UAAU,CAAC,IAAI,CACb,CACN,CAAC,CACC,CACJ,CACJ,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B","sourcesContent":["import React from \"react\";\n\nimport { SuggestionsProps } from \"../../components\";\nimport { useSearch } from \"../../hooks\";\n\nexport type ExampleSuggestionsProps = React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n>;\n\nexport const ExampleSuggestions: React.FC<ExampleSuggestionsProps> = (\n props\n) => {\n const { setSearchTerm } = useSearch();\n\n return (\n <>\n <h3>Suggestions</h3>\n <ul>\n {props.suggestions.map((suggestion) => (\n <li onClick={() => setSearchTerm(suggestion.text)}>\n {suggestion.text}\n </li>\n ))}\n </ul>\n </>\n );\n};\n"]}
|
|
@@ -17,5 +17,8 @@ export * from "./ExampleResultPaginationNextPrev";
|
|
|
17
17
|
export * from "./ExampleSearch";
|
|
18
18
|
export * from "./ExampleSortBy";
|
|
19
19
|
export * from "./ExampleStats";
|
|
20
|
+
export * from "./ExampleSuggestions";
|
|
21
|
+
export * from "./ExampleHookUseFilters";
|
|
22
|
+
export * from "./ExampleHookUseResults";
|
|
20
23
|
export * from "./ExampleHookUseSearch";
|
|
21
24
|
export * from "./ExampleHookUseSortBy";
|
|
@@ -29,6 +29,9 @@ __exportStar(require("./ExampleResultPaginationNextPrev"), exports);
|
|
|
29
29
|
__exportStar(require("./ExampleSearch"), exports);
|
|
30
30
|
__exportStar(require("./ExampleSortBy"), exports);
|
|
31
31
|
__exportStar(require("./ExampleStats"), exports);
|
|
32
|
+
__exportStar(require("./ExampleSuggestions"), exports);
|
|
33
|
+
__exportStar(require("./ExampleHookUseFilters"), exports);
|
|
34
|
+
__exportStar(require("./ExampleHookUseResults"), exports);
|
|
32
35
|
__exportStar(require("./ExampleHookUseSearch"), exports);
|
|
33
36
|
__exportStar(require("./ExampleHookUseSortBy"), exports);
|
|
34
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC;AAErC,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\nexport * from \"./ExampleSuggestions\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ConfigFilterOption } from "../../types";
|
|
3
|
-
import { useFilterListProps, useFilterRangeProps, useFilterSliderProps
|
|
3
|
+
import { useFilterListProps, useFilterRangeProps, useFilterSliderProps } from "../../hooks";
|
|
4
4
|
export declare type FilterProps = {
|
|
5
5
|
/** The filter option being rendered */
|
|
6
6
|
filter: ConfigFilterOption;
|
|
@@ -12,7 +12,7 @@ export declare type FilterProps = {
|
|
|
12
12
|
/** Render method for Range filters */
|
|
13
13
|
renderFilterRange?: React.FC<{
|
|
14
14
|
filter: ConfigFilterOption;
|
|
15
|
-
filterRangeProps: ReturnType<typeof useFilterRangeProps
|
|
15
|
+
filterRangeProps: ReturnType<typeof useFilterRangeProps>;
|
|
16
16
|
}>;
|
|
17
17
|
/** Render method for Slider filters */
|
|
18
18
|
renderFilterSlider?: React.FC<{
|