@bento-core/facet-filter 1.0.1-ccdihub.2 → 1.0.1-ccdihub.4

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.
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
- var _SliderStyle = _interopRequireDefault(require("./SliderStyle"));
10
9
  var _Types = require("../Types");
11
10
  var _InputMinMaxView = _interopRequireDefault(require("./InputMinMaxView"));
12
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -29,11 +28,11 @@ const SliderView = _ref => {
29
28
  maxUpperBound,
30
29
  quantifier,
31
30
  datafield,
32
- facetValues,
33
- style
31
+ facetValues
34
32
  } = facet;
35
33
  const lowerBoundValue = facetValues[0];
36
34
  const upperBoundValue = facetValues[1];
35
+ console.log(facet);
37
36
 
38
37
  // Determines whether the lower bound and upper bound values are valid
39
38
  const isValid = () => {
@@ -62,13 +61,13 @@ const SliderView = _ref => {
62
61
  };
63
62
  const valuetext = value => "".concat(value);
64
63
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
65
- className: style && style.sliderRoot ? style.sliderRoot : classes.sliderRoot
64
+ className: classes.sliderRoot
66
65
  }, /*#__PURE__*/_react.default.createElement("div", {
67
- className: style && style.minMaxInputs ? style.minMaxInputs : classes.minMaxInputs
66
+ className: classes.minMaxInputs
68
67
  }, /*#__PURE__*/_react.default.createElement("div", {
69
- className: style && style.minValue ? style.minValue : classes.minValue
68
+ className: classes.minValue
70
69
  }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
71
- className: style && style.minInputLabel ? style.minInputLabel : classes.minInputLabel
70
+ className: classes.minInputLabel
72
71
  }, "Min:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
73
72
  lowerBoundVal: sliderValue[0],
74
73
  upperBoundVal: sliderValue[1],
@@ -77,9 +76,9 @@ const SliderView = _ref => {
77
76
  type: _Types.silderTypes.INPUT_MIN,
78
77
  onInputChange: handleChangeCommittedSlider
79
78
  })), /*#__PURE__*/_react.default.createElement("div", {
80
- className: style && style.maxValue ? style.maxValue : classes.maxValue
79
+ className: classes.maxValue
81
80
  }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
82
- className: style && style.maxInputLabel ? style.maxInputLabel : classes.maxInputLabel
81
+ className: classes.maxInputLabel
83
82
  }, "Max:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
84
83
  lowerBoundVal: sliderValue[0],
85
84
  upperBoundVal: sliderValue[1],
@@ -88,7 +87,7 @@ const SliderView = _ref => {
88
87
  type: _Types.silderTypes.INPUT_MAX,
89
88
  onInputChange: handleChangeCommittedSlider
90
89
  }))), /*#__PURE__*/_react.default.createElement("div", {
91
- className: style && style.slider ? style.slider : classes.slider
90
+ className: classes.slider
92
91
  }, /*#__PURE__*/_react.default.createElement(_core.Slider, {
93
92
  disableSwap: true,
94
93
  getAriaValueText: valuetext,
@@ -99,19 +98,136 @@ const SliderView = _ref => {
99
98
  min: minLowerBound,
100
99
  max: maxUpperBound,
101
100
  classes: {
102
- rail: style && style.rail ? style.rail : classes.rail,
103
- thumb: isValid() ? style && style.thumb ? style.thumb : classes.thumb : style && style.invalidThumb ? style.invalidThumb : classes.invalidThumb,
104
- track: isValid() ? style && style.track ? style.track : classes.track : style && style.invalidTrack ? style.invalidTrack : classes.invalidTrack
101
+ rail: classes.rail,
102
+ thumb: isValid() ? classes.thumb : classes.invalidThumb,
103
+ track: isValid() ? classes.track : classes.invalidTrack
105
104
  }
106
105
  })), /*#__PURE__*/_react.default.createElement(_core.Box, {
107
- className: style && style.lowerUpperBound ? style.lowerUpperBound : classes.lowerUpperBound
106
+ className: classes.lowerUpperBound
108
107
  }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
109
- className: style && style.lowerBound ? style.lowerBound : classes.lowerBound
108
+ className: classes.lowerBound
110
109
  }, minLowerBound), /*#__PURE__*/_react.default.createElement(_core.Typography, {
111
- className: style && style.upperBound ? style.upperBound : classes.upperBound
110
+ className: classes.upperBound
112
111
  }, maxUpperBound))), (sliderValue[0] > minLowerBound || sliderValue[1] < maxUpperBound) && /*#__PURE__*/_react.default.createElement(_core.Typography, {
113
- className: isValid() ? style && style.sliderText ? style.sliderText : classes.sliderText : style && style.invalidSliderText ? style.invalidSliderText : classes.invalidSliderText
112
+ className: isValid() ? classes.sliderText : classes.invalidSliderText
114
113
  }, sliderValue[0], ' - ', sliderValue[1], "\xA0", quantifier));
