@bento-core/facet-filter 1.0.1-ccdihub.37 → 1.0.1-ccdihub.39

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.
Files changed (27) hide show
  1. package/dist/components/facet/NewFacetStyle.js +20 -12
  2. package/dist/components/facet/NewFacetView.js +27 -6
  3. package/dist/components/facet/NewSearchFacetView.js +31 -8
  4. package/dist/components/facet/ReduxNewFacetView.js +6 -2
  5. package/dist/components/facet/ReduxNewSearchFacetView.js +6 -2
  6. package/dist/components/inputs/FilterItemStyle.js +2 -2
  7. package/dist/components/inputs/checkbox/CheckboxStyle.js +2 -2
  8. package/dist/components/inputs/checkbox/CheckboxView.js +3 -3
  9. package/dist/components/inputs/checkbox/SearchCheckboxView.js +3 -3
  10. package/dist/components/inputs/checkbox/assets/checkedbox.svg +1 -1
  11. package/dist/store/actions/ActionTypes.js +2 -1
  12. package/dist/store/actions/Actions.js +10 -2
  13. package/dist/store/reducers/SideBarReducer.js +20 -2
  14. package/package.json +1 -1
  15. package/src/components/facet/NewFacetStyle.js +19 -11
  16. package/src/components/facet/NewFacetView.js +30 -5
  17. package/src/components/facet/NewSearchFacetView.js +33 -7
  18. package/src/components/facet/ReduxNewFacetView.js +5 -0
  19. package/src/components/facet/ReduxNewSearchFacetView.js +5 -0
  20. package/src/components/inputs/FilterItemStyle.js +2 -2
  21. package/src/components/inputs/checkbox/CheckboxStyle.js +2 -2
  22. package/src/components/inputs/checkbox/CheckboxView.js +3 -3
  23. package/src/components/inputs/checkbox/SearchCheckboxView.js +3 -3
  24. package/src/components/inputs/checkbox/assets/checkedbox.svg +1 -1
  25. package/src/store/actions/ActionTypes.js +1 -0
  26. package/src/store/actions/Actions.js +8 -0
  27. package/src/store/reducers/SideBarReducer.js +17 -0
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _Search_Icon = _interopRequireDefault(require("./assets/Search_Icon.svg"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
7
  var _default = () => ({
10
8
  expansionPanelDetailsRoot: {
11
9
  display: 'block'
@@ -21,7 +19,6 @@ var _default = () => ({
21
19
  },
22
20
  subSectionSummaryText: {
23
21
  marginLeft: '10px',
24
- lineHeight: 0,
25
22
  color: '#323232',
26
23
  fontFamily: 'Raleway',
27
24
  fontSize: '13px',
@@ -64,10 +61,7 @@ var _default = () => ({
64
61
  sortGroupItemCounts: {
65
62
  cursor: 'pointer',
66
63
  fontFamily: 'Nunito',
67
- fontSize: '10px',
68
- float: 'right',
69
- marginRight: '10px',
70
- marginTop: '5px'
64
+ fontSize: '10px'
71
65
  },
72
66
  highlight: {
73
67
  color: '#b2c6d6'
@@ -85,19 +79,18 @@ var _default = () => ({
85
79
  position: 'relative'
86
80
  },
87
81
  searchBox: {
88
- fontSize: '11px',
82
+ fontSize: '14px',
89
83
  fontFamily: 'Nunito',
90
84
  width: 'calc(100% - 26px)',
91
85
  height: '30px',
92
86
  marginTop: '12px',
93
87
  borderRadius: '5px',
94
- background: "url(".concat(_Search_Icon.default, ") right 5px center no-repeat"),
95
88
  marginLeft: '6px',
96
89
  border: '1px solid',
97
90
  padding: '5px'
98
91
  },
99
92
  searchBoxWithText: {
100
- fontSize: '11px',
93
+ fontSize: '14px',
101
94
  fontFamily: 'Nunito',
102
95
  width: 'calc(100% - 26px)',
103
96
  height: '30px',
@@ -108,23 +101,38 @@ var _default = () => ({
108
101
  padding: '5px'
109
102
  },
110
103
  expandedDisplayButton: {
104
+ display: 'flex',
105
+ alignItems: 'center',
106
+ justifyContent: 'space-between',
111
107
  backgroundColor: '#4D889E !important',
112
108
  color: 'white',
113
109
  width: 'calc(100% - 26px)',
114
110
  height: '30px',
115
111
  marginBottom: '5px',
116
112
  marginLeft: '6px',
113
+ padding: '6px 11px',
117
114
  borderRadius: '5px',
118
- fontSize: '12px',
115
+ fontFamily: 'Nunito',
116
+ fontSize: '11px',
119
117
  fontWeight: '600',
120
118
  top: '8px'
121
119
  },
120
+ expandedDisplayCount: {
121
+ marginLeft: '4px',
122
+ fontFamily: 'Nunito',
123
+ fontSize: '11px',
124
+ fontWeight: '600',
125
+ lineHeight: '17px',
126
+ color: '#ffffff',
127
+ backgroundColor: '#5D98AE',
128
+ padding: '1px 2px'
129
+ },
122
130
  clearTextButton: {
123
131
  padding: '0px',
124
132
  height: '20px',
125
133
  position: 'absolute',
126
134
  right: '14px',
127
- top: '14px'
135
+ top: '16px'
128
136
  },
129
137
  timeUnitToggle: {
130
138
  marginLeft: '8px',
@@ -36,10 +36,27 @@ const NewFacetView = _ref => {
36
36
  queryParams,
37
37
  timeUnitState,
38
38
  onTimeUnitChange,
39
- unknownAgesState
39
+ unknownAgesState,
40
+ expandState,
41
+ onToggleFacetExpand
40
42
  } = _ref;
41
- const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
42
- const onExpandFacet = () => setExpand(!expand);
43
+ const expand = expandState[facet.datafield] !== undefined ? expandState[facet.datafield] : facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false;
44
+ const isUserInitiated = (0, _react.useRef)(false);
45
+ const prevExpandRef = (0, _react.useRef)(expand);
46
+ (0, _react.useEffect)(() => {
47
+ prevExpandRef.current = expand;
48
+ // Reset flag after render
49
+ if (isUserInitiated.current) {
50
+ setTimeout(() => {
51
+ isUserInitiated.current = false;
52
+ }, 0);
53
+ }
54
+ }, [expand]);
55
+ const onExpandFacet = () => {
56
+ isUserInitiated.current = true;
57
+ const newExpandState = !expand;
58
+ onToggleFacetExpand(facet.datafield, newExpandState);
59
+ };
43
60
  const query = new URLSearchParams((0, _reactRouterDom.useLocation)().search);
44
61
  const navigate = (0, _reactRouterDom.useNavigate)();
45
62
 
@@ -114,7 +131,11 @@ const NewFacetView = _ref => {
114
131
  classes: {
115
132
  root: classes.expansionPanelsideBarItem
116
133
  },
117
- id: facet.section
134
+ id: facet.section,
135
+ TransitionProps: {
136
+ // Disable animation if change is not user-initiated
137
+ timeout: isUserInitiated.current ? undefined : 0
138
+ }
118
139
  }, CustomView ? /*#__PURE__*/_react.default.createElement(CustomView, {
119
140
  facet: facet,
120
141
  facetClasses: isActiveFacet ? "activeFacet".concat(facet.section) : "inactiveFacet".concat(facet.section)
@@ -171,14 +192,14 @@ const NewFacetView = _ref => {
171
192
  onClick: () => {
172
193
  onSortFacet(_Sort.sortType.ALPHABET);
173
194
  }
174
- }, "Sort alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
195
+ }, "Sort Alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
175
196
  className: (0, _clsx.default)(classes.sortGroupItemCounts, {
176
197
  [classes.highlight]: sortBy === _Sort.sortType.NUMERIC
177
198
  }),
178
199
  onClick: () => {
179
200
  onSortFacet(_Sort.sortType.NUMERIC);
180
201
  }
181
- }, "Sort by count"))), /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
202
+ }, "Sort by Count"))), /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
182
203
  facet: facet,
183
204
  queryParams: queryParams,
184
205
  sortBy: sortBy,
@@ -58,11 +58,28 @@ const SearchFacetView = _ref => {
58
58
  onSortChange,
59
59
  CustomView,
60
60
  queryParams,
61
- unknownAgesState
61
+ unknownAgesState,
62
+ expandState,
63
+ onToggleFacetExpand
62
64
  } = _ref;
63
- const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
65
+ const expand = expandState[facet.datafield] !== undefined ? expandState[facet.datafield] : facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false;
66
+ const isUserInitiated = (0, _react.useRef)(false);
67
+ const prevExpandRef = (0, _react.useRef)(expand);
68
+ (0, _react.useEffect)(() => {
69
+ prevExpandRef.current = expand;
70
+ // Reset flag after render
71
+ if (isUserInitiated.current) {
72
+ setTimeout(() => {
73
+ isUserInitiated.current = false;
74
+ }, 0);
75
+ }
76
+ }, [expand]);
77
+ const onExpandFacet = () => {
78
+ isUserInitiated.current = true;
79
+ const newExpandState = !expand;
80
+ onToggleFacetExpand(facet.datafield, newExpandState);
81
+ };
64
82
  const [open, setOpen] = (0, _react.useState)(false);
65
- const onExpandFacet = () => setExpand(!expand);
66
83
  const query = new URLSearchParams((0, _reactRouterDom.useLocation)().search);
67
84
  const navigate = (0, _reactRouterDom.useNavigate)();
68
85
  const onClearSection = () => {
@@ -132,7 +149,11 @@ const SearchFacetView = _ref => {
132
149
  classes: {
133
150
  root: classes.expansionPanelsideBarItem
134
151
  },
135
- id: facet.section
152
+ id: facet.section,
153
+ TransitionProps: {
154
+ // Disable animation if change is not user-initiated
155
+ timeout: isUserInitiated.current ? undefined : 0
156
+ }
136
157
  }, CustomView ? /*#__PURE__*/_react.default.createElement(CustomView, {
137
158
  facet: facet,
138
159
  facetClasses: isActiveFacet ? "activeFacet".concat(facet.section) : "inactiveFacet".concat(facet.section)
@@ -151,7 +172,7 @@ const SearchFacetView = _ref => {
151
172
  className: searchText && searchText.trim() !== '' ? classes.searchBoxWithText : classes.searchBox,
152
173
  value: searchText,
153
174
  type: "text",
154
- placeholder: "e.g. Sarcoma, Neoplasm",
175
+ placeholder: "e.g. Sarcoma, Neoplasm, phs087...",
155
176
  onChange: e => onSearchTextChange(facet.datafield, e.target.value)
156
177
  }), searchText && searchText.trim() !== '' && /*#__PURE__*/_react.default.createElement(_core.IconButton, {
157
178
  "aria-label": "close",
@@ -171,7 +192,9 @@ const SearchFacetView = _ref => {
171
192
  variant: "text",
172
193
  className: classes.expandedDisplayButton,
173
194
  onClick: () => setOpen(!open)
174
- }, "VIEW EXPANDED DISPLAY (".concat(checkedItems.length + newUncheckedFullList.length, ")")))), facetValues.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
195
+ }, "VIEW EXPANDED DISPLAY", /*#__PURE__*/_react.default.createElement("span", {
196
+ className: classes.expandedDisplayCount
197
+ }, "".concat(checkedItems.length + newUncheckedFullList.length))))), facetValues.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
175
198
  className: classes.sortGroup
176
199
  }, /*#__PURE__*/_react.default.createElement("span", {
177
200
  className: classes.sortGroupIcon
@@ -192,14 +215,14 @@ const SearchFacetView = _ref => {
192
215
  onClick: () => {
193
216
  onSortChange(facet.datafield, _Sort.sortType.ALPHABET);
194
217
  }
195
- }, "Sort alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
218
+ }, "Sort Alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
196
219
  className: (0, _clsx.default)(classes.sortGroupItemCounts, {
197
220
  [classes.highlight]: sortBy === _Sort.sortType.NUMERIC
198
221
  }),
199
222
  onClick: () => {
200
223
  onSortChange(facet.datafield, _Sort.sortType.NUMERIC);
201
224
  }
202
- }, "Sort by count")), /*#__PURE__*/_react.default.createElement(_SearchFilterItems.default, {
225
+ }, "Sort by Count")), /*#__PURE__*/_react.default.createElement(_SearchFilterItems.default, {
203
226
  searchText: searchText,
204
227
  facet: facet,
205
228
  queryParams: queryParams,
@@ -11,10 +11,11 @@ var _NewFacetView = _interopRequireDefault(require("./NewFacetView"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  const ReduxNewFacetView = props => /*#__PURE__*/_react.default.createElement(_NewFacetView.default, props);
13
13
  const mapStateToProps = state => {
14
- var _state$statusReducer, _state$statusReducer2;
14
+ var _state$statusReducer, _state$statusReducer2, _state$statusReducer3;
15
15
  return {
16
16
  timeUnitState: (state === null || state === void 0 ? void 0 : (_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.timeUnitState) || {},
17
- unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {}
17
+ unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {},
18
+ expandState: (state === null || state === void 0 ? void 0 : (_state$statusReducer3 = state.statusReducer) === null || _state$statusReducer3 === void 0 ? void 0 : _state$statusReducer3.expandState) || {}
18
19
  };
19
20
  };
20
21
  const mapDispatchToProps = dispatch => ({
@@ -29,6 +30,9 @@ const mapDispatchToProps = dispatch => ({
29
30
  },
30
31
  onUnknownAgesChange: (datafield, unknownAges) => {
31
32
  dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
33
+ },
34
+ onToggleFacetExpand: (datafield, expanded) => {
35
+ dispatch((0, _Actions.toggleFacetExpand)(datafield, expanded));
32
36
  }
33
37
  });
34
38
  var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxNewFacetView);
@@ -13,11 +13,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  const ReduxNewSearchFacetView = props => /*#__PURE__*/_react.default.createElement(_NewSearchFacetView.default, props);
15
15
  const mapStateToProps = (state, ownProps) => {
16
- var _state$statusReducer, _state$statusReducer2;
16
+ var _state$statusReducer, _state$statusReducer2, _state$statusReducer3;
17
17
  return {
18
18
  searchText: ((_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.searchState[ownProps.facet.datafield]) || '',
19
19
  sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null,
20
- unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {}
20
+ unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {},
21
+ expandState: (state === null || state === void 0 ? void 0 : (_state$statusReducer3 = state.statusReducer) === null || _state$statusReducer3 === void 0 ? void 0 : _state$statusReducer3.expandState) || {}
21
22
  };
22
23
  };
23
24
  const mapDispatchToProps = dispatch => ({
@@ -35,6 +36,9 @@ const mapDispatchToProps = dispatch => ({
35
36
  },
36
37
  onUnknownAgesChange: (datafield, unknownAges) => {
37
38
  dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
39
+ },
40
+ onToggleFacetExpand: (datafield, expanded) => {
41
+ dispatch((0, _Actions.toggleFacetExpand)(datafield, expanded));
38
42
  }
39
43
  });
40
44
  var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxNewSearchFacetView);
@@ -37,8 +37,8 @@ var _default = () => ({
37
37
  maxHeight: '400px',
38
38
  overflowY: 'auto',
39
39
  overflowX: 'hidden',
40
- borderTop: '2px solid #AEAEAE',
41
- borderBottom: '2px solid #AEAEAE',
40
+ borderTop: '1px solid #AEAEAE',
41
+ borderBottom: '1px solid #AEAEAE',
42
42
  marginRight: '-1px',
43
43
  '&::-webkit-scrollbar': {
44
44
  width: '12px',
@@ -30,11 +30,11 @@ var _default = () => ({
30
30
  checkboxName: {
31
31
  margin: '0',
32
32
  color: '#000000',
33
- fontSize: '16px',
33
+ fontSize: '15px',
34
34
  fontWeight: 300,
35
35
  marginTop: '1.5px',
36
36
  fontFamily: 'Nunito',
37
- lineHeight: '120%'
37
+ lineHeight: '16px'
38
38
  }
39
39
  });
40
40
  exports.default = _default;
@@ -135,11 +135,11 @@ const CheckBoxView = _ref => {
135
135
  ["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
136
136
  ["".concat(checkedSection, "SubjectChecked")]: isChecked
137
137
  })
138
- }, "(".concat(subjects.toLocaleString(), ")"))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
138
+ }, "".concat(subjects.toLocaleString()))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
139
139
  style: {
140
- backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
140
+ backgroundColor: isChecked ? '#AEAEAE' : '#B1B1B1',
141
141
  margin: '0px',
142
- height: isChecked ? '2px' : '1px'
142
+ height: isChecked ? '0.5px' : '0.5px'
143
143
  }
144
144
  }));
145
145
  };
@@ -135,11 +135,11 @@ const CheckBoxView = _ref => {
135
135
  ["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
136
136
  ["".concat(checkedSection, "SubjectChecked")]: isChecked
137
137
  })
138
- }, "(".concat(subjects.toLocaleString(), ")"))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
138
+ }, "".concat(subjects.toLocaleString()))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
139
139
  style: {
140
- backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
140
+ backgroundColor: isChecked ? '#AEAEAE' : '#B1B1B1',
141
141
  margin: '0px',
142
- height: isChecked ? '2px' : '1px'
142
+ height: isChecked ? '0.5px' : '0.5px'
143
143
  }
