@bento-core/facet-filter 1.0.1-ctdc.2 → 1.0.1-ctdc.3

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.
@@ -59,7 +59,8 @@ const FacetView = _ref => {
59
59
  */
60
60
  const {
61
61
  type,
62
- facetValues
62
+ facetValues,
63
+ displayFacetCount = true
63
64
  } = facet;
64
65
  const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
65
66
  const displayFacet = _objectSpread({}, facet);
@@ -107,7 +108,7 @@ const FacetView = _ref => {
107
108
  onClick: () => {
108
109
  onSortFacet(_Sort.sortType.ALPHABET);
109
110
  }
110
- }, "Sort alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
111
+ }, "Sort alphabetically"), displayFacetCount && /*#__PURE__*/_react.default.createElement("span", {
111
112
  className: (0, _clsx.default)(classes.sortGroupItemCounts, {
112
113
  [classes.highlight]: sortBy === _Sort.sortType.NUMERIC
113
114
  }),
@@ -38,7 +38,8 @@ const CheckBoxView = _ref => {
38
38
  field = 'group',
39
39
  count = 'subjects',
40
40
  customCount = text => "(".concat(text, ")"),
41
- defaultValue = ''
41
+ defaultValue = '',
42
+ displayFacetCount = true
42
43
  } = facet;
43
44
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
44
45
  const checkedSection = "".concat(section).toLowerCase().replace(/\ /g, '_');
@@ -102,7 +103,7 @@ const CheckBoxView = _ref => {
102
103
  className: datafield
103
104
  }, name)) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
104
105
  className: "".concat(checkedSection, "_md_space")
105
- }), /*#__PURE__*/_react.default.createElement(_core.Typography, {
106
+ }), displayFacetCount && /*#__PURE__*/_react.default.createElement(_core.Typography, {
106
107
  className: (0, _clsx.default)("".concat(checkedSection, "Subjects"), {
107
108
  ["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
108
109
  ["".concat(checkedSection, "SubjectChecked")]: isChecked
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-ctdc.2",
3
+ "version": "1.0.1-ctdc.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -51,7 +51,7 @@ const FacetView = ({
51
51
  /**
52
52
  * display checked items on facet collapse
53
53
  */
54
- const { type, facetValues } = facet;
54
+ const { type, facetValues, displayFacetCount = true } = facet;
55
55
  const selectedItems = facetValues && facetValues.filter((item) => item.isChecked);
56
56
  const displayFacet = { ...facet };
57
57
  displayFacet.facetValues = selectedItems;
@@ -135,18 +135,20 @@ const FacetView = ({
135
135
  >
136
136
  Sort alphabetically
137
137
  </span>
138
- <span
139
- className={
140
- clsx(classes.sortGroupItemCounts, {
141
- [classes.highlight]: sortBy === sortType.NUMERIC,
142
- })
143
- }
144
- onClick={() => {
145
- onSortFacet(sortType.NUMERIC);
146
- }}
147
- >
148
- Sort by count
149
- </span>
138
+ { displayFacetCount && (
139
+ <span
140
+ className={
141
+ clsx(classes.sortGroupItemCounts, {
142
+ [classes.highlight]: sortBy === sortType.NUMERIC,
143
+ })
144
+ }
145
+ onClick={() => {
146
+ onSortFacet(sortType.NUMERIC);
147
+ }}
148
+ >
149
+ Sort by count
150
+ </span>
151
+ )}
150
152
  </>
151
153
  )}
152
154
  </div>
@@ -42,6 +42,7 @@ const CheckBoxView = ({
42
42
  count = 'subjects',
43
43
  customCount = (text) => `(${text})`,
44
44
  defaultValue = '',
45
+ displayFacetCount = true,
45
46
  } = facet;
46
47
 
47
48
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
@@ -115,14 +116,16 @@ const CheckBoxView = ({
115
116
  <LabelComponent />
116
117
  )}
117
118
  <ListItemText className={`${checkedSection}_md_space`} />
118
- <Typography
119
- className={clsx(`${checkedSection}Subjects`, {
120
- [`${checkedSection}SubjectUnChecked`]: !isChecked,
121
- [`${checkedSection}SubjectChecked`]: isChecked,
122
- })}
123
- >
124
- {customCount(checkboxItem[count] || 0)}
125
- </Typography>
119
+ { displayFacetCount && (
120
+ <Typography
121
+ className={clsx(`${checkedSection}Subjects`, {
122
+ [`${checkedSection}SubjectUnChecked`]: !isChecked,
123
+ [`${checkedSection}SubjectChecked`]: isChecked,
124
+ })}
125
+ >
126
+ {customCount(checkboxItem[count] || 0)}
127
+ </Typography>
128
+ )}
126
129
  </ListItem>
127
130
  <Divider
128
131
  style={{