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