144
144
  }));
145
145
  };
@@ -1,4 +1,4 @@
1
1
  <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
2
+ <rect width="14" height="14" fill="#477C90"/>
3
3
  <path d="M3 6.52174L4.95652 10L12 2" stroke="white" stroke-width="2"/>
4
4
  </svg>
@@ -15,7 +15,8 @@ const sideBarActionTypes = {
15
15
  SORT_CHANGED: 'SORT_CHANGED',
16
16
  UPDATE_FILTER_STATE: 'UPDATE_FILTER_STATE',
17
17
  TIME_UNIT_CHANGED: 'TIME_UNIT_CHANGED',
18
- UNKNOWN_AGES_CHANGED: 'UNKNOWN_AGES_CHANGED'
18
+ UNKNOWN_AGES_CHANGED: 'UNKNOWN_AGES_CHANGED',
19
+ TOGGLE_FACET_EXPAND: 'TOGGLE_FACET_EXPAND'
19
20
  };
20
21
  exports.sideBarActionTypes = sideBarActionTypes;
21
22
  const Actions = '';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateFilterState = exports.unknownAgesChange = exports.toggleSilder = exports.toggleCheckBox = exports.timeUnitChange = exports.sortChange = exports.searchTextChange = exports.clearSliderSection = exports.clearFacetSection = exports.clearAllFilters = exports.clearAllAndSelectFacet = void 0;
