@riosst100/pwa-marketplace 2.3.5 → 2.3.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.3.5",
4
+ "version": "2.3.6",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -15,10 +15,14 @@ import { useFieldApi } from 'informed';
15
15
  import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInformedFieldStateWrapper';
16
16
 
17
17
  const FilterItemRadioGroup = props => {
18
- const { filterApi, filterState, group, items, onApply, labels } = props;
18
+ const { filterApi, filterState, group, items, onApply, labels,isListExpanded = true, itemCountToShow = 5 } = props;
19
19
 
20
20
  const radioItems = useMemo(() => {
21
- return items.map(item => {
21
+ return items.map((item,index) => {
22
+ if (!isListExpanded && index >= itemCountToShow) {
23
+ return null;
24
+ }
25
+
22
26
  const code = `item-${group}-${item.value}`;
23
27
  return (
24
28
  <FilterItemRadio
@@ -32,7 +36,7 @@ const FilterItemRadioGroup = props => {
32
36
  />
33
37
  );
34
38
  });
35
- }, [filterApi, filterState, group, items, labels, onApply]);
39
+ }, [filterApi, filterState, group, items, labels, onApply,isListExpanded,itemCountToShow]);
36
40
 
37
41
  const fieldValue = useMemo(() => {
38
42
  if (filterState) {
@@ -103,6 +103,7 @@ const FilterList = props => {
103
103
  // search value is not referenced, so this array is stable
104
104
  const itemElements = useMemo(() => {
105
105
  // if (filterFrontendInput === 'boolean') {
106
+
106
107
  const key = `item-${group}`;
107
108
  return (
108
109
  <li
@@ -118,6 +119,8 @@ const FilterList = props => {
118
119
  items={items}
119
120
  onApply={onApply}
120
121
  labels={labels}
122
+ isListExpanded={isListExpanded}
123
+ itemCountToShow={itemCountToShow}
121
124
  />
122
125
  </li>
123
126
  );