Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/js/components/RangeSliderControlled/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class SliderControlled extends Component {
wrapperStyle={styles.slider}
trackStyle={styles.trackStyle}
highlightedTrackStyle={styles.highlightedTrackStyle}
highlightedTrackStyle2={styles.highlightedTrackStyle2}
handleStyle={styles.handleStyle}
hoveredHandleStyle={styles.hoveredHandleStyle}
focusedHandleStyle={styles.focusedHandleStyle}
Expand All @@ -64,6 +65,7 @@ export default class SliderControlled extends Component {
'wrapperStyle={styles.slider}\n ' +
'trackStyle={styles.trackStyle}\n ' +
'highlightedTrackStyle={styles.highlightedTrackStyle}\n ' +
'highlightedTrackClassName2={styles.sliderHighlightedTrack2}\n ' +
'handleStyle={styles.handleStyle}\n ' +
'hoveredHandleStyle={styles.hoveredHandleStyle}\n ' +
'focusedHandleStyle={styles.focusedHandleStyle}\n ' +
Expand Down
6 changes: 6 additions & 0 deletions docs/js/components/RangeSliderControlled/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export default {
backgroundColor: 'grey',
top: 14,
},
highlightedTrackStyle2: {
height: 5,
border: '3px solid black',
backgroundColor: 'red',
top: 14,
},
handleStyle: {
height: 30,
width: 30,
Expand Down
4 changes: 4 additions & 0 deletions docs/js/components/RangeSliderReadOnly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default class SliderDisabled extends Component {
readOnly
defaultValue={value}
onChange={this.onChange}
highlightedTrackStyle={styles.highlightedTrackStyle}
highlightedTrackStyle2={styles.highlightedTrackStyle2}
/>
</div>
<div>
Expand All @@ -55,6 +57,8 @@ export default class SliderDisabled extends Component {
'step={2}\n ' +
'readOnly\n ' +
'defaultValue={value}\n ' +
'highlightedTrackClassName={styles.sliderHighlightedTrack}\n ' +
'highlightedTrackClassName2={styles.sliderHighlightedTrack2}\n ' +
'onChange={this.onChange}\n' +
'/>'
}
Expand Down
6 changes: 6 additions & 0 deletions docs/js/components/RangeSliderReadOnly/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
background-color: #dafbda !important;
top: 12px !important;
}
.sliderHighlightedTrack2 {
height: 5px !important;
border: 1px solid red !important;
background-color: #dafbda !important;
top: 12px !important;
}
.sliderHandle {
height: 30px !important;
width: 30px !important;
Expand Down
2 changes: 2 additions & 0 deletions docs/js/components/RangeSliderUncontrolled/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class SliderUncontrolled extends Component {
wrapperClassName={styles.slider}
trackClassName={styles.sliderTrack}
highlightedTrackClassName={styles.sliderHighlightedTrack}
highlightedTrackClassName2={styles.sliderHighlightedTrack2}
handleClassName={styles.sliderHandle}
/>
</div>
Expand All @@ -49,6 +50,7 @@ export default class SliderUncontrolled extends Component {
value={'<RangeSlider\n step={2}\n onChange={this.onChange}\n ' +
'wrapperClassName={styles.slider}\n ' +
'highlightedTrackClassName={styles.sliderHighlightedTrack}\n ' +
'highlightedTrackClassName2={styles.sliderHighlightedTrack2}\n ' +
'trackClassName={styles.sliderTrack}\n handleClassName={styles.sliderHandle}\n/>'}
options={{
lineNumbers: true,
Expand Down
6 changes: 6 additions & 0 deletions docs/js/components/RangeSliderUncontrolled/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
background-color: #dafbda !important;
top: 12px !important;
}
.sliderHighlightedTrack2 {
height: 5px !important;
border: 1px solid #31da31 !important;
background-color: #dafbda !important;
top: 12px !important;
}
.sliderHandle {
height: 30px !important;
width: 30px !important;
Expand Down
Binary file added js/.DS_Store
Binary file not shown.
Binary file modified js/components/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion js/components/Handle/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { injectStyle, removeStyle, calculateStyle, getMousePosition } from '../../utils/handle';
import { notSimilar } from '../../utils/common';
import styles from './styles';
Expand Down
3 changes: 1 addition & 2 deletions js/components/Handle/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default {
width: 30,
backgroundColor: '#2771e2',
border: '1px solid #052350',
borderRadius: '50%',
outline: 'none !important',
},
handleVertical: {
Expand All @@ -19,7 +18,7 @@ export default {
left: 0,
backgroundColor: '#2771e2',
border: '1px solid #052350',
borderRadius: '50%',

outline: 'none !important',
},
focusedHandle: {
Expand Down
3 changes: 2 additions & 1 deletion js/components/HighlightedTrack/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { notSimilar } from '../../utils/common';
import styles from './styles';

Expand Down
4 changes: 2 additions & 2 deletions js/components/HighlightedTrack/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {
width: '100%',
top: 13,
height: 4,
backgroundColor: '#99c1ff',
border: '1px solid #2771e2',
backgroundColor: '#00FA9A',

},
highlightedTrackVertical: {
position: 'absolute',
Expand Down
Binary file added js/components/RangeSlider/.DS_Store
Binary file not shown.
20 changes: 17 additions & 3 deletions js/components/RangeSlider/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Track from '../Track';
import HighlightedTrack from '../HighlightedTrack';
import Handle from '../Handle';
Expand Down Expand Up @@ -36,13 +37,15 @@ export default class RangeSlider extends Component {
trackClassName: PropTypes.string,
disabledTrackClassName: PropTypes.string,
highlightedTrackClassName: PropTypes.string,
highlightedTrackClassName2: PropTypes.string,
disabledHighlightedTrackClassName: PropTypes.string,
handleClassName: PropTypes.string,
disabledHandleClassName: PropTypes.string,
wrapperStyle: PropTypes.object,
trackStyle: PropTypes.object,
disabledTrackStyle: PropTypes.object,
highlightedTrackStyle: PropTypes.object,
highlightedTrackStyle2: PropTypes.object,
disabledHighlightedTrackStyle: PropTypes.object,
handleStyle: PropTypes.object,
focusedHandleStyle: PropTypes.object,
Expand Down Expand Up @@ -297,6 +300,7 @@ export default class RangeSlider extends Component {
orientation,
disabledTrackStyle,
highlightedTrackStyle,
highlightedTrackStyle2,
disabledHighlightedTrackStyle,
handleStyle,
focusedHandleStyle,
Expand All @@ -307,6 +311,7 @@ export default class RangeSlider extends Component {
trackClassName,
disabledTrackClassName,
highlightedTrackClassName,
highlightedTrackClassName2,
disabledHighlightedTrackClassName,
handleClassName,
disabledHandleClassName,
Expand Down Expand Up @@ -366,9 +371,18 @@ export default class RangeSlider extends Component {
style={highlightedTrackStyle}
disabledStyle={disabledHighlightedTrackStyle}
className={highlightedTrackClassName}
offset={0}
length={`${(startValue) * percentageFactor}%`}
disabledClassName={disabledHighlightedTrackClassName}
/>
<HighlightedTrack
disabled={disabled}
orientation={orientation}
style={highlightedTrackStyle2}
disabledStyle={disabledHighlightedTrackStyle}
className={highlightedTrackClassName2}
offset={`${startValue * percentageFactor}%`}
length={`${(endValue - startValue) * percentageFactor}%`}
className={highlightedTrackClassName}
length={`${(endValue-startValue)*percentageFactor}%`}
disabledClassName={disabledHighlightedTrackClassName}
/>
<Handle
Expand Down
35 changes: 20 additions & 15 deletions js/components/Slider/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Track from '../Track';
import Handle from '../Handle';
import styles from './styles';
Expand Down Expand Up @@ -89,25 +90,29 @@ export default class Slider extends Component {
value: number;

_setTrackDimensions: Function = (track: Object): void => {
const { orientation } = this.props;
const trackLength = orientation === 'vertical' ? track.clientHeight : track.clientWidth;
this.setState({
trackLength,
});
this.trackOffset = orientation === 'vertical' ?
track.offsetParent && track.offsetParent.offsetTop :
track.offsetParent && track.offsetParent.offsetLeft;
if (track) {
const { orientation } = this.props;
const trackLength = orientation === 'vertical' ? track.clientHeight : track.clientWidth;
this.setState({
trackLength,
});
this.trackOffset = orientation === 'vertical' ?
track.offsetParent && track.offsetParent.offsetTop :
track.offsetParent && track.offsetParent.offsetLeft;
}
};

_setHandleSize: Function = (handle): void => {
const { orientation } = this.props;
const hendleSize = orientation === 'vertical' ?
if (handle) {
const { orientation } = this.props;
const hendleSize = orientation === 'vertical' ?
handle.clientHeight :
handle.clientWidth;
if (!this.state.hendleSize) {
this.setState({
hendleSize,
});
if (!this.state.hendleSize) {
this.setState({
hendleSize,
});
}
}
};

Expand Down
3 changes: 2 additions & 1 deletion js/components/Track/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './styles';

export default class Track extends Component {
Expand Down
4 changes: 2 additions & 2 deletions js/components/Track/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default {
top: 13,
height: 4,
borderRadius: 10,
backgroundColor: 'white',
border: '1px solid #2771e2',
backgroundColor: '#99c1ff',
border: '1px solid #a0c6e8',
},
trackVertical: {
position: 'absolute',
Expand Down
6 changes: 3 additions & 3 deletions js/utils/handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export function injectStyle(): void {
}

export function removeStyle(): void {
if (canUseDOM && styleElement) {
document.body.removeChild(styleElement);
}
// if (canUseDOM && styleElement) {
// document.body.removeChild(styleElement);
// }
}

export function calculateStyle(styles: Object, state: Object, props: Object): Object {
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"mocha": "^2.4.5",
"postcss-loader": "^0.9.1",
"precss": "^1.4.0",
"prop-types": "^15.5.8",
"react": "^15.0.1",
"react-addons-test-utils": "^15.0.2",
"react-dom": "^15.0.1",
Expand All @@ -71,5 +72,6 @@
"name": "Jyoti Puri",
"email": "jyotipuri@gmail.com"
},
"license": "MIT"
"license": "MIT",
"dependencies": {}
}