6
+ exports.updateFilterState = exports.unknownAgesChange = exports.toggleSilder = exports.toggleFacetExpand = exports.toggleCheckBox = exports.timeUnitChange = exports.sortChange = exports.searchTextChange = exports.clearSliderSection = exports.clearFacetSection = exports.clearAllFilters = exports.clearAllAndSelectFacet = void 0;
7
7
  var _ActionTypes = require("./ActionTypes");
8
8
  const toggleCheckBox = toggleCheckBoxItem => ({
9
9
  type: _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED,
@@ -74,4 +74,12 @@ const unknownAgesChange = (datafield, unknownAges) => ({
74
74
  unknownAges
75
75
  }
76
76
  });
77
- exports.unknownAgesChange = unknownAgesChange;
77
+ exports.unknownAgesChange = unknownAgesChange;
78
+ const toggleFacetExpand = (datafield, expanded) => ({
79
+ type: _ActionTypes.sideBarActionTypes.TOGGLE_FACET_EXPAND,
80
+ payload: {
81
+ datafield,
82
+ expanded
83
+ }
84
+ });
85
+ exports.toggleFacetExpand = toggleFacetExpand;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.onUnknownAgesChange = exports.onToggleStateUpdate = exports.onTimeUnitChange = exports.onSortChange = exports.onSearchTextChange = exports.onClearSliderSection = exports.onClearFacetSection = void 0;
6
+ exports.onUnknownAgesChange = exports.onToggleStateUpdate = exports.onToggleFacetExpand = exports.onTimeUnitChange = exports.onSortChange = exports.onSearchTextChange = exports.onClearSliderSection = exports.onClearFacetSection = void 0;
7
7
  exports.sideBarReducerGenerator = sideBarReducerGenerator;
8
8
  exports.updateSiderValue = void 0;
9
9
  var _ActionTypes = require("../actions/ActionTypes");
@@ -16,8 +16,10 @@ const initFilterState = {
16
16
  searchState: {},
17
17
  sortState: {},
18
18
  timeUnitState: {},
19
- unknownAgesState: {}
19
+ unknownAgesState: {},
20
+ expandState: {} // Add this line
20
21
  };
22
+
21
23
  const onToggleStateUpdate = _ref => {
22
24
  let {
23
25
  filterState,
@@ -122,6 +124,17 @@ const onUnknownAgesChange = _ref8 => {
122
124
  return updatedState;
123
125
  };
124
126
  exports.onUnknownAgesChange = onUnknownAgesChange;
127
+ const onToggleFacetExpand = _ref9 => {
128
+ let {
129
+ datafield,
130
+ expanded,
131
+ expandState
132
+ } = _ref9;
133
+ const updatedState = _objectSpread({}, expandState);
134
+ updatedState[datafield] = expanded;
135
+ return updatedState;
136
+ };
137
+ exports.onToggleFacetExpand = onToggleFacetExpand;
125
138
  function sideBarReducerGenerator() {
126
139
  return {
127
140
  actionTypes: _ActionTypes.sideBarActionTypes,
@@ -196,6 +209,11 @@ function sideBarReducerGenerator() {
196
209
  return _objectSpread(_objectSpread({}, state), {}, {
197
210
  unknownAgesState: _objectSpread({}, updateState)
198
211
  });
212
+ case _ActionTypes.sideBarActionTypes.TOGGLE_FACET_EXPAND:
213
+ updateState = onToggleFacetExpand(_objectSpread(_objectSpread({}, payload), state));
214
+ return _objectSpread(_objectSpread({}, state), {}, {
215
+ expandState: _objectSpread({}, updateState)
216
+ });
199
217
  default:
200
218
  return state;
201
219
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-ccdihub.37",
3
+ "version": "1.0.1-ccdihub.39",
4
4
  "description": "### Bento core sidebar design:",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,5 +1,3 @@
1
- import SearchIcon from './assets/Search_Icon.svg';
2
-
3
1
  export default () => ({
4
2
  expansionPanelDetailsRoot: {
5
3
  display: 'block',
@@ -15,7 +13,6 @@ export default () => ({
15
13
  },
16
14
  subSectionSummaryText: {
17
15
  marginLeft: '10px',
18
- lineHeight: 0,
19
16
  color: '#323232',
20
17
  fontFamily: 'Raleway',
21
18
  fontSize: '13px',
@@ -59,9 +56,6 @@ export default () => ({
59
56
  cursor: 'pointer',
60
57
  fontFamily: 'Nunito',
61
58
  fontSize: '10px',
62
- float: 'right',
63
- marginRight: '10px',
64
- marginTop: '5px',
65
59
  },
66
60
  highlight: {
67
61
  color: '#b2c6d6',
@@ -79,19 +73,18 @@ export default () => ({
79
73
  position: 'relative',
80
74
  },
81
75
  searchBox: {
82
- fontSize: '11px',
76
+ fontSize: '14px',
83
77
  fontFamily: 'Nunito',
84
78
  width: 'calc(100% - 26px)',
85
79
  height: '30px',
86
80
  marginTop: '12px',
87
81
  borderRadius: '5px',
88
- background: `url(${SearchIcon}) right 5px center no-repeat`,
89
82
  marginLeft: '6px',
90
83
  border: '1px solid',
91
84
  padding: '5px',
92
85
  },
93
86
  searchBoxWithText: {
94
- fontSize: '11px',
87
+ fontSize: '14px',
95
88
  fontFamily: 'Nunito',
96
89
  width: 'calc(100% - 26px)',
97
90
  height: '30px',
@@ -102,23 +95,38 @@ export default () => ({
102
95
  padding: '5px',
103
96
  },
104
97
  expandedDisplayButton: {
98
+ display: 'flex',
99
+ alignItems: 'center',
100
+ justifyContent: 'space-between',
105
101
  backgroundColor: '#4D889E !important',
106
102
  color: 'white',
107
103
  width: 'calc(100% - 26px)',
108
104
  height: '30px',
109
105
  marginBottom: '5px',
110
106
  marginLeft: '6px',
107
+ padding: '6px 11px',
111
108
  borderRadius: '5px',
112
- fontSize: '12px',
109
+ fontFamily: 'Nunito',
110
+ fontSize: '11px',
113
111
  fontWeight: '600',
114
112
  top: '8px',
115
113
  },
114
+ expandedDisplayCount: {
115
+ marginLeft: '4px',
116
+ fontFamily: 'Nunito',
117
+ fontSize: '11px',
118
+ fontWeight: '600',
119
+ lineHeight: '17px',
120
+ color: '#ffffff',
121
+ backgroundColor: '#5D98AE',
122
+ padding: '1px 2px',
123
+ },
116
124
  clearTextButton: {
117
125
  padding: '0px',
118
126
  height: '20px',
119
127
  position: 'absolute',
120
128
  right: '14px',
121
- top: '14px',
129
+ top: '16px',
122
130
  },
123
131
  timeUnitToggle: {
124
132
  marginLeft: '8px',
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useRef, useEffect } from 'react';
2
2
  import {
3
3
  useLocation,
4
4
  useNavigate,
@@ -31,9 +31,30 @@ const NewFacetView = ({
31
31
  timeUnitState,
32
32
  onTimeUnitChange,
33
33
  unknownAgesState,
34
+ expandState,
35
+ onToggleFacetExpand,
34
36
  }) => {
35
- const [expand, setExpand] = useState(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
36
- const onExpandFacet = () => setExpand(!expand);
37
+ const expand = expandState[facet.datafield] !== undefined ? expandState[facet.datafield] : (facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
38
+
39
+ const isUserInitiated = useRef(false);
40
+ const prevExpandRef = useRef(expand);
41
+
42
+ useEffect(() => {
43
+ prevExpandRef.current = expand;
44
+ // Reset flag after render
45
+ if (isUserInitiated.current) {
46
+ setTimeout(() => {
47
+ isUserInitiated.current = false;
48
+ }, 0);
49
+ }
50
+ }, [expand]);
51
+
52
+ const onExpandFacet = () => {
53
+ isUserInitiated.current = true;
54
+ const newExpandState = !expand;
55
+ onToggleFacetExpand(facet.datafield, newExpandState);
56
+ };
57
+
37
58
  const query = new URLSearchParams(useLocation().search);
38
59
  const navigate = useNavigate();
39
60
 
@@ -110,6 +131,10 @@ const NewFacetView = ({
110
131
  root: classes.expansionPanelsideBarItem,
111
132
  }}
112
133
  id={facet.section}
134
+ TransitionProps={{
135
+ // Disable animation if change is not user-initiated
136
+ timeout: isUserInitiated.current ? undefined : 0,
137
+ }}
113
138
  >
114
139
  { CustomView ? (
115
140
  <CustomView
@@ -209,7 +234,7 @@ const NewFacetView = ({
209
234
  onSortFacet(sortType.ALPHABET);
210
235
  }}
211
236
  >
212
- Sort alphabetically
237
+ Sort Alphabetically
213
238
  </span>
214
239
  <span
215
240
  className={
@@ -221,7 +246,7 @@ const NewFacetView = ({
221
246
  onSortFacet(sortType.NUMERIC);
222
247
  }}
223
248
  >
224
- Sort by count
249
+ Sort by Count
225
250
  </span>
226
251
  </>
227
252
  )}
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useRef, useEffect } from 'react';
2
2
  import {
3
3
  useLocation,
4
4
  useNavigate,
@@ -56,10 +56,31 @@ const SearchFacetView = ({
56
56
  CustomView,
57
57
  queryParams,
58
58
  unknownAgesState,
59
+ expandState,
60
+ onToggleFacetExpand,
59
61
  }) => {
60
- const [expand, setExpand] = useState(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
62
+ const expand = expandState[facet.datafield] !== undefined ? expandState[facet.datafield] : (facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
63
+
64
+ const isUserInitiated = useRef(false);
65
+ const prevExpandRef = useRef(expand);
66
+
67
+ useEffect(() => {
68
+ prevExpandRef.current = expand;
69
+ // Reset flag after render
70
+ if (isUserInitiated.current) {
71
+ setTimeout(() => {
72
+ isUserInitiated.current = false;
73
+ }, 0);
74
+ }
75
+ }, [expand]);
76
+
77
+ const onExpandFacet = () => {
78
+ isUserInitiated.current = true;
79
+ const newExpandState = !expand;
80
+ onToggleFacetExpand(facet.datafield, newExpandState);
81
+ };
82
+
61
83
  const [open, setOpen] = useState(false);
62
- const onExpandFacet = () => setExpand(!expand);
63
84
  const query = new URLSearchParams(useLocation().search);
64
85
  const navigate = useNavigate();
65
86
 
@@ -133,6 +154,10 @@ const SearchFacetView = ({
133
154
  root: classes.expansionPanelsideBarItem,
134
155
  }}
135
156
  id={facet.section}
157
+ TransitionProps={{
158
+ // Disable animation if change is not user-initiated
159
+ timeout: isUserInitiated.current ? undefined : 0,
160
+ }}
136
161
  >
137
162
  {CustomView ? (
138
163
  <CustomView
@@ -178,7 +203,7 @@ const SearchFacetView = ({
178
203
  className={searchText && searchText.trim() !== '' ? classes.searchBoxWithText : classes.searchBox}
179
204
  value={searchText}
180
205
  type="text"
181
- placeholder="e.g. Sarcoma, Neoplasm"
206
+ placeholder="e.g. Sarcoma, Neoplasm, phs087..."
182
207
  onChange={(e) => onSearchTextChange(facet.datafield, e.target.value)}
183
208
  />
184
209
  {
@@ -203,7 +228,8 @@ const SearchFacetView = ({
203
228
  </div>
204
229
  <div className={classes.searchContainer}>
205
230
  <Button variant="text" className={classes.expandedDisplayButton} onClick={() => setOpen(!open)}>
206
- {`VIEW EXPANDED DISPLAY (${checkedItems.length + newUncheckedFullList.length})`}
231
+ VIEW EXPANDED DISPLAY
232
+ <span className={classes.expandedDisplayCount}>{`${checkedItems.length + newUncheckedFullList.length}`}</span>
207
233
  </Button>
208
234
  </div>
209
235
  </>
@@ -237,7 +263,7 @@ const SearchFacetView = ({
237
263
  onSortChange(facet.datafield, sortType.ALPHABET);
238
264
  }}
239
265
  >
240
- Sort alphabetically
266
+ Sort Alphabetically
241
267
  </span>
242
268
  <span
243
269
  className={
@@ -249,7 +275,7 @@ const SearchFacetView = ({
249
275
  onSortChange(facet.datafield, sortType.NUMERIC);
250
276
  }}
251
277
  >
252
- Sort by count
278
+ Sort by Count
253
279
  </span>
254
280
  </div>
255
281
  <SearchFilterItems
@@ -5,6 +5,7 @@ import {
5
5
  clearSliderSection,
6
6
  timeUnitChange,
7
7
  unknownAgesChange,
8
+ toggleFacetExpand,
8
9
  } from '../../store/actions/Actions';
9
10
  import NewFacetView from './NewFacetView';
10
11
 
@@ -13,6 +14,7 @@ const ReduxNewFacetView = ((props) => <NewFacetView {...props} />);
13
14
  const mapStateToProps = (state) => ({
14
15
  timeUnitState: state?.statusReducer?.timeUnitState || {},
15
16
  unknownAgesState: state?.statusReducer?.unknownAgesState || {},
17
+ expandState: state?.statusReducer?.expandState || {},
16
18
  });
17
19
 
18
20
  const mapDispatchToProps = (dispatch) => ({
@@ -22,6 +24,9 @@ const mapDispatchToProps = (dispatch) => ({
22
24
  onUnknownAgesChange: (datafield, unknownAges) => {
23
25
  dispatch(unknownAgesChange(datafield, unknownAges));
24
26
  },
27
+ onToggleFacetExpand: (datafield, expanded) => {
28
+ dispatch(toggleFacetExpand(datafield, expanded));
29
+ },
25
30
  });
26
31
 
27
32
  export default connect(mapStateToProps, mapDispatchToProps)(ReduxNewFacetView);
@@ -6,6 +6,7 @@ import {
6
6
  searchTextChange,
7
7
  sortChange,
8
8
  unknownAgesChange,
9
+ toggleFacetExpand,
9
10
  } from '../../store/actions/Actions';
10
11
  // import FacetView from './FacetView';
11
12
  import NewSearchFacetView from './NewSearchFacetView';
@@ -16,6 +17,7 @@ const mapStateToProps = (state, ownProps) => ({
16
17
  searchText: state.statusReducer?.searchState[ownProps.facet.datafield] || '',
17
18
  sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null,
18
19
  unknownAgesState: state?.statusReducer?.unknownAgesState || {},
20
+ expandState: state?.statusReducer?.expandState || {},
19
21
  });
20
22
 
21
23
  const mapDispatchToProps = (dispatch) => ({
@@ -30,6 +32,9 @@ const mapDispatchToProps = (dispatch) => ({
30
32
  onUnknownAgesChange: (datafield, unknownAges) => {
31
33
  dispatch(unknownAgesChange(datafield, unknownAges));
32
34
  },
35
+ onToggleFacetExpand: (datafield, expanded) => {
36
+ dispatch(toggleFacetExpand(datafield, expanded));
37
+ },
33
38
  });
34
39
 
35
40
  export default connect(mapStateToProps, mapDispatchToProps)(ReduxNewSearchFacetView);
@@ -31,8 +31,8 @@ export default () => ({
31
31
  maxHeight: '400px',
32
32
  overflowY: 'auto',
33
33
  overflowX: 'hidden',
34
- borderTop: '2px solid #AEAEAE',
35
- borderBottom: '2px solid #AEAEAE',
34
+ borderTop: '1px solid #AEAEAE',
35
+ borderBottom: '1px solid #AEAEAE',
36
36
  marginRight: '-1px',
37
37
  '&::-webkit-scrollbar': {
38
38
  width: '12px',
@@ -24,10 +24,10 @@ export default () => ({
24
24
  checkboxName: {
25
25
  margin: '0',
26
26
  color: '#000000',
27
- fontSize: '16px',
27
+ fontSize: '15px',
28
28
  fontWeight: 300,
29
29
  marginTop: '1.5px',
30
30
  fontFamily: 'Nunito',
31
- lineHeight: '120%',
31
+ lineHeight: '16px',
32
32
  },
33
33
  });
@@ -162,14 +162,14 @@ const CheckBoxView = ({
162
162
  [`${checkedSection}SubjectChecked`]: isChecked,
163
163
  })}
164
164
  >
165
- {`(${subjects.toLocaleString()})`}
165
+ {`${subjects.toLocaleString()}`}
166
166
  </Typography>
167
167
  </ListItem>
168
168
  <Divider
169
169
  style={{
170
- backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
170
+ backgroundColor: isChecked ? '#AEAEAE' : '#B1B1B1',
171
171
  margin: '0px',
172
- height: isChecked ? '2px' : '1px',
172
+ height: isChecked ? '0.5px' : '0.5px',
173
173
  }}
174
174
  />
175
175
  </>
@@ -162,14 +162,14 @@ const CheckBoxView = ({
162
162
  [`${checkedSection}SubjectChecked`]: isChecked,
163
163
  })}
164
164
  >
165
- {`(${subjects.toLocaleString()})`}
165
+ {`${subjects.toLocaleString()}`}
166
166
  </Typography>
167
167
  </ListItem>
168
168
  <Divider
169
169
  style={{
170
- backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
170
+ backgroundColor: isChecked ? '#AEAEAE' : '#B1B1B1',
171
171
  margin: '0px',
172
- height: isChecked ? '2px' : '1px',
172
+ height: isChecked ? '0.5px' : '0.5px',
173
173
  }}
174
174
  />
175
175
  </>
@@ -1,4 +1,4 @@
1
1
  <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
2
+ <rect width="14" height="14" fill="#477C90"/>
3
3
  <path d="M3 6.52174L4.95652 10L12 2" stroke="white" stroke-width="2"/>
4
4
  </svg>
@@ -10,6 +10,7 @@ export const sideBarActionTypes = {
10
10
  UPDATE_FILTER_STATE: 'UPDATE_FILTER_STATE',
11
11
  TIME_UNIT_CHANGED: 'TIME_UNIT_CHANGED',
12
12
  UNKNOWN_AGES_CHANGED: 'UNKNOWN_AGES_CHANGED',
13
+ TOGGLE_FACET_EXPAND: 'TOGGLE_FACET_EXPAND',
13
14
  };
14
15
 
15
16
  export const Actions = '';
@@ -67,3 +67,11 @@ export const unknownAgesChange = (datafield, unknownAges) => ({
67
67
  unknownAges,
68
68
  },
69
69
  });
70
+
71
+ export const toggleFacetExpand = (datafield, expanded) => ({
72
+ type: sideBarActionTypes.TOGGLE_FACET_EXPAND,
73
+ payload: {
74
+ datafield,
75
+ expanded,
76
+ },
77
+ });
@@ -6,6 +6,7 @@ const initFilterState = {
6
6
  sortState: {},
7
7
  timeUnitState: {},
8
8
  unknownAgesState: {},
9
+ expandState: {}, // Add this line
9
10
  };
10
11
 
11
12
  export const onToggleStateUpdate = ({
@@ -100,6 +101,16 @@ export const onUnknownAgesChange = ({
100
101
  return updatedState;
101
102
  };
102
103
 
104
+ export const onToggleFacetExpand = ({
105
+ datafield,
106
+ expanded,
107
+ expandState,
108
+ }) => {
109
+ const updatedState = { ...expandState };
110
+ updatedState[datafield] = expanded;
111
+ return updatedState;
112
+ };
113
+
103
114
  export function sideBarReducerGenerator() {
104
115
  return {
105
116
  actionTypes: sideBarActionTypes,
@@ -177,6 +188,12 @@ export function sideBarReducerGenerator() {
177
188
  ...state,
178
189
  unknownAgesState: { ...updateState },
179
190
  };
191
+ case sideBarActionTypes.TOGGLE_FACET_EXPAND:
192
+ updateState = onToggleFacetExpand({ ...payload, ...state });
193
+ return {
194
+ ...state,
195
+ expandState: { ...updateState },
196
+ };
180
197
  default:
181
198
  return state;
182
199
  }