diff --git a/browser/react-widgets.js b/browser/react-widgets.js index c9bc14e64..c77645398 100644 --- a/browser/react-widgets.js +++ b/browser/react-widgets.js @@ -1,5 +1,5 @@ -/*! v"2.2.3" | (c) 2015 Jason Quense | https://github.com/jquense/react-widgets/blob/master/License.txt */ -this.ReactWidgets=function(e){function t(n){if(s[n])return s[n].exports;var r=s[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var s={};return t.m=e,t.c=s,t.p="",t(0)}([function(e,t,s){e.exports={DropdownList:s(1),Combobox:s(2),Calendar:s(3),DateTimePicker:s(4),NumberPicker:s(5),Multiselect:s(6),SelectList:s(7),utils:{ReplaceTransitionGroup:s(8),SlideTransition:s(9)}}},function(e,t,s){"use strict";var n=function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;tr?this.setState({view:i=e.initialView}):r>s&&this.setState({view:i=e.finalView}),m.eq(o,n(this.props.value),_[i])||this.setState({currentDate:o?new Date(o):new Date})},render:function(){var e=this,t=v.omit(this.props,Object.keys(x)),s=t.className,n=r(t,["className"]),p=P[this.state.view],l=this.state.view,u=this.props.disabled||this.props.readOnly,c=this.state.currentDate,d=this._id("_view_label"),y=this.state.view+"_"+m[this.state.view](c),T=this._id("_view");return o.createElement("div",i({},n,{onKeyDown:this._keyDown,onFocus:this._maybeHandle(this._focus.bind(null,!0),!0),onBlur:this._focus.bind(null,!1),className:h(s,{"rw-calendar":!0,"rw-widget":!0,"rw-state-focus":this.state.focused,"rw-state-disabled":this.props.disabled,"rw-state-readonly":this.props.readOnly,"rw-rtl":this.isRtl()})}),o.createElement(a,{label:this._label(),labelId:d,messages:this.props.messages,upDisabled:u||this.state.view===this.props.finalView,prevDisabled:u||!m.inRange(this.nextDate(g.LEFT),this.props.min,this.props.max,l),nextDisabled:u||!m.inRange(this.nextDate(g.RIGHT),this.props.min,this.props.max,l),onViewChange:this._maybeHandle(this.navigate.bind(null,g.UP,null)),onMoveLeft:this._maybeHandle(this.navigate.bind(null,g.LEFT,null)),onMoveRight:this._maybeHandle(this.navigate.bind(null,g.RIGHT,null))}),o.createElement(f,{ref:"animation",duration:this.props.duration,direction:this.state.slideDirection,onAnimate:function(){return e._focus(!0)}},o.createElement(p,{ref:"currentView",key:y,id:T,culture:this.props.culture,"aria-labelledby":d,selectedDate:this.props.value,value:this.state.currentDate,onChange:this._maybeHandle(this.change),onKeyDown:this._maybeHandle(this._keyDown),onMoveLeft:this._maybeHandle(this.navigate.bind(null,g.LEFT)),onMoveRight:this._maybeHandle(this.navigate.bind(null,g.RIGHT)),disabled:this.props.disabled,readOnly:this.props.readOnly,min:this.props.min,max:this.props.max})))},navigate:function(e,t){var s=this.state.view,n=e===g.LEFT||e===g.UP?"right":"left";t||(t=-1!==[g.LEFT,g.RIGHT].indexOf(e)?this.nextDate(e):this.state.currentDate),e===g.DOWN&&(s=b[s]||s),e===g.UP&&(s=O[s]||s),this.isValidView(s)&&m.inRange(t,this.props.min,this.props.max,s)&&(this._focus(!0,"nav"),this.setState({currentDate:t,slideDirection:n,view:s}))},_focus:function(e,t){var s=this;-1!==+this.props.tabIndex&&(clearTimeout(this.timer),this.timer=setTimeout(function(){e&&s.getDOMNode().focus(),e!==s.state.focused&&(s.notify(e?"onFocus":"onBlur",t),s.setState({focused:e}))}))},change:function(e){var t=this;return setTimeout(function(){return t._focus(!0)}),this.props.onChange&&this.state.view===this.props.initialView?this.notify("onChange",e):void this.navigate(g.DOWN,e)},nextDate:function(e){var t=e===g.LEFT?"subtract":"add",s=this.state.view,n=s===T.MONTH?s:T.YEAR,r=D[s]||1;return m[t](this.state.currentDate,1*r,n)},_keyDown:function(e){var t=e.ctrlKey,s=e.key;t?("ArrowDown"===s&&(e.preventDefault(),this.navigate(g.DOWN)),"ArrowUp"===s&&(e.preventDefault(),this.navigate(g.UP)),"ArrowLeft"===s&&(e.preventDefault(),this.navigate(g.LEFT)),"ArrowRight"===s&&(e.preventDefault(),this.navigate(g.RIGHT))):this.refs.currentView._keyDown&&this.refs.currentView._keyDown(e),this.notify("onKeyDown",[e])},_label:function(){var e=this.state.view,t=this.state.currentDate,s=this.props.culture;return"month"===e?m.format(t,m.formats.MONTH_YEAR,s):"year"===e?m.format(t,m.formats.YEAR):"decade"===e?m.format(m.firstOfDecade(t),m.formats.YEAR,s)+" - "+m.format(m.lastOfDecade(t),m.formats.YEAR,s):"century"===e?m.format(m.firstOfCentury(t),m.formats.YEAR,s)+" - "+m.format(m.lastOfCentury(t),m.formats.YEAR,s):void 0},inRangeValue:function(e){var t=n(e);return null===t?t:m.max(m.min(t,this.props.max),this.props.min)},isValidView:function(e){var t=w.indexOf(this.props.initialView),s=w.indexOf(this.props.finalView),n=w.indexOf(e);return n>=t&&s>=n}});e.exports=d.createControlledClass(C,{value:"onChange"}),e.exports.BaseCalendar=C},function(e,t,s){"use strict";function n(e,t,s){var n="";return e instanceof Date&&!isNaN(e.getTime())&&(n=c.format(e,t,s)),n}function r(e,t,s){var n;e=[].concat(e);for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},a=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;ts;)r.push(e.slice(s,s+=t));return r},splat:function(e){return null==e?[]:[].concat(e)},noop:function(){},uniqueId:function(e){return""+((null==e?"":e)+ ++i)}}},function(e){"use strict";var t={eq:function(e,t){return e===t},neq:function(e,t){return e!==t},gt:function(e,t){return e>t},gte:function(e,t){return e>=t},lt:function(e,t){return t>e},lte:function(e,t){return t>=e},contains:function(e,t){return-1!==e.indexOf(t)},startsWith:function(e,t){return 0===e.lastIndexOf(t,0)},endsWith:function(e,t){var s=e.length-t.length,n=e.indexOf(t,s);return-1!==n&&n===s}};e.exports=t},function(e,t,s){"use strict";function n(e){var t=o.Children.map(e,function(e){return e});for(var s in t)return s}var r=function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0&&i(e,s,s+n)}},getDefaultProps:function(){return{value:""}},render:function(){return r.createElement("input",n({},this.props,{type:"text",className:this.props.className+" rw-input",onKeyDown:this.props.onKeyDown,onChange:this._change,value:null==this.props.value?"":this.props.value}))},isSuggesting:function(){var e=this.props.value,t=null!=this._last&&-1!==e.toLowerCase().indexOf(this._last.toLowerCase());return this.props.suggest&&t},accept:function(e){var t=this.getDOMNode().value||"",s=t.length;this._last=null,e&&i(this.getDOMNode(),s,s)},_change:function(e){var t=e.target.value;this._last=t,this.props.onChange(e,t)},focus:function(){this.getDOMNode().focus()}})},function(e,t,s){"use strict";function n(e,t){return p.propType(function(s,n,i,o){return void 0!==s[n]?s[e]?t&&t(s,n,i,o):new Error("ReactWidgets: you have provided a `"+n+"` prop to `"+i+"` without an `"+e+"` handler. This will render a read-only field. If the field should be mutable use `"+r(n)+"`. Otherwise, set `"+e+"`"):void 0})}function r(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function i(e,t,s){return function(){t&&t.apply(e,arguments),s&&s.apply(e,arguments)}}var o=s(12),a=s(10),p=s(44);e.exports={createControlledClass:function(e,t,s){function p(e,s){var n,r=t[e],i=r&&l(this.props,e),o={};return this._notifying||(this._notifying=[]),this.props[r]&&(n=[].slice.call(arguments,1),this._notifying.push(!0),this.props[r].apply(this,n),this._notifying.pop()),o[e]=s,this.setState(o),!i}function l(e,t){return void 0!==e[t]}var u=o.transform(t,function(t,s,i){var o=e.type.propTypes[i];t[i]=n(s,o),t[r(i)]=o},{});return s=s||{},a.createClass({displayName:e.displayName,propTypes:u,getInitialState:function(){var e=this.props,s=Object.keys(t);return o.transform(s,function(t,s){t[s]=e[r(s)]},{})},shouldComponentUpdate:function(){return!this._notifying||!this._notifying.length},render:function(){var n,r,u=this;n=o.transform(t,function(e,t,s){e[s]=l(u.props,s)?u.props[s]:u.state[s]},{}),r=o.transform(t,function(e,t,s){e[t]=p.bind(u,s)},{}),n=o.merge(this.props,n,r);for(var c in s)o.has(n,c)&&(n[c]=i(this,s[c],n[c]));return a.createElement(e,n,this.props.children)}})}}},function(e,t,s){"use strict";function n(e){function t(t,s,n,r,i){return r=r||"<>",null!=s[n]?e(s,n,r,i):t?new Error("Required prop `"+n+"` was not specified in `"+r+"`."):void 0}var s=t.bind(null,!1);return s.isRequired=t.bind(null,!0),s}var r=s(10);e.exports={elementType:n(function(e,t,s){if("function"!=typeof e[t]){if(r.isValidElement(e[t]))return new Error("Invalid prop `"+t+"` specified in `"+s+"`. Expected an Element `type`, not an actual Element");if("string"!=typeof e[t])return new Error("Invalid prop `"+t+"` specified in `"+s+"`. Expected an Element `type` such as a tag name or return value of React.createClass(...)")}return!0})}},function(e,t,s){"use strict";var n=function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=t&&s(i._dataText.call(n,r).toLowerCase(),e.toLowerCase())})}}},function(e,t,s){"use strict";function n(e,t,s){return t=s.caseSensitive?t:t.toLowerCase(),function(n){var r=o._dataText.call(s,n);return s.caseSensitive||(r=r.toLowerCase()),e(r,t)}}var r=s(10),i=s(13),o=s(25),a=(s(12),Object.keys(i).filter(function(e){return"filter"!==e}));e.exports={propTypes:{data:r.PropTypes.array,value:r.PropTypes.any,filter:r.PropTypes.oneOfType([r.PropTypes.func,r.PropTypes.oneOf(a.concat(!1))]),caseSensitive:r.PropTypes.bool,minLength:r.PropTypes.number},getDefaultProps:function(){return{caseSensitive:!1,minLength:1}},filterIndexOf:function(e,t){var s=-1,r="function"==typeof this.props.filter?this.props.filter:n(i[this.props.filter||"eq"],t,this);return!t||!t.trim()||this.props.filter&&t.length<(this.props.minLength||1)?-1:(e.every(function(e,n){return r(e,t)?(s=n,!1):!0}),s)},filter:function(e,t){var s="string"==typeof this.props.filter?n(i[this.props.filter],t,this):this.props.filter;return!s||!t||!t.trim()||t.length<(this.props.minLength||1)?e:e.filter(function(e){return s(e,t)})}}},function(e,t,s){"use strict";var n=s(10),r=s(12);e.exports={propTypes:{valueField:n.PropTypes.string,textField:n.PropTypes.string},_dataValue:function(e){var t=this.props.valueField;return t&&e&&r.has(e,t)?e[t]:e},_dataText:function(e){var t=this.props.textField;return(t&&e&&r.has(e,t)?e[t]:e)+""},_dataIndexOf:function(e,t){return r.findIndex(e,this._valueMatcher.bind(null,t),this)},_valueMatcher:function(e,t){return r.isShallowEqual(this._dataValue(e),this._dataValue(t))},_dataItem:function(e,t){var s,n=e[0],i=this.props.valueField;return r.has(t,i)||typeof n==typeof val?t:(s=this._dataIndexOf(e,this._dataValue(t)),-1!==s?e[s]:t)}}},function(e,t,s){"use strict";var n=s(39);e.exports={_scrollTo:function(e,t){var s=this.props.onMove; -this.props.open&&(s?s(e,t):(this._scrollCancel&&this._scrollCancel(),this._scrollCancel=n(e,t)))}}},function(e,t,s){"use strict";var n=s(10);e.exports={propTypes:{isRtl:n.PropTypes.bool},contextTypes:{isRtl:n.PropTypes.bool},childContextTypes:{isRtl:n.PropTypes.bool},getChildContext:function(){return{isRtl:this.props.isRtl||this.context&&this.context.isRtl}},isRtl:function(){return!!(this.props.isRtl||this.context&&this.context.isRtl)}}},function(e,t,s){"use strict";var n=s(10),r=s(15);e.exports=n.createClass({displayName:"exports",propTypes:{label:n.PropTypes.string.isRequired,labelId:n.PropTypes.string,upDisabled:n.PropTypes.bool.isRequired,prevDisabled:n.PropTypes.bool.isRequired,nextDisabled:n.PropTypes.bool.isRequired,onViewChange:n.PropTypes.func.isRequired,onMoveLeft:n.PropTypes.func.isRequired,onMoveRight:n.PropTypes.func.isRequired,messages:n.PropTypes.shape({moveBack:n.PropTypes.string,moveForward:n.PropTypes.string})},mixins:[s(35),s(47)],getDefaultProps:function(){return{messages:{moveBack:"navigate back",moveForward:"navigate forward"}}},render:function(){var e=this.isRtl();return n.createElement("div",{className:"rw-header"},n.createElement(r,{className:"rw-btn-left",tabIndex:"-1",onClick:this.props.onMoveLeft,disabled:this.props.prevDisabled,"aria-disabled":this.props.prevDisabled,title:this.props.moveBack},n.createElement("i",{className:"rw-i rw-i-caret-"+(e?"right":"left")},n.createElement("span",{className:"rw-sr"},this.props.moveBack))),n.createElement(r,{className:"rw-btn-view",id:this.props.labelId,tabIndex:"-1",onClick:this.props.onViewChange,disabled:this.props.upDisabled,"aria-disabled":this.props.upDisabled},this.props.label),n.createElement(r,{className:"rw-btn-right",tabIndex:"-1",onClick:this.props.onMoveRight,disabled:this.props.nextDisabled,"aria-disabled":this.props.nextDisabled,title:this.props.moveForward},n.createElement("i",{className:"rw-i rw-i-caret-"+(e?"left":"right")},n.createElement("span",{className:"rw-sr"},this.props.moveForward))))}})},function(e,t,s){"use strict";function n(e,t,s,n,r){var i=a.add(e,t,s);return a.inRange(i,n,r,"day")?i:e}var r=Object.assign||function(e){for(var t=1;ts&&i.date(r)===o&&i.lte(r,n.max);)s++,t.push({date:r,label:i.format(r,e.format,e.culture)}),r=i.add(r,e.step||30,"minutes");return t},_dateValues:function(e){var t,s,n=e.value||i.today(),r=e.preserveDate,o=e.min,a=e.max;return r?{min:i.eq(n,o,"day")?o:i.today(),max:i.eq(n,a,"day")?o:i.tomorrow()}:(t=i.startOf(i.merge(new Date,o),"minutes"),s=i.startOf(i.merge(new Date,a),"minutes"),i.lte(s,t)&&i.gt(a,o,"day")&&(s=i.tomorrow()),{min:t,max:s})},_keyDown:function(e){var t=this,s=e.key,n=String.fromCharCode(e.keyCode),r=this.state.focusedItem,i=this.refs.list;"End"===s?this.setState({focusedItem:i.last()}):"Home"===s?this.setState({focusedItem:i.first()}):"Enter"===s?this.props.onSelect(r):"ArrowDown"===s?(e.preventDefault(),this.setState({focusedItem:i.next(r)})):"ArrowUp"===s?(e.preventDefault(),this.setState({focusedItem:i.prev(r)})):(e.preventDefault(),this.search(n,function(e){t.setState({focusedItem:e})}))},search:function(e,t){var s=this,n=((this._searchTerm||"")+e).toLowerCase();clearTimeout(this._timer),this._searchTerm=n,this._timer=setTimeout(function(){var e=s.refs.list,r=e.next(s.state.focusedItem,n);s._searchTerm="",r&&t(r)},this.props.delay)}})},function(e,t,s){"use strict";function n(e){return!isNaN(e.getTime())}function r(e,t,s){var r="";return e instanceof Date&&n(e)&&(r=l.format(e,t,s)),r}function i(e,t,s){return function(){e&&e.apply(s,arguments),t&&t.apply(s,arguments)}}var o=Object.assign||function(e){for(var t=1;t=this.props.min},current:i("stringValue")})},function(e,t,s){"use strict";function n(e){return e===e.window?e:9===e.nodeType&&e.defaultView}var r=s(42);e.exports=function(e,t){var s,i,o,a,p,l,u,c=r.offset(e),h={top:0,left:0};if(e){s=t||r.scrollParent(e),a=n(s),i=r.scrollTop(s),l=r.height(s,!0),a=n(s),a||(h=r.offset(s)),c={top:c.top-h.top,left:c.left-h.left,height:c.height,width:c.width},p=c.height,o=c.top+(a?0:i),u=o+p,i=i>o?o:u>i+l?u-l:i;var d=r.raf(function(){return r.scrollTop(s,i)});return function(){return r.raf.cancel(d)}}}},function(e,t,s){"use strict";var n=Object.assign||function(e){for(var t=1;te&&this.isDisabled(e,!0);)e++;e!==t&&this.setState({focused:e})},last:function(){for(var e=this.props.value.length-1;e>-1&&this.isDisabled(e,!0);)e--;e>=0&&this.setState({focused:e})},next:function(){for(var e=this.state.focused+1,t=this.props.value.length;t>e&&this.isDisabled(e,!0);)e++;return null!==this.state.focused?e>=t?this.clear():void this.setState({focused:e}):void 0},prev:function(){var e=this.state.focused;for(null===e&&(e=this.props.value.length),e--;e>-1&&this.isDisabled(e,!0);)e--;e>=0&&this.setState({focused:e})}})},function(e,t,s){"use strict";function n(e){return e===e.window?e:9===e.nodeType&&e.defaultView}function r(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})}function i(e){return e.replace(/[A-Z]/g,function(e,t){return(0!==t?"-":"")+e.toLowerCase()})}function o(e,t){return"removeProperty"in e?e.removeProperty(t):e.removeAttribute(t)}function a(e){if(!e)throw new Error;var t=e.ownerDocument;return"defaultView"in t?t.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null):{getPropertyValue:function(t){var s=arguments,n=/(\-([a-z]){1})/g;return"float"==t&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return s[2].toUpperCase()})),e.currentStyle[t]||null}}}var p=s(50);if(p){var l,u,c,h,d,f,m=Object.prototype.hasOwnProperty,y=s(52),v="",g=document.createElement("div"),T={},w="transform",b={O:"otransitionend",Moz:"transitionend",Webkit:"webkitTransitionEnd"},O={left:"translateX",right:"translateX",top:"translateY",bottom:"translateY"};for(var _ in b)if(m.call(b,_)&&void 0!==g.style[_+"TransitionProperty"]){v="-"+_.toLowerCase()+"-",f=b[_];break}f||void 0===g.style.transitionProperty||(f="transitionend"),d=!f,w=v+w,T[c=v+"transition-property"]=T[u=v+"transition-duration"]=T[h=v+"transition-delay"]=T[l=v+"transition-timing-function"]=""}var P=e.exports={width:function(e,t){var s=n(e);return s?s.innerWidth:t?e.clientWidth:P.offset(e).width},height:function(e,t){var s=n(e);return s?s.innerHeight:t?e.clientHeight:P.offset(e).height},hasFocus:function(e){var t=e.ownerDocument;return null==t.activeElement?!1:t.activeElement===e},offset:function(e){var t=e.ownerDocument,s=t&&t.documentElement,n={top:0,left:0,height:0,width:0};if(s)return P.contains(s,e)?(void 0!==e.getBoundingClientRect&&(n=e.getBoundingClientRect()),{top:n.top+window.pageYOffset-s.clientTop,left:n.left+window.pageXOffset-s.clientLeft,width:n.width||e.offsetWidth,height:n.height||e.offsetHeight}):n},css:function(e,t,s){var n="",p=t;if("string"==typeof t){if(void 0===s)return e.style[r(t)]||a(e).getPropertyValue(t);(p={})[t]=s}for(var l in p)m.call(p,l)&&(p[l]||0===p[l]?n+=i(l)+":"+p[l]+";":o(e.style,i(l)));e.style.cssText+=";"+n},contains:function(){var e=p&&document.documentElement;return e&&e.contains?function(e,t){return e.contains(t)}:e&&e.compareDocumentPosition?function(e,t){return e===t||!!(16&e.compareDocumentPosition(t))}:function(e,t){if(t)do if(t===e)return!0;while(t=t.parentNode);return!1}}(),scrollParent:function(e){var t=P.css(e,"position"),s="absolute"===t,n=e.ownerDocument;if("fixed"===t)return n||document;for(;(e=e.parentNode)&&9!==e.nodeType;){var r=s&&"static"===P.css(e,"position"),i=P.css(e,"overflow")+P.css(e,"overflow-y")+P.css(e,"overflow-x");if(!r&&/(auto|scroll)/.test(i)&&P.height(e)0&&(v[c]=p.join(", "),v[u]=s/1e3+"s",v[h]="0s",v[l]=n||"linear",P.on(e,f,o),setTimeout(function(){a||o(y)},s+25)),e.clientLeft,P.css(e,v),0>=s&&setTimeout(o.bind(null,y),0)}}},function(e){!function(){e.exports=this.Globalize}()},function(e,t,s){"use strict";var n=s(10),r=e.exports={version:function(){return n.version.split(".").map(parseFloat)},propType:function(e){return function(t,s,n,i){var o=r.version(),a=e.call(this,t,s,n,i);return a&&a!==!0?0===o[0]&&o[1]<11?void 0:a:void 0}}}},function(e){"use strict";function t(e){var t,s,n,r;if(void 0!==e.selectionStart)t=e.selectionStart,s=e.selectionEnd;else try{e.focus(),n=e.createTextRange(),r=n.duplicate(),n.moveToBookmark(document.selection.createRange().getBookmark()),r.setEndPoint("EndToStart",n),t=r.text.length,s=t+n.text.length}catch(i){}return{start:t,end:s}}function s(e,t,s){var n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t,s)):(e.focus(),n=e.createTextRange(),n.collapse(!0),n.moveStart("character",t),n.moveEnd("character",s-t),n.select())}catch(r){}}e.exports=function(e,n,r){return void 0===n?t(e):void s(e,n,r)}},function(e,t,s){"use strict";function n(e,t,s,n,r){var p=o.startsWith;return i.find(t,function(t,i){return("next"===r?i>n:n>i)&&p(a._dataText.call(e,t).toLowerCase(),s.toLowerCase())})}var r=s(10),i=s(12),o=s(13),a=s(25);e.exports={propTypes:{textField:r.PropTypes.string},first:function(){return this._data()[0]},last:function(){var e=this._data();return e[e.length-1]},prev:function(e,t){var s=this._data(),r=s.indexOf(e);return-1===r&&(r=s.length),t?n(this,s,t,r,"prev"):--r<0?s[0]:s[r]},next:function(e,t){var s=this._data(),r=s.indexOf(e);return t?n(this,s,t,r,"next"):++r===s.length?s[s.length-1]:s[r]}}},function(e,t,s){"use strict";var n=s(10);e.exports={contextTypes:{isRtl:n.PropTypes.bool},isRtl:function(){return!!this.context.isRtl}}},function(e,t,s){"use strict";function n(e,t,s){return null==e?e:i.max(i.min(e,s),t)}var r=s(10),i=s(33),o=s(34).directions;e.exports=function(e,t){return{propTypes:{value:r.PropTypes.instanceOf(Date),min:r.PropTypes.instanceOf(Date),max:r.PropTypes.instanceOf(Date)},getInitialState:function(){return{focusedDate:n(this.props.value,this.props.min,this.props.max)}},componentWillReceiveProps:function(e){var s=this.state.focusedDate;//!dates.inRange(focused, nextProps.min, nextProps.max) -i.eq(e.value,s,t)||this.setState({focusedDate:e.value})},_keyDown:function(s){var n=s.key,r=this.state.focusedDate,a=r;if("Enter"===n)return s.preventDefault(),this.props.onChange(a);if("ArrowLeft"===n?a=this.move(a,o.LEFT):"ArrowRight"===n?a=this.move(a,o.RIGHT):"ArrowUp"===n?a=this.move(a,o.UP):"ArrowDown"===n&&(a=this.move(a,o.DOWN)),!i.eq(r,a,t)){if(s.preventDefault(),i.gt(a,this.props.value,e))return this.props.onMoveRight(a);if(i.lt(a,this.props.value,e))return this.props.onMoveLeft(a);this.setState({focusedDate:a})}}}}},function(e){"use strict";e.exports=function(e){return function(t){var s={};return s[e]=t,this.setState(s),this}}},function(e){"use strict";e.exports=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e){function t(e){for(var t=1;tn&&(n=12+t),f.month(e)!==n%12&&(e=f.date(e,0)),e}function s(e){return e=e.charAt(0).toUpperCase()+e.substr(1),function(t,s){return void 0===s?t["get"+e]():(t=new Date(t),t["set"+e](s),t)}}function n(e){return function(t,s,n){return e(+f.startOf(t,n),+f.startOf(s,n))}}var r="milliseconds",i="seconds",o="minutes",a="hours",p="day",l="week",u="month",c="year",h="decade",d="century",f=e.exports={startOfWeek:function(){return 0},add:function(e,s,n){if(e=new Date(e),n===r)return f.milliseconds(e,f.milliseconds(e)+s);if(n===i)return f.seconds(e,f.seconds(e)+s);if(n===o)return f.minutes(e,f.minutes(e)+s);if(n===a)return f.hours(e,f.hours(e)+s);if(n===p)return f.date(e,f.date(e)+s);if(n===l)return f.date(e,f.date(e)+7*s);if(n===u)return t(e,s);if(n===c)return f.year(e,f.year(e)+s);if(n===h)return f.year(e,f.year(e)+10*s);if(n===d)return f.year(e,f.year(e)+100*s);throw new TypeError('Invalid units: "'+n+'"')},subtract:function(e,t,s){return f.add(e,-t,s)},startOf:function(e,t){switch(e=new Date(e),t){case"century":case"decade":case"year":e=f.month(e,0);case"month":e=f.date(e,1);case"week":case"day":e=f.hours(e,0);case"hours":e=f.minutes(e,0);case"minutes":e=f.seconds(e,0);case"seconds":e=f.milliseconds(e,0)}return t===h&&(e=f.subtract(e,f.year(e)%10,"year")),t===d&&(e=f.subtract(e,f.year(e)%100,"year")),t===l&&(e=f.weekday(e,0)),e},endOf:function(e,t){return e=new Date(e),e=f.startOf(e,t),e=f.add(e,1,t),e=f.subtract(e,1,r)},eq:n(function(e,t){return e===t}),gt:n(function(e,t){return e>t}),gte:n(function(e,t){return e>=t}),lt:n(function(e,t){return t>e}),lte:n(function(e,t){return t>=e}),min:function(){var e=Array.prototype.slice.call(arguments);return new Date(Math.min.apply(Math,e))},max:function(){var e=Array.prototype.slice.call(arguments);return new Date(Math.max.apply(Math,e))},inRange:function(e,t,s,n){return n=n||"day",!(t&&!f.gte(e,t,n)||s&&!f.lte(e,s,n))},milliseconds:s("Milliseconds"),seconds:s("Seconds"),minutes:s("Minutes"),hours:s("Hours"),day:s("Day"),date:s("Date"),month:s("Month"),year:s("FullYear"),decade:function(e,t){return void 0==t?f.year(f.startOf(e,h)):f.add(e,t+10,c)},century:function(e,t){return void 0==t?f.year(f.startOf(e,d)):f.add(e,t+100,c)},weekday:function(e,t){var s=(f.day(e)+7-f.startOfWeek())%7;return void 0==t?s:f.add(e,t-s,p)}}},function(e){function t(){for(var e={},t=0;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;tr?this.setState({view:i=e.initialView}):r>s&&this.setState({view:i=e.finalView}),m.eq(o,n(this.props.value),_[i])||this.setState({currentDate:o?new Date(o):new Date})},render:function(){var e=this,t=v.omit(this.props,Object.keys(x)),s=t.className,n=r(t,["className"]),p=P[this.state.view],l=this.state.view,u=this.props.disabled||this.props.readOnly,c=this.state.currentDate,d=this._id("_view_label"),y=this.state.view+"_"+m[this.state.view](c),T=this._id("_view");return o.createElement("div",i({},n,{onKeyDown:this._keyDown,onFocus:this._maybeHandle(this._focus.bind(null,!0),!0),onBlur:this._focus.bind(null,!1),className:h(s,{"rw-calendar":!0,"rw-widget":!0,"rw-state-focus":this.state.focused,"rw-state-disabled":this.props.disabled,"rw-state-readonly":this.props.readOnly,"rw-rtl":this.isRtl()})}),o.createElement(a,{label:this._label(),labelId:d,messages:this.props.messages,upDisabled:u||this.state.view===this.props.finalView,prevDisabled:u||!m.inRange(this.nextDate(g.LEFT),this.props.min,this.props.max,l),nextDisabled:u||!m.inRange(this.nextDate(g.RIGHT),this.props.min,this.props.max,l),onViewChange:this._maybeHandle(this.navigate.bind(null,g.UP,null)),onMoveLeft:this._maybeHandle(this.navigate.bind(null,g.LEFT,null)),onMoveRight:this._maybeHandle(this.navigate.bind(null,g.RIGHT,null))}),o.createElement(f,{ref:"animation",duration:this.props.duration,direction:this.state.slideDirection,onAnimate:function(){return e._focus(!0)}},o.createElement(p,{ref:"currentView",key:y,id:T,culture:this.props.culture,"aria-labelledby":d,selectedDate:this.props.value,value:this.state.currentDate,onChange:this._maybeHandle(this.change),onKeyDown:this._maybeHandle(this._keyDown),onMoveLeft:this._maybeHandle(this.navigate.bind(null,g.LEFT)),onMoveRight:this._maybeHandle(this.navigate.bind(null,g.RIGHT)),disabled:this.props.disabled,readOnly:this.props.readOnly,min:this.props.min,max:this.props.max})))},navigate:function(e,t){var s=this.state.view,n=e===g.LEFT||e===g.UP?"right":"left";t||(t=-1!==[g.LEFT,g.RIGHT].indexOf(e)?this.nextDate(e):this.state.currentDate),e===g.DOWN&&(s=b[s]||s),e===g.UP&&(s=O[s]||s),this.isValidView(s)&&m.inRange(t,this.props.min,this.props.max,s)&&(this._focus(!0,"nav"),this.setState({currentDate:t,slideDirection:n,view:s}))},_focus:function(e,t){var s=this;-1!==+this.props.tabIndex&&this.setTimeout("focus",function(){e&&s.getDOMNode().focus(),e!==s.state.focused&&(s.notify(e?"onFocus":"onBlur",t),s.setState({focused:e}))})},change:function(e){var t=this;return setTimeout(function(){return t._focus(!0)}),this.props.onChange&&this.state.view===this.props.initialView?this.notify("onChange",e):void this.navigate(g.DOWN,e)},nextDate:function(e){var t=e===g.LEFT?"subtract":"add",s=this.state.view,n=s===T.MONTH?s:T.YEAR,r=D[s]||1;return m[t](this.state.currentDate,1*r,n)},_keyDown:function(e){var t=e.ctrlKey,s=e.key;t?("ArrowDown"===s&&(e.preventDefault(),this.navigate(g.DOWN)),"ArrowUp"===s&&(e.preventDefault(),this.navigate(g.UP)),"ArrowLeft"===s&&(e.preventDefault(),this.navigate(g.LEFT)),"ArrowRight"===s&&(e.preventDefault(),this.navigate(g.RIGHT))):this.refs.currentView._keyDown&&this.refs.currentView._keyDown(e),this.notify("onKeyDown",[e])},_label:function(){var e=this.state.view,t=this.state.currentDate,s=this.props.culture;return"month"===e?m.format(t,m.formats.MONTH_YEAR,s):"year"===e?m.format(t,m.formats.YEAR):"decade"===e?m.format(m.firstOfDecade(t),m.formats.YEAR,s)+" - "+m.format(m.lastOfDecade(t),m.formats.YEAR,s):"century"===e?m.format(m.firstOfCentury(t),m.formats.YEAR,s)+" - "+m.format(m.lastOfCentury(t),m.formats.YEAR,s):void 0},inRangeValue:function(e){var t=n(e);return null===t?t:m.max(m.min(t,this.props.max),this.props.min)},isValidView:function(e){var t=w.indexOf(this.props.initialView),s=w.indexOf(this.props.finalView),n=w.indexOf(e);return n>=t&&s>=n}});e.exports=d.createControlledClass(C,{value:"onChange"}),e.exports.BaseCalendar=C},function(e,t,s){"use strict";function n(e,t,s){var n="";return e instanceof Date&&!isNaN(e.getTime())&&(n=c.format(e,t,s)),n}function r(e,t,s){var n;e=[].concat(e);for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},a=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;ts;)r.push(e.slice(s,s+=t));return r},splat:function(e){return null==e?[]:[].concat(e)},noop:function(){},uniqueId:function(e){return""+((null==e?"":e)+ ++i)}}},function(e,t,s){"use strict";var n=s(11);e.exports=function(e,t){return 1===arguments.length&&("string"==typeof e?t={}:(t=e,e="")),Array.isArray(t)||(t=n.transform(t,function(e,t,s){t&&e.push(s)},[])),(e?e+" ":"")+t.join(" ")}},function(e,t,s){"use strict";function n(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function r(e,t,s){return function(){t&&t.apply(e,arguments),s&&s.apply(e,arguments)}}{var i=s(11),o=s(10);s(44)}e.exports={createControlledClass:function(e,t,s){function a(e,s){var n,r=t[e],i=r&&p(this.props,e),o={};return this._notifying||(this._notifying=[]),this.props[r]&&(n=[].slice.call(arguments,1),this._notifying.push(!0),this.props[r].apply(this,n),this._notifying.pop()),o[e]=s,this.setState(o),!i}function p(e,t){return void 0!==e[t]}var l={};return s=s||{},o.createClass({displayName:e.displayName,propTypes:l,getInitialState:function(){var e=this.props,s=Object.keys(t);return i.transform(s,function(t,s){t[s]=e[n(s)]},{})},shouldComponentUpdate:function(){return!this._notifying||!this._notifying.length},render:function(){var n=this,l={};i.each(t,function(e,t){l[t]=p(n.props,t)?n.props[t]:n.state[t],l[e]=a.bind(n,t)}),l=i.assign({},this.props,l);for(var u in s)i.has(l,u)&&(l[u]=r(this,s[u],l[u]));return o.createElement(e,l,this.props.children)}})}}},function(e,t,s){"use strict";function n(e){function t(t,s,n,r,i){return r=r||"<>",null!=s[n]?e(s,n,r,i):t?new Error("Required prop `"+n+"` was not specified in `"+r+"`."):void 0}var s=t.bind(null,!1);return s.isRequired=t.bind(null,!0),s}var r=s(10);e.exports={elementType:n(function(e,t,s){if("function"!=typeof e[t]){if(r.isValidElement(e[t]))return new Error("Invalid prop `"+t+"` specified in `"+s+"`. Expected an Element `type`, not an actual Element");if("string"!=typeof e[t])return new Error("Invalid prop `"+t+"` specified in `"+s+"`. Expected an Element `type` such as a tag name or return value of React.createClass(...)")}return!0})}},function(e,t,s){"use strict";function n(e){var t=o.Children.map(e,function(e){return e});for(var s in t)return s}var r=function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;tt},gte:function(e,t){return e>=t},lt:function(e,t){return t>e},lte:function(e,t){return t>=e},contains:function(e,t){return-1!==e.indexOf(t)},startsWith:function(e,t){return 0===e.lastIndexOf(t,0)},endsWith:function(e,t){var s=e.length-t.length,n=e.indexOf(t,s);return-1!==n&&n===s}};e.exports=t},function(e,t,s){"use strict";var n=function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s},r=Object.assign||function(e){for(var t=1;t=0&&i(e,s,s+n)}},getDefaultProps:function(){return{value:""}},render:function(){return r.createElement("input",n({},this.props,{type:"text",className:this.props.className+" rw-input",onKeyDown:this.props.onKeyDown,onChange:this._change,value:null==this.props.value?"":this.props.value}))},isSuggesting:function(){var e=this.props.value,t=null!=this._last&&-1!==e.toLowerCase().indexOf(this._last.toLowerCase());return this.props.suggest&&t},accept:function(e){var t=this.getDOMNode().value||"",s=t.length;this._last=null,e&&i(this.getDOMNode(),s,s)},_change:function(e){var t=e.target.value;this._last=t,this.props.onChange(e,t)},focus:function(){this.getDOMNode().focus()}})},function(e,t,s){"use strict";function n(e,t,s){return t=s.caseSensitive?t:t.toLowerCase(),function(n){var r=o._dataText.call(s,n);return s.caseSensitive||(r=r.toLowerCase()),e(r,t)}}var r=s(10),i=s(25),o=s(22),a=Object.keys(i).filter(function(e){return"filter"!==e});e.exports={propTypes:{data:r.PropTypes.array,value:r.PropTypes.any,filter:r.PropTypes.oneOfType([r.PropTypes.func,r.PropTypes.oneOf(a.concat(!1))]),caseSensitive:r.PropTypes.bool,minLength:r.PropTypes.number},getDefaultProps:function(){return{caseSensitive:!1,minLength:1}},filterIndexOf:function(e,t){var s=-1,r="function"==typeof this.props.filter?this.props.filter:n(i[this.props.filter||"eq"],t,this);return!t||!t.trim()||this.props.filter&&t.length<(this.props.minLength||1)?-1:(e.every(function(e,n){return r(e,t)?(s=n,!1):!0}),s)},filter:function(e,t){var s="string"==typeof this.props.filter?n(i[this.props.filter],t,this):this.props.filter; +return!s||!t||!t.trim()||t.length<(this.props.minLength||1)?e:e.filter(function(e){return s(e,t)})}}},function(e,t,s){"use strict";var n=s(10),r=s(26);e.exports=n.createClass({displayName:"exports",propTypes:{label:n.PropTypes.string.isRequired,labelId:n.PropTypes.string,upDisabled:n.PropTypes.bool.isRequired,prevDisabled:n.PropTypes.bool.isRequired,nextDisabled:n.PropTypes.bool.isRequired,onViewChange:n.PropTypes.func.isRequired,onMoveLeft:n.PropTypes.func.isRequired,onMoveRight:n.PropTypes.func.isRequired,messages:n.PropTypes.shape({moveBack:n.PropTypes.string,moveForward:n.PropTypes.string})},mixins:[s(21),s(47)],getDefaultProps:function(){return{messages:{moveBack:"navigate back",moveForward:"navigate forward"}}},render:function(){var e=this.isRtl();return n.createElement("div",{className:"rw-header"},n.createElement(r,{className:"rw-btn-left",tabIndex:"-1",onClick:this.props.onMoveLeft,disabled:this.props.prevDisabled,"aria-disabled":this.props.prevDisabled,title:this.props.moveBack},n.createElement("i",{className:"rw-i rw-i-caret-"+(e?"right":"left")},n.createElement("span",{className:"rw-sr"},this.props.moveBack))),n.createElement(r,{className:"rw-btn-view",id:this.props.labelId,tabIndex:"-1",onClick:this.props.onViewChange,disabled:this.props.upDisabled,"aria-disabled":this.props.upDisabled},this.props.label),n.createElement(r,{className:"rw-btn-right",tabIndex:"-1",onClick:this.props.onMoveRight,disabled:this.props.nextDisabled,"aria-disabled":this.props.nextDisabled,title:this.props.moveForward},n.createElement("i",{className:"rw-i rw-i-caret-"+(e?"left":"right")},n.createElement("span",{className:"rw-sr"},this.props.moveForward))))}})},function(e,t,s){"use strict";function n(e,t,s,n,r){var i=a.add(e,t,s);return a.inRange(i,n,r,"day")?i:e}var r=Object.assign||function(e){for(var t=1;t=this.props.min},current:function(e){this.setState({stringValue:e})}})},function(e,t,s){"use strict";var n=Object.assign||function(e){for(var t=1;te&&this.isDisabled(e,!0);)e++;e!==t&&this.setState({focused:e})},last:function(){for(var e=this.props.value.length-1;e>-1&&this.isDisabled(e,!0);)e--;e>=0&&this.setState({focused:e})},next:function(){for(var e=this.state.focused+1,t=this.props.value.length;t>e&&this.isDisabled(e,!0);)e++;return null!==this.state.focused?e>=t?this.clear():void this.setState({focused:e}):void 0},prev:function(){var e=this.state.focused;for(null===e&&(e=this.props.value.length),e--;e>-1&&this.isDisabled(e,!0);)e--;e>=0&&this.setState({focused:e})}})},function(e,t,s){"use strict";var n=Object.assign||function(e){for(var t=1;ts&&i.date(r)===o&&i.lte(r,n.max);)s++,t.push({date:r,label:i.format(r,e.format,e.culture)}),r=i.add(r,e.step||30,"minutes");return t},_dateValues:function(e){var t,s,n=e.value||i.today(),r=e.preserveDate,o=e.min,a=e.max;return r?{min:i.eq(n,o,"day")?o:i.today(),max:i.eq(n,a,"day")?o:i.tomorrow()}:(t=i.startOf(i.merge(new Date,o),"minutes"),s=i.startOf(i.merge(new Date,a),"minutes"),i.lte(s,t)&&i.gt(a,o,"day")&&(s=i.tomorrow()),{min:t,max:s})},_keyDown:function(e){var t=this,s=e.key,n=String.fromCharCode(e.keyCode),r=this.state.focusedItem,i=this.refs.list;"End"===s?this.setState({focusedItem:i.last()}):"Home"===s?this.setState({focusedItem:i.first()}):"Enter"===s?this.props.onSelect(r):"ArrowDown"===s?(e.preventDefault(),this.setState({focusedItem:i.next(r)})):"ArrowUp"===s?(e.preventDefault(),this.setState({focusedItem:i.prev(r)})):(e.preventDefault(),this.search(n,function(e){t.setState({focusedItem:e})}))},search:function(e,t){var s=this,n=((this._searchTerm||"")+e).toLowerCase();this._searchTerm=n,this.setTimeout("search",function(){var e=s.refs.list,r=e.next(s.state.focusedItem,n);s._searchTerm="",r&&t(r)},this.props.delay)}})},function(e,t,s){"use strict";function n(e){return!isNaN(e.getTime())}function r(e,t,s){var r="";return e instanceof Date&&n(e)&&(r=l.format(e,t,s)),r}function i(e,t,s){return function(){e&&e.apply(s,arguments),t&&t.apply(s,arguments)}}var o=Object.assign||function(e){for(var t=1;tu?u:f>r+d?f-d:r;var v=l(function(){return p(s,r)});return function(){return l.cancel(v)}}}},function(e,t,s){"use strict";var n=s(53),r=n.on,i=n.off,o=s(49),a=o.height,p=o.width,l=o.offset;e.exports={height:a,width:p,offset:l,on:r,off:i,css:s(54),contains:s(55),scrollParent:s(50),scrollTop:s(51),raf:s(52),animate:s(56)}},function(e){!function(){e.exports=this.Globalize}()},function(e,t,s){"use strict";var n=s(10),r=e.exports={version:function(){return n.version.split(".").map(parseFloat)},propType:function(e){return function(t,s,n,i){var o=r.version(),a=e.call(this,t,s,n,i);return a&&a!==!0?0===o[0]&&o[1]<11?void 0:a:void 0}}}},function(e,t,s){"use strict";function n(e,t,s,n){var r,i,p=o.startsWith,l=-1,u=t.length;for(s=s.toLowerCase();++ln,i=r&&a._dataText.call(e,t[l]).toLowerCase(),r&&p(i,s))return t[l]}function r(e,t,s,n){var r,i,p=o.startsWith,l=t.length;for(s=s.toLowerCase();--l>=0;)if(r=r||n>l,i=r&&a._dataText.call(e,t[l]).toLowerCase(),r&&p(i,s))return t[l]}var i=s(10),o=(s(11),s(25)),a=s(22);e.exports={propTypes:{textField:i.PropTypes.string},first:function(){return this._data()[0]},last:function(){var e=this._data();return e[e.length-1]},prev:function(e,t){var s=this._data(),n=s.indexOf(e);return-1===n&&(n=s.length),t?r(this,s,t,n):--n<0?s[0]:s[n]},next:function(e,t){var s=this._data(),r=s.indexOf(e);return t?n(this,s,t,r):++r===s.length?s[s.length-1]:s[r]}}},function(e){"use strict";function t(e){var t,s,n,r;if(void 0!==e.selectionStart)t=e.selectionStart,s=e.selectionEnd;else try{e.focus(),n=e.createTextRange(),r=n.duplicate(),n.moveToBookmark(document.selection.createRange().getBookmark()),r.setEndPoint("EndToStart",n),t=r.text.length,s=t+n.text.length}catch(i){}return{start:t,end:s}}function s(e,t,s){var n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t,s)):(e.focus(),n=e.createTextRange(),n.collapse(!0),n.moveStart("character",t),n.moveEnd("character",s-t),n.select())}catch(r){}}e.exports=function(e,n,r){return void 0===n?t(e):void s(e,n,r)}},function(e,t,s){"use strict";var n=s(10);e.exports={contextTypes:{isRtl:n.PropTypes.bool},isRtl:function(){return!!this.context.isRtl}}},function(e,t,s){"use strict";function n(e,t,s){return null==e?e:i.max(i.min(e,s),t)}var r=s(10),i=s(34),o=s(35).directions;e.exports=function(e,t){return{propTypes:{value:r.PropTypes.instanceOf(Date),min:r.PropTypes.instanceOf(Date),max:r.PropTypes.instanceOf(Date)},getInitialState:function(){return{focusedDate:n(this.props.value,this.props.min,this.props.max)}},componentWillReceiveProps:function(e){var s=this.state.focusedDate;//!dates.inRange(focused, nextProps.min, nextProps.max) +i.eq(e.value,s,t)||this.setState({focusedDate:e.value})},_keyDown:function(s){var n=s.key,r=this.state.focusedDate,a=r;if("Enter"===n)return s.preventDefault(),this.props.onChange(a);if("ArrowLeft"===n?a=this.move(a,o.LEFT):"ArrowRight"===n?a=this.move(a,o.RIGHT):"ArrowUp"===n?a=this.move(a,o.UP):"ArrowDown"===n&&(a=this.move(a,o.DOWN)),!i.eq(r,a,t)){if(s.preventDefault(),i.gt(a,this.props.value,e))return this.props.onMoveRight(a);if(i.lt(a,this.props.value,e))return this.props.onMoveLeft(a);this.setState({focusedDate:a})}}}}},function(e,t,s){"use strict";function n(e){var t=e.ownerDocument,s=t&&t.documentElement,n={top:0,left:0,height:0,width:0};if(s)return i(s,e)?(void 0!==e.getBoundingClientRect&&(n=e.getBoundingClientRect()),{top:n.top+window.pageYOffset-s.clientTop,left:n.left+window.pageXOffset-s.clientLeft,width:n.width||e.offsetWidth,height:n.height||e.offsetHeight}):n}function r(e){return e===e.window?e:9===e.nodeType&&e.defaultView}var i=s(55);e.exports={width:function(e,t){var s=r(e);return s?s.innerWidth:t?e.clientWidth:n(e).width},height:function(e,t){var s=r(e);return s?s.innerHeight:t?e.clientHeight:n(e).height},offset:n}},function(e,t,s){"use strict";var n=s(54),r=s(49),i=r.height;e.exports=function(e){var t=n(e,"position"),s="absolute"===t,r=e.ownerDocument;if("fixed"===t)return r||document;for(;(e=e.parentNode)&&9!==e.nodeType;){var o=s&&"static"===n(e,"position"),a=n(e,"overflow")+n(e,"overflow-y")+n(e,"overflow-x");if(!o&&/(auto|scroll)/.test(a)&&i(e)0&&(O[a]=w.join(", "),O[o]=s/1e3+"s",O[p]="0s",O[i]=n||"linear",f(e,T.endEvent,l),setTimeout(function(){d||l(b)},s+500)),e.clientLeft,h(e,O),0>=s&&setTimeout(l.bind(null,b),0)}function r(){var e,t="",s={O:"otransitionend",Moz:"transitionend",Webkit:"webkitTransitionEnd"},n=document.createElement("div");for(var r in s)if(c.call(s,r)&&void 0!==n.style[r+"TransitionProperty"]){t="-"+r.toLowerCase()+"-",e=s[r];break}return e||void 0===n.style.transitionProperty||(e="transitionend"),{endEvent:e,prefix:t}}var i,o,a,p,l=s(59).canUseDOM,u=s(60),c=Object.prototype.hasOwnProperty,h=s(54),d=s(53),f=d.on,m=d.off,y={left:"translateX",right:"translateX",top:"translateY",bottom:"translateY"},v={},g="transform",T={};l&&(T=r(),g=T.prefix+g,v[a=T.prefix+"transition-property"]=v[o=T.prefix+"transition-duration"]=v[p=T.prefix+"transition-delay"]=v[i=T.prefix+"transition-timing-function"]=""),n.endEvent=T.endEvent,e.exports=n},function(e){function t(e,t){var s=f.month(e),n=s+t;return e=f.month(e,n),0>n&&(n=12+t),f.month(e)!==n%12&&(e=f.date(e,0)),e}function s(e){return e=e.charAt(0).toUpperCase()+e.substr(1),function(t,s){return void 0===s?t["get"+e]():(t=new Date(t),t["set"+e](s),t)}}function n(e){return function(t,s,n){return e(+f.startOf(t,n),+f.startOf(s,n))}}var r="milliseconds",i="seconds",o="minutes",a="hours",p="day",l="week",u="month",c="year",h="decade",d="century",f=e.exports={startOfWeek:function(){return 0},add:function(e,s,n){if(e=new Date(e),n===r)return f.milliseconds(e,f.milliseconds(e)+s);if(n===i)return f.seconds(e,f.seconds(e)+s);if(n===o)return f.minutes(e,f.minutes(e)+s);if(n===a)return f.hours(e,f.hours(e)+s);if(n===p)return f.date(e,f.date(e)+s);if(n===l)return f.date(e,f.date(e)+7*s);if(n===u)return t(e,s);if(n===c)return f.year(e,f.year(e)+s);if(n===h)return f.year(e,f.year(e)+10*s);if(n===d)return f.year(e,f.year(e)+100*s);throw new TypeError('Invalid units: "'+n+'"')},subtract:function(e,t,s){return f.add(e,-t,s)},startOf:function(e,t){switch(e=new Date(e),t){case"century":case"decade":case"year":e=f.month(e,0);case"month":e=f.date(e,1);case"week":case"day":e=f.hours(e,0);case"hours":e=f.minutes(e,0);case"minutes":e=f.seconds(e,0);case"seconds":e=f.milliseconds(e,0)}return t===h&&(e=f.subtract(e,f.year(e)%10,"year")),t===d&&(e=f.subtract(e,f.year(e)%100,"year")),t===l&&(e=f.weekday(e,0)),e},endOf:function(e,t){return e=new Date(e),e=f.startOf(e,t),e=f.add(e,1,t),e=f.subtract(e,1,r)},eq:n(function(e,t){return e===t}),gt:n(function(e,t){return e>t}),gte:n(function(e,t){return e>=t}),lt:n(function(e,t){return t>e}),lte:n(function(e,t){return t>=e}),min:function(){var e=Array.prototype.slice.call(arguments);return new Date(Math.min.apply(Math,e))},max:function(){var e=Array.prototype.slice.call(arguments);return new Date(Math.max.apply(Math,e))},inRange:function(e,t,s,n){return n=n||"day",!(t&&!f.gte(e,t,n)||s&&!f.lte(e,s,n))},milliseconds:s("Milliseconds"),seconds:s("Seconds"),minutes:s("Minutes"),hours:s("Hours"),day:s("Day"),date:s("Date"),month:s("Month"),year:s("FullYear"),decade:function(e,t){return void 0==t?f.year(f.startOf(e,h)):f.add(e,t+10,c)},century:function(e,t){return void 0==t?f.year(f.startOf(e,d)):f.add(e,t+100,c)},weekday:function(e,t){var s=(f.day(e)+7-f.startOfWeek())%7;return void 0==t?s:f.add(e,t-s,p)}}},function(e){function t(e){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var t=Object(e),s=Object.prototype.hasOwnProperty,n=1;nDate(1900, 0, 1)" }, @@ -4105,7 +4105,7 @@ ), " handler." ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "min", "new Date()") }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "min", "new Date()") }), React.createElement( PropHeader, { type: "Date", default: "Date(2099, 11, 31)" }, @@ -4124,7 +4124,7 @@ ), " handler." ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "max", "new Date()") }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "max", "new Date()") }), React.createElement( PropHeader, { type: "String", default: "\"M/d/yyyy h:mm tt\"" }, @@ -4142,7 +4142,7 @@ React.createElement("i", { className: "fa fa-external-link" }) ) ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "format", "\"MMM dd yyyy\"") }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "format", "\"MMM dd yyyy\"") }), React.createElement( PropHeader, { type: "[Function, Array]" }, @@ -4195,7 +4195,7 @@ "\"century\"" ) ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "initialView", "\"year\"") }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "initialView", "\"year\"") }), React.createElement( PropHeader, { type: "Enum", default: "\"century\"" }, @@ -4240,7 +4240,7 @@ "\"century\"" ) ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "finalView", "\"year\"") }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "finalView", "\"year\"") }), React.createElement( PropHeader, { type: "[Boolean, String]", default: "false", controllable: true, handler: "onToggle" }, @@ -4602,7 +4602,7 @@ null, "The current value of the NumberPicker." ), - React.createElement(EditableExample, { codeText: __webpack_require__(41)(widgetName, [1, null]) }), + React.createElement(EditableExample, { codeText: __webpack_require__(42)(widgetName, [1, null]) }), React.createElement( PropHeader, { type: "Function(Number? value)" }, @@ -4614,7 +4614,7 @@ "Change event Handler that is called when the value is changed. The handler is called with the", "current numeric value or null." ), - React.createElement(EditableExample, { codeText: __webpack_require__(42)(widgetName, [1, null]) }), + React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, [1, null]) }), React.createElement( PropHeader, { type: "String", default: "d" }, @@ -4643,7 +4643,7 @@ null, "The minimum number that the NumberPicker value." ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "min", 0) }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "min", 0) }), React.createElement( PropHeader, { type: "Number", default: "Infinity" }, @@ -4654,7 +4654,7 @@ null, "The maximum number that the NumberPicker value." ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "max", 5) }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "max", 5) }), React.createElement( PropHeader, { type: "Number", default: "1" }, @@ -4665,7 +4665,7 @@ null, "Amount to increase or decrease value when using the spinner buttons." ), - React.createElement(EditableExample, { codeText: __webpack_require__(43)(widgetName, "step", 5) }), + React.createElement(EditableExample, { codeText: __webpack_require__(44)(widgetName, "step", 5) }), React.createElement( PropHeader, { type: "Boolean", default: "false" }, @@ -6394,6 +6394,181 @@ /***/ }, /* 40 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1), + Button = __webpack_require__(15).Button, + ButtonGroup = __webpack_require__(15).ButtonGroup, + RW = __webpack_require__(67); + + + // var valueComp = React.createClass({ + // render: function() { + // return ({ ' ' + this.props.item.label }) + // } + // }); + + // var itemComp = React.createClass({ + // render: function() { + // var icons = ['bicycle', 'area-chart', 'anchor'] + + // this._icon || (this._icon = icons[getRandomInt(0, 2)]) + // return ( + //
+ // + // { ' ' + this.props.item.label} + //
+ // ); + // } + // }); + + // function getRandomInt(min, max) { + // return Math.floor(Math.random() * (max - min + 1)) + min; + // } + + var list = [{ label: "orange", id: 1 }, { label: "blue", id: 2 }, { label: "red", id: 3 }, { label: "maroon", id: 4 }, { label: "purple", id: 5 }, { label: "mauve", id: 6 }]; + + var DropdownApi = React.createClass({ + displayName: "DropdownApi", + + + getInitialState: function () { + return { + duration: 250 }; + }, + + render: function () { + var disabled = this.state.disabled === true || Array.isArray(this.state.disabled); + + return React.createElement( + "div", + { className: "example" }, + React.createElement( + "div", + { className: "row" }, + React.createElement( + "div", + { className: "col-md-6 col-lg-7 demo" }, + React.createElement( + "div", + { className: "form-group" }, + React.createElement(RW.SelectList, { + disabled: disabled ? this.state.disabled : false, + readOnly: this.state.disabled === "readonly", + value: this.state.value, + data: list, + multiple: this.state.multiple, + busy: this.state.busy, + onChange: this._change, + isRtl: this.state.isRtl, + valueField: "id", + textField: "label" + }) + ) + ), + React.createElement( + "div", + { className: "col-md-6 col-lg-5 api-panel" }, + React.createElement( + "div", + { className: "form-group" }, + React.createElement( + "label", + { className: "checkbox-inline" }, + React.createElement("input", { type: "checkbox", + checked: this.state.isRtl, + onChange: this._set.bind(null, "isRtl", !this.state.isRtl) }), + "Right to Left" + ) + ), + React.createElement( + "div", + { className: "form-group" }, + React.createElement( + "label", + { className: "checkbox-inline" }, + React.createElement("input", { type: "checkbox", + checked: this.state.multiple, + onChange: this._set.bind(null, "multiple", !this.state.multiple) }), + "Is Multiple" + ) + ), + React.createElement( + "div", + { className: "form-group" }, + React.createElement( + ButtonGroup, + null, + React.createElement( + Button, + { + active: this.state.disabled === "disabled", + onClick: this.disabled }, + "Disable" + ), + React.createElement( + Button, + { + active: this.state.disabled === "readonly", + onClick: this.readOnly }, + "Readonly" + ) + ), + React.createElement( + Button, + { style: { marginLeft: 10 }, + active: this.state.busy, + onClick: this._set.bind(null, "busy", !this.state.busy) }, + "Busy" + ) + ), + React.createElement( + "div", + { className: "form-group" }, + React.createElement( + "label", + { className: "form-label" }, + "Disable Values" + ), + React.createElement(RW.Multiselect, { + value: Array.isArray(this.state.disabled) ? this.state.disabled : [], + data: list, + textField: "label", + valueField: "id", + disabled: this.state.disabled === true, + onChange: this._set.bind(null, "disabled") }) + ) + ) + ) + ); + }, + + _change: function (val) { + this.setState({ value: val }); + }, + + _set: function (field, value) { + var obj = {}; + obj[field] = value; + this.setState(obj); + }, + + readOnly: function () { + var val = this.state.disabled === "readonly" ? false : "readonly"; + this.setState({ disabled: val }); + }, + + disabled: function () { + var val = this.state.disabled === true ? false : true; + this.setState({ disabled: val }); + } + }); + + module.exports = DropdownApi; + +/***/ }, +/* 41 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -6556,7 +6731,7 @@ } }); /***/ }, -/* 41 */ +/* 42 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -6573,7 +6748,7 @@ }; /***/ }, -/* 42 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -6594,7 +6769,7 @@ }; /***/ }, -/* 43 */ +/* 44 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -6605,53 +6780,42 @@ }; /***/ }, -/* 44 */ +/* 45 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var React = __webpack_require__(1), + dates = __webpack_require__(90), Button = __webpack_require__(15).Button, ButtonGroup = __webpack_require__(15).ButtonGroup, RW = __webpack_require__(67); - - // var valueComp = React.createClass({ - // render: function() { - // return ({ ' ' + this.props.item.label }) - // } - // }); - - // var itemComp = React.createClass({ - // render: function() { - // var icons = ['bicycle', 'area-chart', 'anchor'] - - // this._icon || (this._icon = icons[getRandomInt(0, 2)]) - // return ( - //
- // - // { ' ' + this.props.item.label} - //
- // ); - // } - // }); - - // function getRandomInt(min, max) { - // return Math.floor(Math.random() * (max - min + 1)) + min; - // } - - var list = [{ label: "orange", id: 1 }, { label: "blue", id: 2 }, { label: "red", id: 3 }, { label: "maroon", id: 4 }, { label: "purple", id: 5 }, { label: "mauve", id: 6 }]; - - var DropdownApi = React.createClass({ - displayName: "DropdownApi", - - + module.exports = React.createClass({ + displayName: "exports", getInitialState: function () { return { - duration: 250 }; + calendar: true, + time: true, + format: "f" }; }, render: function () { - var disabled = this.state.disabled === true || Array.isArray(this.state.disabled); + var props; + + props = { + format: this.state.format, + max: this.state.max || undefined, + min: this.state.min || undefined, + calendar: this.state.calendar, + time: this.state.time, + finalView: this.state.finalView, + initialView: this.state.initialView, + disabled: this.state.disabled === "disabled", + readOnly: this.state.disabled === "readonly", + isRtl: this.state.isRtl }; + return React.createElement( "div", @@ -6661,171 +6825,7 @@ { className: "row" }, React.createElement( "div", - { className: "col-md-6 col-lg-7 demo" }, - React.createElement( - "div", - { className: "form-group" }, - React.createElement(RW.SelectList, { - disabled: disabled ? this.state.disabled : false, - readOnly: this.state.disabled === "readonly", - value: this.state.value, - data: list, - multiple: this.state.multiple, - busy: this.state.busy, - onChange: this._change, - isRtl: this.state.isRtl, - valueField: "id", - textField: "label" - }) - ) - ), - React.createElement( - "div", - { className: "col-md-6 col-lg-5 api-panel" }, - React.createElement( - "div", - { className: "form-group" }, - React.createElement( - "label", - { className: "checkbox-inline" }, - React.createElement("input", { type: "checkbox", - checked: this.state.isRtl, - onChange: this._set.bind(null, "isRtl", !this.state.isRtl) }), - "Right to Left" - ) - ), - React.createElement( - "div", - { className: "form-group" }, - React.createElement( - "label", - { className: "checkbox-inline" }, - React.createElement("input", { type: "checkbox", - checked: this.state.multiple, - onChange: this._set.bind(null, "multiple", !this.state.multiple) }), - "Is Multiple" - ) - ), - React.createElement( - "div", - { className: "form-group" }, - React.createElement( - ButtonGroup, - null, - React.createElement( - Button, - { - active: this.state.disabled === "disabled", - onClick: this.disabled }, - "Disable" - ), - React.createElement( - Button, - { - active: this.state.disabled === "readonly", - onClick: this.readOnly }, - "Readonly" - ) - ), - React.createElement( - Button, - { style: { marginLeft: 10 }, - active: this.state.busy, - onClick: this._set.bind(null, "busy", !this.state.busy) }, - "Busy" - ) - ), - React.createElement( - "div", - { className: "form-group" }, - React.createElement( - "label", - { className: "form-label" }, - "Disable Values" - ), - React.createElement(RW.Multiselect, { - value: Array.isArray(this.state.disabled) ? this.state.disabled : [], - data: list, - textField: "label", - valueField: "id", - disabled: this.state.disabled === true, - onChange: this._set.bind(null, "disabled") }) - ) - ) - ) - ); - }, - - _change: function (val) { - this.setState({ value: val }); - }, - - _set: function (field, value) { - var obj = {}; - obj[field] = value; - this.setState(obj); - }, - - readOnly: function () { - var val = this.state.disabled === "readonly" ? false : "readonly"; - this.setState({ disabled: val }); - }, - - disabled: function () { - var val = this.state.disabled === true ? false : true; - this.setState({ disabled: val }); - } - }); - - module.exports = DropdownApi; - -/***/ }, -/* 45 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - - var React = __webpack_require__(1), - dates = __webpack_require__(90), - Button = __webpack_require__(15).Button, - ButtonGroup = __webpack_require__(15).ButtonGroup, - RW = __webpack_require__(67); - - module.exports = React.createClass({ - displayName: "exports", - getInitialState: function () { - return { - calendar: true, - time: true, - format: "f" }; - }, - - render: function () { - var props; - - props = { - format: this.state.format, - max: this.state.max || undefined, - min: this.state.min || undefined, - calendar: this.state.calendar, - time: this.state.time, - finalView: this.state.finalView, - initialView: this.state.initialView, - disabled: this.state.disabled === "disabled", - readOnly: this.state.disabled === "readonly", - isRtl: this.state.isRtl }; - - - return React.createElement( - "div", - { className: "example" }, - React.createElement( - "div", - { className: "row" }, - React.createElement( - "div", - { className: "col-md-6 demo" }, + { className: "col-md-6 demo" }, React.createElement( "div", { className: "form-group" }, @@ -10622,14 +10622,14 @@ }; var React = __webpack_require__(1), - _ = __webpack_require__(122), - cx = __webpack_require__(121), - controlledInput = __webpack_require__(127), - CustomPropTypes = __webpack_require__(128), - Popup = __webpack_require__(124), - PlainList = __webpack_require__(129), - GroupableList = __webpack_require__(130), - validateList = __webpack_require__(131); + _ = __webpack_require__(121), + cx = __webpack_require__(122), + controlledInput = __webpack_require__(123), + CustomPropTypes = __webpack_require__(124), + Popup = __webpack_require__(125), + PlainList = __webpack_require__(126), + GroupableList = __webpack_require__(127), + validateList = __webpack_require__(128); var propTypes = { @@ -10670,7 +10670,7 @@ displayName: "DropdownList", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(135), __webpack_require__(136), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(131), __webpack_require__(132), __webpack_require__(133), __webpack_require__(134)], propTypes: propTypes, @@ -10694,7 +10694,7 @@ }; }, - componentDidMount: function () { + componentDidMount: function componentDidMount() { validateList(this.refs.list); }, @@ -10754,17 +10754,17 @@ }, _focus: function (focused, e) { - var self = this; + var _this = this; + - clearTimeout(self.timer); - self.timer = setTimeout(function () { - if (focused) self.getDOMNode().focus();else self.close(); + this.setTimeout("focus", function () { + if (focused) _this.getDOMNode().focus();else _this.close(); - if (focused !== self.state.focused) { - self.notify(focused ? "onFocus" : "onBlur", e); - self.setState({ focused: focused }); + if (focused !== _this.state.focused) { + _this.notify(focused ? "onFocus" : "onBlur", e); + _this.setState({ focused: focused }); } - }, 0); + }); }, _onSelect: function (data) { @@ -10830,10 +10830,9 @@ var _this = this; var word = ((this._searchTerm || "") + character).toLowerCase(); - clearTimeout(this._timer); this._searchTerm = word; - this._timer = setTimeout(function () { + this.setTimeout("search", function () { var list = _this.refs.list, key = _this.props.open ? "focusedItem" : "selectedItem", item = list.next(_this.state[key], word); @@ -10884,17 +10883,17 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - _ = __webpack_require__(122), - filter = __webpack_require__(123), - Popup = __webpack_require__(124), - Btn = __webpack_require__(125), - Input = __webpack_require__(126), - controlledInput = __webpack_require__(127), - CustomPropTypes = __webpack_require__(128), - PlainList = __webpack_require__(129), - GroupableList = __webpack_require__(130), - validateList = __webpack_require__(131); + cx = __webpack_require__(122), + _ = __webpack_require__(121), + filter = __webpack_require__(135), + Popup = __webpack_require__(125), + Btn = __webpack_require__(136), + Input = __webpack_require__(137), + controlledInput = __webpack_require__(123), + CustomPropTypes = __webpack_require__(124), + PlainList = __webpack_require__(126), + GroupableList = __webpack_require__(127), + validateList = __webpack_require__(128); var propTypes = { //-- controlled props ----------- @@ -10938,7 +10937,7 @@ displayName: "ComboBox", - mixins: [__webpack_require__(132), __webpack_require__(133), __webpack_require__(134), __webpack_require__(135), __webpack_require__(136), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(138), __webpack_require__(132), __webpack_require__(133), __webpack_require__(134)], propTypes: propTypes, @@ -11218,17 +11217,17 @@ }; var React = __webpack_require__(1), - Header = __webpack_require__(141), - Month = __webpack_require__(142), - Year = __webpack_require__(143), - Decade = __webpack_require__(144), - Century = __webpack_require__(145), - cx = __webpack_require__(121), - controlledInput = __webpack_require__(127), + Header = __webpack_require__(143), + Month = __webpack_require__(144), + Year = __webpack_require__(145), + Decade = __webpack_require__(146), + Century = __webpack_require__(147), + cx = __webpack_require__(122), + controlledInput = __webpack_require__(123), SlideTransition = __webpack_require__(99), - dates = __webpack_require__(146), - constants = __webpack_require__(139), - _ = __webpack_require__(122); //values, omit, object + dates = __webpack_require__(139), + constants = __webpack_require__(140), + _ = __webpack_require__(121); //values, omit, object var dir = constants.directions; @@ -11273,7 +11272,7 @@ displayName: "Calendar", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(131), __webpack_require__(134)], propTypes: propTypes, @@ -11401,9 +11400,7 @@ if (+this.props.tabIndex === -1) return; - clearTimeout(this.timer); - - this.timer = setTimeout(function () { + this.setTimeout("focus", function () { if (focused) _this.getDOMNode().focus(); if (focused !== _this.state.focused) { @@ -11517,20 +11514,20 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - _ = __webpack_require__(122) //pick, omit, has + cx = __webpack_require__(122), + _ = __webpack_require__(121) //pick, omit, has , - dates = __webpack_require__(146), - views = __webpack_require__(139).calendarViews, - popups = __webpack_require__(139).datePopups, - Popup = __webpack_require__(124), + dates = __webpack_require__(139), + views = __webpack_require__(140).calendarViews, + popups = __webpack_require__(140).datePopups, + Popup = __webpack_require__(125), Calendar = __webpack_require__(93).BaseCalendar, - Time = __webpack_require__(149), - DateInput = __webpack_require__(150), - Btn = __webpack_require__(125), - CustomPropTypes = __webpack_require__(128), - controlledInput = __webpack_require__(127); + Time = __webpack_require__(141), + DateInput = __webpack_require__(142), + Btn = __webpack_require__(136), + CustomPropTypes = __webpack_require__(124), + controlledInput = __webpack_require__(123); var viewEnum = Object.keys(views).map(function (k) { return views[k]; @@ -11575,7 +11572,7 @@ var DateTimePicker = React.createClass({ displayName: "DateTimePicker", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(136), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(131), __webpack_require__(133), __webpack_require__(134)], propTypes: propTypes, @@ -11722,9 +11719,7 @@ var _this = this; var input = this.refs.valueInput; - clearTimeout(this.timer); - - this.timer = setTimeout(function () { + this.setTimeout("focus", function () { if (focused) input.getDOMNode().focus();else _this.close(); if (focused !== _this.state.focused) { @@ -11835,14 +11830,14 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - _ = __webpack_require__(122) //omit + cx = __webpack_require__(122), + _ = __webpack_require__(121) //omit , - controlledInput = __webpack_require__(127), - directions = __webpack_require__(139).directions, - Input = __webpack_require__(140); + controlledInput = __webpack_require__(123), + directions = __webpack_require__(140).directions, + Input = __webpack_require__(148); - var Btn = __webpack_require__(125), + var Btn = __webpack_require__(136), propTypes = { // -- controlled props ----------- @@ -11875,7 +11870,7 @@ displayName: "NumberPicker", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(131), __webpack_require__(134)], propTypes: propTypes, @@ -11984,9 +11979,9 @@ _focus: function (focused, e) { var _this = this; - clearTimeout(this.timer); - this.timer = setTimeout(function () { + + this.setTimeout("focus", function () { var el = _this.refs.input.getDOMNode(); focused && el.focus(); @@ -12061,16 +12056,16 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - _ = __webpack_require__(122), - SelectInput = __webpack_require__(147), - TagList = __webpack_require__(148), - Popup = __webpack_require__(124), - PlainList = __webpack_require__(129), - GroupableList = __webpack_require__(130), - validateList = __webpack_require__(131), - controlledInput = __webpack_require__(127), - CustomPropTypes = __webpack_require__(128); + cx = __webpack_require__(122), + _ = __webpack_require__(121), + SelectInput = __webpack_require__(149), + TagList = __webpack_require__(150), + Popup = __webpack_require__(125), + PlainList = __webpack_require__(126), + GroupableList = __webpack_require__(127), + validateList = __webpack_require__(128), + controlledInput = __webpack_require__(123), + CustomPropTypes = __webpack_require__(124); var propTypes = { data: React.PropTypes.array, @@ -12117,7 +12112,7 @@ displayName: "Multiselect", - mixins: [__webpack_require__(132), __webpack_require__(134), __webpack_require__(135), __webpack_require__(136), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(138), __webpack_require__(132), __webpack_require__(133), __webpack_require__(134)], propTypes: propTypes, @@ -12260,9 +12255,7 @@ var _this = this; if (this.props.disabled === true) return; - clearTimeout(this.timer); - - this.timer = setTimeout(function () { + this.setTimeout("focus", function () { if (focused) { _this.refs.input.focus(); _this.open(); @@ -12420,13 +12413,14 @@ }; var React = __webpack_require__(1), - _ = __webpack_require__(122), - cx = __webpack_require__(121), - controlledInput = __webpack_require__(127), - CustomPropTypes = __webpack_require__(128), - PlainList = __webpack_require__(129), - GroupableList = __webpack_require__(130), - validateList = __webpack_require__(131), + _ = __webpack_require__(121), + cx = __webpack_require__(122), + controlledInput = __webpack_require__(123), + CustomPropTypes = __webpack_require__(124), + PlainList = __webpack_require__(126), + GroupableList = __webpack_require__(127), + validateList = __webpack_require__(128), + filter = __webpack_require__(135), scrollTo = __webpack_require__(151); var propTypes = { @@ -12446,6 +12440,7 @@ busy: React.PropTypes.bool, + filter: React.PropTypes.string, delay: React.PropTypes.number, disabled: React.PropTypes.oneOfType([React.PropTypes.array, React.PropTypes.bool, React.PropTypes.oneOf(["disabled"])]), @@ -12463,7 +12458,7 @@ propTypes: propTypes, - mixins: [__webpack_require__(132), __webpack_require__(133), __webpack_require__(135), __webpack_require__(137)], + mixins: [__webpack_require__(129), __webpack_require__(130), __webpack_require__(132), __webpack_require__(134)], getDefaultProps: function getDefaultProps() { return { @@ -12537,12 +12532,13 @@ "rw-state-readonly": this.isReadOnly(), "rw-rtl": this.isRtl(), "rw-loading-mask": this.props.busy - }) }), React.createElement(List, { ref: "list", + }) }), React.createElement(List, _extends({ ref: "list" + }, _.pick(this.props, Object.keys(List.type.propTypes)), { data: this._data(), focused: focusedItem, optID: optID, itemComponent: this.state.ListItem, - onMove: this._scrollTo })); + onMove: this._scrollTo }))); }, _scrollTo: function _scrollTo(selected, list) { @@ -12584,7 +12580,7 @@ } else if (this.props.multiple && e.keyCode === 65 && e.ctrlKey) { e.preventDefault(); this._selectAll(); - } else this.search(String.fromCharCode(e.keyCode), this._locate); + } else this.search(String.fromCharCode(e.keyCode)); function change(item, cked) { if (item) { @@ -12650,16 +12646,15 @@ }, _focus: function (focused, e) { - var self = this; + var _this = this; - clearTimeout(self.timer); - self.timer = setTimeout(function () { - if (focused) self.getDOMNode().focus(); - if (focused !== self.state.focused) { - self.setState({ focused: focused }); + this.setTimeout("focus", function () { + if (focused) _this.getDOMNode().focus(); + if (focused !== _this.state.focused) { + _this.setState({ focused: focused }); } - }, 0); + }); }, isDisabledItem: function (item) { @@ -12670,10 +12665,20 @@ return this.isReadOnly() || this._contains(item, this.props.readOnly); }, - _locate: function (word) { - var idx = this.findNextWordIndex(word, this.state.focusedIndex); + search: function (character) { + var _this = this; + var word = ((this._searchTerm || "") + character).toLowerCase(), + list = this.refs.list; + + this._searchTerm = word; + + this.setTimeout("search", function () { + var focusedItem = list.next(_this.state.focusedItem, word); + + _this._searchTerm = ""; - if (idx !== -1) this.setFocusedIndex(idx); + if (focusedItem) _this.setState({ focusedItem: focusedItem }); + }, this.props.delay); }, _data: function () { @@ -12690,6 +12695,7 @@ }); + function getListItem(parent) { return React.createClass({ @@ -12731,7 +12737,6 @@ module.exports = controlledInput.createControlledClass(SelectList, { value: "onChange" }); module.exports.BaseSelectList = SelectList; - //!focused && self.next(0) /***/ }, /* 98 */ @@ -12748,7 +12753,7 @@ var React = __webpack_require__(1), $ = __webpack_require__(152), - _ = __webpack_require__(122); + _ = __webpack_require__(121); module.exports = React.createClass({ @@ -12944,7 +12949,7 @@ var React = __webpack_require__(1), ReplaceTransitionGroup = __webpack_require__(98), - _ = __webpack_require__(122), + _ = __webpack_require__(121), $ = __webpack_require__(152); @@ -13026,7 +13031,9 @@ }, _wrapChild: function (child, ref) { - return React.createElement(SlideChildGroup, { key: child.key, ref: ref, direction: this.props.direction, duration: this.props.duration }, child); + return React.createElement(SlideChildGroup, { key: child.key, ref: ref, + direction: this.props.direction, + duration: this.props.duration }, child); }, render: function () { @@ -13034,7 +13041,7 @@ var children = this.props.children; var props = _objectWithoutProperties(this.props, ["style", "children"]); - style = _.merge(style, { position: "relative", overflow: "hidden" }); + style = _.assign({}, style, { position: "relative", overflow: "hidden" }); return React.createElement(ReplaceTransitionGroup, _extends({}, props, { ref: "container", @@ -13337,7 +13344,7 @@ /* 107 */ /***/ function(module, exports, __webpack_require__) { - var Promise = __webpack_require__(167); + var Promise = __webpack_require__(172); // TODO: Use process.env.NODE_ENV check + envify to enable // when's promise monitor here when in dev. @@ -16109,13 +16116,13 @@ } })(); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166).Buffer)) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(173).Buffer)) /***/ }, /* 119 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(165); + module.exports = __webpack_require__(163); /***/ }, @@ -16262,27 +16269,10 @@ } }; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166).Buffer)) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(173).Buffer)) /***/ }, /* 121 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var _ = __webpack_require__(122); - - module.exports = function (existing, classes) { - if (arguments.length === 1) if (typeof existing === "string") classes = {};else classes = existing, existing = ""; - - if (!Array.isArray(classes)) classes = _.transform(classes, function (arr, value, key) { - if (!!value) arr.push(key); - }, []); - - return (existing ? existing + " " : "") + classes.join(" "); - }; - -/***/ }, -/* 122 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -16292,9 +16282,7 @@ has: has, - merge: __webpack_require__(170), - - extend: __webpack_require__(168), + assign: __webpack_require__(101), isShallowEqual: function (a, b) { if (a === b) return true; @@ -16349,15 +16337,6 @@ } else for (var key in arr) if (has(arr, key)) if (cb.call(thisArg, arr[key], key, arr)) return arr[key]; }, - findIndex: function (arr, cb, thisArg) { - var idx = -1, - len = arr.length; - - while (++idx < len) if (cb.call(thisArg, arr[idx], idx, arr)) return idx; - - return -1; - }, - chunk: function (array, chunkSize) { var index = 0, length = array ? array.length : 0, @@ -16396,51 +16375,174 @@ } /***/ }, -/* 123 */ +/* 122 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + var _ = __webpack_require__(121); - var common = { - eq: function (a, b) { - return a === b; - }, - neq: function (a, b) { - return a !== b; - }, - gt: function (a, b) { - return a > b; - }, - gte: function (a, b) { - return a >= b; - }, - lt: function (a, b) { - return a < b; - }, - lte: function (a, b) { - return a <= b; - }, - - contains: function (a, b) { - return a.indexOf(b) !== -1; - }, - - startsWith: function (a, b) { - return a.lastIndexOf(b, 0) === 0; - }, + module.exports = function (existing, classes) { + if (arguments.length === 1) if (typeof existing === "string") classes = {};else classes = existing, existing = ""; - endsWith: function (a, b) { - var pos = a.length - b.length, - lastIndex = a.indexOf(b, pos); + if (!Array.isArray(classes)) classes = _.transform(classes, function (arr, value, key) { + if (!!value) arr.push(key); + }, []); - return lastIndex !== -1 && lastIndex === pos; - } + return (existing ? existing + " " : "") + classes.join(" "); }; - module.exports = common; - +/***/ }, +/* 123 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var _ = __webpack_require__(121) //invert, transform + , + React = __webpack_require__(1), + compat = __webpack_require__(158); + + + function compatPropType(handler, propType) { + return compat.propType(function (props, propName, componentName, location) { + if (props[propName] !== undefined) { + if (!props[handler]) return new Error("ReactWidgets: you have provided a `" + propName + "` prop to " + "`" + componentName + "` without an `" + handler + "` handler. This will render a read-only field. " + "If the field should be mutable use `" + defaultKey(propName) + "`. Otherwise, set `" + handler + "`"); + + return propType && propType(props, propName, componentName, location); + } + }); + } + + module.exports = { + + createControlledClass: function (Component, controlledValues, taps) { + var types = {}; + + if (true) { + types = _.transform(controlledValues, function (obj, handler, prop) { + var type = Component.type.propTypes[prop]; + + obj[prop] = compatPropType(handler, type); + obj[defaultKey(prop)] = type; + }, {}); + } + + taps = taps || {}; + + return React.createClass({ + + displayName: Component.displayName, + + propTypes: types, + + getInitialState: function () { + var props = this.props, + keys = Object.keys(controlledValues); + + return _.transform(keys, function (state, key) { + state[key] = props[defaultKey(key)]; + }, {}); + }, + + shouldComponentUpdate: function () { + //let the setState trigger the update + return !this._notifying || !this._notifying.length; + }, + + render: function () { + var _this = this; + var props = {}; + + _.each(controlledValues, function (handle, prop) { + props[prop] = isProp(_this.props, prop) ? _this.props[prop] : _this.state[prop]; + + props[handle] = setAndNotify.bind(_this, prop); + }); + + props = _.assign({}, this.props, props); + + for (var k in taps) if (_.has(props, k)) props[k] = chain(this, taps[k], props[k]); + + return React.createElement(Component, props, this.props.children); + } + }); + + function setAndNotify(prop, value) { + /*jshint validthis:true */ + var handler = controlledValues[prop], + controlled = handler && isProp(this.props, prop), + state = {}, + args; + + if (!this._notifying) this._notifying = []; + + if (this.props[handler]) { + args = [].slice.call(arguments, 1); + this._notifying.push(true); + this.props[handler].apply(this, args); + this._notifying.pop(); + } + + state[prop] = value; + this.setState(state); + + return !controlled; + } + + function isProp(props, prop) { + return props[prop] !== undefined; + } + } + }; + + function defaultKey(key) { + return "default" + key.charAt(0).toUpperCase() + key.substr(1); + } + + function chain(thisArg, a, b) { + return function chainedFunction() { + a && a.apply(thisArg, arguments); + b && b.apply(thisArg, arguments); + }; + } + /***/ }, /* 124 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1); + + module.exports = { + + elementType: createChainableTypeChecker(function (props, propName, componentName, location) { + if (typeof props[propName] !== "function") { + if (React.isValidElement(props[propName])) return new Error("Invalid prop `" + propName + "` specified in `" + componentName + "`." + " Expected an Element `type`, not an actual Element"); + + if (typeof props[propName] !== "string") return new Error("Invalid prop `" + propName + "` specified in `" + componentName + "`." + " Expected an Element `type` such as a tag name or return value of React.createClass(...)"); + } + return true; + }) + }; + + + function createChainableTypeChecker(validate) { + function checkType(isRequired, props, propName, componentName, location) { + componentName = componentName || "<>"; + if (props[propName] == null) { + if (isRequired) { + return new Error("Required prop `" + propName + "` was not specified in `" + componentName + "`."); + } + } else return validate(props, propName, componentName, location); + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + +/***/ }, +/* 125 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -16598,7 +16700,7 @@ } /***/ }, -/* 125 */ +/* 126 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -16618,25 +16720,118 @@ }return target; }; - var React = __webpack_require__(1); + var React = __webpack_require__(1), + CustomPropTypes = __webpack_require__(124), + cx = __webpack_require__(122), + _ = __webpack_require__(121); + module.exports = React.createClass({ - displayName: "exports", + displayName: "List", - render: function () { - var className = this.props.className; - var props = _objectWithoutProperties(this.props, ["className"]); + mixins: [__webpack_require__(129), __webpack_require__(132), __webpack_require__(159)], - return React.createElement("button", _extends({}, props, { type: "button", className: (className || "") + " rw-btn" }), this.props.children); + propTypes: { + data: React.PropTypes.array, + onSelect: React.PropTypes.func, + onMove: React.PropTypes.func, + itemComponent: CustomPropTypes.elementType, + + selectedIndex: React.PropTypes.number, + focusedIndex: React.PropTypes.number, + valueField: React.PropTypes.string, + textField: React.PropTypes.string, + + optID: React.PropTypes.string, + + messages: React.PropTypes.shape({ + emptyList: React.PropTypes.string + }) }, + + + getDefaultProps: function () { + return { + optID: "", + onSelect: function () {}, + data: [], + messages: { + emptyList: "There are no items in this list" + } + }; + }, + + getInitialState: function getInitialState() { + return {}; + }, + + + componentDidMount: function componentDidMount() { + this._setScrollPosition(); + }, + + componentDidUpdate: function componentDidUpdate(prevProps) { + if (prevProps.focused !== this.props.focused) this._setScrollPosition(); + }, + + render: function render() { + var _this = this; + var _$omit = _.omit(this.props, ["data"]); + + var className = _$omit.className; + var props = _objectWithoutProperties(_$omit, ["className"]); + var ItemComponent = this.props.itemComponent; + var items; + + items = !this.props.data.length ? React.createElement("li", null, this.props.messages.emptyList) : this.props.data.map(function (item, idx) { + var focused = item === _this.props.focused, + selected = item === _this.props.selected; + + return React.createElement("li", { + key: "item_" + idx, + role: "option", + id: focused ? _this.props.optID : undefined, + "aria-selected": selected, + className: cx({ + "rw-list-option": true, + "rw-state-focus": focused, + "rw-state-selected": selected }), + onClick: _this.props.onSelect.bind(null, item) }, ItemComponent ? React.createElement(ItemComponent, { item: item }) : _this._dataText(item)); + }); + + return React.createElement("ul", _extends({}, props, { + className: (className || "") + " rw-list", + ref: "scrollable", + role: "listbox" }), items); + }, + + _data: function _data() { + return this.props.data; + }, + + _setScrollPosition: function () { + var list = this.getDOMNode(), + idx = this._data().indexOf(this.props.focused), + selected = list.children[idx]; + + if (!selected) return; + + this.notify("onMove", [selected, list]); } + }); /***/ }, -/* 126 */ +/* 127 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + var _objectWithoutProperties = function (obj, keys) { + var target = {};for (var i in obj) { + if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; + }return target; + }; + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i];for (var key in source) { @@ -16648,902 +16843,1021 @@ }; var React = __webpack_require__(1), - caretPos = __webpack_require__(158); + CustomPropTypes = __webpack_require__(124), + cx = __webpack_require__(122), + _ = __webpack_require__(121); + module.exports = React.createClass({ - displayName: "exports", + displayName: "List", - propTypes: { - value: React.PropTypes.string, - onChange: React.PropTypes.func.isRequired - }, + mixins: [__webpack_require__(129), __webpack_require__(132), __webpack_require__(159)], + propTypes: { + data: React.PropTypes.array, + onSelect: React.PropTypes.func, + onMove: React.PropTypes.func, - // hello - componentDidUpdate: function () { - var input = this.getDOMNode(), - val = this.props.value; + itemComponent: CustomPropTypes.elementType, + groupComponent: CustomPropTypes.elementType, - if (this.isSuggesting()) { - var start = val.toLowerCase().indexOf(this._last.toLowerCase()) + this._last.length, - end = val.length - start; + selected: React.PropTypes.any, + focused: React.PropTypes.any, + + valueField: React.PropTypes.string, + textField: React.PropTypes.string, + + optID: React.PropTypes.string, + + groupBy: React.PropTypes.oneOfType([React.PropTypes.func, React.PropTypes.string]), + + messages: React.PropTypes.shape({ + emptyList: React.PropTypes.string + }) }, - if (start >= 0) { - caretPos(input, start, start + end); - } - } - }, getDefaultProps: function () { return { - value: "" + optID: "", + onSelect: function () {}, + data: [], + messages: { + emptyList: "There are no items in this list" + } }; }, - render: function () { - return React.createElement("input", _extends({}, this.props, { - type: "text", - className: this.props.className + " rw-input", - onKeyDown: this.props.onKeyDown, - onChange: this._change, - value: this.props.value == null ? "" : this.props.value })); - }, + getInitialState: function () { + var keys = []; - isSuggesting: function () { - var val = this.props.value, - isSuggestion = this._last != null && val.toLowerCase().indexOf(this._last.toLowerCase()) !== -1; + return { + groups: this._group(this.props.groupBy, this.props.data, keys), - return this.props.suggest && isSuggestion; + sortedKeys: keys + }; }, - accept: function (removeCaret) { - var val = this.getDOMNode().value || "", - end = val.length; + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + var keys = []; - this._last = null; - removeCaret && caretPos(this.getDOMNode(), end, end); + if (nextProps.data !== this.props.data || nextProps.groupBy !== this.props.groupBy) this.setState({ + groups: this._group(nextProps.groupBy, nextProps.data, keys), + sortedKeys: keys + }); }, - _change: function (e) { - var val = e.target.value; - this._last = val; - this.props.onChange(e, val); + componentDidMount: function componentDidMount(prevProps, prevState) { + this._setScrollPosition(); }, - focus: function () { - this.getDOMNode().focus(); - } - }); + componentDidUpdate: function componentDidUpdate(prevProps) { + if (prevProps.focused !== this.props.focused) this._setScrollPosition(); + }, -/***/ }, -/* 127 */ -/***/ function(module, exports, __webpack_require__) { + render: function () { + var _this = this; + var _$omit = _.omit(this.props, ["data", "selectedIndex"]); - "use strict"; - var _ = __webpack_require__(122) //invert, transform - , - React = __webpack_require__(1), - compat = __webpack_require__(160); + var className = _$omit.className; + var props = _objectWithoutProperties(_$omit, ["className"]); + var groups = this.state.groups; + var items = []; + var idx = -1; + var group; + if (this.props.data.length) { + items = this.state.sortedKeys.reduce(function (items, key) { + group = groups[key]; + items.push(_this._renderGroupHeader(key)); - function compatPropType(handler, propType) { - return compat.propType(function (props, propName, componentName, location) { - if (props[propName] !== undefined) { - if (!props[handler]) return new Error("ReactWidgets: you have provided a `" + propName + "` prop to " + "`" + componentName + "` without an `" + handler + "` handler. This will render a read-only field. " + "If the field should be mutable use `" + defaultKey(propName) + "`. Otherwise, set `" + handler + "`"); + for (var itemIdx = 0; itemIdx < group.length; itemIdx++) items.push(_this._renderItem(key, group[itemIdx], ++idx)); - return propType && propType(props, propName, componentName, location); - } - }); - } + return items; + }, []); + } else items = React.createElement("li", null, this.props.messages.emptyList); - module.exports = { + return React.createElement("ul", _extends({}, props, { + className: (className || "") + " rw-list rw-list-grouped", + ref: "scrollable", + role: "listbox" }), items); + }, - createControlledClass: function (Component, controlledValues, taps) { - // var publicMethods - // = _.transform(publicApi || [], function(obj, method) { - // obj[method] = function (...args){ - // return this.refs[this._innerRef][method](args) - // } - // }, {}) - - var types = _.transform(controlledValues, function (obj, handler, prop) { - var type = Component.type.propTypes[prop]; - - obj[prop] = compatPropType(handler, type); - obj[defaultKey(prop)] = type; - }, {}); + _renderGroupHeader: function _renderGroupHeader(group) { + var ItemComponent = this.props.groupComponent; - taps = taps || {}; + return React.createElement("li", { + key: "item_" + group, + tabIndex: "-1", + role: "separator", + className: "rw-list-optgroup" }, ItemComponent ? React.createElement(ItemComponent, { item: group }) : group); + }, - return React.createClass({ + _renderItem: function _renderItem(group, item, idx) { + var focused = this.props.focused === item, + selected = this.props.selected === item, + ItemComponent = this.props.itemComponent; - displayName: Component.displayName, + //console.log('hi') + return React.createElement("li", { + key: "item_" + group + "_" + idx, + role: "option", + id: focused ? this.props.optID : undefined, + "aria-selected": selected, + onClick: this.props.onSelect.bind(null, item), + className: cx({ + "rw-state-focus": focused, + "rw-state-selected": selected, + "rw-list-option": true + }) }, ItemComponent ? React.createElement(ItemComponent, { item: item }) : this._dataText(item)); + }, - propTypes: types, + _isIndexOf: function _isIndexOf(idx, item) { + return this.props.data[idx] === item; + }, - getInitialState: function () { - var props = this.props, - keys = Object.keys(controlledValues); + _group: function _group(groupBy, data, keys) { + var iter = typeof groupBy === "function" ? groupBy : function (item) { + return item[groupBy]; + }; - return _.transform(keys, function (state, key) { - state[key] = props[defaultKey(key)]; - }, {}); - }, + // the keys array ensures that groups are rendered in the order they came in + // which means that if you sort the data array it will render sorted, + // so long as you also sorted by group + keys = keys || []; - shouldComponentUpdate: function () { - //let the setState trigger the update - return !this._notifying || !this._notifying.length; - }, + return data.reduce(function (grps, item) { + var group = iter(item); - render: function () { - var _this = this; - var props, handles; + _.has(grps, group) ? grps[group].push(item) : (keys.push(group), grps[group] = [item]); - props = _.transform(controlledValues, function (obj, handle, prop) { - obj[prop] = isProp(_this.props, prop) ? _this.props[prop] : _this.state[prop]; - }, {}); + return grps; + }, {}); + }, - handles = _.transform(controlledValues, function (obj, handle, prop) { - obj[handle] = setAndNotify.bind(_this, prop); - }, {}); + _data: function _data() { + var groups = this.state.groups; - props = _.merge(this.props, props, handles); + return this.state.sortedKeys.reduce(function (flat, grp) { + return flat.concat(groups[grp]); + }, []); + }, - for (var k in taps) if (_.has(props, k)) { - props[k] = chain(this, taps[k], props[k]); - } - //this._innerRef = props.ref = props.ref || 'component' + _setScrollPosition: function () { + var selected = this.getItemDOMNode(this.props.focused); - return React.createElement(Component, props, this.props.children); - } - }); + if (!selected) return; - function setAndNotify(prop, value) { - /*jshint validthis:true */ - var handler = controlledValues[prop], - controlled = handler && isProp(this.props, prop), - st = {}, - args; + this.notify("onMove", [selected, this.getDOMNode()]); + }, - if (!this._notifying) this._notifying = []; + getItemDOMNode: function getItemDOMNode(item) { + var list = this.getDOMNode(), + groups = this.state.groups, + idx = -1, + itemIdx, + child; - if (this.props[handler]) { - args = [].slice.call(arguments, 1); - this._notifying.push(true); - this.props[handler].apply(this, args); - this._notifying.pop(); - } + this.state.sortedKeys.some(function (group) { + itemIdx = groups[group].indexOf(item); + idx++; - st[prop] = value; - this.setState(st); + if (itemIdx !== -1) return !!(child = list.children[idx + itemIdx + 1]); - return !controlled; - } + idx += groups[group].length; + }); - function isProp(props, prop) { - return props[prop] !== undefined; - } + return child; } - }; + }); - // function invert(controlledValues){ - // return _.transform(controlledValues, (val, key ) => ,) - // } +/***/ }, +/* 128 */ +/***/ function(module, exports, __webpack_require__) { - function defaultKey(key) { - return "default" + key.charAt(0).toUpperCase() + key.substr(1); - } + "use strict"; + var METHODS = ["next", "prev", "first", "last"]; - function chain(thisArg, a, b) { - return function chainedFunction() { - a && a.apply(thisArg, arguments); - b && b.apply(thisArg, arguments); - }; + module.exports = function validateListComponent(list) { + if (true) { + METHODS.forEach(function (method) { + return assert(typeof list[method] === "function", "List components must implement a `" + method + "()` method"); + }); + } + }; + + function assert(condition, msg) { + var error; + + if (!condition) { + error = new Error(msg); + error.framesToPop = 1; + throw error; + } } /***/ }, -/* 128 */ +/* 129 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var React = __webpack_require__(1); + var React = __webpack_require__(1), + _ = __webpack_require__(121); //uniqueID module.exports = { - elementType: createChainableTypeChecker(function (props, propName, componentName, location) { - if (typeof props[propName] !== "function") { - if (React.isValidElement(props[propName])) return new Error("Invalid prop `" + propName + "` specified in `" + componentName + "`." + " Expected an Element `type`, not an actual Element"); + propTypes: { - if (typeof props[propName] !== "string") return new Error("Invalid prop `" + propName + "` specified in `" + componentName + "`." + " Expected an Element `type` such as a tag name or return value of React.createClass(...)"); - } - return true; - }) - }; + disabled: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(["disabled"])]), + readOnly: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(["readOnly"])]) }, - function createChainableTypeChecker(validate) { - function checkType(isRequired, props, propName, componentName, location) { - componentName = componentName || "<>"; - if (props[propName] == null) { - if (isRequired) { - return new Error("Required prop `" + propName + "` was not specified in `" + componentName + "`."); - } - } else return validate(props, propName, componentName, location); - } + isDisabled: function () { + return this.props.disabled === true || this.props.disabled === "disabled"; + }, - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); + isReadOnly: function () { + return this.props.readOnly === true || this.props.readOnly === "readonly"; + }, - return chainedCheckType; - } + notify: function (handler, args) { + this.props[handler] && this.props[handler].apply(null, [].concat(args)); + }, + + _id: function (suffix) { + this._id_ || (this._id_ = _.uniqueId("rw_")); + return (this.props.id || this._id_) + suffix; + }, + + _maybeHandle: function (handler, disabledOnly) { + if (!(this.isDisabled() || !disabledOnly && this.isReadOnly())) return handler; + return function () {}; + } }; /***/ }, -/* 129 */ +/* 130 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var _objectWithoutProperties = function (obj, keys) { - var target = {};for (var i in obj) { - if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; - }return target; - }; + var _require = __webpack_require__(121); - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; + var has = _require.has; - var React = __webpack_require__(1), - CustomPropTypes = __webpack_require__(128), - cx = __webpack_require__(121), - _ = __webpack_require__(122); - module.exports = React.createClass({ + module.exports = { - displayName: "List", + componentWillUnmount: function componentWillUnmount() { + var timers = this._timers || {}; - mixins: [__webpack_require__(132), __webpack_require__(135), __webpack_require__(159)], + for (var k in timers) if (has(timers, k)) clearTimeout(timers[k]); + }, - propTypes: { - data: React.PropTypes.array, - onSelect: React.PropTypes.func, - onMove: React.PropTypes.func, - itemComponent: CustomPropTypes.elementType, + setTimeout: (function (_setTimeout) { + var _setTimeoutWrapper = function setTimeout() { + return _setTimeout.apply(this, arguments); + }; - selectedIndex: React.PropTypes.number, - focusedIndex: React.PropTypes.number, - valueField: React.PropTypes.string, - textField: React.PropTypes.string, + _setTimeoutWrapper.toString = function () { + return _setTimeout.toString(); + }; - optID: React.PropTypes.string, + return _setTimeoutWrapper; + })(function (key, cb, duration) { + var timers = this._timers || (this._timers = Object.create(null)); - messages: React.PropTypes.shape({ - emptyList: React.PropTypes.string - }) }, + clearTimeout(timers[key]); + timers[key] = setTimeout(cb, duration); + }) + }; - getDefaultProps: function () { - return { - optID: "", - onSelect: function () {}, - data: [], - messages: { - emptyList: "There are no items in this list" - } - }; - }, +/***/ }, +/* 131 */ +/***/ function(module, exports, __webpack_require__) { - getInitialState: function getInitialState() { - return {}; - }, + "use strict"; + var _ = __webpack_require__(121); + //backport PureRenderEqual + module.exports = { - componentDidMount: function componentDidMount() { - this._setScrollPosition(); - }, + shouldComponentUpdate: function (nextProps, nextState) { + return !_.isShallowEqual(this.props, nextProps) || !_.isShallowEqual(this.state, nextState); + } + }; - componentDidUpdate: function componentDidUpdate(prevProps) { - if (prevProps.focused !== this.props.focused) this._setScrollPosition(); +/***/ }, +/* 132 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1), + _ = __webpack_require__(121); + + module.exports = { + + propTypes: { + valueField: React.PropTypes.string, + textField: React.PropTypes.string }, + + _dataValue: function (item) { + var field = this.props.valueField; + + return field && item && _.has(item, field) ? item[field] : item; }, - render: function render() { - var _this = this; - var _$omit = _.omit(this.props, ["data"]); + _dataText: function (item) { + var field = this.props.textField; - var className = _$omit.className; - var props = _objectWithoutProperties(_$omit, ["className"]); - var ItemComponent = this.props.itemComponent; - var items; + return (field && item && _.has(item, field) ? item[field] : item) + ""; + }, - items = !this.props.data.length ? React.createElement("li", null, this.props.messages.emptyList) : this.props.data.map(function (item, idx) { - var focused = item === _this.props.focused, - selected = item === _this.props.selected; + _dataIndexOf: function (data, item) { + var _this = this; + var idx = -1, + len = data.length, + finder = function (datum) { + return _this._valueMatcher(item, datum); + }; - return React.createElement("li", { - key: "item_" + idx, - role: "option", - id: focused ? _this.props.optID : undefined, - "aria-selected": selected, - className: cx({ - "rw-list-option": true, - "rw-state-focus": focused, - "rw-state-selected": selected }), - onClick: _this.props.onSelect.bind(null, item) }, ItemComponent ? React.createElement(ItemComponent, { item: item }) : _this._dataText(item)); - }); + while (++idx < len) if (finder(data[idx])) return idx; - return React.createElement("ul", _extends({}, props, { - className: (className || "") + " rw-list", - ref: "scrollable", - role: "listbox" }), items); + return -1; }, - _data: function _data() { - return this.props.data; + _valueMatcher: function (a, b) { + return _.isShallowEqual(this._dataValue(a), this._dataValue(b)); }, - _setScrollPosition: function () { - var list = this.getDOMNode(), - idx = this._data().indexOf(this.props.focused), - selected = list.children[idx]; + _dataItem: function (data, item) { + var first = data[0], + field = this.props.valueField, + idx; - if (!selected) return; + // make an attempt to see if we were passed in dataItem vs just a valueField value + // either an object with the right prop, or a primitive + // { valueField: 5 } || "hello" [ "hello" ] + if (_.has(item, field) || typeof first === typeof val) return item; - this.notify("onMove", [selected, list]); - } + idx = this._dataIndexOf(data, this._dataValue(item)); - }); + if (idx !== -1) return data[idx]; + + return item; + } + }; /***/ }, -/* 130 */ +/* 133 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var _objectWithoutProperties = function (obj, keys) { - var target = {};for (var i in obj) { - if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; - }return target; - }; + var scrollTo = __webpack_require__(151); - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; + module.exports = { - var React = __webpack_require__(1), - CustomPropTypes = __webpack_require__(128), - cx = __webpack_require__(121), - _ = __webpack_require__(122); + _scrollTo: function _scrollTo(selected, list) { + var handler = this.props.onMove; + if (this.props.open) { + if (handler) handler(selected, list);else { + this._scrollCancel && this._scrollCancel(); + this._scrollCancel = scrollTo(selected, list); + } + } + } }; - module.exports = React.createClass({ +/***/ }, +/* 134 */ +/***/ function(module, exports, __webpack_require__) { - displayName: "List", + "use strict"; + var React = __webpack_require__(1); - mixins: [__webpack_require__(132), __webpack_require__(135), __webpack_require__(159)], + module.exports = { propTypes: { - data: React.PropTypes.array, - onSelect: React.PropTypes.func, - onMove: React.PropTypes.func, + isRtl: React.PropTypes.bool + }, - itemComponent: CustomPropTypes.elementType, - groupComponent: CustomPropTypes.elementType, + contextTypes: { + isRtl: React.PropTypes.bool + }, - selected: React.PropTypes.any, - focused: React.PropTypes.any, + childContextTypes: { + isRtl: React.PropTypes.bool + }, - valueField: React.PropTypes.string, - textField: React.PropTypes.string, + getChildContext: function () { + return { + isRtl: this.props.isRtl || this.context && this.context.isRtl + }; + }, - optID: React.PropTypes.string, + isRtl: function () { + return !!(this.props.isRtl || this.context && this.context.isRtl); + } - groupBy: React.PropTypes.oneOfType([React.PropTypes.func, React.PropTypes.string]), + }; - messages: React.PropTypes.shape({ - emptyList: React.PropTypes.string - }) }, +/***/ }, +/* 135 */ +/***/ function(module, exports, __webpack_require__) { + "use strict"; - getDefaultProps: function () { - return { - optID: "", - onSelect: function () {}, - data: [], - messages: { - emptyList: "There are no items in this list" - } - }; + var common = { + eq: function (a, b) { + return a === b; + }, + neq: function (a, b) { + return a !== b; + }, + gt: function (a, b) { + return a > b; + }, + gte: function (a, b) { + return a >= b; + }, + lt: function (a, b) { + return a < b; + }, + lte: function (a, b) { + return a <= b; }, - getInitialState: function () { - var keys = []; - - return { - groups: this._group(this.props.groupBy, this.props.data, keys), + contains: function (a, b) { + return a.indexOf(b) !== -1; + }, - sortedKeys: keys - }; + startsWith: function (a, b) { + return a.lastIndexOf(b, 0) === 0; }, - componentWillReceiveProps: function componentWillReceiveProps(nextProps) { - var keys = []; + endsWith: function (a, b) { + var pos = a.length - b.length, + lastIndex = a.indexOf(b, pos); - if (nextProps.data !== this.props.data || nextProps.groupBy !== this.props.groupBy) this.setState({ - groups: this._group(nextProps.groupBy, nextProps.data, keys), - sortedKeys: keys - }); - }, + return lastIndex !== -1 && lastIndex === pos; + } + }; - componentDidMount: function componentDidMount(prevProps, prevState) { - this._setScrollPosition(); - }, + module.exports = common; + +/***/ }, +/* 136 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var _objectWithoutProperties = function (obj, keys) { + var target = {};for (var i in obj) { + if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; + }return target; + }; + + var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i];for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + }return target; + }; + + var React = __webpack_require__(1); + + module.exports = React.createClass({ + displayName: "exports", - componentDidUpdate: function componentDidUpdate(prevProps) { - if (prevProps.focused !== this.props.focused) this._setScrollPosition(); - }, render: function () { - var _this = this; - var _$omit = _.omit(this.props, ["data", "selectedIndex"]); + var className = this.props.className; + var props = _objectWithoutProperties(this.props, ["className"]); - var className = _$omit.className; - var props = _objectWithoutProperties(_$omit, ["className"]); - var groups = this.state.groups; - var items = []; - var idx = -1; - var group; + return React.createElement("button", _extends({}, props, { type: "button", className: (className || "") + " rw-btn" }), this.props.children); + } + }); - if (this.props.data.length) { - items = this.state.sortedKeys.reduce(function (items, key) { - group = groups[key]; - items.push(_this._renderGroupHeader(key)); +/***/ }, +/* 137 */ +/***/ function(module, exports, __webpack_require__) { - for (var itemIdx = 0; itemIdx < group.length; itemIdx++) items.push(_this._renderItem(key, group[itemIdx], ++idx)); + "use strict"; + var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i];for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + }return target; + }; - return items; - }, []); - } else items = React.createElement("li", null, this.props.messages.emptyList); + var React = __webpack_require__(1), + caretPos = __webpack_require__(160); - return React.createElement("ul", _extends({}, props, { - className: (className || "") + " rw-list rw-list-grouped", - ref: "scrollable", - role: "listbox" }), items); - }, + module.exports = React.createClass({ + displayName: "exports", - _renderGroupHeader: function _renderGroupHeader(group) { - var ItemComponent = this.props.groupComponent; - return React.createElement("li", { - key: "item_" + group, - tabIndex: "-1", - role: "separator", - className: "rw-list-optgroup" }, ItemComponent ? React.createElement(ItemComponent, { item: group }) : group); + propTypes: { + value: React.PropTypes.string, + onChange: React.PropTypes.func.isRequired }, - _renderItem: function _renderItem(group, item, idx) { - var focused = this.props.focused === item, - selected = this.props.selected === item, - ItemComponent = this.props.itemComponent; - //console.log('hi') - return React.createElement("li", { - key: "item_" + group + "_" + idx, - role: "option", - id: focused ? this.props.optID : undefined, - "aria-selected": selected, - onClick: this.props.onSelect.bind(null, item), - className: cx({ - "rw-state-focus": focused, - "rw-state-selected": selected, - "rw-list-option": true - }) }, ItemComponent ? React.createElement(ItemComponent, { item: item }) : this._dataText(item)); - }, + // hello + componentDidUpdate: function () { + var input = this.getDOMNode(), + val = this.props.value; - _isIndexOf: function _isIndexOf(idx, item) { - return this.props.data[idx] === item; + if (this.isSuggesting()) { + var start = val.toLowerCase().indexOf(this._last.toLowerCase()) + this._last.length, + end = val.length - start; + + if (start >= 0) { + caretPos(input, start, start + end); + } + } }, - _group: function _group(groupBy, data, keys) { - var iter = typeof groupBy === "function" ? groupBy : function (item) { - return item[groupBy]; + getDefaultProps: function () { + return { + value: "" }; + }, - // the keys array ensures that groups are rendered in the order they came in - // which means that if you sort the data array it will render sorted, - // so long as you also sorted by group - keys = keys || []; - - return data.reduce(function (grps, item) { - var group = iter(item); + render: function () { + return React.createElement("input", _extends({}, this.props, { + type: "text", + className: this.props.className + " rw-input", + onKeyDown: this.props.onKeyDown, + onChange: this._change, + value: this.props.value == null ? "" : this.props.value })); + }, - _.has(grps, group) ? grps[group].push(item) : (keys.push(group), grps[group] = [item]); + isSuggesting: function () { + var val = this.props.value, + isSuggestion = this._last != null && val.toLowerCase().indexOf(this._last.toLowerCase()) !== -1; - return grps; - }, {}); + return this.props.suggest && isSuggestion; }, - _data: function _data() { - var groups = this.state.groups; + accept: function (removeCaret) { + var val = this.getDOMNode().value || "", + end = val.length; - return this.state.sortedKeys.reduce(function (flat, grp) { - return flat.concat(groups[grp]); - }, []); + this._last = null; + removeCaret && caretPos(this.getDOMNode(), end, end); }, - _setScrollPosition: function () { - var selected = this.getItemDOMNode(this.props.focused); + _change: function (e) { + var val = e.target.value; + this._last = val; + this.props.onChange(e, val); + }, - if (!selected) return; + focus: function () { + this.getDOMNode().focus(); + } + }); - this.notify("onMove", [selected, this.getDOMNode()]); +/***/ }, +/* 138 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1), + filters = __webpack_require__(135), + helper = __webpack_require__(132); + + var filterTypes = Object.keys(filters).filter(function (i) { + return i !== "filter"; + }); + + module.exports = { + + propTypes: { + data: React.PropTypes.array, + value: React.PropTypes.any, + filter: React.PropTypes.oneOfType([React.PropTypes.func, React.PropTypes.oneOf(filterTypes.concat(false))]), + caseSensitive: React.PropTypes.bool, + minLength: React.PropTypes.number }, + + getDefaultProps: function () { + return { + caseSensitive: false, + minLength: 1 + }; }, - getItemDOMNode: function getItemDOMNode(item) { - var list = this.getDOMNode(), - groups = this.state.groups, - idx = -1, - itemIdx, - child; + filterIndexOf: function (items, searchTerm) { + var idx = -1, + matches = typeof this.props.filter === "function" ? this.props.filter : getFilter(filters[this.props.filter || "eq"], searchTerm, this); - this.state.sortedKeys.some(function (group) { - itemIdx = groups[group].indexOf(item); - idx++; + if (!searchTerm || !searchTerm.trim() || this.props.filter && searchTerm.length < (this.props.minLength || 1)) return -1; - if (itemIdx !== -1) return !!(child = list.children[idx + itemIdx + 1]); + items.every(function (item, i) { + if (matches(item, searchTerm)) return (idx = i, false); - idx += groups[group].length; + return true; }); - return child; - } - - }); + return idx; + }, -/***/ }, -/* 131 */ -/***/ function(module, exports, __webpack_require__) { + filter: function (items, searchTerm) { + var matches = typeof this.props.filter === "string" ? getFilter(filters[this.props.filter], searchTerm, this) : this.props.filter; - "use strict"; - var METHODS = ["next", "prev", "first", "last"]; + if (!matches || !searchTerm || !searchTerm.trim() || searchTerm.length < (this.props.minLength || 1)) return items; - module.exports = function validateListComponent(list) { - if (true) { - METHODS.forEach(function (method) { - return assert(typeof list[method] === "function", "List components must implement a `" + method + "()` method"); + return items.filter(function (item) { + return matches(item, searchTerm); }); } }; - function assert(condition, msg) { - var error; - if (!condition) { - error = new Error(msg); - error.framesToPop = 1; - throw error; - } + function getFilter(matcher, searchTerm, ctx) { + searchTerm = !ctx.caseSensitive ? searchTerm.toLowerCase() : searchTerm; + + return function (item) { + var val = helper._dataText.call(ctx, item); + + if (!ctx.caseSensitive) val = val.toLowerCase(); + + return matcher(val, searchTerm); + }; } /***/ }, -/* 132 */ +/* 139 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var React = __webpack_require__(1), - _ = __webpack_require__(122); //uniqueID - module.exports = { + var dateMath = __webpack_require__(90), + globalize = __webpack_require__(174), + _ = __webpack_require__(121); //extend - propTypes: { + var dates = module.exports = _.assign(dateMath, { + // wrapper methods for isolating globalize use throughout the lib + // looking forward towards the 1.0 release + culture: function (culture) { + return culture ? globalize.findClosestCulture(culture) : globalize.culture(); + }, - disabled: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(["disabled"])]), + startOfWeek: function (culture) { + culture = dates.culture(culture); - readOnly: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(["readOnly"])]) }, + if (!culture || !culture.calendar) return 0; - isDisabled: function () { - return this.props.disabled === true || this.props.disabled === "disabled"; + return culture.calendar.firstDay || 0; }, - isReadOnly: function () { - return this.props.readOnly === true || this.props.readOnly === "readonly"; + parse: function (date, format, culture) { + return globalize.parseDate(date, format, culture); }, - notify: function (handler, args) { - this.props[handler] && this.props[handler].apply(null, [].concat(args)); + format: function (date, format, culture) { + return globalize.format(date, format, culture); }, - _id: function (suffix) { - this._id_ || (this._id_ = _.uniqueId("rw_")); - return (this.props.id || this._id_) + suffix; + //------------------------------------- + + shortDaysOfWeek: function (culture) { + var start = dates.startOfWeek(culture), + days, + front; + + culture = dates.culture(culture); + + if (culture && culture.calendar) { + days = culture.calendar.days.namesShort.slice(); + + if (start === 0) return days; + + front = days.splice(0, start); + days = days.concat(front); + return days; + } }, - _maybeHandle: function (handler, disabledOnly) { - if (!(this.isDisabled() || !disabledOnly && this.isReadOnly())) return handler; - return function () {}; - } }; + monthsInYear: function (year) { + var months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], + date = new Date(year, 0, 1); -/***/ }, -/* 133 */ -/***/ function(module, exports, __webpack_require__) { + return months.map(function (i) { + return dates.month(date, i); + }); + }, - "use strict"; - var React = __webpack_require__(1), - filter = __webpack_require__(123), - helper = __webpack_require__(135), - _ = __webpack_require__(122); + firstOfDecade: function (date) { + var decade = dates.year(date) % 10; - module.exports = { + return dates.subtract(date, decade, "year"); + }, - propTypes: { - data: React.PropTypes.array, - value: React.PropTypes.any, - delay: React.PropTypes.number, - filter: React.PropTypes.string }, + lastOfDecade: function (date) { + return dates.add(dates.firstOfDecade(date), 9, "year"); + }, - search: function (character, cb) { - var self = this, - word = ((this._searchTerm || "") + character).toLowerCase(); + firstOfCentury: function (date) { + var decade = dates.year(date) % 100; + return dates.subtract(date, decade, "year"); + }, - clearTimeout(this._timer); + lastOfCentury: function (date) { + return dates.add(dates.firstOfCentury(date), 99, "year"); + }, - this._searchTerm = word; + firstVisibleDay: function (date) { + var firstOfMonth = dates.startOf(date, "month"); + return dates.startOf(firstOfMonth, "week"); + }, - this._timer = setTimeout(function () { - self._searchTerm = ""; - cb(word); - }, this.props.delay); + lastVisibleDay: function (date) { + var endOfMonth = dates.endOf(date, "month"); + return dates.endOf(endOfMonth, "week"); }, - findNextWordIndex: function (word, current) { - var matcher = filter.startsWith, - self = this; + visibleDays: function (date) { + var current = dates.firstVisibleDay(date), + last = dates.lastVisibleDay(date), + days = []; - return _.findIndex(self._data(), function (item, i) { - return i >= current && matcher(helper._dataText.call(self, item).toLowerCase(), word.toLowerCase()); - }); + while (dates.lte(current, last, "day")) { + days.push(current); + current = dates.add(current, 1, "day"); + } + + return days; + }, + + merge: function (date, time) { + if (time == null && date == null) return null; + + if (time == null) time = new Date(); + if (date == null) date = new Date(); + + date = dates.startOf(date, "day"); + date = dates.hours(date, dates.hours(time)); + date = dates.minutes(date, dates.minutes(time)); + date = dates.seconds(date, dates.seconds(time)); + return dates.milliseconds(date, dates.milliseconds(time)); + }, + + sameMonth: function (dateA, dateB) { + return dates.eq(dateA, dateB, "month"); + }, + + today: function () { + return this.startOf(new Date(), "day"); + }, + + yesterday: function () { + return this.add(this.startOf(new Date(), "day"), -1, "day"); + }, + + tomorrow: function () { + return this.add(this.startOf(new Date(), "day"), 1, "day"); + }, + + formats: { + DAY_OF_MONTH: "dd", + DAY_NAME_SHORT: null, + MONTH_NAME_ABRV: "MMM", + MONTH_YEAR: "MMMM yyyy", + YEAR: "yyyy" } - }; + }); /***/ }, -/* 134 */ +/* 140 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var React = __webpack_require__(1), - filters = __webpack_require__(123), - helper = __webpack_require__(135), - _ = __webpack_require__(122); + var _ = __webpack_require__(121); //object - var filterTypes = Object.keys(filters).filter(function (i) { - return i !== "filter"; - }); + var views = { + MONTH: "month", + YEAR: "year", + DECADE: "decade", + CENTURY: "century" + }; module.exports = { - propTypes: { - data: React.PropTypes.array, - value: React.PropTypes.any, - filter: React.PropTypes.oneOfType([React.PropTypes.func, React.PropTypes.oneOf(filterTypes.concat(false))]), - caseSensitive: React.PropTypes.bool, - minLength: React.PropTypes.number }, - - getDefaultProps: function () { - return { - caseSensitive: false, - minLength: 1 - }; + directions: { + LEFT: "LEFT", + RIGHT: "RIGHT", + UP: "UP", + DOWN: "DOWN" }, - filterIndexOf: function (items, searchTerm) { - var idx = -1, - matches = typeof this.props.filter === "function" ? this.props.filter : getFilter(filters[this.props.filter || "eq"], searchTerm, this); - - if (!searchTerm || !searchTerm.trim() || this.props.filter && searchTerm.length < (this.props.minLength || 1)) return -1; - - items.every(function (item, i) { - if (matches(item, searchTerm)) return (idx = i, false); - - return true; - }); - - return idx; + datePopups: { + TIME: "time", + CALENDAR: "calendar" }, - filter: function (items, searchTerm) { - var matches = typeof this.props.filter === "string" ? getFilter(filters[this.props.filter], searchTerm, this) : this.props.filter; + calendarViews: views, - if (!matches || !searchTerm || !searchTerm.trim() || searchTerm.length < (this.props.minLength || 1)) return items; + calendarViewHierarchy: _.object([[views.MONTH, views.YEAR], [views.YEAR, views.DECADE], [views.DECADE, views.CENTURY]]), - return items.filter(function (item) { - return matches(item, searchTerm); - }); - } + calendarViewUnits: _.object([[views.MONTH, views.DAY], [views.YEAR, views.MONTH], [views.DECADE, views.YEAR], [views.CENTURY, views.DECADE]]) }; - - function getFilter(matcher, searchTerm, ctx) { - searchTerm = !ctx.caseSensitive ? searchTerm.toLowerCase() : searchTerm; - - return function (item) { - var val = helper._dataText.call(ctx, item); - - if (!ctx.caseSensitive) val = val.toLowerCase(); - - return matcher(val, searchTerm); - }; - } - /***/ }, -/* 135 */ +/* 141 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i];for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + }return target; + }; + var React = __webpack_require__(1), - _ = __webpack_require__(122); + dates = __webpack_require__(139), + List = __webpack_require__(126), + CustomPropTypes = __webpack_require__(124), + _ = __webpack_require__(121); // omit - module.exports = { - propTypes: { - valueField: React.PropTypes.string, - textField: React.PropTypes.string }, + module.exports = React.createClass({ - _dataValue: function (item) { - var field = this.props.valueField; + displayName: "TimeList", - return field && item && _.has(item, field) ? item[field] : item; - }, + propTypes: { + value: React.PropTypes.instanceOf(Date), + min: React.PropTypes.instanceOf(Date), + max: React.PropTypes.instanceOf(Date), + step: React.PropTypes.number, + itemComponent: CustomPropTypes.elementType, + onSelect: React.PropTypes.func, + preserveDate: React.PropTypes.bool, + culture: React.PropTypes.string }, - _dataText: function (item) { - var field = this.props.textField; + mixins: [__webpack_require__(130)], - return (field && item && _.has(item, field) ? item[field] : item) + ""; + getDefaultProps: function getDefaultProps() { + return { + step: 30, + format: "t", + onSelect: function () {}, + preserveDate: true, + delay: 300 + }; }, - _dataIndexOf: function (data, item) { - return _.findIndex(data, this._valueMatcher.bind(null, item), this); - }, + getInitialState: function getInitialState() { + var data = this._dates(this.props), + focusedItem = this._closestDate(data, this.props.value); - _valueMatcher: function (a, b) { - return _.isShallowEqual(this._dataValue(a), this._dataValue(b)); + return { + focusedItem: focusedItem || data[0], + dates: data + }; }, - _dataItem: function (data, item) { - var first = data[0], - field = this.props.valueField, - idx; - - // make an attempt to see if we were passed in dataItem vs just a valueField value - // either an object with the right prop, or a primitive - // { valueField: 5 } || "hello" [ "hello" ] - if (_.has(item, field) || typeof first === typeof val) return item; - - idx = this._dataIndexOf(data, this._dataValue(item)); - - if (idx !== -1) return data[idx]; - - return item; - } - }; - -/***/ }, -/* 136 */ -/***/ function(module, exports, __webpack_require__) { + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + var data = this._dates(nextProps), + focusedItem = this._closestDate(data, this.props.value); - "use strict"; - var scrollTo = __webpack_require__(151); + if (nextProps.value !== this.props.value) this.setState({ + focusedItem: focusedItem || data[0], + dates: data + }); + }, - module.exports = { + render: function () { + var times = this.state.dates, + date = this._closestDate(times, this.props.value); - _scrollTo: function _scrollTo(selected, list) { - var handler = this.props.onMove; + return React.createElement(List, _extends({}, _.omit(this.props, "value"), { + ref: "list", + data: times, + textField: "label", + valueField: "date", + selected: date, + focused: this.state.focusedItem, + itemComponent: this.props.itemComponent, + onSelect: this.props.onSelect })); + }, - if (this.props.open) { - if (handler) handler(selected, list);else { - this._scrollCancel && this._scrollCancel(); - this._scrollCancel = scrollTo(selected, list); - } - } - } }; + _closestDate: function (times, date) { + var roundTo = 1000 * 60 * this.props.step, + inst = null, + label; -/***/ }, -/* 137 */ -/***/ function(module, exports, __webpack_require__) { + if (!date) return null; - "use strict"; - var React = __webpack_require__(1); + date = new Date(Math.floor(date.getTime() / roundTo) * roundTo); + label = dates.format(date, this.props.format, this.props.culture); - module.exports = { + times.some(function (time) { + if (time.label === label) return inst = time; + }); - propTypes: { - isRtl: React.PropTypes.bool + return inst; }, - contextTypes: { - isRtl: React.PropTypes.bool + _data: function _data() { + return this.state.dates; }, - childContextTypes: { - isRtl: React.PropTypes.bool - }, + _dates: function (props) { + var times = [], + i = 0, + values = this._dateValues(props), + start = values.min, + startDay = dates.date(start); - getChildContext: function () { - return { - isRtl: this.props.isRtl || this.context && this.context.isRtl - }; + // debugger; + while (i < 100 && (dates.date(start) === startDay && dates.lte(start, values.max))) { + i++; + times.push({ date: start, label: dates.format(start, props.format, props.culture) }); + start = dates.add(start, props.step || 30, "minutes"); + } + return times; }, - isRtl: function () { - return !!(this.props.isRtl || this.context && this.context.isRtl); - } - - }; - -/***/ }, -/* 138 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var _ = __webpack_require__(122); + _dateValues: function (props) { + var value = props.value || dates.today(), + useDate = props.preserveDate, + min = props.min, + max = props.max, + start, + end; - //backport PureRenderEqual - module.exports = { + //compare just the time regradless of whether they fall on the same day + if (!useDate) { + start = dates.startOf(dates.merge(new Date(), min), "minutes"); + end = dates.startOf(dates.merge(new Date(), max), "minutes"); - shouldComponentUpdate: function (nextProps, nextState) { - return !_.isShallowEqual(this.props, nextProps) || !_.isShallowEqual(this.state, nextState); - } - }; + if (dates.lte(end, start) && dates.gt(max, min, "day")) end = dates.tomorrow(); -/***/ }, -/* 139 */ -/***/ function(module, exports, __webpack_require__) { + return { + min: start, + max: end + }; + } - "use strict"; - var _ = __webpack_require__(122); //object + //date parts are equal + return { + min: dates.eq(value, min, "day") ? min : dates.today(), + max: dates.eq(value, max, "day") ? min : dates.tomorrow() + }; + }, - var views = { - MONTH: "month", - YEAR: "year", - DECADE: "decade", - CENTURY: "century" - }; + _keyDown: function (e) { + var _this = this; + var key = e.key, + character = String.fromCharCode(e.keyCode), + focusedItem = this.state.focusedItem, + list = this.refs.list; - module.exports = { + if (key === "End") this.setState({ focusedItem: list.last() });else if (key === "Home") this.setState({ focusedItem: list.first() });else if (key === "Enter") this.props.onSelect(focusedItem);else if (key === "ArrowDown") { + e.preventDefault(); + this.setState({ focusedItem: list.next(focusedItem) }); + } else if (key === "ArrowUp") { + e.preventDefault(); + this.setState({ focusedItem: list.prev(focusedItem) }); + } else { + e.preventDefault(); - directions: { - LEFT: "LEFT", - RIGHT: "RIGHT", - UP: "UP", - DOWN: "DOWN" + this.search(character, function (item) { + _this.setState({ focusedItem: item }); + }); + } }, - datePopups: { - TIME: "time", - CALENDAR: "calendar" - }, + search: function (character, cb) { + var _this = this; + var word = ((this._searchTerm || "") + character).toLowerCase(); - calendarViews: views, + this._searchTerm = word; - calendarViewHierarchy: _.object([[views.MONTH, views.YEAR], [views.YEAR, views.DECADE], [views.DECADE, views.CENTURY]]), + this.setTimeout("search", function () { + var list = _this.refs.list, + item = list.next(_this.state.focusedItem, word); - calendarViewUnits: _.object([[views.MONTH, views.DAY], [views.YEAR, views.MONTH], [views.DECADE, views.YEAR], [views.CENTURY, views.DECADE]]) - }; + _this._searchTerm = ""; + if (item) cb(item); + }, this.props.delay); + } }); /***/ }, -/* 140 */ +/* 142 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -17558,103 +17872,105 @@ }; var React = __webpack_require__(1), - setter = __webpack_require__(161), - globalize = __webpack_require__(171); - + cx = __webpack_require__(122), + dates = __webpack_require__(139); module.exports = React.createClass({ - displayName: "NumberPickerInput", + displayName: "DatePickerInput", + propTypes: { - value: React.PropTypes.number, format: React.PropTypes.string, - min: React.PropTypes.number, + parse: React.PropTypes.func.isRequired, + value: React.PropTypes.instanceOf(Date), onChange: React.PropTypes.func.isRequired, - onKeyDown: React.PropTypes.func }, + culture: React.PropTypes.string }, getDefaultProps: function () { return { - value: null, - format: "d", - editing: false }; - }, - - getInitialState: function () { - var value = this.props.editing ? this.props.value : globalize.format(this.props.value, this.props.format); - - return { - stringValue: value + textValue: "" }; }, componentWillReceiveProps: function (nextProps) { - var value = nextProps.editing ? nextProps.value : globalize.format(nextProps.value, nextProps.format); + this.setState({ + textValue: formatDate(nextProps.value, nextProps.editing && nextProps.editFormat ? nextProps.editFormat : nextProps.format, nextProps.culture) + }); + }, - if (isNaN(nextProps.value)) value = ""; + getInitialState: function () { + var text = formatDate(this.props.value, this.props.editing && this.props.editFormat ? this.props.editFormat : this.props.format, this.props.culture); - this.current(value); + this.lastValue = text; + return { + textValue: text + }; }, render: function () { - var value = this.state.stringValue; + var value = this.state.textValue; return React.createElement("input", _extends({}, this.props, { type: "text", - className: "rw-input", - onChange: this._change, - onBlur: this._finish, + className: cx({ "rw-input": true }), + value: value, "aria-disabled": this.props.disabled, "aria-readonly": this.props.readOnly, disabled: this.props.disabled, readOnly: this.props.readOnly, - value: value })); + onChange: this._change, + onBlur: chain(this.props.blur, this._blur, this) })); }, _change: function (e) { - var val = e.target.value, - number = +e.target.value, - isNull = val !== 0 && !val, - hasMin = isFinite(this.props.min); + this.setState({ textValue: e.target.value }); + }, - //console.log(hasMin, this.props.min) - //a null value is only possible when there is no min - if (!hasMin && isNull) return this.props.onChange(null); + _blur: function (e) { + var val = e.target.value; - if (this.isValid(number) && number !== this.props.value) return this.props.onChange(number); + //console.log('blur', val, e.target, '\nlast', this.lastValue) - //console.log(val !== 0 && !val) - this.current(e.target.value); + if (val === this.lastValue) return; + + this.lastValue = val; + this.props.onChange(this.props.parse(val), val); }, - _finish: function (e) { - var number = +this.state.stringValue; + focus: function () { + this.getDOMNode().focus(); + } - // if number is below the min - // we need to flush low values eventually, onBlur is definativly no typing - if (!isNaN(number) && number < this.props.min) { - this.props.onChange(number); - } - }, + }); - isValid: function (value) { - var num = +value; + function isValid(d) { + return !isNaN(d.getTime()); + } - if (isNaN(num)) return false; - return num >= this.props.min; - }, + function formatDate(date, format, culture) { + var val = ""; - //this intermediate state is for when one runs into the decimal or are typing the number - current: setter("stringValue") }); + if (date instanceof Date && isValid(date)) val = dates.format(date, format, culture); + + return val; + } + + function chain(a, b, thisArg) { + return function () { + a && a.apply(thisArg, arguments); + b && b.apply(thisArg, arguments); + }; + } /***/ }, -/* 141 */ +/* 143 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var React = __webpack_require__(1), - Btn = __webpack_require__(125); + Btn = __webpack_require__(136); module.exports = React.createClass({ displayName: "exports", @@ -17677,7 +17993,7 @@ }) }, - mixins: [__webpack_require__(138), __webpack_require__(162)], + mixins: [__webpack_require__(131), __webpack_require__(161)], getDefaultProps: function () { return { @@ -17710,7 +18026,7 @@ }); /***/ }, -/* 142 */ +/* 144 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -17725,11 +18041,11 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - dates = __webpack_require__(146), - directions = __webpack_require__(139).directions, - _ = __webpack_require__(122), - Btn = __webpack_require__(125); + cx = __webpack_require__(122), + dates = __webpack_require__(139), + directions = __webpack_require__(140).directions, + _ = __webpack_require__(121), + Btn = __webpack_require__(136); var opposite = { LEFT: directions.RIGHT, @@ -17740,7 +18056,7 @@ displayName: "MonthView", - mixins: [__webpack_require__(132), __webpack_require__(162), __webpack_require__(163)("month", "day")], + mixins: [__webpack_require__(129), __webpack_require__(161), __webpack_require__(162)("month", "day")], propTypes: { culture: React.PropTypes.string, @@ -17791,111 +18107,12 @@ }, - _headers: function (format) { - var days = dates.shortDaysOfWeek(this.props.culture); - - return days.map(function (day, i) { - return React.createElement("th", { key: "header_" + i }, day); - }); - }, - - move: function (date, direction) { - var min = this.props.min, - max = this.props.max; - - if (this.isRtl() && opposite[direction]) direction = opposite[direction]; - - if (direction === directions.LEFT) date = nextDate(date, -1, "day", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "day", min, max);else if (direction === directions.UP) date = nextDate(date, -1, "week", min, max);else if (direction === directions.DOWN) date = nextDate(date, 1, "week", min, max); - - return date; - } - - }); - - function nextDate(date, val, unit, min, max) { - var newDate = dates.add(date, val, unit); - - return dates.inRange(newDate, min, max, "day") ? newDate : date; - } - -/***/ }, -/* 143 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; - - var React = __webpack_require__(1), - cx = __webpack_require__(121), - dates = __webpack_require__(146), - directions = __webpack_require__(139).directions, - Btn = __webpack_require__(125), - _ = __webpack_require__(122); - - var opposite = { - LEFT: directions.RIGHT, - RIGHT: directions.LEFT - }; - - module.exports = React.createClass({ - - displayName: "YearView", - - mixins: [__webpack_require__(132), __webpack_require__(162), __webpack_require__(163)("year", "month")], - - propTypes: { - culture: React.PropTypes.string, - value: React.PropTypes.instanceOf(Date), - min: React.PropTypes.instanceOf(Date), - max: React.PropTypes.instanceOf(Date), - onChange: React.PropTypes.func.isRequired - }, - - - render: function () { - var props = _.omit(this.props, ["max", "min", "value", "onChange"]), - months = dates.monthsInYear(dates.year(this.props.value)), - rows = _.chunk(months, 4); - - return React.createElement("table", _extends({}, props, { - tabIndex: this.props.disabled ? "-1" : "0", - ref: "table", - role: "grid", - className: "rw-calendar-grid rw-nav-view", - "aria-activedescendant": this._id("_selected_item"), - onKeyUp: this._keyUp }), React.createElement("tbody", null, rows.map(this._row))); - }, - - _row: function (row, i) { - var _this = this; - var id = this._id("_selected_item"); - - return React.createElement("tr", { key: i, role: "row" }, row.map(function (date, i) { - var focused = dates.eq(date, _this.state.focusedDate, "month"), - selected = dates.eq(date, _this.props.value, "month"); - - return dates.inRange(date, _this.props.min, _this.props.max, "month") ? React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, date), tabIndex: "-1", - id: focused ? id : undefined, - "aria-selected": selected, - "aria-disabled": _this.props.disabled, - disabled: _this.props.disabled, - className: cx({ - "rw-state-focus": focused, - "rw-state-selected": selected - }) }, dates.format(date, dates.formats.MONTH_NAME_ABRV, _this.props.culture))) : React.createElement("td", { key: i, className: "rw-empty-cell", role: "gridcell" }, " "); - })); - }, - - focus: function () { - this.refs.table.getDOMNode().focus(); + _headers: function (format) { + var days = dates.shortDaysOfWeek(this.props.culture); + + return days.map(function (day, i) { + return React.createElement("th", { key: "header_" + i }, day); + }); }, move: function (date, direction) { @@ -17904,7 +18121,7 @@ if (this.isRtl() && opposite[direction]) direction = opposite[direction]; - if (direction === directions.LEFT) date = nextDate(date, -1, "month", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "month", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "month", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "month", min, max); + if (direction === directions.LEFT) date = nextDate(date, -1, "day", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "day", min, max);else if (direction === directions.UP) date = nextDate(date, -1, "week", min, max);else if (direction === directions.DOWN) date = nextDate(date, 1, "week", min, max); return date; } @@ -17913,11 +18130,12 @@ function nextDate(date, val, unit, min, max) { var newDate = dates.add(date, val, unit); - return dates.inRange(newDate, min, max, "month") ? newDate : date; + + return dates.inRange(newDate, min, max, "day") ? newDate : date; } /***/ }, -/* 144 */ +/* 145 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -17932,40 +18150,40 @@ }; var React = __webpack_require__(1), - _ = __webpack_require__(122), - cx = __webpack_require__(121), - dates = __webpack_require__(146), - directions = __webpack_require__(139).directions, - Btn = __webpack_require__(125); + cx = __webpack_require__(122), + dates = __webpack_require__(139), + directions = __webpack_require__(140).directions, + Btn = __webpack_require__(136), + _ = __webpack_require__(121); var opposite = { LEFT: directions.RIGHT, RIGHT: directions.LEFT }; - module.exports = React.createClass({ - displayName: "DecadeView", + displayName: "YearView", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(162), __webpack_require__(163)("decade", "year")], + mixins: [__webpack_require__(129), __webpack_require__(161), __webpack_require__(162)("year", "month")], propTypes: { culture: React.PropTypes.string, - value: React.PropTypes.instanceOf(Date), min: React.PropTypes.instanceOf(Date), max: React.PropTypes.instanceOf(Date), onChange: React.PropTypes.func.isRequired }, + render: function () { var props = _.omit(this.props, ["max", "min", "value", "onChange"]), - years = getDecadeYears(this.props.value), - rows = _.chunk(years, 4); + months = dates.monthsInYear(dates.year(this.props.value)), + rows = _.chunk(months, 4); return React.createElement("table", _extends({}, props, { tabIndex: this.props.disabled ? "-1" : "0", + ref: "table", role: "grid", className: "rw-calendar-grid rw-nav-view", "aria-activedescendant": this._id("_selected_item"), @@ -17976,55 +18194,46 @@ var _this = this; var id = this._id("_selected_item"); - return React.createElement("tr", { key: "row_" + i, role: "row" }, row.map(function (date, i) { - var focused = dates.eq(date, _this.state.focusedDate, "year"), - selected = dates.eq(date, _this.props.value, "year"); + return React.createElement("tr", { key: i, role: "row" }, row.map(function (date, i) { + var focused = dates.eq(date, _this.state.focusedDate, "month"), + selected = dates.eq(date, _this.props.value, "month"); - return !dates.inRange(date, _this.props.min, _this.props.max, "year") ? React.createElement("td", { key: i, role: "gridcell", className: "rw-empty-cell" }, " ") : React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, date), tabIndex: "-1", + return dates.inRange(date, _this.props.min, _this.props.max, "month") ? React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, date), tabIndex: "-1", id: focused ? id : undefined, "aria-selected": selected, "aria-disabled": _this.props.disabled, disabled: _this.props.disabled, className: cx({ - "rw-off-range": !inDecade(date, _this.props.value), "rw-state-focus": focused, - "rw-state-selected": selected }) }, dates.format(date, dates.formats.YEAR, _this.props.culture))); + "rw-state-selected": selected + }) }, dates.format(date, dates.formats.MONTH_NAME_ABRV, _this.props.culture))) : React.createElement("td", { key: i, className: "rw-empty-cell", role: "gridcell" }, " "); })); }, + focus: function () { + this.refs.table.getDOMNode().focus(); + }, + move: function (date, direction) { var min = this.props.min, max = this.props.max; if (this.isRtl() && opposite[direction]) direction = opposite[direction]; - if (direction === directions.LEFT) date = nextDate(date, -1, "year", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "year", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "year", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "year", min, max); + if (direction === directions.LEFT) date = nextDate(date, -1, "month", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "month", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "month", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "month", min, max); return date; } }); - function inDecade(date, start) { - return dates.gte(date, dates.startOf(start, "decade"), "year") && dates.lte(date, dates.endOf(start, "decade"), "year"); - } - - function getDecadeYears(_date) { - var days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], - date = dates.add(dates.startOf(_date, "decade"), -2, "year"); - - return days.map(function (i) { - return date = dates.add(date, 1, "year"); - }); - } - function nextDate(date, val, unit, min, max) { var newDate = dates.add(date, val, unit); - return dates.inRange(newDate, min, max, "year") ? newDate : date; + return dates.inRange(newDate, min, max, "month") ? newDate : date; } /***/ }, -/* 145 */ +/* 146 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -18039,11 +18248,11 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - dates = __webpack_require__(146), - directions = __webpack_require__(139).directions, - Btn = __webpack_require__(125), - _ = __webpack_require__(122); //omit + _ = __webpack_require__(121), + cx = __webpack_require__(122), + dates = __webpack_require__(139), + directions = __webpack_require__(140).directions, + Btn = __webpack_require__(136); var opposite = { LEFT: directions.RIGHT, @@ -18053,22 +18262,22 @@ module.exports = React.createClass({ - displayName: "CenturyView", + displayName: "DecadeView", - mixins: [__webpack_require__(132), __webpack_require__(138), __webpack_require__(162), __webpack_require__(163)("century", "decade")], + mixins: [__webpack_require__(129), __webpack_require__(131), __webpack_require__(161), __webpack_require__(162)("decade", "year")], propTypes: { culture: React.PropTypes.string, + value: React.PropTypes.instanceOf(Date), min: React.PropTypes.instanceOf(Date), max: React.PropTypes.instanceOf(Date), - onChange: React.PropTypes.func.isRequired }, render: function () { var props = _.omit(this.props, ["max", "min", "value", "onChange"]), - years = getCenturyDecades(this.props.value), + years = getDecadeYears(this.props.value), rows = _.chunk(years, 4); return React.createElement("table", _extends({}, props, { @@ -18084,234 +18293,51 @@ var id = this._id("_selected_item"); return React.createElement("tr", { key: "row_" + i, role: "row" }, row.map(function (date, i) { - var focused = dates.eq(date, _this.state.focusedDate, "decade"), - selected = dates.eq(date, _this.props.value, "decade"), - d = inRangeDate(date, _this.props.min, _this.props.max); + var focused = dates.eq(date, _this.state.focusedDate, "year"), + selected = dates.eq(date, _this.props.value, "year"); - return !inRange(date, _this.props.min, _this.props.max) ? React.createElement("td", { key: i, role: "gridcell", className: "rw-empty-cell" }, " ") : React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, d), - tabIndex: "-1", + return !dates.inRange(date, _this.props.min, _this.props.max, "year") ? React.createElement("td", { key: i, role: "gridcell", className: "rw-empty-cell" }, " ") : React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, date), tabIndex: "-1", id: focused ? id : undefined, "aria-selected": selected, "aria-disabled": _this.props.disabled, disabled: _this.props.disabled, className: cx({ - "rw-off-range": !inCentury(date, _this.props.value), + "rw-off-range": !inDecade(date, _this.props.value), "rw-state-focus": focused, - "rw-state-selected": selected }) }, label(date, _this.props.culture))); + "rw-state-selected": selected }) }, dates.format(date, dates.formats.YEAR, _this.props.culture))); })); }, - move: function (date, direction) { var min = this.props.min, max = this.props.max; if (this.isRtl() && opposite[direction]) direction = opposite[direction]; - if (direction === directions.LEFT) date = nextDate(date, -1, "decade", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "decade", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "decade", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "decade", min, max); + if (direction === directions.LEFT) date = nextDate(date, -1, "year", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "year", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "year", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "year", min, max); return date; } }); - function label(date, culture) { - return dates.format(dates.startOf(date, "decade"), dates.formats.YEAR, culture) + " - " + dates.format(dates.endOf(date, "decade"), dates.formats.YEAR, culture); - } - - function inRangeDate(decade, min, max) { - return dates.max(dates.min(decade, max), min); - } - - function inRange(decade, min, max) { - return dates.gte(decade, dates.startOf(min, "decade"), "year") && dates.lte(decade, dates.endOf(max, "decade"), "year"); - } - - function inCentury(date, start) { - return dates.gte(date, dates.startOf(start, "century"), "year") && dates.lte(date, dates.endOf(start, "century"), "year"); + function inDecade(date, start) { + return dates.gte(date, dates.startOf(start, "decade"), "year") && dates.lte(date, dates.endOf(start, "decade"), "year"); } - function getCenturyDecades(_date) { + function getDecadeYears(_date) { var days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], - date = dates.add(dates.startOf(_date, "century"), -20, "year"); + date = dates.add(dates.startOf(_date, "decade"), -2, "year"); return days.map(function (i) { - return date = dates.add(date, 10, "year"); + return date = dates.add(date, 1, "year"); }); - } - - - function nextDate(date, val, unit, min, max) { - var newDate = dates.add(date, val, unit); - return dates.inRange(newDate, min, max, "decade") ? newDate : date; - } - -/***/ }, -/* 146 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var dateMath = __webpack_require__(90), - globalize = __webpack_require__(171), - _ = __webpack_require__(122); //extend - - var dates = module.exports = _.extend(dateMath, { - // wrapper methods for isolating globalize use throughout the lib - // looking forward towards the 1.0 release - culture: function (culture) { - return culture ? globalize.findClosestCulture(culture) : globalize.culture(); - }, - - startOfWeek: function (culture) { - culture = dates.culture(culture); - - if (!culture || !culture.calendar) return 0; - - return culture.calendar.firstDay || 0; - }, - - parse: function (date, format, culture) { - return globalize.parseDate(date, format, culture); - }, - - format: function (date, format, culture) { - return globalize.format(date, format, culture); - }, - - //------------------------------------- - - shortDaysOfWeek: function (culture) { - var start = dates.startOfWeek(culture), - days, - front; - - culture = dates.culture(culture); - - if (culture && culture.calendar) { - days = culture.calendar.days.namesShort.slice(); - - if (start === 0) return days; - - front = days.splice(0, start); - days = days.concat(front); - return days; - } - }, - - // daysOfWeek: function(date, format, culture){ - // var range = [0,1,2,3,4,5,6] - // if (arguments.length === 1){ - // format = date - // date = new Date() - // } - - // format = format || 'do' - - // return range.map(i => dates.format(dates.weekday(date, i), format, culture) ) - // }, - - // months: function(date, format, culture){ - // var months = [0,1,2,3,4,5,6,7,8,9,10,11] - - // if (arguments.length === 1){ - // format = date - // date = new Date() - // } - // format = format || dates.formats.DAY_NAME_ABRV - - // return months.map( i => dates.format(dates.month(date, i), format, culture)) - // }, - - monthsInYear: function (year) { - var months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], - date = new Date(year, 0, 1); - - return months.map(function (i) { - return dates.month(date, i); - }); - }, - - firstOfDecade: function (date) { - var decade = dates.year(date) % 10; - - return dates.subtract(date, decade, "year"); - }, - - lastOfDecade: function (date) { - return dates.add(dates.firstOfDecade(date), 9, "year"); - }, - - firstOfCentury: function (date) { - var decade = dates.year(date) % 100; - return dates.subtract(date, decade, "year"); - }, - - lastOfCentury: function (date) { - return dates.add(dates.firstOfCentury(date), 99, "year"); - }, - - firstVisibleDay: function (date) { - var firstOfMonth = dates.startOf(date, "month"); - return dates.startOf(firstOfMonth, "week"); - }, - - lastVisibleDay: function (date) { - var endOfMonth = dates.endOf(date, "month"); - return dates.endOf(endOfMonth, "week"); - }, - - visibleDays: function (date) { - var current = dates.firstVisibleDay(date), - last = dates.lastVisibleDay(date), - days = []; - - while (dates.lte(current, last, "day")) { - days.push(current); - current = dates.add(current, 1, "day"); - } - - return days; - }, - - merge: function (date, time) { - if (time == null && date == null) return null; - - if (time == null) time = new Date(); - if (date == null) date = new Date(); - - date = dates.startOf(date, "day"); - date = dates.hours(date, dates.hours(time)); - date = dates.minutes(date, dates.minutes(time)); - date = dates.seconds(date, dates.seconds(time)); - return dates.milliseconds(date, dates.milliseconds(time)); - }, - - sameMonth: function (dateA, dateB) { - return dates.eq(dateA, dateB, "month"); - }, - - today: function () { - return this.startOf(new Date(), "day"); - }, - - yesterday: function () { - return this.add(this.startOf(new Date(), "day"), -1, "day"); - }, - - tomorrow: function () { - return this.add(this.startOf(new Date(), "day"), 1, "day"); - }, - - formats: { - DAY_OF_MONTH: "dd", - DAY_NAME_SHORT: null, - MONTH_NAME_ABRV: "MMM", - MONTH_YEAR: "MMMM yyyy", - YEAR: "yyyy" - } + } - }); + function nextDate(date, val, unit, min, max) { + var newDate = dates.add(date, val, unit); + return dates.inRange(newDate, min, max, "year") ? newDate : date; + } /***/ }, /* 147 */ @@ -18328,45 +18354,114 @@ }return target; }; - var React = __webpack_require__(1); + var React = __webpack_require__(1), + cx = __webpack_require__(122), + dates = __webpack_require__(139), + directions = __webpack_require__(140).directions, + Btn = __webpack_require__(136), + _ = __webpack_require__(121); //omit + + var opposite = { + LEFT: directions.RIGHT, + RIGHT: directions.LEFT + }; + module.exports = React.createClass({ - displayName: "MultiselectInput", + displayName: "CenturyView", + + mixins: [__webpack_require__(129), __webpack_require__(131), __webpack_require__(161), __webpack_require__(162)("century", "decade")], propTypes: { - value: React.PropTypes.string, - onChange: React.PropTypes.func.isRequired, + culture: React.PropTypes.string, + value: React.PropTypes.instanceOf(Date), + min: React.PropTypes.instanceOf(Date), + max: React.PropTypes.instanceOf(Date), - disabled: React.PropTypes.bool, - readOnly: React.PropTypes.bool }, + onChange: React.PropTypes.func.isRequired + }, + render: function () { + var props = _.omit(this.props, ["max", "min", "value", "onChange"]), + years = getCenturyDecades(this.props.value), + rows = _.chunk(years, 4); - componentDidUpdate: function () { - this.props.focused && this.focus(); + return React.createElement("table", _extends({}, props, { + tabIndex: this.props.disabled ? "-1" : "0", + role: "grid", + className: "rw-calendar-grid rw-nav-view", + "aria-activedescendant": this._id("_selected_item"), + onKeyUp: this._keyUp }), React.createElement("tbody", null, rows.map(this._row))); }, - render: function () { - var value = this.props.value, - placeholder = this.props.placeholder, - size = Math.max((value || placeholder).length, 1); + _row: function (row, i) { + var _this = this; + var id = this._id("_selected_item"); - return React.createElement("input", _extends({}, this.props, { - type: "text", - className: "rw-input", - "aria-disabled": this.props.disabled, - "aria-readonly": this.props.readOnly, - disabled: this.props.disabled, - readOnly: this.props.readOnly, - size: size })); + return React.createElement("tr", { key: "row_" + i, role: "row" }, row.map(function (date, i) { + var focused = dates.eq(date, _this.state.focusedDate, "decade"), + selected = dates.eq(date, _this.props.value, "decade"), + d = inRangeDate(date, _this.props.min, _this.props.max); + + return !inRange(date, _this.props.min, _this.props.max) ? React.createElement("td", { key: i, role: "gridcell", className: "rw-empty-cell" }, " ") : React.createElement("td", { key: i, role: "gridcell" }, React.createElement(Btn, { onClick: _this.props.onChange.bind(null, d), + tabIndex: "-1", + id: focused ? id : undefined, + "aria-selected": selected, + "aria-disabled": _this.props.disabled, + disabled: _this.props.disabled, + className: cx({ + "rw-off-range": !inCentury(date, _this.props.value), + "rw-state-focus": focused, + "rw-state-selected": selected }) }, label(date, _this.props.culture))); + })); }, - focus: function () { - this.getDOMNode().focus(); + + move: function (date, direction) { + var min = this.props.min, + max = this.props.max; + + if (this.isRtl() && opposite[direction]) direction = opposite[direction]; + + if (direction === directions.LEFT) date = nextDate(date, -1, "decade", min, max);else if (direction === directions.RIGHT) date = nextDate(date, 1, "decade", min, max);else if (direction === directions.UP) date = nextDate(date, -4, "decade", min, max);else if (direction === directions.DOWN) date = nextDate(date, 4, "decade", min, max); + + return date; } }); + function label(date, culture) { + return dates.format(dates.startOf(date, "decade"), dates.formats.YEAR, culture) + " - " + dates.format(dates.endOf(date, "decade"), dates.formats.YEAR, culture); + } + + function inRangeDate(decade, min, max) { + return dates.max(dates.min(decade, max), min); + } + + function inRange(decade, min, max) { + return dates.gte(decade, dates.startOf(min, "decade"), "year") && dates.lte(decade, dates.endOf(max, "decade"), "year"); + } + + function inCentury(date, start) { + return dates.gte(date, dates.startOf(start, "century"), "year") && dates.lte(date, dates.endOf(start, "century"), "year"); + } + + function getCenturyDecades(_date) { + var days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], + date = dates.add(dates.startOf(_date, "century"), -20, "year"); + + return days.map(function (i) { + return date = dates.add(date, 10, "year"); + }); + } + + + function nextDate(date, val, unit, min, max) { + var newDate = dates.add(date, val, unit); + return dates.inRange(newDate, min, max, "decade") ? newDate : date; + } + /***/ }, /* 148 */ /***/ function(module, exports, __webpack_require__) { @@ -18383,131 +18478,97 @@ }; var React = __webpack_require__(1), - _ = __webpack_require__(122), - cx = __webpack_require__(121), - Btn = __webpack_require__(125); + globalize = __webpack_require__(174); - module.exports = React.createClass({ - displayName: "MultiselectTagList", + module.exports = React.createClass({ - mixins: [__webpack_require__(135), __webpack_require__(138)], + displayName: "NumberPickerInput", propTypes: { - value: React.PropTypes.array, - - valueField: React.PropTypes.string, - textField: React.PropTypes.string, - - valueComponent: React.PropTypes.func, + value: React.PropTypes.number, + format: React.PropTypes.string, + min: React.PropTypes.number, - disabled: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.array, React.PropTypes.oneOf(["disabled"])]), + onChange: React.PropTypes.func.isRequired, + onKeyDown: React.PropTypes.func }, - readOnly: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.array, React.PropTypes.oneOf(["readonly"])]) + getDefaultProps: function () { + return { + value: null, + format: "d", + editing: false }; }, - getInitialState: function () { + var value = this.props.editing ? this.props.value : globalize.format(this.props.value, this.props.format); + return { - focused: null + stringValue: value }; }, - render: function () { - var _this = this; - var ValueComponent = this.props.valueComponent, - props = _.omit(this.props, ["value", "disabled", "readOnly"]), - focusIdx = this.state.focused, - value = this.props.value; - - return React.createElement("ul", _extends({}, props, { - className: "rw-multiselect-taglist" }), value.map(function (item, i) { - var disabled = _this.isDisabled(item), - readonly = _this.isReadOnly(item); - - return React.createElement("li", { key: i, - className: cx({ - "rw-state-focus": !disabled && focusIdx === i, - "rw-state-disabled": disabled, - "rw-state-readonly": readonly }) }, ValueComponent ? React.createElement(ValueComponent, { item: item }) : _this._dataText(item), React.createElement(Btn, { tabIndex: "-1", onClick: !(disabled || readonly) && _this._delete.bind(null, item), - "aria-disabled": disabled, - disabled: disabled }, "×", React.createElement("span", { className: "rw-sr" }, "Remove " + _this._dataText(item)))); - })); - }, - - _delete: function (val, e) { - this.props.onDelete(val); - }, - - removeCurrent: function () { - var val = this.props.value[this.state.focused]; - - if (val && !(this.isDisabled(val) || this.isReadOnly(val))) this.props.onDelete(val); - }, - - isDisabled: function (val, isIdx) { - if (isIdx) val = this.props.value[val]; - - return this.props.disabled === true || this._dataIndexOf(this.props.disabled || [], val) !== -1; - }, + componentWillReceiveProps: function (nextProps) { + var value = nextProps.editing ? nextProps.value : globalize.format(nextProps.value, nextProps.format); - isReadOnly: function (val, isIdx) { - if (isIdx) val = this.props.value[val]; + if (isNaN(nextProps.value)) value = ""; - return this.props.readOnly === true || this._dataIndexOf(this.props.readOnly || [], val) !== -1; + this.current(value); }, - removeNext: function () { - var val = this.props.value[this.props.value.length - 1]; + render: function () { + var value = this.state.stringValue; - if (val && !(this.isDisabled(val) || this.isReadOnly(val))) this.props.onDelete(val); + return React.createElement("input", _extends({}, this.props, { + type: "text", + className: "rw-input", + onChange: this._change, + onBlur: this._finish, + "aria-disabled": this.props.disabled, + "aria-readonly": this.props.readOnly, + disabled: this.props.disabled, + readOnly: this.props.readOnly, + value: value })); }, - clear: function () { - this.setState({ focused: null }); - }, + _change: function (e) { + var val = e.target.value, + number = +e.target.value, + isNull = val !== 0 && !val, + hasMin = isFinite(this.props.min); - first: function () { - var idx = 0, - l = this.props.value.length; + //console.log(hasMin, this.props.min) + //a null value is only possible when there is no min + if (!hasMin && isNull) return this.props.onChange(null); - while (idx < l && this.isDisabled(idx, true)) idx++; + if (this.isValid(number) && number !== this.props.value) return this.props.onChange(number); - if (idx !== l) this.setState({ focused: idx }); + //console.log(val !== 0 && !val) + this.current(e.target.value); }, - last: function () { - var idx = this.props.value.length - 1; - - while (idx > -1 && this.isDisabled(idx, true)) idx--; + _finish: function (e) { + var number = +this.state.stringValue; - if (idx >= 0) this.setState({ focused: idx }); + // if number is below the min + // we need to flush low values eventually, onBlur is definativly no typing + if (!isNaN(number) && number < this.props.min) { + this.props.onChange(number); + } }, - next: function () { - var nextIdx = this.state.focused + 1, - l = this.props.value.length; - - while (nextIdx < l && this.isDisabled(nextIdx, true)) nextIdx++; - - if (this.state.focused === null) return; - - if (nextIdx >= l) return this.clear(); + isValid: function (value) { + var num = +value; - this.setState({ focused: nextIdx }); + if (isNaN(num)) return false; + return num >= this.props.min; }, - prev: function () { - var nextIdx = this.state.focused; - - if (nextIdx === null) nextIdx = this.props.value.length; - - nextIdx--; - - while (nextIdx > -1 && this.isDisabled(nextIdx, true)) nextIdx--; - - if (nextIdx >= 0) this.setState({ focused: nextIdx }); + //this intermediate state is for when one runs into the decimal or are typing the number + current: function (val) { + this.setState({ stringValue: val }); } + }); /***/ }, @@ -18525,174 +18586,44 @@ }return target; }; - var React = __webpack_require__(1), - dates = __webpack_require__(146), - List = __webpack_require__(129), - CustomPropTypes = __webpack_require__(128), - _ = __webpack_require__(122); // omit - + var React = __webpack_require__(1); module.exports = React.createClass({ - displayName: "TimeList", + displayName: "MultiselectInput", propTypes: { - value: React.PropTypes.instanceOf(Date), - min: React.PropTypes.instanceOf(Date), - max: React.PropTypes.instanceOf(Date), - step: React.PropTypes.number, - itemComponent: CustomPropTypes.elementType, - onSelect: React.PropTypes.func, - preserveDate: React.PropTypes.bool, - culture: React.PropTypes.string }, - - getDefaultProps: function () { - return { - step: 30, - format: "t", - onSelect: function () {}, - preserveDate: true, - delay: 300 - }; - }, - - getInitialState: function () { - var data = this._dates(this.props), - focusedItem = this._closestDate(data, this.props.value); + value: React.PropTypes.string, + onChange: React.PropTypes.func.isRequired, - return { - focusedItem: focusedItem || data[0], - dates: data - }; - }, + disabled: React.PropTypes.bool, + readOnly: React.PropTypes.bool }, - componentWillReceiveProps: function (nextProps) { - var data = this._dates(nextProps), - focusedItem = this._closestDate(data, this.props.value); - if (nextProps.value !== this.props.value) this.setState({ - focusedItem: focusedItem || data[0], - dates: data - }); + componentDidUpdate: function () { + this.props.focused && this.focus(); }, render: function () { - var times = this.state.dates, - date = this._closestDate(times, this.props.value); - - return React.createElement(List, _extends({}, _.omit(this.props, "value"), { - ref: "list", - data: times, - textField: "label", - valueField: "date", - selected: date, - focused: this.state.focusedItem, - itemComponent: this.props.itemComponent, - onSelect: this.props.onSelect })); - }, - - _closestDate: function (times, date) { - var roundTo = 1000 * 60 * this.props.step, - inst = null, - label; - - if (!date) return null; - - date = new Date(Math.floor(date.getTime() / roundTo) * roundTo); - label = dates.format(date, this.props.format, this.props.culture); - - times.some(function (time) { - if (time.label === label) return inst = time; - }); - - return inst; - }, - - _data: function _data() { - return this.state.dates; - }, - - _dates: function (props) { - var times = [], - i = 0, - values = this._dateValues(props), - start = values.min, - startDay = dates.date(start); - - // debugger; - while (i < 100 && (dates.date(start) === startDay && dates.lte(start, values.max))) { - i++; - times.push({ date: start, label: dates.format(start, props.format, props.culture) }); - start = dates.add(start, props.step || 30, "minutes"); - } - return times; - }, - - _dateValues: function (props) { - var value = props.value || dates.today(), - useDate = props.preserveDate, - min = props.min, - max = props.max, - start, - end; - - //compare just the time regradless of whether they fall on the same day - if (!useDate) { - start = dates.startOf(dates.merge(new Date(), min), "minutes"); - end = dates.startOf(dates.merge(new Date(), max), "minutes"); - - if (dates.lte(end, start) && dates.gt(max, min, "day")) end = dates.tomorrow(); - - return { - min: start, - max: end - }; - } - - //date parts are equal - return { - min: dates.eq(value, min, "day") ? min : dates.today(), - max: dates.eq(value, max, "day") ? min : dates.tomorrow() - }; - }, - - _keyDown: function (e) { - var _this = this; - var key = e.key, - character = String.fromCharCode(e.keyCode), - focusedItem = this.state.focusedItem, - list = this.refs.list; - - if (key === "End") this.setState({ focusedItem: list.last() });else if (key === "Home") this.setState({ focusedItem: list.first() });else if (key === "Enter") this.props.onSelect(focusedItem);else if (key === "ArrowDown") { - e.preventDefault(); - this.setState({ focusedItem: list.next(focusedItem) }); - } else if (key === "ArrowUp") { - e.preventDefault(); - this.setState({ focusedItem: list.prev(focusedItem) }); - } else { - e.preventDefault(); + var value = this.props.value, + placeholder = this.props.placeholder, + size = Math.max((value || placeholder).length, 1); - this.search(character, function (item) { - _this.setState({ focusedItem: item }); - }); - } + return React.createElement("input", _extends({}, this.props, { + type: "text", + className: "rw-input", + "aria-disabled": this.props.disabled, + "aria-readonly": this.props.readOnly, + disabled: this.props.disabled, + readOnly: this.props.readOnly, + size: size })); }, - search: function (character, cb) { - var _this = this; - var word = ((this._searchTerm || "") + character).toLowerCase(); - - clearTimeout(this._timer); - this._searchTerm = word; - - this._timer = setTimeout(function () { - var list = _this.refs.list, - item = list.next(_this.state.focusedItem, word); + focus: function () { + this.getDOMNode().focus(); + } - _this._searchTerm = ""; - if (item) cb(item); - }, this.props.delay); - } }); + }); /***/ }, /* 150 */ @@ -18710,110 +18641,151 @@ }; var React = __webpack_require__(1), - cx = __webpack_require__(121), - dates = __webpack_require__(146); + _ = __webpack_require__(121), + cx = __webpack_require__(122), + Btn = __webpack_require__(136); module.exports = React.createClass({ - displayName: "DatePickerInput", + displayName: "MultiselectTagList", + mixins: [__webpack_require__(132), __webpack_require__(131)], propTypes: { - format: React.PropTypes.string, - parse: React.PropTypes.func.isRequired, + value: React.PropTypes.array, - value: React.PropTypes.instanceOf(Date), - onChange: React.PropTypes.func.isRequired, - culture: React.PropTypes.string }, + valueField: React.PropTypes.string, + textField: React.PropTypes.string, - getDefaultProps: function () { - return { - textValue: "" - }; - }, + valueComponent: React.PropTypes.func, - componentWillReceiveProps: function (nextProps) { - this.setState({ - textValue: formatDate(nextProps.value, nextProps.editing && nextProps.editFormat ? nextProps.editFormat : nextProps.format, nextProps.culture) - }); + disabled: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.array, React.PropTypes.oneOf(["disabled"])]), + + readOnly: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.array, React.PropTypes.oneOf(["readonly"])]) }, - getInitialState: function () { - var text = formatDate(this.props.value, this.props.editing && this.props.editFormat ? this.props.editFormat : this.props.format, this.props.culture); - this.lastValue = text; + getInitialState: function () { return { - textValue: text + focused: null }; }, render: function () { - var value = this.state.textValue; + var _this = this; + var ValueComponent = this.props.valueComponent, + props = _.omit(this.props, ["value", "disabled", "readOnly"]), + focusIdx = this.state.focused, + value = this.props.value; - return React.createElement("input", _extends({}, this.props, { - type: "text", - className: cx({ "rw-input": true }), - value: value, - "aria-disabled": this.props.disabled, - "aria-readonly": this.props.readOnly, - disabled: this.props.disabled, - readOnly: this.props.readOnly, - onChange: this._change, - onBlur: chain(this.props.blur, this._blur, this) })); + return React.createElement("ul", _extends({}, props, { + className: "rw-multiselect-taglist" }), value.map(function (item, i) { + var disabled = _this.isDisabled(item), + readonly = _this.isReadOnly(item); + + return React.createElement("li", { key: i, + className: cx({ + "rw-state-focus": !disabled && focusIdx === i, + "rw-state-disabled": disabled, + "rw-state-readonly": readonly }) }, ValueComponent ? React.createElement(ValueComponent, { item: item }) : _this._dataText(item), React.createElement(Btn, { tabIndex: "-1", onClick: !(disabled || readonly) && _this._delete.bind(null, item), + "aria-disabled": disabled, + disabled: disabled }, "×", React.createElement("span", { className: "rw-sr" }, "Remove " + _this._dataText(item)))); + })); + }, + + _delete: function (val, e) { + this.props.onDelete(val); + }, + + removeCurrent: function () { + var val = this.props.value[this.state.focused]; + + if (val && !(this.isDisabled(val) || this.isReadOnly(val))) this.props.onDelete(val); + }, + + isDisabled: function (val, isIdx) { + if (isIdx) val = this.props.value[val]; + + return this.props.disabled === true || this._dataIndexOf(this.props.disabled || [], val) !== -1; + }, + + isReadOnly: function (val, isIdx) { + if (isIdx) val = this.props.value[val]; + + return this.props.readOnly === true || this._dataIndexOf(this.props.readOnly || [], val) !== -1; + }, + + removeNext: function () { + var val = this.props.value[this.props.value.length - 1]; + + if (val && !(this.isDisabled(val) || this.isReadOnly(val))) this.props.onDelete(val); }, - _change: function (e) { - this.setState({ textValue: e.target.value }); + clear: function () { + this.setState({ focused: null }); }, - _blur: function (e) { - var val = e.target.value; + first: function () { + var idx = 0, + l = this.props.value.length; - //console.log('blur', val, e.target, '\nlast', this.lastValue) + while (idx < l && this.isDisabled(idx, true)) idx++; - if (val === this.lastValue) return; + if (idx !== l) this.setState({ focused: idx }); + }, - this.lastValue = val; - this.props.onChange(this.props.parse(val), val); + last: function () { + var idx = this.props.value.length - 1; + + while (idx > -1 && this.isDisabled(idx, true)) idx--; + + if (idx >= 0) this.setState({ focused: idx }); }, - focus: function () { - this.getDOMNode().focus(); - } + next: function () { + var nextIdx = this.state.focused + 1, + l = this.props.value.length; - }); + while (nextIdx < l && this.isDisabled(nextIdx, true)) nextIdx++; - function isValid(d) { - return !isNaN(d.getTime()); - } + if (this.state.focused === null) return; - function formatDate(date, format, culture) { - var val = ""; + if (nextIdx >= l) return this.clear(); - if (date instanceof Date && isValid(date)) val = dates.format(date, format, culture); + this.setState({ focused: nextIdx }); + }, - return val; - } + prev: function () { + var nextIdx = this.state.focused; - function chain(a, b, thisArg) { - return function () { - a && a.apply(thisArg, arguments); - b && b.apply(thisArg, arguments); - }; - } + if (nextIdx === null) nextIdx = this.props.value.length; + + nextIdx--; + + while (nextIdx > -1 && this.isDisabled(nextIdx, true)) nextIdx--; + + if (nextIdx >= 0) this.setState({ focused: nextIdx }); + } + }); /***/ }, /* 151 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var $ = __webpack_require__(152); + var _require = __webpack_require__(164); + + var getOffset = _require.offset; + var height = _require.height; + var getScrollParent = __webpack_require__(165); + var scrollTop = __webpack_require__(166); + var raf = __webpack_require__(167); module.exports = function scrollTo(selected, scrollParent) { - var offset = $.offset(selected), + var offset = getOffset(selected), poff = { top: 0, left: 0 }, list, - scrollTop, + listScrollTop, selectedTop, isWin, selectedHeight, @@ -18822,15 +18794,14 @@ if (!selected) return; - list = scrollParent || $.scrollParent(selected); // if we know the parent skip this step for perf (maybe) - + list = scrollParent || getScrollParent(selected); isWin = getWindow(list); - scrollTop = $.scrollTop(list); + listScrollTop = scrollTop(list); - listHeight = $.height(list, true); + listHeight = height(list, true); isWin = getWindow(list); - if (!isWin) poff = $.offset(list); + if (!isWin) poff = getOffset(list); offset = { top: offset.top - poff.top, @@ -18841,18 +18812,17 @@ selectedHeight = offset.height; - selectedTop = offset.top + (isWin ? 0 : scrollTop); + selectedTop = offset.top + (isWin ? 0 : listScrollTop); bottom = selectedTop + selectedHeight; - scrollTop = scrollTop > selectedTop ? selectedTop : bottom > scrollTop + listHeight ? bottom - listHeight : scrollTop; + listScrollTop = listScrollTop > selectedTop ? selectedTop : bottom > listScrollTop + listHeight ? bottom - listHeight : listScrollTop; - var id = $.raf(function () { - return $.scrollTop(list, scrollTop); + var id = raf(function () { + return scrollTop(list, listScrollTop); }); - return function () { - return $.raf.cancel(id); + return raf.cancel(id); }; }; @@ -18865,274 +18835,40 @@ /***/ function(module, exports, __webpack_require__) { "use strict"; - var canUseDom = __webpack_require__(164); - - if (canUseDom) { - var has = Object.prototype.hasOwnProperty, - raf = __webpack_require__(169), - transitionTiming, - transitionDuration, - transitionProperty, - transitionDelay, - notSupported, - endEvent, - prefix = "", - el = document.createElement("div"), - reset = {}, - transform = "transform", - transitions = { - O: "otransitionend", - Moz: "transitionend", - Webkit: "webkitTransitionEnd" - }; - - var TRANSLATION_MAP = { - left: "translateX", right: "translateX", - top: "translateY", bottom: "translateY" }; - - for (var vendor in transitions) if (has.call(transitions, vendor)) { - if (el.style[vendor + "TransitionProperty"] !== undefined) { - prefix = "-" + vendor.toLowerCase() + "-"; - endEvent = transitions[vendor]; - break; - } - } - - if (!endEvent && el.style.transitionProperty !== undefined) endEvent = "transitionend"; - - notSupported = !endEvent; - - transform = prefix + transform; - - reset[transitionProperty = prefix + "transition-property"] = reset[transitionDuration = prefix + "transition-duration"] = reset[transitionDelay = prefix + "transition-delay"] = reset[transitionTiming = prefix + "transition-timing-function"] = ""; - } - - var DOM = module.exports = { - - width: function (node, client) { - var win = getWindow(node); - return win ? win.innerWidth : client ? node.clientWidth : DOM.offset(node).width; - }, - - height: function (node, client) { - var win = getWindow(node); - return win ? win.innerHeight : client ? node.clientHeight : DOM.offset(node).height; - }, - - hasFocus: function (node) { - var doc = node.ownerDocument; - if (doc.activeElement == null) return false; - return doc.activeElement === node; - }, - - offset: function (node) { - var doc = node.ownerDocument, - docElem = doc && doc.documentElement, - box = { top: 0, left: 0, height: 0, width: 0 }; - - if (!docElem) return; - - if (!DOM.contains(docElem, node)) return box; - - if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect(); - - return { - top: box.top + window.pageYOffset - docElem.clientTop, - left: box.left + window.pageXOffset - docElem.clientLeft, - width: box.width || node.offsetWidth, - height: box.height || node.offsetHeight }; - }, - - css: function (node, property, value) { - var css = "", - props = property; - - if (typeof property === "string") { - if (value === undefined) return node.style[camelize(property)] || getComputedStyle(node).getPropertyValue(property);else (props = {})[property] = value; - } - - for (var key in props) if (has.call(props, key)) { - !props[key] && props[key] !== 0 ? removeStyle(node.style, dasherize(key)) : css += dasherize(key) + ":" + props[key] + ";"; - } - - node.style.cssText += ";" + css; - }, - - contains: (function () { - var root = canUseDom && document.documentElement; - - return root && root.contains ? function (context, node) { - return context.contains(node); - } : root && root.compareDocumentPosition ? function (context, node) { - return context === node || !!(context.compareDocumentPosition(node) & 16); - } : function (context, node) { - if (node) do { - if (node === context) return true; - } while (node = node.parentNode); - - return false; - }; - })(), - - scrollParent: function (node) { - var position = DOM.css(node, "position"), - excludeStatic = position === "absolute", - ownerDoc = node.ownerDocument; - - if (position === "fixed") return ownerDoc || document; - - while ((node = node.parentNode) && node.nodeType !== 9) { - var isStatic = excludeStatic && DOM.css(node, "position") === "static", - style = DOM.css(node, "overflow") + DOM.css(node, "overflow-y") + DOM.css(node, "overflow-x"); - - if (isStatic) continue; - - if (/(auto|scroll)/.test(style) && DOM.height(node) < node.scrollHeight) return node; - } - - return document; - }, - - scrollTop: function (node, val) { - var win = getWindow(node); - - if (val === undefined) return win ? "pageYOffset" in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop; - - if (win) win.scrollTo("pageXOffset" in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val; - }, - - - on: function (node, eventName, handler) { - if (node.addEventListener) node.addEventListener(eventName, handler, false);else if (node.attachEvent) node.attachEvent("on" + eventName, handler);else node["on" + eventName] = handler; - }, - - off: function (node, eventName, handler) { - if (node.addEventListener) node.removeEventListener(eventName, handler, false);else if (node.attachEvent) node.detachEvent("on" + eventName, handler);else node["on" + eventName] = null; - }, - - trigger: function (node, type) { - var event = document.createEvent("Events"); - event.initEvent(type, true, true); - node.dispatchEvent(event); - }, - - raf: (function () { - var compatRaf = function (cb) { - return raf(cb); - }, - cancel = "clearTimeout", - keys = ["cancelAnimationFrame", "webkitCancelAnimationFrame", "mozCancelAnimationFrame", "oCancelAnimationFrame", "msCancelAnimationFrame"]; - - if (canUseDom) { - for (var i = 0; i < keys.length; i++) if (keys[i] in window) { - cancel = keys[i]; - break; - } - - compatRaf.cancel = function (id) { - return window[cancel](id); - }; - } - - return compatRaf; - })(), - - /* code in part from: Zepto 1.1.4 | zeptojs.com/license */ - // super lean animate function for transitions - // doesn't support translations to keep it matching the jquery API - animate: function (node, properties, duration, easing, callback) { - var cssProperties = [], - fakeEvent = { target: node, currentTarget: node }, - cssValues = {}, - transforms = "", - fired; - - if (typeof easing === "function") callback = easing, easing = null; - - if (notSupported) duration = 0; - if (duration === undefined) duration = 200; - - for (var key in properties) if (has.call(properties, key)) { - if (/(top|bottom)/.test(key)) transforms += TRANSLATION_MAP[key] + "(" + properties[key] + ") ";else { - cssValues[key] = properties[key]; - cssProperties.push(dasherize(key)); - } - } - - if (transforms) { - cssValues[transform] = transforms; - cssProperties.push(transform); - } - - if (duration > 0) { - cssValues[transitionProperty] = cssProperties.join(", "); - cssValues[transitionDuration] = duration / 1000 + "s"; - cssValues[transitionDelay] = 0 + "s"; - cssValues[transitionTiming] = easing || "linear"; + var _require = __webpack_require__(168); - DOM.on(node, endEvent, done); + var on = _require.on; + var off = _require.off; + var _require2 = __webpack_require__(164); - setTimeout(function () { - if (!fired) done(fakeEvent); - }, duration + 25); - } + var height = _require2.height; + var width = _require2.width; + var offset = _require2.offset; - // trigger page reflow - node.clientLeft; - DOM.css(node, cssValues); - if (duration <= 0) setTimeout(done.bind(null, fakeEvent), 0); + module.exports = { - function done(event) { - if (event.target !== event.currentTarget) return; + height: height, - fired = true; - DOM.off(event.target, endEvent, done); - DOM.css(node, reset); + width: width, - callback && callback.call(this); - } - } - }; + offset: offset, + on: on, - function getWindow(node) { - return node === node.window ? node : node.nodeType === 9 && node.defaultView; - } + off: off, - function camelize(str) { - return str.replace(/-+(.)?/g, function (match, chr) { - return chr ? chr.toUpperCase() : ""; - }); - } + css: __webpack_require__(169), - function dasherize(str) { - return str.replace(/[A-Z]/g, function (char, index) { - return (index !== 0 ? "-" : "") + char.toLowerCase(); - }); - } + contains: __webpack_require__(170), - function removeStyle(styles, key) { - return "removeProperty" in styles ? styles.removeProperty(key) : styles.removeAttribute(key); - } + scrollParent: __webpack_require__(165), - function getComputedStyle(node) { - if (!node) throw new Error(); - var doc = node.ownerDocument; + scrollTop: __webpack_require__(166), - return "defaultView" in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" - getPropertyValue: function getPropertyValue(prop) { - var _arguments = arguments; - var re = /(\-([a-z]){1})/g; - if (prop == "float") prop = "styleFloat"; - if (re.test(prop)) prop = prop.replace(re, function () { - return _arguments[2].toUpperCase(); - }); + raf: __webpack_require__(167), - return node.currentStyle[prop] || null; - } - }; - } + animate: __webpack_require__(171) }; /***/ }, /* 153 */ @@ -19639,21 +19375,123 @@ }); }, - removeEndEventListener: function(node, eventListener) { - if (endEvents.length === 0) { - return; - } - endEvents.forEach(function(endEvent) { - removeEventListener(node, endEvent, eventListener); - }); + removeEndEventListener: function(node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function(endEvent) { + removeEventListener(node, endEvent, eventListener); + }); + } + }; + + module.exports = ReactTransitionEvents; + + +/***/ }, +/* 158 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1); + + var compat = module.exports = { + + version: function () { + return React.version.split(".").map(parseFloat); + }, + + propType: function (fn) { + return function validator(props, propName, componentName, location) { + var ver = compat.version(), + err = fn.call(this, props, propName, componentName, location); + + if (err && err !== true) { + if (ver[0] === 0 && ver[1] < 11) return void 0; + + return err; + } + }; + } + }; + +/***/ }, +/* 159 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1), + _ = __webpack_require__(121), + filter = __webpack_require__(135), + helper = __webpack_require__(132); + + module.exports = { + + propTypes: { + textField: React.PropTypes.string }, + + first: function first() { + return this._data()[0]; + }, + + last: function last() { + var data = this._data(); + return data[data.length - 1]; + }, + + prev: function prev(item, word) { + var data = this._data(), + idx = data.indexOf(item); + + if (idx === -1) idx = data.length; + + return word ? findPrevInstance(this, data, word, idx) : --idx < 0 ? data[0] : data[idx]; + }, + + next: function next(item, word) { + var data = this._data(), + idx = data.indexOf(item); + + return word ? findNextInstance(this, data, word, idx) : ++idx === data.length ? data[data.length - 1] : data[idx]; } + }; - module.exports = ReactTransitionEvents; + function findNextInstance(ctx, data, word, startIndex) { + var matches = filter.startsWith, + idx = -1, + len = data.length, + foundStart, + itemText; + + word = word.toLowerCase(); + + while (++idx < len) { + foundStart = foundStart || idx > startIndex; + itemText = foundStart && helper._dataText.call(ctx, data[idx]).toLowerCase(); + + if (foundStart && matches(itemText, word)) return data[idx]; + } + } + + function findPrevInstance(ctx, data, word, startIndex) { + var matches = filter.startsWith, + idx = data.length, + foundStart, + itemText; + + word = word.toLowerCase(); + + while (--idx >= 0) { + foundStart = foundStart || idx < startIndex; + itemText = foundStart && helper._dataText.call(ctx, data[idx]).toLowerCase(); + if (foundStart && matches(itemText, word)) return data[idx]; + } + } /***/ }, -/* 158 */ +/* 160 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -19707,213 +19545,480 @@ /* not focused or not visible */ /* not focused or not visible */ /***/ }, -/* 159 */ +/* 161 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var React = __webpack_require__(1); + + module.exports = { + + contextTypes: { + isRtl: React.PropTypes.bool + }, + + isRtl: function () { + return !!this.context.isRtl; + } + + }; + +/***/ }, +/* 162 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var React = __webpack_require__(1), - _ = __webpack_require__(122), - filter = __webpack_require__(123), - helper = __webpack_require__(135); + dates = __webpack_require__(139), + directions = __webpack_require__(140).directions; + + module.exports = function (viewUnit, smallUnit) { + return { + propTypes: { + value: React.PropTypes.instanceOf(Date), + min: React.PropTypes.instanceOf(Date), + max: React.PropTypes.instanceOf(Date) }, + + getInitialState: function () { + return { + focusedDate: constrainValue(this.props.value, this.props.min, this.props.max) + }; + }, + + componentWillReceiveProps: function (nextProps) { + var focused = this.state.focusedDate; + + //!dates.inRange(focused, nextProps.min, nextProps.max) + + if (!dates.eq(nextProps.value, focused, smallUnit)) this.setState({ + focusedDate: nextProps.value + }); + }, + + _keyDown: function (e) { + var key = e.key, + current = this.state.focusedDate, + date = current; + + if (key === "Enter") { + e.preventDefault(); + return this.props.onChange(date); + } + + if (key === "ArrowLeft") date = this.move(date, directions.LEFT);else if (key === "ArrowRight") date = this.move(date, directions.RIGHT);else if (key === "ArrowUp") date = this.move(date, directions.UP);else if (key === "ArrowDown") date = this.move(date, directions.DOWN); + + + if (!dates.eq(current, date, smallUnit)) { + e.preventDefault(); + + if (dates.gt(date, this.props.value, viewUnit)) return this.props.onMoveRight(date); + + if (dates.lt(date, this.props.value, viewUnit)) return this.props.onMoveLeft(date); + + this.setState({ + focusedDate: date + }); + } + } + }; + }; + + + function constrainValue(value, min, max) { + if (value == null) return value; + return dates.max(dates.min(value, max), min); + } + +/***/ }, +/* 163 */ +/***/ function(module, exports, __webpack_require__) { + + // Load modules + + var Stringify = __webpack_require__(175); + var Parse = __webpack_require__(176); + + + // Declare internals + + var internals = {}; + module.exports = { + stringify: Stringify, + parse: Parse + }; - propTypes: { - textField: React.PropTypes.string }, - first: function first() { - return this._data()[0]; +/***/ }, +/* 164 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var contains = __webpack_require__(170); + + function offset(node) { + var doc = node.ownerDocument, + docElem = doc && doc.documentElement, + box = { top: 0, left: 0, height: 0, width: 0 }; + + if (!docElem) return; + + if (!contains(docElem, node)) return box; + + if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect(); + + return { + top: box.top + window.pageYOffset - docElem.clientTop, + left: box.left + window.pageXOffset - docElem.clientLeft, + width: box.width || node.offsetWidth, + height: box.height || node.offsetHeight }; + } + + module.exports = { + + width: function (node, client) { + var win = getWindow(node); + return win ? win.innerWidth : client ? node.clientWidth : offset(node).width; }, - last: function last() { - var data = this._data(); - return data[data.length - 1]; + height: function (node, client) { + var win = getWindow(node); + return win ? win.innerHeight : client ? node.clientHeight : offset(node).height; }, - prev: function prev(item, word) { - var data = this._data(), - idx = data.indexOf(item); + offset: offset - if (idx === -1) idx = data.length; + }; - return word ? findNextInstance(this, data, word, idx, "prev") : --idx < 0 ? data[0] : data[idx]; - }, + function getWindow(node) { + return node === node.window ? node : node.nodeType === 9 && node.defaultView; + } - next: function next(item, word) { - var data = this._data(), - idx = data.indexOf(item); +/***/ }, +/* 165 */ +/***/ function(module, exports, __webpack_require__) { - return word ? findNextInstance(this, data, word, idx, "next") : ++idx === data.length ? data[data.length - 1] : data[idx]; - } + "use strict"; + + var css = __webpack_require__(169); + var _require = __webpack_require__(164); + + var height = _require.height; + + + module.exports = function scrollPrarent(node) { + var position = css(node, "position"), + excludeStatic = position === "absolute", + ownerDoc = node.ownerDocument; + + if (position === "fixed") return ownerDoc || document; + + while ((node = node.parentNode) && node.nodeType !== 9) { + var isStatic = excludeStatic && css(node, "position") === "static", + style = css(node, "overflow") + css(node, "overflow-y") + css(node, "overflow-x"); + + if (isStatic) continue; + + if (/(auto|scroll)/.test(style) && height(node) < node.scrollHeight) return node; + } + + return document; + }; + +/***/ }, +/* 166 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + module.exports = function scrollTop(node, val) { + var win = node === node.window ? node : node.nodeType === 9 && node.defaultView; + + if (val === undefined) return win ? "pageYOffset" in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop; + + if (win) win.scrollTo("pageXOffset" in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val; }; - function findNextInstance(ctx, data, word, current, dir) { - var matcher = filter.startsWith; +/***/ }, +/* 167 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; - return _.find(data, function (item, i) { - return (dir === "next" ? i > current : i < current) && matcher(helper._dataText.call(ctx, item).toLowerCase(), word.toLowerCase()); - }); + var canUseDOM = __webpack_require__(104).canUseDOM, + cancel = "clearTimeout", + raf = fallback, + compatRaf; + + var keys = ["cancelAnimationFrame", "webkitCancelAnimationFrame", "mozCancelAnimationFrame", "oCancelAnimationFrame", "msCancelAnimationFrame"]; + + + compatRaf = function (cb) { + return raf(cb); + }; + compatRaf.cancel = function (id) { + return window[cancel](id); + }; + + module.exports = compatRaf; + + if (canUseDOM) { + raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || fallback; + + for (var i = 0; i < keys.length; i++) if (keys[i] in window) { + cancel = keys[i]; + break; + } + } + + /* https://github.com/component/raf */ + var prev = new Date().getTime(); + + function fallback(fn) { + var curr = new Date().getTime(), + ms = Math.max(0, 16 - (curr - prev)), + req = setTimeout(fn, ms); + prev = curr; + return req; } /***/ }, -/* 160 */ +/* 168 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var React = __webpack_require__(1); - var compat = module.exports = { + module.exports = { - version: function () { - return React.version.split(".").map(parseFloat); + on: function (node, eventName, handler) { + if (node.addEventListener) node.addEventListener(eventName, handler, false);else if (node.attachEvent) node.attachEvent("on" + eventName, handler); }, - propType: function (fn) { - return function validator(props, propName, componentName, location) { - var ver = compat.version(), - err = fn.call(this, props, propName, componentName, location); + off: function (node, eventName, handler) { + if (node.addEventListener) node.removeEventListener(eventName, handler, false);else if (node.attachEvent) node.detachEvent("on" + eventName, handler); + } + }; - if (err && err !== true) { - if (ver[0] === 0 && ver[1] < 11) return void 0; +/***/ }, +/* 169 */ +/***/ function(module, exports, __webpack_require__) { - return err; - } - }; + "use strict"; + + var camelize = __webpack_require__(177), + hyphenate = __webpack_require__(178), + has = Object.prototype.hasOwnProperty; + + module.exports = function cssFn(node, property, value) { + var css = "", + props = property; + + if (typeof property === "string") { + if (value === undefined) return node.style[camelize(property)] || _getComputedStyle(node).getPropertyValue(property);else (props = {})[property] = value; } + + for (var key in props) if (has.call(props, key)) { + !props[key] && props[key] !== 0 ? removeStyle(node.style, hyphenate(key)) : css += hyphenate(key) + ":" + props[key] + ";"; + } + + node.style.cssText += ";" + css; }; + function removeStyle(styles, key) { + return "removeProperty" in styles ? styles.removeProperty(key) : styles.removeAttribute(key); + } + + function _getComputedStyle(node) { + if (!node) throw new Error(); + var doc = node.ownerDocument; + + return "defaultView" in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" + getPropertyValue: function getPropertyValue(prop) { + var _arguments = arguments; + var re = /(\-([a-z]){1})/g; + if (prop == "float") prop = "styleFloat"; + if (re.test(prop)) prop = prop.replace(re, function () { + return _arguments[2].toUpperCase(); + }); + + return node.currentStyle[prop] || null; + } + }; + } + /***/ }, -/* 161 */ +/* 170 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + var canUseDOM = __webpack_require__(104).canUseDOM; + + var contains = (function () { + var root = canUseDOM && document.documentElement; - module.exports = function stateSetter(key) { - return function (val) { - var state = {}; + return root && root.contains ? function (context, node) { + return context.contains(node); + } : root && root.compareDocumentPosition ? function (context, node) { + return context === node || !!(context.compareDocumentPosition(node) & 16); + } : function (context, node) { + if (node) do { + if (node === context) return true; + } while (node = node.parentNode); - state[key] = val; - this.setState(state); - return this; + return false; }; - }; + })(); + + module.exports = contains; /***/ }, -/* 162 */ +/* 171 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var React = __webpack_require__(1); + var canUseDOM = __webpack_require__(104).canUseDOM; + var hyphenate = __webpack_require__(178); + var has = Object.prototype.hasOwnProperty; + var css = __webpack_require__(169); + var _require = __webpack_require__(168); - module.exports = { + var on = _require.on; + var off = _require.off; - contextTypes: { - isRtl: React.PropTypes.bool - }, - isRtl: function () { - return !!this.context.isRtl; - } + var TRANSLATION_MAP = { + left: "translateX", right: "translateX", + top: "translateY", bottom: "translateY" }; - }; + var reset = {}, + transform = "transform", + transition = {}, + transitionTiming, + transitionDuration, + transitionProperty, + transitionDelay; -/***/ }, -/* 163 */ -/***/ function(module, exports, __webpack_require__) { + if (canUseDOM) { + transition = getTransitionProperties(); - "use strict"; - var React = __webpack_require__(1), - dates = __webpack_require__(146), - directions = __webpack_require__(139).directions; + transform = transition.prefix + transform; - module.exports = function (viewUnit, smallUnit) { - return { - propTypes: { - value: React.PropTypes.instanceOf(Date), - min: React.PropTypes.instanceOf(Date), - max: React.PropTypes.instanceOf(Date) }, + reset[transitionProperty = transition.prefix + "transition-property"] = reset[transitionDuration = transition.prefix + "transition-duration"] = reset[transitionDelay = transition.prefix + "transition-delay"] = reset[transitionTiming = transition.prefix + "transition-timing-function"] = ""; + } - getInitialState: function () { - return { - focusedDate: constrainValue(this.props.value, this.props.min, this.props.max) - }; - }, + animate.endEvent = transition.endEvent; - componentWillReceiveProps: function (nextProps) { - var focused = this.state.focusedDate; + module.exports = animate; - //!dates.inRange(focused, nextProps.min, nextProps.max) + /* code in part from: Zepto 1.1.4 | zeptojs.com/license */ + // super lean animate function for transitions + // doesn't support all translations to keep it matching the jquery API + function animate(node, properties, duration, easing, callback) { + var cssProperties = [], + fakeEvent = { target: node, currentTarget: node }, + cssValues = {}, + transforms = "", + fired; - if (!dates.eq(nextProps.value, focused, smallUnit)) this.setState({ - focusedDate: nextProps.value - }); - }, + if (typeof easing === "function") callback = easing, easing = null; - _keyDown: function (e) { - var key = e.key, - current = this.state.focusedDate, - date = current; + if (!transition.endEvent) duration = 0; + if (duration === undefined) duration = 200; - if (key === "Enter") { - e.preventDefault(); - return this.props.onChange(date); - } + for (var key in properties) if (has.call(properties, key)) { + if (/(top|bottom)/.test(key)) transforms += TRANSLATION_MAP[key] + "(" + properties[key] + ") ";else { + cssValues[key] = properties[key]; + cssProperties.push(hyphenate(key)); + } + } - if (key === "ArrowLeft") date = this.move(date, directions.LEFT);else if (key === "ArrowRight") date = this.move(date, directions.RIGHT);else if (key === "ArrowUp") date = this.move(date, directions.UP);else if (key === "ArrowDown") date = this.move(date, directions.DOWN); + if (transforms) { + cssValues[transform] = transforms; + cssProperties.push(transform); + } + if (duration > 0) { + cssValues[transitionProperty] = cssProperties.join(", "); + cssValues[transitionDuration] = duration / 1000 + "s"; + cssValues[transitionDelay] = 0 + "s"; + cssValues[transitionTiming] = easing || "linear"; - if (!dates.eq(current, date, smallUnit)) { - e.preventDefault(); + on(node, transition.endEvent, done); - if (dates.gt(date, this.props.value, viewUnit)) return this.props.onMoveRight(date); + setTimeout(function () { + if (!fired) done(fakeEvent); + }, duration + 500); + } - if (dates.lt(date, this.props.value, viewUnit)) return this.props.onMoveLeft(date); + // trigger page reflow + node.clientLeft; + css(node, cssValues); - this.setState({ - focusedDate: date - }); - } - } - }; - }; + if (duration <= 0) setTimeout(done.bind(null, fakeEvent), 0); + function done(event) { + if (event.target !== event.currentTarget) return; - function constrainValue(value, min, max) { - if (value == null) return value; - return dates.max(dates.min(value, max), min); + fired = true; + off(event.target, transition.endEvent, done); + + css(node, reset); + + callback && callback.call(this); + } } -/***/ }, -/* 164 */ -/***/ function(module, exports, __webpack_require__) { - "use strict"; - module.exports = !!(typeof window !== "undefined" && window.document && window.document.createElement); + function getTransitionProperties() { + var endEvent, + prefix = "", + transitions = { + O: "otransitionend", + Moz: "transitionend", + Webkit: "webkitTransitionEnd" + }; -/***/ }, -/* 165 */ -/***/ function(module, exports, __webpack_require__) { + var element = document.createElement("div"); - // Load modules + for (var vendor in transitions) if (has.call(transitions, vendor)) { + if (element.style[vendor + "TransitionProperty"] !== undefined) { + prefix = "-" + vendor.toLowerCase() + "-"; + endEvent = transitions[vendor]; + break; + } + } - var Stringify = __webpack_require__(172); - var Parse = __webpack_require__(173); + if (!endEvent && element.style.transitionProperty !== undefined) endEvent = "transitionend"; + return { endEvent: endEvent, prefix: prefix }; + } - // Declare internals +/***/ }, +/* 172 */ +/***/ function(module, exports, __webpack_require__) { - var internals = {}; + var __WEBPACK_AMD_DEFINE_RESULT__;/** @license MIT License (c) copyright 2010-2014 original author or authors */ + /** @author Brian Cavalier */ + /** @author John Hann */ + (function(define) { 'use strict'; + !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { - module.exports = { - stringify: Stringify, - parse: Parse - }; + var makePromise = __webpack_require__(179); + var Scheduler = __webpack_require__(180); + var async = __webpack_require__(181); + + return makePromise({ + scheduler: new Scheduler(async) + }); + + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + })(__webpack_require__(182)); /***/ }, -/* 166 */ +/* 173 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {/*! @@ -19923,9 +20028,9 @@ * @license MIT */ - var base64 = __webpack_require__(181) - var ieee754 = __webpack_require__(177) - var isArray = __webpack_require__(178) + var base64 = __webpack_require__(189) + var ieee754 = __webpack_require__(184) + var isArray = __webpack_require__(185) exports.Buffer = Buffer exports.SlowBuffer = Buffer @@ -20969,121 +21074,10 @@ } } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166).Buffer)) - -/***/ }, -/* 167 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/** @license MIT License (c) copyright 2010-2014 original author or authors */ - /** @author Brian Cavalier */ - /** @author John Hann */ - - (function(define) { 'use strict'; - !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { - - var makePromise = __webpack_require__(174); - var Scheduler = __webpack_require__(175); - var async = __webpack_require__(176); - - return makePromise({ - scheduler: new Scheduler(async) - }); - - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - })(__webpack_require__(179)); - - -/***/ }, -/* 168 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = extend - - function extend(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (source.hasOwnProperty(key)) { - target[key] = source[key] - } - } - } - - return target - } - - -/***/ }, -/* 169 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Expose `requestAnimationFrame()`. - */ - - exports = module.exports = window.requestAnimationFrame - || window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame - || window.oRequestAnimationFrame - || window.msRequestAnimationFrame - || fallback; - - /** - * Fallback implementation. - */ - - var prev = new Date().getTime(); - function fallback(fn) { - var curr = new Date().getTime(); - var ms = Math.max(0, 16 - (curr - prev)); - var req = setTimeout(fn, ms); - prev = curr; - return req; - } - - /** - * Cancel. - */ - - var cancel = window.cancelAnimationFrame - || window.webkitCancelAnimationFrame - || window.mozCancelAnimationFrame - || window.oCancelAnimationFrame - || window.msCancelAnimationFrame - || window.clearTimeout; - - exports.cancel = function(id){ - cancel.call(window, id); - }; - - -/***/ }, -/* 170 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = extend - - function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (source.hasOwnProperty(key)) { - target[key] = source[key] - } - } - } - - return target - } - + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(173).Buffer)) /***/ }, -/* 171 */ +/* 174 */ /***/ function(module, exports, __webpack_require__) { /*! @@ -22673,7 +22667,7 @@ /***/ }, -/* 172 */ +/* 175 */ /***/ function(module, exports, __webpack_require__) { // Load modules @@ -22737,7 +22731,7 @@ /***/ }, -/* 173 */ +/* 176 */ /***/ function(module, exports, __webpack_require__) { // Load modules @@ -22867,37 +22861,128 @@ module.exports = function (str, options) { - if (str === '' || - str === null || - typeof str === 'undefined') { + if (str === '' || + str === null || + typeof str === 'undefined') { + + return {}; + } + + options = options || {}; + options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; + + var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; + var obj = {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0, il = keys.length; i < il; ++i) { + var key = keys[i]; + var newObj = internals.parseKeys(key, tempObj[key], options); + obj = Utils.merge(obj, newObj); + } + + return Utils.compact(obj); + }; + + +/***/ }, +/* 177 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule camelizeStyleName + * @typechecks + */ + + "use strict"; + + var camelize = __webpack_require__(186); + + var msPattern = /^-ms-/; + + /** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ + function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); + } + + module.exports = camelizeStyleName; + + +/***/ }, +/* 178 */ +/***/ function(module, exports, __webpack_require__) { - return {}; - } + /** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule hyphenateStyleName + * @typechecks + */ - options = options || {}; - options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; + "use strict"; - var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; - var obj = {}; + var hyphenate = __webpack_require__(187); - // Iterate over the keys and setup the new object + var msPattern = /^ms-/; - var keys = Object.keys(tempObj); - for (var i = 0, il = keys.length; i < il; ++i) { - var key = keys[i]; - var newObj = internals.parseKeys(key, tempObj[key], options); - obj = Utils.merge(obj, newObj); - } + /** + * Hyphenates a camelcased CSS property name, for example: + * + * > hyphenateStyleName('backgroundColor') + * < "background-color" + * > hyphenateStyleName('MozTransition') + * < "-moz-transition" + * > hyphenateStyleName('msTransition') + * < "-ms-transition" + * + * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix + * is converted to `-ms-`. + * + * @param {string} string + * @return {string} + */ + function hyphenateStyleName(string) { + return hyphenate(string).replace(msPattern, '-ms-'); + } - return Utils.compact(obj); - }; + module.exports = hyphenateStyleName; /***/ }, -/* 174 */ +/* 179 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/** @license MIT License (c) copyright 2010-2014 original author or authors */ @@ -23695,11 +23780,11 @@ return Promise; }; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - }(__webpack_require__(179))); + }(__webpack_require__(182))); /***/ }, -/* 175 */ +/* 180 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/** @license MIT License (c) copyright 2010-2014 original author or authors */ @@ -23709,7 +23794,7 @@ (function(define) { 'use strict'; !(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { - var Queue = __webpack_require__(182); + var Queue = __webpack_require__(188); // Credit to Twisol (https://github.com/Twisol) for suggesting // this type of extensible queue + trampoline approach for next-tick conflation. @@ -23783,11 +23868,11 @@ return Scheduler; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - }(__webpack_require__(179))); + }(__webpack_require__(182))); /***/ }, -/* 176 */ +/* 181 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;var require;/* WEBPACK VAR INJECTION */(function(process) {/** @license MIT License (c) copyright 2010-2014 original author or authors */ @@ -23837,7 +23922,7 @@ var vertx; try { // vert.x 1.x || 2.x - vertx = __webpack_require__(180); + vertx = __webpack_require__(183); } catch (ignore) {} if (vertx) { @@ -23860,12 +23945,25 @@ return nextTick; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - }(__webpack_require__(179))); + }(__webpack_require__(182))); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(183))) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(190))) /***/ }, -/* 177 */ +/* 182 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = function() { throw new Error("define cannot be used indirect"); }; + + +/***/ }, +/* 183 */ +/***/ function(module, exports, __webpack_require__) { + + /* (ignored) */ + +/***/ }, +/* 184 */ /***/ function(module, exports, __webpack_require__) { exports.read = function(buffer, offset, isLE, mLen, nBytes) { @@ -23955,7 +24053,7 @@ /***/ }, -/* 178 */ +/* 185 */ /***/ function(module, exports, __webpack_require__) { @@ -23994,20 +24092,156 @@ /***/ }, -/* 179 */ +/* 186 */ /***/ function(module, exports, __webpack_require__) { - module.exports = function() { throw new Error("define cannot be used indirect"); }; + /** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule camelize + * @typechecks + */ + + var _hyphenPattern = /-(.)/g; + + /** + * Camelcases a hyphenated string, for example: + * + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ + function camelize(string) { + return string.replace(_hyphenPattern, function(_, character) { + return character.toUpperCase(); + }); + } + + module.exports = camelize; /***/ }, -/* 180 */ +/* 187 */ /***/ function(module, exports, __webpack_require__) { - /* (ignored) */ + /** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule hyphenate + * @typechecks + */ + + var _uppercasePattern = /([A-Z])/g; + + /** + * Hyphenates a camelcased string, for example: + * + * > hyphenate('backgroundColor') + * < "background-color" + * + * For CSS style names, use `hyphenateStyleName` instead which works properly + * with all vendor prefixes, including `ms`. + * + * @param {string} string + * @return {string} + */ + function hyphenate(string) { + return string.replace(_uppercasePattern, '-$1').toLowerCase(); + } + + module.exports = hyphenate; + /***/ }, -/* 181 */ +/* 188 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/** @license MIT License (c) copyright 2010-2014 original author or authors */ + /** @author Brian Cavalier */ + /** @author John Hann */ + + (function(define) { 'use strict'; + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + /** + * Circular queue + * @param {number} capacityPow2 power of 2 to which this queue's capacity + * will be set initially. eg when capacityPow2 == 3, queue capacity + * will be 8. + * @constructor + */ + function Queue(capacityPow2) { + this.head = this.tail = this.length = 0; + this.buffer = new Array(1 << capacityPow2); + } + + Queue.prototype.push = function(x) { + if(this.length === this.buffer.length) { + this._ensureCapacity(this.length * 2); + } + + this.buffer[this.tail] = x; + this.tail = (this.tail + 1) & (this.buffer.length - 1); + ++this.length; + return this.length; + }; + + Queue.prototype.shift = function() { + var x = this.buffer[this.head]; + this.buffer[this.head] = void 0; + this.head = (this.head + 1) & (this.buffer.length - 1); + --this.length; + return x; + }; + + Queue.prototype._ensureCapacity = function(capacity) { + var head = this.head; + var buffer = this.buffer; + var newBuffer = new Array(capacity); + var i = 0; + var len; + + if(head === 0) { + len = this.length; + for(; i current : i < current) && matcher(helper._dataText.call(ctx, item).toLowerCase(), word.toLowerCase()); - }); + word = word.toLowerCase(); + + while (++idx < len) { + foundStart = foundStart || idx > startIndex; + itemText = foundStart && helper._dataText.call(ctx, data[idx]).toLowerCase(); + + if (foundStart && matches(itemText, word)) return data[idx]; + } +} + +function findPrevInstance(ctx, data, word, startIndex) { + var matches = filter.startsWith, + idx = data.length, + foundStart, + itemText; + + word = word.toLowerCase(); + + while (--idx >= 0) { + foundStart = foundStart || idx < startIndex; + itemText = foundStart && helper._dataText.call(ctx, data[idx]).toLowerCase(); + + if (foundStart && matches(itemText, word)) return data[idx]; + } } \ No newline at end of file diff --git a/lib/mixins/TextSearchMixin.js b/lib/mixins/TextSearchMixin.js deleted file mode 100644 index e9fc05970..000000000 --- a/lib/mixins/TextSearchMixin.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -var React = require("react"), - filter = require("../util/filter"), - helper = require("./DataHelpersMixin"), - _ = require("../util/_"); - -module.exports = { - - propTypes: { - data: React.PropTypes.array, - value: React.PropTypes.any, - delay: React.PropTypes.number, - filter: React.PropTypes.string }, - - search: function (character, cb) { - var self = this, - word = ((this._searchTerm || "") + character).toLowerCase(); - - clearTimeout(this._timer); - - this._searchTerm = word; - - this._timer = setTimeout(function () { - self._searchTerm = ""; - cb(word); - }, this.props.delay); - }, - - findNextWordIndex: function (word, current) { - var matcher = filter.startsWith, - self = this; - - return _.findIndex(self._data(), function (item, i) { - return i >= current && matcher(helper._dataText.call(self, item).toLowerCase(), word.toLowerCase()); - }); - } - -}; \ No newline at end of file diff --git a/lib/mixins/TimeoutMixin.js b/lib/mixins/TimeoutMixin.js new file mode 100644 index 000000000..5f84feec0 --- /dev/null +++ b/lib/mixins/TimeoutMixin.js @@ -0,0 +1,33 @@ +"use strict"; +var _require = require("../util/_"); + +var has = _require.has; + + + +module.exports = { + + componentWillUnmount: function componentWillUnmount() { + var timers = this._timers || {}; + + for (var k in timers) if (has(timers, k)) clearTimeout(timers[k]); + }, + + setTimeout: (function (_setTimeout) { + var _setTimeoutWrapper = function setTimeout() { + return _setTimeout.apply(this, arguments); + }; + + _setTimeoutWrapper.toString = function () { + return _setTimeout.toString(); + }; + + return _setTimeoutWrapper; + })(function (key, cb, duration) { + var timers = this._timers || (this._timers = Object.create(null)); + + clearTimeout(timers[key]); + timers[key] = setTimeout(cb, duration); + }) + +}; \ No newline at end of file diff --git a/lib/util/_.js b/lib/util/_.js index 22d1f4747..f8093f734 100644 --- a/lib/util/_.js +++ b/lib/util/_.js @@ -60,15 +60,6 @@ var _ = module.exports = { } else for (var key in arr) if (has(arr, key)) if (cb.call(thisArg, arr[key], key, arr)) return arr[key]; }, - findIndex: function (arr, cb, thisArg) { - var idx = -1, - len = arr.length; - - while (++idx < len) if (cb.call(thisArg, arr[idx], idx, arr)) return idx; - - return -1; - }, - chunk: function (array, chunkSize) { var index = 0, length = array ? array.length : 0, diff --git a/package.json b/package.json index 6b43460cc..84847dfde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-widgets", - "version": "2.2.3", + "version": "2.2.4", "description": "React widgets", "main": "index.js", "author": { diff --git a/src/DropdownList.jsx b/src/DropdownList.jsx index 5ecc90215..fd118ea26 100644 --- a/src/DropdownList.jsx +++ b/src/DropdownList.jsx @@ -73,8 +73,6 @@ var DropdownList = React.createClass({ getInitialState: function(){ var initialIdx = this._dataIndexOf(this.props.data, this.props.value); - this._timers = Object.create(null); - return { selectedItem: this.props.data[initialIdx], focusedItem: this.props.data[initialIdx] || this.props.data[0],