115
114
  };
116
- var _default = (0, _core.withStyles)(_SliderStyle.default)(SliderView);
115
+ const styles = () => ({
116
+ sliderRoot: props => props.facet.style && props.facet.style.sliderRoot ? props.facet.style.sliderRoot : {
117
+ marginTop: '10px',
118
+ marginLeft: '20px',
119
+ marginRight: 'Auto',
120
+ paddingRight: '20px'
121
+ },
122
+ minValue: props => ({
123
+ fontFamily: 'Nunito',
124
+ fontSize: '15px',
125
+ color: '#000000',
126
+ marginBottom: '0px',
127
+ float: 'left',
128
+ width: '75px',
129
+ display: 'flex'
130
+ }),
131
+ maxValue: props => ({
132
+ fontFamily: 'Nunito',
133
+ fontSize: '15px',
134
+ color: '#000000',
135
+ float: 'right',
136
+ marginBottom: '0px',
137
+ display: 'flex'
138
+ }),
139
+ rail: props => ({
140
+ borderRadius: 4,
141
+ height: 6,
142
+ background: '#142D64'
143
+ }),
144
+ minInputLabel: props => ({
145
+ float: 'left',
146
+ lineHeight: '34px',
147
+ marginRight: '5px'
148
+ }),
149
+ maxInputLabel: props => ({
150
+ float: 'left',
151
+ lineHeight: '34px',
152
+ marginRight: '5px'
153
+ }),
154
+ thumb: props => ({
155
+ height: 16,
156
+ width: 16,
157
+ background: '#10A075'
158
+ }),
159
+ invalidThumb: props => ({
160
+ height: 16,
161
+ width: 16,
162
+ background: '#F44336'
163
+ }),
164
+ track: props => ({
165
+ borderRadius: 4,
166
+ height: 6,
167
+ background: '#10A075',
168
+ '&~&': {
169
+ background: '#142D64'
170
+ }
171
+ }),
172
+ invalidTrack: props => ({
173
+ borderRadius: 4,
174
+ height: 6,
175
+ background: '#F44336',
176
+ '&~&': {
177
+ background: '#142D64'
178
+ }
179
+ }),
180
+ upperBound: props => ({
181
+ fontFamily: 'Nunito',
182
+ fontSize: '10px',
183
+ color: '#000000',
184
+ float: 'right',
185
+ marginLeft: 'Auto',
186
+ marginRight: 'Auto',
187
+ marginBottom: '15px'
188
+ }),
189
+ lowerBound: props => ({
190
+ fontFamily: 'Nunito',
191
+ fontSize: '10px',
192
+ color: '#000000',
193
+ float: 'left',
194
+ marginLeft: 'Auto',
195
+ marginRight: 'Auto',
196
+ marginBottom: '15px'
197
+ }),
198
+ sliderText: props => ({
199
+ color: '#10a075',
200
+ lineHeight: '120%',
201
+ fontFamily: 'Nunito',
202
+ fontSize: '14px',
203
+ padding: '5px 15px 5px 0px',
204
+ width: '100%',
205
+ textAlign: 'right',
206
+ background: '#f5fdee',
207
+ marginTop: '10px'
208
+ }),
209
+ invalidSliderText: props => ({
210
+ color: '#D32F2F',
211
+ lineHeight: '120%',
212
+ fontFamily: 'Nunito',
213
+ fontSize: '14px',
214
+ padding: '5px 15px 5px 0px',
215
+ width: '100%',
216
+ textAlign: 'right',
217
+ background: '#E57373',
218
+ marginTop: '10px'
219
+ }),
220
+ sliderListItem: props => ({
221
+ height: '15px'
222
+ }),
223
+ listItemGutters: props => ({
224
+ display: 'flex',
225
+ justifyContent: 'space-between',
226
+ padding: '2px 5px 2px 8px'
227
+ }),
228
+ lowerUpperBound: props => ({
229
+ height: '15px'
230
+ })
231
+ });
232
+ var _default = (0, _core.withStyles)(styles)(SliderView);
117
233
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-ccdihub.2",
3
+ "version": "1.0.1-ccdihub.4",
4
4
  "description": "### Bento core sidebar design:",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable object-curly-newline */
