@bento-core/facet-filter 1.0.1-popsci.2 → 1.0.1-popsci.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.
@@ -25,7 +25,7 @@ var _default = () => ({
25
25
  sortGroupItem: {
26
26
  cursor: 'pointer',
27
27
  fontFamily: 'Nunito',
28
- fontSize: '10px',
28
+ fontSize: '11px',
29
29
  marginRight: '32px'
30
30
  }
31
31
  });
@@ -46,7 +46,7 @@ var _default = () => ({
46
46
  sortGroupItem: {
47
47
  cursor: 'pointer',
48
48
  fontFamily: 'Nunito',
49
- fontSize: '10px',
49
+ fontSize: '11px',
50
50
  marginRight: '32px'
51
51
  },
52
52
  NonSortGroup: {
@@ -57,25 +57,25 @@ var _default = () => ({
57
57
  },
58
58
  NonSortGroupItem: {
59
59
  fontFamily: 'Nunito',
60
- fontSize: '10px',
60
+ fontSize: '11px',
61
61
  marginRight: '32px'
62
62
  },
63
63
  sortGroupItemCounts: {
64
64
  cursor: 'pointer',
65
65
  fontFamily: 'Nunito',
66
- fontSize: '10px',
66
+ fontSize: '11px',
67
67
  float: 'right',
68
68
  marginRight: '10px',
69
69
  marginTop: '5px'
70
70
  },
71
71
  highlight: {
72
- color: '#b2c6d6'
72
+ color: '#537A9D'
73
73
  },
74
74
  showMore: {
75
75
  textAlign: 'right',
76
76
  paddingRight: '5px',
77
77
  cursor: 'pointer',
78
- fontSize: '10px',
78
+ fontSize: '11px',
79
79
  width: '100%'
80
80
  }
81
81
  });
@@ -35,7 +35,7 @@ const FacetView = _ref => {
35
35
  const onExpandFacet = () => setExpand(!expand);
36
36
 
37
37
  /**
38
- * expand section incase of active local search
38
+ * Expand section incase of active local search
39
39
  */
40
40
  (0, _react.useEffect)(() => {
41
41
  if (autoComplete && autoComplete.length > 0 || upload && upload.length > 0) {
@@ -8,6 +8,12 @@ var _default = () => ({
8
8
  listItemGutters: {
9
9
  padding: '10px 20px 10px 0px'
10
10
  },
11
+ listItemRoot: {
12
+ cursor: 'pointer',
13
+ '&:hover': {
14
+ backgroundColor: 'rgba(0, 0, 0, 0.04)'
15
+ }
16
+ },
11
17
  checkboxRoot: {
12
18
  marginLeft: '5px',
13
19
  height: 12
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _styles = require("@material-ui/core/styles");
9
9
  var _core = require("@material-ui/core");
10
+ var _TouchRipple = _interopRequireDefault(require("@material-ui/core/ButtonBase/TouchRipple"));
10
11
  var _clsx = _interopRequireDefault(require("clsx"));
11
12
  var _icons = require("@material-ui/icons");
12
13
  var _CheckboxStyle = _interopRequireDefault(require("./CheckboxStyle"));
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
17
  /* eslint-disable no-unused-vars */
15
18
  /* eslint-disable no-unused-vars */
16
19
  /* eslint-disable react/jsx-wrap-multilines */
@@ -18,8 +21,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
21
  /* eslint-disable object-curly-newline */
19
22
  /* eslint-disable object-shorthand */
20
23
  /* eslint-disable react/jsx-one-expression-per-line */
24
+ /* eslint-disable no-useless-escape */
21
25
 
22
- const alignment = 'flex-start';
23
26
  const CheckBoxView = _ref => {
24
27
  let {
25
28
  classes,
@@ -39,6 +42,18 @@ const CheckBoxView = _ref => {
39
42
  } = checkboxItem;
40
43
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
41
44
  const checkedSection = "".concat(section).toLowerCase().replace(' ', '_');
45
+ const checkboxId = "checkbox_".concat(facet.label, "_").concat(name);
46
+ const rippleRef = (0, _react.useRef)(null);
47
+ const handleRippleStart = event => {
48
+ if (rippleRef.current) {
49
+ rippleRef.current.start(event);
50
+ }
51
+ };
52
+ const handleRippleStop = event => {
53
+ if (rippleRef.current) {
54
+ rippleRef.current.stop(event);
55
+ }
56
+ };
42
57
  const handleToggle = () => {
43
58
  const toggleCheckBoxItem = {
44
59
  name: name,
@@ -59,24 +74,33 @@ const CheckBoxView = _ref => {
59
74
  className: classes.checkboxName
60
75
  }, name));
61
76
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.ListItem, {
77
+ component: "div",
62
78
  width: 1,
63
- button: true,
64
79
  alignItems: "flex-start",
65
80
  onClick: handleToggle,
81
+ onMouseDown: handleRippleStart,
82
+ onMouseUp: handleRippleStop,
83
+ onMouseLeave: handleRippleStop,
66
84
  classes: {
67
- gutters: classes.listItemGutters
85
+ gutters: classes.listItemGutters,
86
+ root: classes.listItemRoot
68
87
  },
69
88
  className: (0, _clsx.default)({
70
89
  ["".concat(checkedSection, "Checked").concat(indexType)]: isChecked
71
90
  })
72
91
  }, /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
73
- id: "checkbox_".concat(facet.label, "_").concat(name),
92
+ id: checkboxId,
74
93
  icon: /*#__PURE__*/_react.default.createElement(_icons.CheckBoxOutlineBlank, {
75
94
  style: {
76
95
  fontSize: 18
77
- }
96
+ },
97
+ className: checkedSection
78
98
  }),
79
- onClick: handleToggle,
99
+ inputProps: {
100
+ 'aria-label': 'checkbox',
101
+ tabIndex: -1,
102
+ 'aria-hidden': true
103
+ },
80
104
  checked: isChecked,
81
105
  checkedIcon: /*#__PURE__*/_react.default.createElement(_icons.CheckBox, {
82
106
  style: {
@@ -88,18 +112,26 @@ const CheckBoxView = _ref => {
88
112
  color: "secondary",
89
113
  classes: {
90
114
  root: classes.checkboxRoot
115
+ },
116
+ style: {
117
+ pointerEvents: 'none'
91
118
  }
92
119
  }), tooltip ? /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
93
120
  id: datafield,
94
121
  title: tooltip
95
122
  }, /*#__PURE__*/_react.default.createElement("div", {
96
123
  className: datafield
97
- }, /*#__PURE__*/_react.default.createElement(LabelComponent, null))) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, null), /*#__PURE__*/_react.default.createElement(_core.Typography, {
124
+ }, /*#__PURE__*/_react.default.createElement(LabelComponent, null))) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
125
+ className: "".concat(checkedSection, "_md_space")
126
+ }), /*#__PURE__*/_react.default.createElement(_core.Typography, {
98
127
  className: (0, _clsx.default)("".concat(checkedSection, "Subjects"), {
99
128
  ["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
100
129
  ["".concat(checkedSection, "SubjectChecked")]: isChecked
101
130
  })
102
- }, "(".concat(subjects, ")"))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
131
+ }, "(".concat(subjects, ")")), /*#__PURE__*/_react.default.createElement(_TouchRipple.default, {
132
+ ref: rippleRef,
133
+ center: true
134
+ })), /*#__PURE__*/_react.default.createElement(_core.Divider, {
103
135
  style: {
104
136
  backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
105
137
  margin: '0px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-popsci.2",
3
+ "version": "1.0.1-popsci.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,5 +25,5 @@
25
25
  },
26
26
  "author": "CTOS Bento Team",
27
27
  "license": "ISC",
28
- "gitHead": "5c65b1486cf1962dce93f6e71019e6079d82a4ba"
28
+ "gitHead": "01a57a616fd8d9cc6ffca70907b17b16a1dc369f"
29
29
  }
@@ -19,7 +19,7 @@ export default () => ({
19
19
  sortGroupItem: {
20
20
  cursor: 'pointer',
21
21
  fontFamily: 'Nunito',
22
- fontSize: '10px',
22
+ fontSize: '11px',
23
23
  marginRight: '32px',
24
24
  },
25
25
  });
@@ -40,7 +40,7 @@ export default () => ({
40
40
  sortGroupItem: {
41
41
  cursor: 'pointer',
42
42
  fontFamily: 'Nunito',
43
- fontSize: '10px',
43
+ fontSize: '11px',
44
44
  marginRight: '32px',
45
45
  },
46
46
  NonSortGroup: {
@@ -51,25 +51,25 @@ export default () => ({
51
51
  },
52
52
  NonSortGroupItem: {
53
53
  fontFamily: 'Nunito',
54
- fontSize: '10px',
54
+ fontSize: '11px',
55
55
  marginRight: '32px',
56
56
  },
57
57
  sortGroupItemCounts: {
58
58
  cursor: 'pointer',
59
59
  fontFamily: 'Nunito',
60
- fontSize: '10px',
60
+ fontSize: '11px',
61
61
  float: 'right',
62
62
  marginRight: '10px',
63
63
  marginTop: '5px',
64
64
  },
65
65
  highlight: {
66
- color: '#b2c6d6',
66
+ color: '#537A9D',
67
67
  },
68
68
  showMore: {
69
69
  textAlign: 'right',
70
70
  paddingRight: '5px',
71
71
  cursor: 'pointer',
72
- fontSize: '10px',
72
+ fontSize: '11px',
73
73
  width: '100%',
74
74
  },
75
75
  });
@@ -2,6 +2,12 @@ export default () => ({
2
2
  listItemGutters: {
3
3
  padding: '10px 20px 10px 0px',
4
4
  },
5
+ listItemRoot: {
6
+ cursor: 'pointer',
7
+ '&:hover': {
8
+ backgroundColor: 'rgba(0, 0, 0, 0.04)',
9
+ },
10
+ },
5
11
  checkboxRoot: {
6
12
  marginLeft: '5px',
7
13
  height: 12,
@@ -5,7 +5,9 @@
5
5
  /* eslint-disable object-curly-newline */
6
6
  /* eslint-disable object-shorthand */
7
7
  /* eslint-disable react/jsx-one-expression-per-line */
8
- import React from 'react';
8
+ /* eslint-disable no-useless-escape */
9
+
10
+ import React, { useRef } from 'react';
9
11
  import { withStyles } from '@material-ui/core/styles';
10
12
  import {
11
13
  Checkbox,
@@ -15,15 +17,15 @@ import {
15
17
  Tooltip,
16
18
  Box,
17
19
  Typography,
20
+ ButtonBase,
18
21
  } from '@material-ui/core';
22
+ import TouchRipple from '@material-ui/core/ButtonBase/TouchRipple';
19
23
  import clsx from 'clsx';
20
24
  import {
21
25
  CheckBox as CheckBoxIcon, CheckBoxOutlineBlank as CheckBoxBlankIcon,
22
26
  } from '@material-ui/icons';
23
27
  import styles from './CheckboxStyle';
24
28
 
25
- const alignment = 'flex-start';
26
-
27
29
  const CheckBoxView = ({
28
30
  classes,
29
31
  checkboxItem,
@@ -42,6 +44,20 @@ const CheckBoxView = ({
42
44
  } = checkboxItem;
43
45
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
44
46
  const checkedSection = `${section}`.toLowerCase().replace(' ', '_');
47
+ const checkboxId = `checkbox_${facet.label}_${name}`;
48
+ const rippleRef = useRef(null);
49
+
50
+ const handleRippleStart = (event) => {
51
+ if (rippleRef.current) {
52
+ rippleRef.current.start(event);
53
+ }
54
+ };
55
+
56
+ const handleRippleStop = (event) => {
57
+ if (rippleRef.current) {
58
+ rippleRef.current.stop(event);
59
+ }
60
+ };
45
61
 
46
62
  const handleToggle = () => {
47
63
  const toggleCheckBoxItem = {
@@ -68,57 +84,63 @@ const CheckBoxView = ({
68
84
 
69
85
  return (
70
86
  <>
71
- <ListItem
72
- width={1}
73
- button
74
- alignItems="flex-start"
75
- onClick={handleToggle}
76
- classes={{ gutters: classes.listItemGutters }}
77
- className={clsx({ [`${checkedSection}Checked${indexType}`]: isChecked })}
78
- >
79
- <Checkbox
80
- id={`checkbox_${facet.label}_${name}`}
81
- icon={<CheckBoxBlankIcon style={{ fontSize: 18 }} />}
87
+ <ListItem
88
+ component="div"
89
+ width={1}
90
+ alignItems="flex-start"
82
91
  onClick={handleToggle}
83
- checked={isChecked}
84
- checkedIcon={(
85
- <CheckBoxIcon
86
- style={{
87
- fontSize: 18,
88
- }}
89
- className={`${checkedSection}CheckedIcon`}
90
- />
92
+ onMouseDown={handleRippleStart}
93
+ onMouseUp={handleRippleStop}
94
+ onMouseLeave={handleRippleStop}
95
+ classes={{ gutters: classes.listItemGutters, root: classes.listItemRoot }}
96
+ className={clsx({ [`${checkedSection}Checked${indexType}`]: isChecked })}
97
+ >
98
+ <Checkbox
99
+ id={checkboxId}
100
+ icon={(<CheckBoxBlankIcon style={{ fontSize: 18 }} className={checkedSection} />
101
+ )}
102
+ inputProps={{ 'aria-label': 'checkbox', tabIndex: -1, 'aria-hidden': true }}
103
+ checked={isChecked}
104
+ checkedIcon={(
105
+ <CheckBoxIcon
106
+ style={{
107
+ fontSize: 18,
108
+ }}
109
+ className={`${checkedSection}CheckedIcon`}
110
+ />
111
+ )}
112
+ disableRipple
113
+ color="secondary"
114
+ classes={{ root: classes.checkboxRoot }}
115
+ style={{ pointerEvents: 'none' }}
116
+ />
117
+ { tooltip ? (
118
+ <Tooltip id={datafield} title={tooltip}>
119
+ <div className={datafield}>
120
+ <LabelComponent />
121
+ </div>
122
+ </Tooltip>
123
+ ) : (
124
+ <LabelComponent />
91
125
  )}
92
- disableRipple
93
- color="secondary"
94
- classes={{ root: classes.checkboxRoot }}
126
+ <ListItemText className={`${checkedSection}_md_space`} />
127
+ <Typography
128
+ className={clsx(`${checkedSection}Subjects`, {
129
+ [`${checkedSection}SubjectUnChecked`]: !isChecked,
130
+ [`${checkedSection}SubjectChecked`]: isChecked,
131
+ })}
132
+ >
133
+ {`(${subjects})`}
134
+ </Typography>
135
+ <TouchRipple ref={rippleRef} center />
136
+ </ListItem>
137
+ <Divider
138
+ style={{
139
+ backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
140
+ margin: '0px',
141
+ height: isChecked ? '2px' : '1px',
142
+ }}
95
143
  />
96
- { tooltip ? (
97
- <Tooltip id={datafield} title={tooltip}>
98
- <div className={datafield}>
99
- <LabelComponent />
100
- </div>
101
- </Tooltip>
102
- ) : (
103
- <LabelComponent />
104
- )}
105
- <ListItemText />
106
- <Typography
107
- className={clsx(`${checkedSection}Subjects`, {
108
- [`${checkedSection}SubjectUnChecked`]: !isChecked,
109
- [`${checkedSection}SubjectChecked`]: isChecked,
110
- })}
111
- >
112
- {`(${subjects})`}
113
- </Typography>
114
- </ListItem>
115
- <Divider
116
- style={{
117
- backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
118
- margin: '0px',
119
- height: isChecked ? '2px' : '1px',
120
- }}
121
- />
122
144
  </>
123
145
  );
124
146
  };