nw-react-slider
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,5 @@ | ||
# 2.0.1 (October 11, 2016) (Akshat) | ||
* Pass triggerOnChangeWhileDragging prop from slider to slider-core. | ||
* Updated demo. | ||
# 2.0.0 (September 29, 2016) (Nikhil) | ||
@@ -2,0 +6,0 @@ * Don't fire onChange on render. |
@@ -22,3 +22,3 @@ # How to contribute | ||
- Pick a bug or feature-request from the [https://github.com/NerdWallet/nw-react-slider/issues](issues list). | ||
- Pick a bug or feature-request from the [issues list](https://github.com/NerdWallet/nw-react-slider/issues). | ||
- Fork the repository and make your changes. | ||
@@ -25,0 +25,0 @@ - Please include the issue number and description in your commit message. |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NWReactSlider=e(require("react"),require("react-dom")):t.NWReactSlider=e(t.React,t.ReactDOM)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){r(1),t.exports=r(5)},function(t,e){},,,,function(t,e,r){"use strict";var n=r(6),o=r(7),i=r(10),a=r(11),s=r(20),l=r(9);t.exports=n.createClass({displayName:"nw-slider",propTypes:{value:n.PropTypes.number,min:n.PropTypes.number,max:n.PropTypes.number,ticks:n.PropTypes.bool,onChange:n.PropTypes.func,onDragStart:n.PropTypes.func,onDragEnd:n.PropTypes.func,markerLabel:n.PropTypes.array,displayFollowerPopover:n.PropTypes.bool},getInitialState:function(){return{rtPosition:void 0,handleWidth:void 0}},componentDidUpdate:function(){l(this.state.handleWidth)&&this.refs.slider.refs.handle&&this.setState({handleWidth:this.refs.slider.refs.handle.offsetWidth})},handleSliderChange:function(t,e){a(this.props.onChange)&&this.props.onChange(t,e),this.setState({rtPosition:e})},render:function(){var t=this.refs.slider&&this.refs.slider.state.trackWidth,e=this.state.handleWidth,r=this.refs.slider&&this.refs.slider.state.dragging,a=this.props.displayFollowerPopover&&!l(this.state.rtPosition)?n.createElement(o,{trackWidth:t,handleWidth:e,value:this.props.value,position:this.state.rtPosition}):n.createElement("span",null);return n.createElement("div",{className:s("slider-container-component",{dragging:r})},n.createElement(i,{ref:"slider",min:this.props.min,max:this.props.max,value:this.props.value,onChange:this.handleSliderChange,onDragStart:this.props.onDragStart,onDragEnd:this.props.onDragEnd,ticks:this.props.ticks,markerLabel:this.props.markerLabel}),a)}})},function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(6),o=r(8),i=r(9);t.exports=n.createClass({displayName:"popover-follow",propTypes:{position:n.PropTypes.number,value:n.PropTypes.number,trackWidth:n.PropTypes.number,handleWidth:n.PropTypes.number},getDefaultProps:function(){return{position:0,value:0,trackWidth:0}},getInitialState:function(){return{arrowPosition:void 0,bubblePosition:void 0,popoverWidth:0,arrowWidth:0}},componentDidMount:function(){var t=this;this.updatePopoverAndArrowWidth(),window.addEventListener("resize",function(){t.updatePopoverAndArrowWidth()})},setPosition:function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=this.props.trackWidth;this.props.handleWidth&&(e+=this.props.handleWidth);var r=this.state.popoverWidth/2-this.state.arrowWidth;t.position>=r&&t.position<=this.props.trackWidth-r?this.setState({bubblePosition:t.position,arrowPosition:r}):t.position<r?this.setState({arrowPosition:t.position,bubblePosition:r}):t.position>this.props.trackWidth-r&&this.setState({arrowPosition:t.position-2*r,bubblePosition:e-r-this.props.handleWidth})},componentWillReceiveProps:function(t){this.setPosition(t)},updatePopoverAndArrowWidth:function(){var t=o.findDOMNode(this.refs.popover);if(t){var e=t.offsetWidth,r=o.findDOMNode(this.refs.popover).getElementsByClassName("arrow").length>0?o.findDOMNode(this.refs.popover).getElementsByClassName("arrow")[0].offsetWidth:12;this.setState({popoverWidth:e,arrowWidth:r},this.setPosition)}},render:function(){var t={};(i(this.state.arrowPosition)||i(this.state.bubblePosition))&&(t={visibility:"hidden"});var e={display:"block",left:this.state.bubblePosition},r={left:this.state.arrowPosition};return n.createElement("div",{style:t,ref:"container",className:"popover-container"},n.createElement("div",{role:"tooltip",ref:"popover",className:"popover",style:e},n.createElement("div",{className:"popover__arrow",style:r}),n.createElement("div",{className:"popover__content"},this.props.value)))}})},function(t,r){t.exports=e},function(t,e){function r(t){return void 0===t}t.exports=r},function(t,e,r){"use strict";var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(6),i=r(8),a=r(11),s=r(13),l=r(9),u=r(14);t.exports=o.createClass({displayName:"core-slider",propTypes:{value:o.PropTypes.number,min:o.PropTypes.number,max:o.PropTypes.number,ticks:o.PropTypes.bool,triggerOnChangeWhileDragging:o.PropTypes.bool,onChange:o.PropTypes.func,onDragStart:o.PropTypes.func,onDragEnd:o.PropTypes.func,markerLabel:o.PropTypes.array},getDefaultProps:function(){return{value:0,min:0,max:10,ticks:!1,triggerOnChangeWhileDragging:!0}},getInitialState:function(){return{position:void 0,value:this.props.value,dragging:!1}},componentWillReceiveProps:function(t,e){var r;this.state.value!==t.value&&(r=this.getBoundValue(t,t.value),this.setState({value:r}),this.setHandlePosition(t,r)),this.props.min===t.min&&this.props.max===t.max||(r=this.getBoundValue(t,r||this.state.value),this.setState({value:r}),this.setHandlePosition(t,r))},shouldComponentUpdate:function(t,e){return!e.dragging},componentDidMount:function(){this.updateTrackWidth(),this.updateTrackWidth=u(this.updateTrackWidth,100,{leading:!1}),window.addEventListener("resize",this.updateTrackWidth)},componentWillUnmount:function(){window.removeEventListener("resize",this.updateTrackWidth)},getBoundValue:function(t,e){var r=e;return r<t.min?r=t.min:r>t.max&&(r=t.max),r},updateTrackWidth:function(){var t=i.findDOMNode(this.refs.track);if(t){var e=t.offsetWidth;this.setState({trackWidth:e},this.setHandlePosition)}},componentDidUpdate:function(){this.refs.drag&&this.refs.drag.setState({clientX:this.state.position})},setHandlePosition:function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=arguments.length<=1||void 0===arguments[1]?this.state.value:arguments[1],r=this.state.trackWidth/(t.max-t.min)*(e-t.min);this.setState({position:r})},updateValueFromPosition:function(t){var e,r,n=t;if(this.props.max===this.props.min)e=this.props.min,r=this.state.trackWidth/2;else{var o,i,a=n/this.state.trackWidth*100,s=100/(this.props.max-this.props.min),l=Math.floor(a/s),u=l+1;u*s-a>=a-l*s?(i=l,o=i*s):(i=u,o=i*s),e=this.props.min+i,r=this.state.trackWidth*(o/100)}return this.setState({value:e,position:r}),{value:e,position:r}},cumulativeOffset:function(t){var e=0,r=0;do e+=t.offsetTop||0,r+=t.offsetLeft||0,t=t.offsetParent;while(t);return{top:e,left:r}},triggerOnChange:function(t){var e=this.updateValueFromPosition(t),r=e.value,n=e.position;a(this.props.onChange)&&this.props.onChange(r,n)},clickOnTrack:function(t){var e=t.clientX-this.cumulativeOffset(t.target).left;this.triggerOnChange(e)},handleUp:function(t,e){var r=this.state.position;a(this.props.onDragEnd)&&this.props.onDragEnd(r),this.setState({dragging:!1}),this.triggerOnChange(r)},handleDown:function(t,e){a(this.props.onDragStart)&&this.props.onDragStart(this.state.position),this.setState({dragging:!0})},dragging:function(t,e){var r=this.refs.drag.state.clientX||0;this.props.triggerOnChangeWhileDragging&&this.triggerOnChange(r),t.preventDefault()},renderTicks:function(){if(!this.props.ticks)return o.createElement("span",null);var t=[],e=this.props.min,r=this.props.max,n=100/(r-e);if(200>r-e)for(var i=e+1;r>i;i++){var a={left:n*(i-e)+"%"};t.push(o.createElement("span",{key:"tick"+i,className:"slider__tick",style:a}))}return o.createElement("div",{key:"ticks",className:"slider__ticks",onClick:this.clickOnTrack},t)},renderMarkers:function(){if(!this.props.markerLabel)return o.createElement("span",null);var t=[],e=this.props,r=e.min,n=e.max,i=e.markerLabel,a=100/(n-r);for(var s in i){var l={left:a*(i[s].value-r)+"%"};i[s].value<=n&&i[s].value>=r&&(this.props.ticks&&200>n-r?t.push(o.createElement("div",{key:"marker"+s,className:"slider__marker marker",style:l},o.createElement("p",{className:"marker__label"},i[s].label))):t.push(o.createElement("div",{key:"marker"+s,className:"slider__marker marker",style:l},o.createElement("p",{className:"marker__label"},i[s].label),o.createElement("span",{key:"marker"+i[s].value,className:"slider__tick slider__tick--marker"}))))}return o.createElement("div",{key:"markers",className:"slider__markers",onClick:this.clickOnTrack},t)},render:function(){var t,e;return l(this.state.position)||(t={axis:"x",handle:".slider__handle",bounds:{left:0,right:this.state.trackWidth},start:{x:this.state.position,y:0},onStop:this.handleUp,onStart:this.handleDown,onDrag:this.dragging},e=o.createElement(s,n({ref:"drag",key:"draggable"},t),o.createElement("span",{ref:"handle",className:"slider__handle"}))),o.createElement("div",{ref:"slider",className:"slider"},e,o.createElement("div",{ref:"track",className:"slider__track",onClick:this.clickOnTrack},this.renderTicks(),this.renderMarkers()))}})},function(t,e,r){function n(t){var e=o(t)?l.call(t):"";return e==i||e==a}var o=r(12),i="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,l=s.toString;t.exports=n},function(t,e){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=r},function(t,e,r){!function(e,n){t.exports=n(r(6),r(8))}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(1)["default"],t.exports.DraggableCore=r(9)["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=r(2),p=n(c),d=r(3),f=n(d),h=r(4),g=n(h),v=r(5),m=r(8),y=r(6),b=r(9),S=n(b),P=r(10),T=n(P),k=function(t){function e(){var t,r,n,a;o(this,e);for(var s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return r=n=i(this,(t=Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.state={dragging:!1,dragged:!1,clientX:n.props.start.x,clientY:n.props.start.y,slackX:0,slackY:0,isElementSVG:!1},n.onDragStart=function(t,e){(0,T["default"])("Draggable: onDragStart: %j",e.position);var r=n.props.onStart(t,(0,v.createUIEvent)(n,e));return r===!1?!1:void n.setState({dragging:!0,dragged:!0})},n.onDrag=function(t,e){if(!n.state.dragging)return!1;(0,T["default"])("Draggable: onDrag: %j",e.position);var r=(0,v.createUIEvent)(n,e),o={clientX:r.position.left,clientY:r.position.top};if(n.props.bounds){var i=o.clientX,a=o.clientY;o.clientX+=n.state.slackX,o.clientY+=n.state.slackY;var s=(0,m.getBoundPosition)(n,o.clientX,o.clientY),u=l(s,2);o.clientX=u[0],o.clientY=u[1],o.slackX=n.state.slackX+(i-o.clientX),o.slackY=n.state.slackY+(a-o.clientY),r.position.left=i,r.position.top=a,r.deltaX=o.clientX-n.state.clientX,r.deltaY=o.clientY-n.state.clientY}var c=n.props.onDrag(t,r);return c===!1?!1:void n.setState(o)},n.onDragStop=function(t,e){if(!n.state.dragging)return!1;var r=n.props.onStop(t,(0,v.createUIEvent)(n,e));return r===!1?!1:((0,T["default"])("Draggable: onDragStop: %j",e.position),void n.setState({dragging:!1,slackX:0,slackY:0}))},a=r,i(n,a)}return a(e,t),u(e,[{key:"componentDidMount",value:function(){f["default"].findDOMNode(this)instanceof SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var t={},e=null,r={x:(0,m.canDragX)(this)?this.state.clientX:this.props.start.x,y:(0,m.canDragY)(this)?this.state.clientY:this.props.start.y};this.state.isElementSVG?e=(0,v.createSVGTransform)(r):t=(0,v.createCSSTransform)(r),this.state.dragging&&!isNaN(this.props.zIndex)&&(t.zIndex=this.props.zIndex);var n=(0,g["default"])(this.props.children.props.className||"","react-draggable",{"react-draggable-dragging":this.state.dragging,"react-draggable-dragged":this.state.dragged});return p["default"].createElement(S["default"],s({},this.props,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),p["default"].cloneElement(p["default"].Children.only(this.props.children),{className:n,style:s({},this.props.children.props.style,t),transform:e}))}}]),e}(p["default"].Component);k.displayName="Draggable",k.propTypes=s({},S["default"].propTypes,{axis:c.PropTypes.oneOf(["both","x","y","none"]),bounds:c.PropTypes.oneOfType([c.PropTypes.shape({left:c.PropTypes.Number,right:c.PropTypes.Number,top:c.PropTypes.Number,bottom:c.PropTypes.Number}),c.PropTypes.string,c.PropTypes.oneOf([!1])]),start:c.PropTypes.shape({x:c.PropTypes.number,y:c.PropTypes.number}),zIndex:c.PropTypes.number,className:y.dontSetMe,style:y.dontSetMe,transform:y.dontSetMe}),k.defaultProps=s({},S["default"].defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN}),e["default"]=k},function(e,r){e.exports=t},function(t,r){t.exports=e},function(t,e,r){var n,o;/*! | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NWReactSlider=e(require("react"),require("react-dom")):t.NWReactSlider=e(t.React,t.ReactDOM)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){r(1),t.exports=r(5)},function(t,e){},,,,function(t,e,r){"use strict";var n=r(6),o=r(7),i=r(10),a=r(11),s=r(20),l=r(9);t.exports=n.createClass({displayName:"nw-slider",propTypes:{value:n.PropTypes.number,min:n.PropTypes.number,max:n.PropTypes.number,ticks:n.PropTypes.bool,onChange:n.PropTypes.func,onDragStart:n.PropTypes.func,onDragEnd:n.PropTypes.func,triggerOnChangeWhileDragging:n.PropTypes.bool,markerLabel:n.PropTypes.array,displayFollowerPopover:n.PropTypes.bool},getInitialState:function(){return{rtPosition:void 0,handleWidth:void 0}},componentDidUpdate:function(){l(this.state.handleWidth)&&this.refs.slider.refs.handle&&this.setState({handleWidth:this.refs.slider.refs.handle.offsetWidth})},handleSliderChange:function(t,e){a(this.props.onChange)&&this.props.onChange(t,e),this.setState({rtPosition:e})},render:function(){var t=this.refs.slider&&this.refs.slider.state.trackWidth,e=this.state.handleWidth,r=this.refs.slider&&this.refs.slider.state.dragging,a=this.props.displayFollowerPopover&&!l(this.state.rtPosition)?n.createElement(o,{trackWidth:t,handleWidth:e,value:this.props.value,position:this.state.rtPosition}):n.createElement("span",null);return n.createElement("div",{className:s("slider-container-component",{dragging:r})},n.createElement(i,{ref:"slider",min:this.props.min,max:this.props.max,value:this.props.value,onChange:this.handleSliderChange,onDragStart:this.props.onDragStart,onDragEnd:this.props.onDragEnd,triggerOnChangeWhileDragging:this.props.triggerOnChangeWhileDragging,ticks:this.props.ticks,markerLabel:this.props.markerLabel}),a)}})},function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(6),o=r(8),i=r(9);t.exports=n.createClass({displayName:"popover-follow",propTypes:{position:n.PropTypes.number,value:n.PropTypes.number,trackWidth:n.PropTypes.number,handleWidth:n.PropTypes.number},getDefaultProps:function(){return{position:0,value:0,trackWidth:0}},getInitialState:function(){return{arrowPosition:void 0,bubblePosition:void 0,popoverWidth:0,arrowWidth:0}},componentDidMount:function(){var t=this;this.updatePopoverAndArrowWidth(),window.addEventListener("resize",function(){t.updatePopoverAndArrowWidth()})},setPosition:function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=this.props.trackWidth;this.props.handleWidth&&(e+=this.props.handleWidth);var r=this.state.popoverWidth/2-this.state.arrowWidth;t.position>=r&&t.position<=this.props.trackWidth-r?this.setState({bubblePosition:t.position,arrowPosition:r}):t.position<r?this.setState({arrowPosition:t.position,bubblePosition:r}):t.position>this.props.trackWidth-r&&this.setState({arrowPosition:t.position-2*r,bubblePosition:e-r-this.props.handleWidth})},componentWillReceiveProps:function(t){this.setPosition(t)},updatePopoverAndArrowWidth:function(){var t=o.findDOMNode(this.refs.popover);if(t){var e=t.offsetWidth,r=o.findDOMNode(this.refs.popover).getElementsByClassName("arrow").length>0?o.findDOMNode(this.refs.popover).getElementsByClassName("arrow")[0].offsetWidth:12;this.setState({popoverWidth:e,arrowWidth:r},this.setPosition)}},render:function(){var t={};(i(this.state.arrowPosition)||i(this.state.bubblePosition))&&(t={visibility:"hidden"});var e={display:"block",left:this.state.bubblePosition},r={left:this.state.arrowPosition};return n.createElement("div",{style:t,ref:"container",className:"popover-container"},n.createElement("div",{role:"tooltip",ref:"popover",className:"popover",style:e},n.createElement("div",{className:"popover__arrow",style:r}),n.createElement("div",{className:"popover__content"},this.props.value)))}})},function(t,r){t.exports=e},function(t,e){function r(t){return void 0===t}t.exports=r},function(t,e,r){"use strict";var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(6),i=r(8),a=r(11),s=r(13),l=r(9),u=r(14);t.exports=o.createClass({displayName:"core-slider",propTypes:{value:o.PropTypes.number,min:o.PropTypes.number,max:o.PropTypes.number,ticks:o.PropTypes.bool,triggerOnChangeWhileDragging:o.PropTypes.bool,onChange:o.PropTypes.func,onDragStart:o.PropTypes.func,onDragEnd:o.PropTypes.func,markerLabel:o.PropTypes.array},getDefaultProps:function(){return{value:0,min:0,max:10,ticks:!1,triggerOnChangeWhileDragging:!0}},getInitialState:function(){return{position:void 0,value:this.props.value,dragging:!1}},componentWillReceiveProps:function(t,e){var r;this.state.value!==t.value&&(r=this.getBoundValue(t,t.value),this.setState({value:r}),this.setHandlePosition(t,r)),this.props.min===t.min&&this.props.max===t.max||(r=this.getBoundValue(t,r||this.state.value),this.setState({value:r}),this.setHandlePosition(t,r))},shouldComponentUpdate:function(t,e){return!e.dragging},componentDidMount:function(){this.updateTrackWidth(),this.updateTrackWidth=u(this.updateTrackWidth,100,{leading:!1}),window.addEventListener("resize",this.updateTrackWidth)},componentWillUnmount:function(){window.removeEventListener("resize",this.updateTrackWidth)},getBoundValue:function(t,e){var r=e;return r<t.min?r=t.min:r>t.max&&(r=t.max),r},updateTrackWidth:function(){var t=i.findDOMNode(this.refs.track);if(t){var e=t.offsetWidth;this.setState({trackWidth:e},this.setHandlePosition)}},componentDidUpdate:function(){this.refs.drag&&this.refs.drag.setState({clientX:this.state.position})},setHandlePosition:function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=arguments.length<=1||void 0===arguments[1]?this.state.value:arguments[1],r=this.state.trackWidth/(t.max-t.min)*(e-t.min);this.setState({position:r})},updateValueFromPosition:function(t){var e,r,n=t;if(this.props.max===this.props.min)e=this.props.min,r=this.state.trackWidth/2;else{var o,i,a=n/this.state.trackWidth*100,s=100/(this.props.max-this.props.min),l=Math.floor(a/s),u=l+1;u*s-a>=a-l*s?(i=l,o=i*s):(i=u,o=i*s),e=this.props.min+i,r=this.state.trackWidth*(o/100)}return this.setState({value:e,position:r}),{value:e,position:r}},cumulativeOffset:function(t){var e=0,r=0;do e+=t.offsetTop||0,r+=t.offsetLeft||0,t=t.offsetParent;while(t);return{top:e,left:r}},triggerOnChange:function(t){var e=this.updateValueFromPosition(t),r=e.value,n=e.position;a(this.props.onChange)&&this.props.onChange(r,n)},clickOnTrack:function(t){var e=t.clientX-this.cumulativeOffset(t.target).left;this.triggerOnChange(e)},handleUp:function(t,e){var r=this.refs.drag.state.clientX||0,n=this.updateValueFromPosition(r),o=n.position;a(this.props.onDragEnd)&&this.props.onDragEnd(o),this.setState({dragging:!1}),this.triggerOnChange(o)},handleDown:function(t,e){a(this.props.onDragStart)&&this.props.onDragStart(this.state.position),this.setState({dragging:!0})},dragging:function(t,e){var r=this.refs.drag.state.clientX||0;this.props.triggerOnChangeWhileDragging&&this.triggerOnChange(r),t.preventDefault()},renderTicks:function(){if(!this.props.ticks)return o.createElement("span",null);var t=[],e=this.props.min,r=this.props.max,n=100/(r-e);if(200>r-e)for(var i=e+1;r>i;i++){var a={left:n*(i-e)+"%"};t.push(o.createElement("span",{key:"tick"+i,className:"slider__tick",style:a}))}return o.createElement("div",{key:"ticks",className:"slider__ticks",onClick:this.clickOnTrack},t)},renderMarkers:function(){if(!this.props.markerLabel)return o.createElement("span",null);var t=[],e=this.props,r=e.min,n=e.max,i=e.markerLabel,a=100/(n-r);for(var s in i){var l={left:a*(i[s].value-r)+"%"};i[s].value<=n&&i[s].value>=r&&(this.props.ticks&&200>n-r?t.push(o.createElement("div",{key:"marker"+s,className:"slider__marker marker",style:l},o.createElement("p",{className:"marker__label"},i[s].label))):t.push(o.createElement("div",{key:"marker"+s,className:"slider__marker marker",style:l},o.createElement("p",{className:"marker__label"},i[s].label),o.createElement("span",{key:"marker"+i[s].value,className:"slider__tick slider__tick--marker"}))))}return o.createElement("div",{key:"markers",className:"slider__markers",onClick:this.clickOnTrack},t)},render:function(){var t,e;return l(this.state.position)||(t={axis:"x",handle:".slider__handle",bounds:{left:0,right:this.state.trackWidth},start:{x:this.state.position,y:0},onStop:this.handleUp,onStart:this.handleDown,onDrag:this.dragging},e=o.createElement(s,n({ref:"drag",key:"draggable"},t),o.createElement("span",{ref:"handle",className:"slider__handle"}))),o.createElement("div",{ref:"slider",className:"slider"},e,o.createElement("div",{ref:"track",className:"slider__track",onClick:this.clickOnTrack},this.renderTicks(),this.renderMarkers()))}})},function(t,e,r){function n(t){var e=o(t)?l.call(t):"";return e==i||e==a}var o=r(12),i="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,l=s.toString;t.exports=n},function(t,e){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=r},function(t,e,r){!function(e,n){t.exports=n(r(6),r(8))}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(1)["default"],t.exports.DraggableCore=r(9)["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=r(2),c=n(p),d=r(3),f=n(d),h=r(4),g=n(h),v=r(5),m=r(8),y=r(6),b=r(9),S=n(b),P=r(10),T=n(P),k=function(t){function e(){var t,r,n,a;o(this,e);for(var s=arguments.length,u=Array(s),p=0;s>p;p++)u[p]=arguments[p];return r=n=i(this,(t=Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.state={dragging:!1,dragged:!1,clientX:n.props.start.x,clientY:n.props.start.y,slackX:0,slackY:0,isElementSVG:!1},n.onDragStart=function(t,e){(0,T["default"])("Draggable: onDragStart: %j",e.position);var r=n.props.onStart(t,(0,v.createUIEvent)(n,e));return r===!1?!1:void n.setState({dragging:!0,dragged:!0})},n.onDrag=function(t,e){if(!n.state.dragging)return!1;(0,T["default"])("Draggable: onDrag: %j",e.position);var r=(0,v.createUIEvent)(n,e),o={clientX:r.position.left,clientY:r.position.top};if(n.props.bounds){var i=o.clientX,a=o.clientY;o.clientX+=n.state.slackX,o.clientY+=n.state.slackY;var s=(0,m.getBoundPosition)(n,o.clientX,o.clientY),u=l(s,2);o.clientX=u[0],o.clientY=u[1],o.slackX=n.state.slackX+(i-o.clientX),o.slackY=n.state.slackY+(a-o.clientY),r.position.left=i,r.position.top=a,r.deltaX=o.clientX-n.state.clientX,r.deltaY=o.clientY-n.state.clientY}var p=n.props.onDrag(t,r);return p===!1?!1:void n.setState(o)},n.onDragStop=function(t,e){if(!n.state.dragging)return!1;var r=n.props.onStop(t,(0,v.createUIEvent)(n,e));return r===!1?!1:((0,T["default"])("Draggable: onDragStop: %j",e.position),void n.setState({dragging:!1,slackX:0,slackY:0}))},a=r,i(n,a)}return a(e,t),u(e,[{key:"componentDidMount",value:function(){f["default"].findDOMNode(this)instanceof SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var t={},e=null,r={x:(0,m.canDragX)(this)?this.state.clientX:this.props.start.x,y:(0,m.canDragY)(this)?this.state.clientY:this.props.start.y};this.state.isElementSVG?e=(0,v.createSVGTransform)(r):t=(0,v.createCSSTransform)(r),this.state.dragging&&!isNaN(this.props.zIndex)&&(t.zIndex=this.props.zIndex);var n=(0,g["default"])(this.props.children.props.className||"","react-draggable",{"react-draggable-dragging":this.state.dragging,"react-draggable-dragged":this.state.dragged});return c["default"].createElement(S["default"],s({},this.props,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),c["default"].cloneElement(c["default"].Children.only(this.props.children),{className:n,style:s({},this.props.children.props.style,t),transform:e}))}}]),e}(c["default"].Component);k.displayName="Draggable",k.propTypes=s({},S["default"].propTypes,{axis:p.PropTypes.oneOf(["both","x","y","none"]),bounds:p.PropTypes.oneOfType([p.PropTypes.shape({left:p.PropTypes.Number,right:p.PropTypes.Number,top:p.PropTypes.Number,bottom:p.PropTypes.Number}),p.PropTypes.string,p.PropTypes.oneOf([!1])]),start:p.PropTypes.shape({x:p.PropTypes.number,y:p.PropTypes.number}),zIndex:p.PropTypes.number,className:y.dontSetMe,style:y.dontSetMe,transform:y.dontSetMe}),k.defaultProps=s({},S["default"].defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN}),e["default"]=k},function(e,r){e.exports=t},function(t,r){t.exports=e},function(t,e,r){var n,o;/*! | ||
Copyright (c) 2016 Jed Watson. | ||
@@ -6,3 +6,3 @@ Licensed under the MIT License (MIT), see | ||
*/ | ||
!function(){"use strict";function r(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var o=typeof n;if("string"===o||"number"===o)t.push(n);else if(Array.isArray(n))t.push(r.apply(null,n));else if("object"===o)for(var a in n)i.call(n,a)&&n[a]&&t.push(a)}}return t.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof t&&t.exports?t.exports=r:(n=[],o=function(){return r}.apply(e,n),!(void 0!==o&&(t.exports=o)))}()},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return x||(x=(0,S.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,S.isFunction)(t[e])})),t[x].call(t,e)}function a(t,e,r){t&&(t.attachEvent?t.attachEvent("on"+e,r):t.addEventListener?t.addEventListener(e,r,!0):t["on"+e]=r)}function s(t,e,r){t&&(t.detachEvent?t.detachEvent("on"+e,r):t.removeEventListener?t.removeEventListener(e,r,!0):t["on"+e]=null)}function l(t){var e=t.clientHeight,r=window.getComputedStyle(t);return e+=(0,S["int"])(r.borderTopWidth),e+=(0,S["int"])(r.borderBottomWidth)}function u(t){var e=t.clientWidth,r=window.getComputedStyle(t);return e+=(0,S["int"])(r.borderLeftWidth),e+=(0,S["int"])(r.borderRightWidth)}function c(t){var e=t.clientHeight,r=window.getComputedStyle(t);return e-=(0,S["int"])(r.paddingTop),e-=(0,S["int"])(r.paddingBottom)}function p(t){var e=t.clientWidth,r=window.getComputedStyle(t);return e-=(0,S["int"])(r.paddingLeft),e-=(0,S["int"])(r.paddingRight)}function d(t){var e=t.x,r=t.y;return o({},(0,P.browserPrefixToKey)("transform",T["default"]),"translate("+e+"px,"+r+"px)")}function f(t){var e=t.x,r=t.y;return"translate("+e+","+r+")"}function h(){var t=document.body.getAttribute("style")||"";document.body.setAttribute("style",t+O)}function g(){var t=document.body.getAttribute("style")||"";document.body.setAttribute("style",t.replace(O,""))}function v(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return b({touchAction:"none"},t)}function m(t,e,r){var n=t._pendingState||t.state,o=!(0,S.isNum)(n.lastX);return{node:w["default"].findDOMNode(t),position:o?{deltaX:0,deltaY:0,lastX:e,lastY:r,clientX:e,clientY:r}:{deltaX:e-n.lastX,deltaY:r-n.lastY,lastX:n.lastX,lastY:n.lastY,clientX:e,clientY:r}}}function y(t,e){return{node:w["default"].findDOMNode(t),position:{left:t.state.clientX+e.position.deltaX,top:t.state.clientY+e.position.deltaY},deltaX:e.position.deltaX,deltaY:e.position.deltaY}}Object.defineProperty(e,"__esModule",{value:!0});var b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.matchesSelector=i,e.addEvent=a,e.removeEvent=s,e.outerHeight=l,e.outerWidth=u,e.innerHeight=c,e.innerWidth=p,e.createCSSTransform=d,e.createSVGTransform=f,e.addUserSelectStyles=h,e.removeUserSelectStyles=g,e.styleHacks=v,e.createCoreEvent=m,e.createUIEvent=y;var S=r(6),P=r(7),T=n(P),k=r(3),w=n(k),x="",D=(0,P.getPrefix)("user-select"),E=(0,P.browserPrefixToStyle)("user-select",D),O=";"+E+": none;"},function(t,e){"use strict";function r(t,e){for(var r=0,n=t.length;n>r;r++)if(e.apply(e,[t[r],r,t]))return t[r]}function n(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)}function o(t){return"number"==typeof t&&!isNaN(t)}function i(t){return parseInt(t,10)}function a(t,e,r){if(t[e])throw new Error("Invalid prop "+e+" passed to "+r+" - do not set this, set it on the child.")}Object.defineProperty(e,"__esModule",{value:!0}),e.findInArray=r,e.isFunction=n,e.isNum=o,e["int"]=i,e.dontSetMe=a},function(t,e){"use strict";function r(){var t=arguments.length<=0||void 0===arguments[0]?"transform":arguments[0];if("undefined"==typeof window||"undefined"==typeof window.document)return"";var e=window.document.documentElement.style;if(t in e)return"";for(var r=0;r<a.length;r++)if(o(t,a[r])in e)return a[r];return""}function n(t,e){return e?""+e+i(t):t}function o(t,e){return e?"-"+e.toLowerCase()+"-"+t:t}function i(t){for(var e="",r=!0,n=0;n<t.length;n++)r?(e+=t[n].toUpperCase(),r=!1):"-"===t[n]?r=!0:e+=t[n];return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getPrefix=r,e.browserPrefixToKey=n,e.browserPrefixToStyle=o;var a=["Moz","Webkit","O","ms"];e["default"]=r()},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){if(!t.props.bounds)return[e,r];var n=t.props.bounds;n="string"==typeof n?n:u(n);var o=f["default"].findDOMNode(t);if("string"==typeof n){var i=void 0;if("parent"===n)i=o.parentNode;else if(i=document.querySelector(n),!i)throw new Error('Bounds selector "'+n+'" could not find an element.');var a=window.getComputedStyle(o),s=window.getComputedStyle(i);n={left:-o.offsetLeft+(0,p["int"])(s.paddingLeft)+(0,p["int"])(a.borderLeftWidth)+(0,p["int"])(a.marginLeft),top:-o.offsetTop+(0,p["int"])(s.paddingTop)+(0,p["int"])(a.borderTopWidth)+(0,p["int"])(a.marginTop),right:(0,h.innerWidth)(i)-(0,h.outerWidth)(o)-o.offsetLeft,bottom:(0,h.innerHeight)(i)-(0,h.outerHeight)(o)-o.offsetTop}}return(0,p.isNum)(n.right)&&(e=Math.min(e,n.right)),(0,p.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,p.isNum)(n.left)&&(e=Math.max(e,n.left)),(0,p.isNum)(n.top)&&(r=Math.max(r,n.top)),[e,r]}function i(t,e,r){var n=Math.round(e/t[0])*t[0],o=Math.round(r/t[1])*t[1];return[n,o]}function a(t){return"both"===t.props.axis||"x"===t.props.axis}function s(t){return"both"===t.props.axis||"y"===t.props.axis}function l(t){var e=t.targetTouches&&t.targetTouches[0]||t;return{clientX:e.clientX,clientY:e.clientY}}function u(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}Object.defineProperty(e,"__esModule",{value:!0}),e.getBoundPosition=o,e.snapToGrid=i,e.canDragX=a,e.canDragY=s,e.getControlPosition=l;var c=r(2),p=(n(c),r(6)),d=r(3),f=n(d),h=r(5)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=r(2),c=n(u),p=r(5),d=r(8),f=r(6),h=r(10),g=n(h),v={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},m=v.mouse,y=function(t){function e(){var t,r,n,a;o(this,e);for(var l=arguments.length,u=Array(l),c=0;l>c;c++)u[c]=arguments[c];return r=n=i(this,(t=Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.state={dragging:!1,lastX:null,lastY:null},n.handleDragStart=function(t){if(n.props.onMouseDown(t),!n.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;if(!(n.props.disabled||n.props.handle&&!(0,p.matchesSelector)(t.target,n.props.handle)||n.props.cancel&&(0,p.matchesSelector)(t.target,n.props.cancel))){t.targetTouches&&n.setState({touchIdentifier:t.targetTouches[0].identifier}),n.props.enableUserSelectHack&&(0,p.addUserSelectStyles)();var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY,i=(0,p.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDragStart: %j",i.position),(0,g["default"])("calling",n.props.onStart);var a=n.props.onStart(t,i);a!==!1&&(n.setState({dragging:!0,lastX:r,lastY:o,scrollX:document.body.scrollLeft,scrollY:document.body.scrollTop}),(0,p.addEvent)(document,"scroll",n.handleScroll),(0,p.addEvent)(document,m.move,n.handleDrag),(0,p.addEvent)(document,m.stop,n.handleDragStop))}},n.handleDrag=function(t){if(!t.targetTouches||t.targetTouches[0].identifier===n.state.touchIdentifier){var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY;if(Array.isArray(n.props.grid)){var i=r-n.state.lastX,a=o-n.state.lastY,l=(0,d.snapToGrid)(n.props.grid,i,a),u=s(l,2);if(i=u[0],a=u[1],!i&&!a)return;r=n.state.lastX+i,o=n.state.lastY+a}var c=(0,p.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDrag: %j",c.position);var f=n.props.onDrag(t,c);return f===!1?void n.handleDragStop({}):void n.setState({lastX:r,lastY:o})}},n.handleDragStop=function(t){if(n.state.dragging&&(!t.changedTouches||t.changedTouches[0].identifier===n.state.touchIdentifier)){n.props.enableUserSelectHack&&(0,p.removeUserSelectStyles)();var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY,i=(0,p.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDragStop: %j",i.position),n.setState({dragging:!1,lastX:null,lastY:null}),n.props.onStop(t,i),(0,g["default"])("DraggableCore: Removing handlers"),(0,p.removeEvent)(document,"scroll",n.handleScroll),(0,p.removeEvent)(document,m.move,n.handleDrag),(0,p.removeEvent)(document,m.stop,n.handleDragStop)}},n.handleScroll=function(t){var e=n.state,r=document.body.scrollLeft,o=document.body.scrollTop,i=(0,p.createCoreEvent)(n);i.position.deltaX=r-e.scrollX,i.position.deltaY=o-e.scrollY,n.setState({lastX:e.lastX+i.position.deltaX,lastY:e.lastY+i.position.deltaY,scrollX:r,scrollY:o}),n.props.onDrag(t,i)},n.onMouseDown=function(t){return m=v.mouse,n.handleDragStart(t)},n.onMouseUp=function(t){return m=v.mouse,n.handleDragStop(t)},n.onTouchStart=function(t){return m=v.touch,n.handleDragStart(t)},n.onTouchEnd=function(t){return m=v.touch,n.handleDragStop(t)},a=r,i(n,a)}return a(e,t),l(e,[{key:"componentWillUnmount",value:function(){(0,p.removeEvent)(document,v.mouse.move,this.handleDrag),(0,p.removeEvent)(document,v.touch.move,this.handleDrag),(0,p.removeEvent)(document,v.mouse.stop,this.handleDragStop),(0,p.removeEvent)(document,v.touch.stop,this.handleDragStop),(0,p.removeEvent)(document,"scroll",this.handleScroll),this.props.enableUserSelectHack&&(0,p.removeUserSelectStyles)()}},{key:"render",value:function(){return c["default"].cloneElement(c["default"].Children.only(this.props.children),{style:(0,p.styleHacks)(this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),e}(c["default"].Component);y.displayName="DraggableCore",y.propTypes={allowAnyClick:u.PropTypes.bool,disabled:u.PropTypes.bool,enableUserSelectHack:u.PropTypes.bool,grid:u.PropTypes.arrayOf(u.PropTypes.number),handle:u.PropTypes.string,cancel:u.PropTypes.string,onStart:u.PropTypes.func,onDrag:u.PropTypes.func,onStop:u.PropTypes.func,onMouseDown:u.PropTypes.func,className:f.dontSetMe,style:f.dontSetMe,transform:f.dontSetMe},y.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){}},e["default"]=y},function(t,e,r){"use strict";function n(){}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n}])})},function(t,e,r){function n(t,e,r){var n=!0,s=!0;if("function"!=typeof t)throw new TypeError(a);return i(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),o(t,e,{leading:n,maxWait:e,trailing:s})}var o=r(15),i=r(12),a="Expected a function";t.exports=n},function(t,e,r){function n(t,e,r){function n(e){var r=y,n=b;return y=b=void 0,w=e,P=t.apply(n,r)}function c(t){return w=t,T=setTimeout(f,e),x?n(t):P}function p(t){var r=t-k,n=t-w,o=e-r;return D?u(o,S-n):o}function d(t){var r=t-k,n=t-w;return void 0===k||r>=e||0>r||D&&n>=S}function f(){var t=i();return d(t)?h(t):void(T=setTimeout(f,p(t)))}function h(t){return T=void 0,E&&y?n(t):(y=b=void 0,P)}function g(){w=0,y=k=b=T=void 0}function v(){return void 0===T?P:h(i())}function m(){var t=i(),r=d(t);if(y=arguments,b=this,k=t,r){if(void 0===T)return c(k);if(D)return T=setTimeout(f,e),n(k)}return void 0===T&&(T=setTimeout(f,e)),P}var y,b,S,P,T,k,w=0,x=!1,D=!1,E=!0;if("function"!=typeof t)throw new TypeError(s);return e=a(e)||0,o(r)&&(x=!!r.leading,D="maxWait"in r,S=D?l(a(r.maxWait)||0,e):S,E="trailing"in r?!!r.trailing:E),m.cancel=g,m.flush=v,m}var o=r(12),i=r(16),a=r(17),s="Expected a function",l=Math.max,u=Math.min;t.exports=n},function(t,e){function r(){return Date.now()}t.exports=r},function(t,e,r){function n(t){if("number"==typeof t)return t;if(a(t))return s;if(i(t)){var e=o(t.valueOf)?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(l,"");var r=c.test(t);return r||p.test(t)?d(t.slice(2),r?2:8):u.test(t)?s:+t}var o=r(11),i=r(12),a=r(18),s=NaN,l=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt;t.exports=n},function(t,e,r){function n(t){return"symbol"==typeof t||o(t)&&s.call(t)==i}var o=r(19),i="[object Symbol]",a=Object.prototype,s=a.toString;t.exports=n},function(t,e){function r(t){return!!t&&"object"==typeof t}t.exports=r},function(t,e,r){var n,o;/*! | ||
!function(){"use strict";function r(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var o=typeof n;if("string"===o||"number"===o)t.push(n);else if(Array.isArray(n))t.push(r.apply(null,n));else if("object"===o)for(var a in n)i.call(n,a)&&n[a]&&t.push(a)}}return t.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof t&&t.exports?t.exports=r:(n=[],o=function(){return r}.apply(e,n),!(void 0!==o&&(t.exports=o)))}()},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return x||(x=(0,S.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,S.isFunction)(t[e])})),t[x].call(t,e)}function a(t,e,r){t&&(t.attachEvent?t.attachEvent("on"+e,r):t.addEventListener?t.addEventListener(e,r,!0):t["on"+e]=r)}function s(t,e,r){t&&(t.detachEvent?t.detachEvent("on"+e,r):t.removeEventListener?t.removeEventListener(e,r,!0):t["on"+e]=null)}function l(t){var e=t.clientHeight,r=window.getComputedStyle(t);return e+=(0,S["int"])(r.borderTopWidth),e+=(0,S["int"])(r.borderBottomWidth)}function u(t){var e=t.clientWidth,r=window.getComputedStyle(t);return e+=(0,S["int"])(r.borderLeftWidth),e+=(0,S["int"])(r.borderRightWidth)}function p(t){var e=t.clientHeight,r=window.getComputedStyle(t);return e-=(0,S["int"])(r.paddingTop),e-=(0,S["int"])(r.paddingBottom)}function c(t){var e=t.clientWidth,r=window.getComputedStyle(t);return e-=(0,S["int"])(r.paddingLeft),e-=(0,S["int"])(r.paddingRight)}function d(t){var e=t.x,r=t.y;return o({},(0,P.browserPrefixToKey)("transform",T["default"]),"translate("+e+"px,"+r+"px)")}function f(t){var e=t.x,r=t.y;return"translate("+e+","+r+")"}function h(){var t=document.body.getAttribute("style")||"";document.body.setAttribute("style",t+O)}function g(){var t=document.body.getAttribute("style")||"";document.body.setAttribute("style",t.replace(O,""))}function v(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return b({touchAction:"none"},t)}function m(t,e,r){var n=t._pendingState||t.state,o=!(0,S.isNum)(n.lastX);return{node:w["default"].findDOMNode(t),position:o?{deltaX:0,deltaY:0,lastX:e,lastY:r,clientX:e,clientY:r}:{deltaX:e-n.lastX,deltaY:r-n.lastY,lastX:n.lastX,lastY:n.lastY,clientX:e,clientY:r}}}function y(t,e){return{node:w["default"].findDOMNode(t),position:{left:t.state.clientX+e.position.deltaX,top:t.state.clientY+e.position.deltaY},deltaX:e.position.deltaX,deltaY:e.position.deltaY}}Object.defineProperty(e,"__esModule",{value:!0});var b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.matchesSelector=i,e.addEvent=a,e.removeEvent=s,e.outerHeight=l,e.outerWidth=u,e.innerHeight=p,e.innerWidth=c,e.createCSSTransform=d,e.createSVGTransform=f,e.addUserSelectStyles=h,e.removeUserSelectStyles=g,e.styleHacks=v,e.createCoreEvent=m,e.createUIEvent=y;var S=r(6),P=r(7),T=n(P),k=r(3),w=n(k),x="",D=(0,P.getPrefix)("user-select"),E=(0,P.browserPrefixToStyle)("user-select",D),O=";"+E+": none;"},function(t,e){"use strict";function r(t,e){for(var r=0,n=t.length;n>r;r++)if(e.apply(e,[t[r],r,t]))return t[r]}function n(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)}function o(t){return"number"==typeof t&&!isNaN(t)}function i(t){return parseInt(t,10)}function a(t,e,r){if(t[e])throw new Error("Invalid prop "+e+" passed to "+r+" - do not set this, set it on the child.")}Object.defineProperty(e,"__esModule",{value:!0}),e.findInArray=r,e.isFunction=n,e.isNum=o,e["int"]=i,e.dontSetMe=a},function(t,e){"use strict";function r(){var t=arguments.length<=0||void 0===arguments[0]?"transform":arguments[0];if("undefined"==typeof window||"undefined"==typeof window.document)return"";var e=window.document.documentElement.style;if(t in e)return"";for(var r=0;r<a.length;r++)if(o(t,a[r])in e)return a[r];return""}function n(t,e){return e?""+e+i(t):t}function o(t,e){return e?"-"+e.toLowerCase()+"-"+t:t}function i(t){for(var e="",r=!0,n=0;n<t.length;n++)r?(e+=t[n].toUpperCase(),r=!1):"-"===t[n]?r=!0:e+=t[n];return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getPrefix=r,e.browserPrefixToKey=n,e.browserPrefixToStyle=o;var a=["Moz","Webkit","O","ms"];e["default"]=r()},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){if(!t.props.bounds)return[e,r];var n=t.props.bounds;n="string"==typeof n?n:u(n);var o=f["default"].findDOMNode(t);if("string"==typeof n){var i=void 0;if("parent"===n)i=o.parentNode;else if(i=document.querySelector(n),!i)throw new Error('Bounds selector "'+n+'" could not find an element.');var a=window.getComputedStyle(o),s=window.getComputedStyle(i);n={left:-o.offsetLeft+(0,c["int"])(s.paddingLeft)+(0,c["int"])(a.borderLeftWidth)+(0,c["int"])(a.marginLeft),top:-o.offsetTop+(0,c["int"])(s.paddingTop)+(0,c["int"])(a.borderTopWidth)+(0,c["int"])(a.marginTop),right:(0,h.innerWidth)(i)-(0,h.outerWidth)(o)-o.offsetLeft,bottom:(0,h.innerHeight)(i)-(0,h.outerHeight)(o)-o.offsetTop}}return(0,c.isNum)(n.right)&&(e=Math.min(e,n.right)),(0,c.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,c.isNum)(n.left)&&(e=Math.max(e,n.left)),(0,c.isNum)(n.top)&&(r=Math.max(r,n.top)),[e,r]}function i(t,e,r){var n=Math.round(e/t[0])*t[0],o=Math.round(r/t[1])*t[1];return[n,o]}function a(t){return"both"===t.props.axis||"x"===t.props.axis}function s(t){return"both"===t.props.axis||"y"===t.props.axis}function l(t){var e=t.targetTouches&&t.targetTouches[0]||t;return{clientX:e.clientX,clientY:e.clientY}}function u(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}Object.defineProperty(e,"__esModule",{value:!0}),e.getBoundPosition=o,e.snapToGrid=i,e.canDragX=a,e.canDragY=s,e.getControlPosition=l;var p=r(2),c=(n(p),r(6)),d=r(3),f=n(d),h=r(5)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=r(2),p=n(u),c=r(5),d=r(8),f=r(6),h=r(10),g=n(h),v={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},m=v.mouse,y=function(t){function e(){var t,r,n,a;o(this,e);for(var l=arguments.length,u=Array(l),p=0;l>p;p++)u[p]=arguments[p];return r=n=i(this,(t=Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.state={dragging:!1,lastX:null,lastY:null},n.handleDragStart=function(t){if(n.props.onMouseDown(t),!n.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;if(!(n.props.disabled||n.props.handle&&!(0,c.matchesSelector)(t.target,n.props.handle)||n.props.cancel&&(0,c.matchesSelector)(t.target,n.props.cancel))){t.targetTouches&&n.setState({touchIdentifier:t.targetTouches[0].identifier}),n.props.enableUserSelectHack&&(0,c.addUserSelectStyles)();var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY,i=(0,c.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDragStart: %j",i.position),(0,g["default"])("calling",n.props.onStart);var a=n.props.onStart(t,i);a!==!1&&(n.setState({dragging:!0,lastX:r,lastY:o,scrollX:document.body.scrollLeft,scrollY:document.body.scrollTop}),(0,c.addEvent)(document,"scroll",n.handleScroll),(0,c.addEvent)(document,m.move,n.handleDrag),(0,c.addEvent)(document,m.stop,n.handleDragStop))}},n.handleDrag=function(t){if(!t.targetTouches||t.targetTouches[0].identifier===n.state.touchIdentifier){var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY;if(Array.isArray(n.props.grid)){var i=r-n.state.lastX,a=o-n.state.lastY,l=(0,d.snapToGrid)(n.props.grid,i,a),u=s(l,2);if(i=u[0],a=u[1],!i&&!a)return;r=n.state.lastX+i,o=n.state.lastY+a}var p=(0,c.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDrag: %j",p.position);var f=n.props.onDrag(t,p);return f===!1?void n.handleDragStop({}):void n.setState({lastX:r,lastY:o})}},n.handleDragStop=function(t){if(n.state.dragging&&(!t.changedTouches||t.changedTouches[0].identifier===n.state.touchIdentifier)){n.props.enableUserSelectHack&&(0,c.removeUserSelectStyles)();var e=(0,d.getControlPosition)(t),r=e.clientX,o=e.clientY,i=(0,c.createCoreEvent)(n,r,o);(0,g["default"])("DraggableCore: handleDragStop: %j",i.position),n.setState({dragging:!1,lastX:null,lastY:null}),n.props.onStop(t,i),(0,g["default"])("DraggableCore: Removing handlers"),(0,c.removeEvent)(document,"scroll",n.handleScroll),(0,c.removeEvent)(document,m.move,n.handleDrag),(0,c.removeEvent)(document,m.stop,n.handleDragStop)}},n.handleScroll=function(t){var e=n.state,r=document.body.scrollLeft,o=document.body.scrollTop,i=(0,c.createCoreEvent)(n);i.position.deltaX=r-e.scrollX,i.position.deltaY=o-e.scrollY,n.setState({lastX:e.lastX+i.position.deltaX,lastY:e.lastY+i.position.deltaY,scrollX:r,scrollY:o}),n.props.onDrag(t,i)},n.onMouseDown=function(t){return m=v.mouse,n.handleDragStart(t)},n.onMouseUp=function(t){return m=v.mouse,n.handleDragStop(t)},n.onTouchStart=function(t){return m=v.touch,n.handleDragStart(t)},n.onTouchEnd=function(t){return m=v.touch,n.handleDragStop(t)},a=r,i(n,a)}return a(e,t),l(e,[{key:"componentWillUnmount",value:function(){(0,c.removeEvent)(document,v.mouse.move,this.handleDrag),(0,c.removeEvent)(document,v.touch.move,this.handleDrag),(0,c.removeEvent)(document,v.mouse.stop,this.handleDragStop),(0,c.removeEvent)(document,v.touch.stop,this.handleDragStop),(0,c.removeEvent)(document,"scroll",this.handleScroll),this.props.enableUserSelectHack&&(0,c.removeUserSelectStyles)()}},{key:"render",value:function(){return p["default"].cloneElement(p["default"].Children.only(this.props.children),{style:(0,c.styleHacks)(this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),e}(p["default"].Component);y.displayName="DraggableCore",y.propTypes={allowAnyClick:u.PropTypes.bool,disabled:u.PropTypes.bool,enableUserSelectHack:u.PropTypes.bool,grid:u.PropTypes.arrayOf(u.PropTypes.number),handle:u.PropTypes.string,cancel:u.PropTypes.string,onStart:u.PropTypes.func,onDrag:u.PropTypes.func,onStop:u.PropTypes.func,onMouseDown:u.PropTypes.func,className:f.dontSetMe,style:f.dontSetMe,transform:f.dontSetMe},y.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){}},e["default"]=y},function(t,e,r){"use strict";function n(){}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n}])})},function(t,e,r){function n(t,e,r){var n=!0,s=!0;if("function"!=typeof t)throw new TypeError(a);return i(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),o(t,e,{leading:n,maxWait:e,trailing:s})}var o=r(15),i=r(12),a="Expected a function";t.exports=n},function(t,e,r){function n(t,e,r){function n(e){var r=y,n=b;return y=b=void 0,w=e,P=t.apply(n,r)}function p(t){return w=t,T=setTimeout(f,e),x?n(t):P}function c(t){var r=t-k,n=t-w,o=e-r;return D?u(o,S-n):o}function d(t){var r=t-k,n=t-w;return void 0===k||r>=e||0>r||D&&n>=S}function f(){var t=i();return d(t)?h(t):void(T=setTimeout(f,c(t)))}function h(t){return T=void 0,E&&y?n(t):(y=b=void 0,P)}function g(){w=0,y=k=b=T=void 0}function v(){return void 0===T?P:h(i())}function m(){var t=i(),r=d(t);if(y=arguments,b=this,k=t,r){if(void 0===T)return p(k);if(D)return T=setTimeout(f,e),n(k)}return void 0===T&&(T=setTimeout(f,e)),P}var y,b,S,P,T,k,w=0,x=!1,D=!1,E=!0;if("function"!=typeof t)throw new TypeError(s);return e=a(e)||0,o(r)&&(x=!!r.leading,D="maxWait"in r,S=D?l(a(r.maxWait)||0,e):S,E="trailing"in r?!!r.trailing:E),m.cancel=g,m.flush=v,m}var o=r(12),i=r(16),a=r(17),s="Expected a function",l=Math.max,u=Math.min;t.exports=n},function(t,e){function r(){return Date.now()}t.exports=r},function(t,e,r){function n(t){if("number"==typeof t)return t;if(a(t))return s;if(i(t)){var e=o(t.valueOf)?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(l,"");var r=p.test(t);return r||c.test(t)?d(t.slice(2),r?2:8):u.test(t)?s:+t}var o=r(11),i=r(12),a=r(18),s=NaN,l=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=n},function(t,e,r){function n(t){return"symbol"==typeof t||o(t)&&s.call(t)==i}var o=r(19),i="[object Symbol]",a=Object.prototype,s=a.toString;t.exports=n},function(t,e){function r(t){return!!t&&"object"==typeof t}t.exports=r},function(t,e,r){var n,o;/*! | ||
Copyright (c) 2016 Jed Watson. | ||
@@ -9,0 +9,0 @@ Licensed under the MIT License (MIT), see |
@@ -181,5 +181,9 @@ 'use strict'; | ||
handleUp: function handleUp(event, ui) { | ||
var position = this.state.position; | ||
var pos = this.refs.drag.state.clientX || 0; | ||
var _updateValueFromPosit2 = this.updateValueFromPosition(pos); | ||
var position = _updateValueFromPosit2.position; | ||
// Do we have a drag end hook ? | ||
if (isFunction(this.props.onDragEnd)) { | ||
@@ -186,0 +190,0 @@ this.props.onDragEnd(position); |
@@ -20,2 +20,3 @@ 'use strict'; | ||
onDragEnd: React.PropTypes.func, | ||
triggerOnChangeWhileDragging: React.PropTypes.bool, | ||
markerLabel: React.PropTypes.array, | ||
@@ -62,2 +63,3 @@ displayFollowerPopover: React.PropTypes.bool | ||
onDragEnd: this.props.onDragEnd, | ||
triggerOnChangeWhileDragging: this.props.triggerOnChangeWhileDragging, | ||
ticks: this.props.ticks, | ||
@@ -64,0 +66,0 @@ markerLabel: this.props.markerLabel }), |
{ | ||
"name": "nw-react-slider", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Slider Component", | ||
@@ -5,0 +5,0 @@ "main": "lib/slider.js", |
@@ -170,4 +170,4 @@ var React = require('react') | ||
handleUp: function (event, ui) { | ||
const position = this.state.position | ||
const pos = this.refs.drag.state.clientX || 0 | ||
const { position } = this.updateValueFromPosition(pos) | ||
// Do we have a drag end hook ? | ||
@@ -174,0 +174,0 @@ if (isFunction(this.props.onDragEnd)) { |
@@ -18,2 +18,3 @@ var React = require('react') | ||
onDragEnd: React.PropTypes.func, | ||
triggerOnChangeWhileDragging: React.PropTypes.bool, | ||
markerLabel: React.PropTypes.array, | ||
@@ -61,2 +62,3 @@ displayFollowerPopover: React.PropTypes.bool | ||
onDragEnd={this.props.onDragEnd} | ||
triggerOnChangeWhileDragging={this.props.triggerOnChangeWhileDragging} | ||
ticks={this.props.ticks} | ||
@@ -63,0 +65,0 @@ markerLabel={this.props.markerLabel} /> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
197184
27
3365
0