5
5
  import React, { useEffect, useState } from 'react';
6
6
  import { withStyles, Slider, Typography, Box } from '@material-ui/core';
7
- import styles from './SliderStyle';
7
+ // import styles from './SliderStyle';
8
8
  import { silderTypes } from '../Types';
9
9
  import InputMinMaxView from './InputMinMaxView';
10
10
 
@@ -14,10 +14,12 @@ const SliderView = ({
14
14
  onSliderToggle,
15
15
  filterState,
16
16
  }) => {
17
- const { minLowerBound, maxUpperBound, quantifier, datafield, facetValues, style } = facet;
17
+ const { minLowerBound, maxUpperBound, quantifier, datafield, facetValues } = facet;
18
18
  const lowerBoundValue = facetValues[0];
19
19
  const upperBoundValue = facetValues[1];
20
20
 
21
+ console.log(facet);
22
+
21
23
  // Determines whether the lower bound and upper bound values are valid
22
24
  const isValid = () => {
23
25
  const checks = [
@@ -52,13 +54,10 @@ const SliderView = ({
52
54
 
53
55
  return (
54
56
  <>
55
- <div className={style && style.sliderRoot ? style.sliderRoot : classes.sliderRoot}>
56
- <div className={style && style.minMaxInputs ? style.minMaxInputs : classes.minMaxInputs}>
57
- <div className={style && style.minValue ? style.minValue : classes.minValue}>
58
- <Typography className={style && style.minInputLabel
59
- ? style.minInputLabel
60
- : classes.minInputLabel}
61
- >
57
+ <div className={classes.sliderRoot}>
58
+ <div className={classes.minMaxInputs}>
59
+ <div className={classes.minValue}>
60
+ <Typography className={classes.minInputLabel}>
62
61
  Min:
63
62
  </Typography>
64
63
  <InputMinMaxView
@@ -70,11 +69,8 @@ const SliderView = ({
70
69
  onInputChange={handleChangeCommittedSlider}
71
70
  />
72
71
  </div>
73
- <div className={style && style.maxValue ? style.maxValue : classes.maxValue}>
74
- <Typography className={style && style.maxInputLabel
75
- ? style.maxInputLabel
76
- : classes.maxInputLabel}
77
- >
72
+ <div className={classes.maxValue}>
73
+ <Typography className={classes.maxInputLabel}>
78
74
  Max:
79
75
  </Typography>
80
76
  <InputMinMaxView
@@ -87,7 +83,7 @@ const SliderView = ({
87
83
  />
88
84
  </div>
89
85
  </div>
90
- <div className={style && style.slider ? style.slider : classes.slider}>
86
+ <div className={classes.slider}>
91
87
  {/* Change to red if invalid range */}
92
88
  <Slider
93
89
  disableSwap
@@ -99,28 +95,17 @@ const SliderView = ({
99
95
  min={minLowerBound}
100
96
  max={maxUpperBound}
101
97
  classes={{
102
- rail: style && style.rail ? style.rail : classes.rail,
103
- thumb: isValid() ? (style && style.thumb ? style.thumb : classes.thumb)
104
- : (style && style.invalidThumb ? style.invalidThumb : classes.invalidThumb),
105
- track: isValid() ? (style && style.track ? style.track : classes.track)
106
- : (style && style.invalidTrack ? style.invalidTrack : classes.invalidTrack),
98
+ rail: classes.rail,
99
+ thumb: isValid() ? classes.thumb : classes.invalidThumb,
100
+ track: isValid() ? classes.track : classes.invalidTrack,
107
101
  }}
108
102
  />
109
103
  </div>
110
- <Box className={style && style.lowerUpperBound
111
- ? style.lowerUpperBound
112
- : classes.lowerUpperBound}
113
- >
114
- <Typography className={style && style.lowerBound
115
- ? style.lowerBound
116
- : classes.lowerBound}
117
- >
104
+ <Box className={classes.lowerUpperBound}>
105
+ <Typography className={classes.lowerBound}>
118
106
  {minLowerBound}
119
107
  </Typography>
120
- <Typography className={style && style.upperBound
121
- ? style.upperBound
122
- : classes.upperBound}
123
- >
108
+ <Typography className={classes.upperBound}>
124
109
  {maxUpperBound}
125
110
  </Typography>
126
111
  </Box>
@@ -130,11 +115,7 @@ const SliderView = ({
130
115
  (sliderValue[0] > minLowerBound || sliderValue[1] < maxUpperBound)
131
116
  && (
132
117
  <Typography
133
- className={isValid()
134
- ? (style && style.sliderText ? style.sliderText : classes.sliderText)
135
- : (style && style.invalidSliderText
136
- ? style.invalidSliderText
137
- : classes.invalidSliderText)}
118
+ className={isValid() ? classes.sliderText : classes.invalidSliderText}
138
119
  >
139
120
  {sliderValue[0]}
140
121
  {' - '}
@@ -148,4 +129,124 @@ const SliderView = ({
148
129
  );
149
130
  };
150
131
 
132
+ const styles = () => ({
133
+ sliderRoot: (props) => (props.facet.style && props.facet.style.sliderRoot
134
+ ? props.facet.style.sliderRoot
135
+ : {
136
+ marginTop: '10px',
137
+ marginLeft: '20px',
138
+ marginRight: 'Auto',
139
+ paddingRight: '20px',
140
+ }),
141
+ minValue: (props) => ({
142
+ fontFamily: 'Nunito',
143
+ fontSize: '15px',
144
+ color: '#000000',
145
+ marginBottom: '0px',
146
+ float: 'left',
147
+ width: '75px',
148
+ display: 'flex',
149
+ }),
150
+ maxValue: (props) => ({
151
+ fontFamily: 'Nunito',
152
+ fontSize: '15px',
153
+ color: '#000000',
154
+ float: 'right',
155
+ marginBottom: '0px',
156
+ display: 'flex',
157
+ }),
158
+ rail: (props) => ({
159
+ borderRadius: 4,
160
+ height: 6,
161
+ background: '#142D64',
162
+ }),
163
+ minInputLabel: (props) => ({
164
+ float: 'left',
165
+ lineHeight: '34px',
166
+ marginRight: '5px',
167
+ }),
168
+ maxInputLabel: (props) => ({
169
+ float: 'left',
170
+ lineHeight: '34px',
171
+ marginRight: '5px',
172
+ }),
173
+ thumb: (props) => ({
174
+ height: 16,
175
+ width: 16,
176
+ background: '#10A075',
177
+ }),
178
+ invalidThumb: (props) => ({
179
+ height: 16,
180
+ width: 16,
181
+ background: '#F44336',
182
+ }),
183
+ track: (props) => ({
184
+ borderRadius: 4,
185
+ height: 6,
186
+ background: '#10A075',
187
+ '&~&': {
188
+ background: '#142D64',
189
+ },
190
+ }),
191
+ invalidTrack: (props) => ({
192
+ borderRadius: 4,
193
+ height: 6,
194
+ background: '#F44336',
195
+ '&~&': {
196
+ background: '#142D64',
197
+ },
198
+ }),
199
+ upperBound: (props) => ({
200
+ fontFamily: 'Nunito',
201
+ fontSize: '10px',
202
+ color: '#000000',
203
+ float: 'right',
204
+ marginLeft: 'Auto',
205
+ marginRight: 'Auto',
206
+ marginBottom: '15px',
207
+ }),
208
+ lowerBound: (props) => ({
209
+ fontFamily: 'Nunito',
210
+ fontSize: '10px',
211
+ color: '#000000',
212
+ float: 'left',
213
+ marginLeft: 'Auto',
214
+ marginRight: 'Auto',
215
+ marginBottom: '15px',
216
+ }),
217
+ sliderText: (props) => ({
218
+ color: '#10a075',
219
+ lineHeight: '120%',
220
+ fontFamily: 'Nunito',
221
+ fontSize: '14px',
222
+ padding: '5px 15px 5px 0px',
223
+ width: '100%',
224
+ textAlign: 'right',
225
+ background: '#f5fdee',
226
+ marginTop: '10px',
227
+ }),
228
+ invalidSliderText: (props) => ({
229
+ color: '#D32F2F',
230
+ lineHeight: '120%',
231
+ fontFamily: 'Nunito',
232
+ fontSize: '14px',
233
+ padding: '5px 15px 5px 0px',
234
+ width: '100%',
235
+ textAlign: 'right',
236
+ background: '#E57373',
237
+ marginTop: '10px',
238
+ }),
239
+ sliderListItem: (props) => ({
240
+ height: '15px',
241
+ }),
242
+ listItemGutters: (props) => ({
243
+ display: 'flex',
244
+ justifyContent: 'space-between',
245
+ padding: '2px 5px 2px 8px',
246
+ }),
247
+ lowerUpperBound: (props) => ({
248
+ height: '15px',
249
+ }),
250
+ });
251
+
151
252
  export default withStyles(styles)(SliderView);