@constructor-io/constructorio-ui-plp 1.4.5 → 1.4.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.
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importDefault(require("react"));
5
5
  function FilterOptionListRow(props) {
6
- const { id, displayValue, displayCountValue, isChecked, onChange, showCheckbox = true } = props;
6
+ const { id, optionValue, displayValue, displayCountValue, isChecked, onChange, showCheckbox = true, } = props;
7
7
  return (react_1.default.createElement("li", { className: 'cio-filter-multiple-option', key: id },
8
8
  react_1.default.createElement("label", { htmlFor: id },
9
- react_1.default.createElement("input", { type: 'checkbox', id: id, value: displayValue, checked: isChecked, onChange: () => onChange(id) }),
9
+ react_1.default.createElement("input", { type: 'checkbox', id: id, value: optionValue, checked: isChecked, onChange: () => onChange(optionValue) }),
10
10
  showCheckbox && (react_1.default.createElement("div", { className: 'cio-checkbox' },
11
11
  react_1.default.createElement("svg", { width: '10', height: '8', viewBox: '0 0 10 8', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', className: 'cio-check' },
12
12
  react_1.default.createElement("path", { d: 'M1 4L3.5 6.5L9 1', stroke: 'white', strokeWidth: '1.7', strokeLinecap: 'round' })))),
@@ -14,7 +14,7 @@ function FilterOptionsList(props) {
14
14
  'cio-collapsible-is-open': !isCollapsed,
15
15
  }) },
16
16
  react_1.default.createElement("ul", { className: 'cio-filter-multiple-options-list cio-collapsible-inner' },
17
- optionsToRender.map((option) => (react_1.default.createElement(FilterOptionListRow_1.default, { id: option.value, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedOptionMap[option.value] || false, onChange: onOptionSelect }))),
17
+ optionsToRender.map((option) => (react_1.default.createElement(FilterOptionListRow_1.default, { id: `${facet.name}-${option.value}`, optionValue: option.value, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedOptionMap[option.value] || false, onChange: onOptionSelect }))),
18
18
  initialNumOptions < facet.options.length && (react_1.default.createElement("button", { type: 'button', className: 'cio-see-all', onClick: () => setIsShowAll(!isShowAll) }, isShowAll ? 'Show Less' : 'Show All')))));
19
19
  }
20
20
  exports.default = FilterOptionsList;
@@ -27,7 +27,7 @@ function Groups(props) {
27
27
  ' > '))),
28
28
  react_1.default.createElement("span", { className: 'cio-groups-crumb' }, groups[0].displayName)),
29
29
  react_1.default.createElement("ul", null,
30
- optionsToRender.map((option) => (react_1.default.createElement(FilterOptionListRow_1.default, { showCheckbox: false, key: option.groupId, id: option.groupId, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedGroupId === option.groupId, onChange: onOptionSelect }))),
30
+ optionsToRender.map((option) => (react_1.default.createElement(FilterOptionListRow_1.default, { showCheckbox: false, key: option.groupId, id: option.groupId, optionValue: option.groupId, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedGroupId === option.groupId, onChange: onOptionSelect }))),
31
31
  initialNumOptions < groups[0].children.length && (react_1.default.createElement("button", { type: 'button', className: 'cio-see-all', onClick: () => setIsShowAll(!isShowAll) }, isShowAll ? 'Show Less' : 'Show All')))))))));
32
32
  }
33
33
  exports.default = Groups;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.4.5';
3
+ exports.default = '1.4.6';
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  export default function FilterOptionListRow(props) {
3
- const { id, displayValue, displayCountValue, isChecked, onChange, showCheckbox = true } = props;
3
+ const { id, optionValue, displayValue, displayCountValue, isChecked, onChange, showCheckbox = true, } = props;
4
4
  return (React.createElement("li", { className: 'cio-filter-multiple-option', key: id },
5
5
  React.createElement("label", { htmlFor: id },
6
- React.createElement("input", { type: 'checkbox', id: id, value: displayValue, checked: isChecked, onChange: () => onChange(id) }),
6
+ React.createElement("input", { type: 'checkbox', id: id, value: optionValue, checked: isChecked, onChange: () => onChange(optionValue) }),
7
7
  showCheckbox && (React.createElement("div", { className: 'cio-checkbox' },
8
8
  React.createElement("svg", { width: '10', height: '8', viewBox: '0 0 10 8', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', className: 'cio-check' },
9
9
  React.createElement("path", { d: 'M1 4L3.5 6.5L9 1', stroke: 'white', strokeWidth: '1.7', strokeLinecap: 'round' })))),
@@ -11,6 +11,6 @@ export default function FilterOptionsList(props) {
11
11
  'cio-collapsible-is-open': !isCollapsed,
12
12
  }) },
13
13
  React.createElement("ul", { className: 'cio-filter-multiple-options-list cio-collapsible-inner' },
14
- optionsToRender.map((option) => (React.createElement(FilterOptionListRow, { id: option.value, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedOptionMap[option.value] || false, onChange: onOptionSelect }))),
14
+ optionsToRender.map((option) => (React.createElement(FilterOptionListRow, { id: `${facet.name}-${option.value}`, optionValue: option.value, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedOptionMap[option.value] || false, onChange: onOptionSelect }))),
15
15
  initialNumOptions < facet.options.length && (React.createElement("button", { type: 'button', className: 'cio-see-all', onClick: () => setIsShowAll(!isShowAll) }, isShowAll ? 'Show Less' : 'Show All')))));
16
16
  }
@@ -24,6 +24,6 @@ export default function Groups(props) {
24
24
  ' > '))),
25
25
  React.createElement("span", { className: 'cio-groups-crumb' }, groups[0].displayName)),
26
26
  React.createElement("ul", null,
27
- optionsToRender.map((option) => (React.createElement(FilterOptionListRow, { showCheckbox: false, key: option.groupId, id: option.groupId, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedGroupId === option.groupId, onChange: onOptionSelect }))),
27
+ optionsToRender.map((option) => (React.createElement(FilterOptionListRow, { showCheckbox: false, key: option.groupId, id: option.groupId, optionValue: option.groupId, displayValue: option.displayName, displayCountValue: option.count.toString(), isChecked: selectedGroupId === option.groupId, onChange: onOptionSelect }))),
28
28
  initialNumOptions < groups[0].children.length && (React.createElement("button", { type: 'button', className: 'cio-see-all', onClick: () => setIsShowAll(!isShowAll) }, isShowAll ? 'Show Less' : 'Show All')))))))));
29
29
  }
@@ -1 +1 @@
1
- export default '1.4.5';
1
+ export default '1.4.6';
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  export interface FilterOptionListRowProps {
3
3
  id: string;
4
+ optionValue: string;
4
5
  displayValue: string;
5
6
  displayCountValue: string;
6
7
  isChecked: boolean;
7
- onChange: (id: string) => void;
8
+ onChange: (value: string) => void;
8
9
  showCheckbox?: boolean;
9
10
  }
10
11
  export default function FilterOptionListRow(props: FilterOptionListRowProps): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- declare const _default: "1.4.5";
1
+ declare const _default: "1.4.6";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-plp",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "Constructor PLP UI library for web applications",
5
5
  "author": "Constructor.io Corporation",
6
6
  "license": "MIT",