UNPKG

react-text-input

Version:

Textarea and input components with custom scrollbars and aurogrow in both axes

1 lines 23.9 kB
module.exports=function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){r(8),e.exports=r(7)},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-dom")},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.GenericInput=void 0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),f=r(2),h=p["default"].PropTypes,d=h.any,v=h.bool,y=t.GenericInput=function(e){function t(){return a(this,t),l(this,Object.getPrototypeOf(t).apply(this,arguments))}return i(t,e),s(t,[{key:"getSubstringBoundingClientRect",value:function(e,t){var r=(0,f.findDOMNode)(this.refs.content),o=r.textContent;return r.innerHTML=o.substring(0,e)+"<span>"+o.substring(e,t)+"</span>"+o.substring(t),r.firstElementChild.getBoundingClientRect()}},{key:"componentDidMount",value:function(){var e=this;(0,f.findDOMNode)(this.refs.placeholder).addEventListener("mousedown",function(t){return(0,f.findDOMNode)(e).focus()})}},{key:"render",value:function(){var e=this.props,t=e.value,r=e.disabled,o=e.placeholder,a=e.className,l=e.children,i=n(e,["value","disabled","placeholder","className","children"]),s=String(t),u=-1;null==t&&(s="",u=null);var f=["text-input"];return a&&(f=f.concat(a)),r&&f.push("text-input--disabled"),s&&f.push("text-input--filled"),p["default"].createElement("div",c({},i,{className:f.join(" "),tabIndex:u}),p["default"].createElement("div",{ref:"placeholder",className:"text-input__placeholder"},o),l,p["default"].createElement("div",{ref:"content",className:"text-input__content"},s))}}]),t}(p["default"].Component);y.propTypes={value:d,disabled:v,placeholder:d,className:d},y.defaultProps={disabled:!1}},function(e,t,r){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){r(5),e.exports=r(4)},function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=("undefined"==typeof t?"undefined":o(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":o(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScrollBox=t.FastTrack=void 0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(2),p=n(u),f=r(6),h=p["default"].PropTypes,d=h.number,v=h.bool,y=h.func,b=h.oneOf,g=h.any,x="x",_="y",m=t.FastTrack={PAGING:"paging",GOTO:"goto",OFF:null},S=t.GenericScrollBox=function(e){function t(){var e,r,o,n;a(this,t);for(var i=arguments.length,s=Array(i),u=0;i>u;u++)s[u]=arguments[u];return r=o=l(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),o.handleX=null,o.handleY=null,o.trackX=null,o.trackY=null,o.viewport=null,o.targetX=0,o.targetY=0,o.previousX=0,o.previousY=0,o.scrollX=0,o.scrollY=0,o.scrollMaxX=0,o.scrollMaxY=0,o.trackMaxX=0,o.trackMaxY=0,o.scrollBarXExposed=!1,o.scrollBarYExposed=!1,o._forceSyncId=0,o._easingBeginTimestamp=0,o._easingDuration=0,o._easing=null,o._silent=!1,o._touchStart=null,o._touchPrev=null,o._touchEnd=null,o.onTouchStart=function(e){var t=o.props,r=t.disabled,n=t.captureTouch,a=t.propagateTouchScroll,l=o,i=l.scrollBarXExposed,s=l.scrollBarYExposed;if(!(r||e.isDefaultPrevented()||!n||e.touches.length>1||!i&&!s)){a||e.stopPropagation();var u=e.touches[0],p=o.viewport,f=p.scrollLeft,h=p.scrollTop;o._touchInitialScrollLeft=f,o._touchInitialScrollTop=h,o._touchStart={x:u.pageX,y:u.pageY},o._touchPrev=c({},o._touchStart)}},o.onTouchMove=function(e){var t=o.props,r=t.propagateTouchScroll,n=t.nativeScroll,a=o,l=a.targetX,i=a.targetY,c=a.scrollMaxX,s=a.scrollMaxY,u=a._touchStart,p=a._touchEnd;if(u){var f=e.touches[0];p?(o._touchPrev.x=p.x,o._touchPrev.y=p.y):o._touchEnd={},o._touchEnd.x=f.pageX,o._touchEnd.y=f.pageY;var h=o._touchPrev.x-o._touchEnd.x,d=o._touchPrev.y-o._touchEnd.y;0>h&&!l||h>0&&l==c||0>d&&!i||d>0&&i==s||e.preventDefault(),r||e.stopPropagation(),n||o.scrollTo(u.x-o._touchEnd.x+o._touchInitialScrollLeft,u.y-o._touchEnd.y+o._touchInitialScrollTop,0)}},o.onTouchEnd=function(e){o._touchStart=null,o._touchPrev=null,o._touchEnd=null},o.onWheel=function(e){var t=o.props,r=t.wheelStepX,n=t.wheelStepY,a=t.disabled,l=t.nativeScroll,i=t.captureWheel,c=t.propagateWheelScroll,s=t.swapWheelAxes,u=t.wheelScrollDuration,p=o,f=p.targetX,h=p.targetY,d=p.scrollMaxX,v=p.scrollMaxY,y=p.scrollBarXExposed,b=p.scrollBarYExposed,g=e.target;if(l&&!i&&e.preventDefault(),!(a||e.isDefaultPrevented()||!i||g!=o.viewport&&"textarea"==g.tagName.toLowerCase())){var x=e.deltaX*y,_=e.deltaY*b;if(e.shiftKey&&!x&&(x=_,_=0),s){var m=[_,x];x=m[0],_=m[1]}if(e.deltaX&&!y||0>x&&!f||x>0&&f==d||e.deltaY&&!b||0>_&&!h||_>0&&h==v)return void(c||e.preventDefault());if(e.preventDefault(),"undefined"!=typeof InstallTrigger){var S=30;x*=S,_*=S}x*=r/100,_*=n/100,Date.now()-o._easingBeginTimestamp>u?o.scrollTo(o.scrollX+x,o.scrollY+_,u):o.scrollTo(o.targetX+x,o.targetY+_,u)}},o.onKeyDown=function(e){var t=o.props,r=t.keyboardStepX,n=t.keyboardStepY,a=t.disabled,l=t.captureKeyboard,i=t.keyboardScrollDuration,c=e.target,s=c.tagName.toLowerCase();if(!a&&!e.isDefaultPrevented()&&l&&/3[3456789]|40/.test(String(e.keyCode))&&"textarea"!=s&&("input"!=s||"text"!=c.type))switch(e.preventDefault(),e.keyCode){case 36:o.scrollTo(0,0,i);break;case 35:o.scrollTo(o.scrollMaxX,o.scrollMaxY,i);break;case 33:case 34:var u=o.viewport.clientHeight,p=o.viewport.clientWidth;33==e.keyCode&&(u*=-1,p*=-1),e.shiftKey?o.scrollBy(p,0,i):o.scrollBy(0,u,i);break;case 38:o.scrollBy(0,-n,i);break;case 40:o.scrollBy(0,n,i);break;case 37:o.scrollBy(-r,0,i);break;case 39:o.scrollBy(r,0,i)}},o.onDragStartX=function(e){return o.onDragStart(e,x)},o.onDragStartY=function(e){return o.onDragStart(e,_)},o.onFastTrackX=function(e){return o.onFastTrack(e,x)},o.onFastTrackY=function(e){return o.onFastTrack(e,_)},o.onCursorApproachingTrack=function(e){var t=o.props,r=t.nativeScroll,n=t.disabled,a=t.captureHandleDrag,l=t.fastTrack;window.orientation||r||n||!a&&l==m.OFF||e.buttons>0||(o.scrollBarXExposed&&o._updateTrackHoverStatus(e,o.trackX),o.scrollBarYExposed&&o._updateTrackHoverStatus(e,o.trackY))},n=r,l(o,n)}return i(t,e),s(t,[{key:"scrollBy",value:function(e,t,r,o,n){this.scrollTo(this.targetX+e,this.targetY+t,r,o,n)}},{key:"scrollTo",value:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?0:arguments[2],o=arguments.length<=3||void 0===arguments[3]?this.props.defaultEasing:arguments[3],n=!(arguments.length<=4||void 0===arguments[4])&&arguments[4];this._easingDuration=r,this._easingBeginTimestamp=Date.now(),this.previousX=this.scrollX,this.previousY=this.scrollY,isNaN(e)||(this.targetX=e),isNaN(t)||(this.targetY=t),this._easing=o,this._silent=Boolean(n),this._forceSync()}},{key:"_forceSync",value:function(){var e=this.handleX,t=this.handleY,r=this.viewport,o=this.scrollY,n=this.scrollX,a=this.previousX,l=this.previousY,i=this._silent,c=this._easingBeginTimestamp,s=this._easing,u=this._easingDuration,p=this.props,f=p.scrollableX,h=p.scrollableY,d=p.nativeScroll,v=p.outset,y=p.onViewportScroll,b=p.scrollMinX,g=p.scrollMinY,x=r.clientWidth,_=r.clientHeight,m=r.offsetWidth,S=r.offsetHeight,w=r.scrollWidth,k=r.scrollHeight,O=r.scrollTop,T=r.scrollLeft,X=Math.max(0,w-x),Y=Math.max(0,k-_);this.scrollBarXExposed=f&&X>=b,this.scrollBarYExposed=h&&Y>=g,this.el.classList.toggle("scroll-box--requires-x",this.scrollBarXExposed),this.el.classList.toggle("scroll-box--requires-y",this.scrollBarYExposed);var M="100%",E="100%";if(d&&v){var P=m-x,D=S-_;P&&(M="calc(100% + "+P+"px)"),D&&(E="calc(100% + "+D+"px)")}r.style.width=M,r.style.height=E;var j=Math.max(0,Math.min(Math.round(this.targetX),X))*this.scrollBarXExposed,B=Math.max(0,Math.min(Math.round(this.targetY),Y))*this.scrollBarYExposed,N=j,C=B;if(o==O&&n==T){var L=Date.now()-c;if(u>L&&"function"==typeof s){var I=s(L/u,L,0,1,u);N=Math.round(a+I*(j-a)),C=Math.round(l+I*(B-l))}else this._easingDuration=0;r.scrollLeft=N,r.scrollTop=C}else this._easingDuration=0,N=j=T,C=B=O;this.targetX=j,this.targetY=B,n==N&&o==C&&this.scrollMaxX==X&&this.scrollMaxY==Y&&(this._easingDuration||(this._easing=null,this._silent=!1)),this.scrollX=N,this.scrollY=C,this.scrollMaxX=X,this.scrollMaxY=Y,this.trackMaxX=0,this.trackMaxY=0,d||(this.trackMaxX=this.trackX.clientWidth-e.offsetWidth,this.trackMaxY=this.trackY.clientHeight-t.offsetHeight,e.style.width=x/w*100+"%",e.style.left=this.trackMaxX*N/X+"px",t.style.height=_/k*100+"%",t.style.top=this.trackMaxY*C/Y+"px"),i||n==N&&o==C||y(this)}},{key:"onDragStart",value:function(e,t){var r=this,o=this.props,n=o.disabled,a=o.captureHandleDrag;if(!n&&a&&0==e.button){e.preventDefault(),e.stopPropagation();var l=void 0;l=t==x?this.trackX:this.trackY;var i=e.clientX-this.handleX.offsetLeft,c=e.clientY-this.handleY.offsetTop,s=function(e){if(r._forceSyncId&&0==e.button||u(),t==x)var o=r.scrollMaxX*(e.clientX-i)/r.trackMaxX;else var n=r.scrollMaxY*(e.clientY-c)/r.trackMaxY;r.scrollTo(o,n,0)},u=function p(e){removeEventListener("mousemove",s),removeEventListener("mouseup",p),r._forceSyncId&&l.classList.remove("scroll-box__track--dragged")};addEventListener("mousemove",s),addEventListener("mouseup",u),l.classList.add("scroll-box__track--dragged")}}},{key:"onFastTrack",value:function(e,t){var r=this.props,o=r.disabled,n=r.fastTrack,a=r.fastTrackDuration;if(!o&&0==e.button){var l=void 0,i=void 0,c=this.viewport,s=c.clientWidth,u=c.clientHeight,p=c.scrollWidth,f=c.scrollHeight,h=e.clientX-this.trackX.getBoundingClientRect().left,d=e.clientY-this.trackY.getBoundingClientRect().top;switch(n){case m.PAGING:t==x?l=this.targetX+(1-2*(h<this.handleX.offsetLeft))*s:i=this.targetY+(1-2*(d<this.handleY.offsetTop))*u;break;case m.GOTO:t==x?l=h/this.trackX.clientWidth*p-s/2:i=d/this.trackY.clientHeight*f-u/2;break;default:return}this.scrollTo(l,i,a)}}},{key:"_updateTrackHoverStatus",value:function(e,t){var r=e.clientX,o=e.clientY,n=this.props.hoverProximity,a=t.getBoundingClientRect(),l=a.width,i=a.left,c=a.top,s=a.height;t.classList.toggle("scroll-box__track--hover",n>o-s-c&&n>c-o&&n>r-l-i&&n>i-r)}},{key:"_componentUpdate",value:function(){var e=this.refs;for(var t in e)e.hasOwnProperty(t)&&(this[t]=(0,f.findDOMNode)(e[t]));this.el=(0,f.findDOMNode)(this),this.viewport=this.el.firstChild;var r=this.props.nativeScroll;null==r?window.orientation&&this.el.classList.add("scroll-box--native"):this.el.classList.toggle("scroll-box--native",r)}},{key:"componentDidMount",value:function(){var e=this,t=function r(){window.cancelAnimationFrame?e._forceSyncId=requestAnimationFrame(r):e._forceSyncId=setTimeout(r,1e3/30),e._forceSync()};this._componentUpdate(),t(),addEventListener("mousemove",this.onCursorApproachingTrack)}},{key:"componentDidUpdate",value:function(){this._componentUpdate(),this._forceSync()}},{key:"componentWillUnmount",value:function(){window.cancelAnimationFrame?cancelAnimationFrame(this._forceSyncId):clearTimeout(this._forceSyncId),this._forceSyncId=0,removeEventListener("mousemove",this.onCursorApproachingTrack)}},{key:"render",value:function(){var e=this.props,t=e.scrollableX,r=e.scrollableY,o=e.hideScrollBarX,n=e.hideScrollBarY,a=e.trackXChildren,l=e.trackYChildren,i=e.handleXChildren,c=e.handleYChildren,s=e.disabled,u=e.outset,f=e.className,h=e.children,d=e.style,v=["scroll-box"];return f&&(v=v.concat(f)),s&&v.push("scroll-box--disabled"),u&&v.push("scroll-box--outset"),t&&!o&&v.push("scroll-box--allow-x"),r&&!n&&v.push("scroll-box--allow-y"),p["default"].createElement("div",{style:d,className:v.join(" "),onWheel:this.onWheel,onKeyDown:this.onKeyDown,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd,tabIndex:"-1"},p["default"].Children.only(h),p["default"].createElement("div",{className:"scroll-box__track scroll-box__track--x",onMouseDown:this.onFastTrackX,ref:"trackX"},p["default"].createElement("div",{className:"scroll-box__handle scroll-box__handle--x",onMouseDown:this.onDragStartX,ref:"handleX"},i),a),p["default"].createElement("div",{className:"scroll-box__track scroll-box__track--y",onMouseDown:this.onFastTrackY,ref:"trackY"},p["default"].createElement("div",{className:"scroll-box__handle scroll-box__handle--y",onMouseDown:this.onDragStartY,ref:"handleY"},c),l))}}]),t}(p["default"].Component);S.defaultProps={nativeScroll:!1,className:"scroll-box--wrapped",scrollableX:!0,scrollableY:!0,hideScrollBarX:!1,hideScrollBarY:!1,hoverProximity:50,disabled:!1,outset:!1,scrollMinX:2,scrollMinY:2,defaultEasing:function(e,t,r,o,n){return o*Math.sqrt(1- --e*e)+r},captureHandleDrag:!0,onViewportScroll:function(e){},fastTrack:m.GOTO,fastTrackDuration:500,captureKeyboard:!0,keyboardStepX:30,keyboardStepY:30,keyboardScrollDuration:200,captureWheel:!0,wheelStepX:30,wheelStepY:30,propagateWheelScroll:!1,swapWheelAxes:!1,wheelScrollDuration:100,captureTouch:!0,propagateTouchScroll:!0},S.propTypes={nativeScroll:v,className:g,scrollableX:v,scrollableY:v,hideScrollBarX:v,hideScrollBarY:v,hoverProximity:d,disabled:v,outset:v,scrollMinX:d,scrollMinY:d,defaultEasing:y,captureHandleDrag:v,onViewportScroll:y,fastTrack:b([m.GOTO,m.PAGING,m.OFF]),fastTrackDuration:d,captureKeyboard:v,keyboardStepX:d,keyboardStepY:d,keyboardScrollDuration:d,captureWheel:v,wheelStepX:d,wheelStepY:d,propagateWheelScroll:v,swapWheelAxes:v,wheelScrollDuration:d,captureTouch:v,propagateTouchScroll:v,trackXChildren:g,trackYChildren:g,handleXChildren:g,handleYChildren:g}},function(e,t){e.exports=r(1)},function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=("undefined"==typeof t?"undefined":o(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":o(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollBox=void 0;var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=r(2),u=n(s),p=r(1);t.ScrollBox=function(e){function t(){return a(this,t),l(this,Object.getPrototypeOf(t).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return u["default"].createElement(p.GenericScrollBox,this.props,u["default"].createElement("div",{className:"scroll-box__viewport"},this.props.children))}}]),t}(u["default"].Component)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var o=r(3);Object.defineProperty(t,"ScrollBox",{enumerable:!0,get:function(){return o.ScrollBox}});var n=r(1);Object.defineProperty(t,"GenericScrollBox",{enumerable:!0,get:function(){return n.GenericScrollBox}}),Object.defineProperty(t,"FastTrack",{enumerable:!0,get:function(){return n.FastTrack}})},function(e,t){},function(e,t){e.exports=r(2)}])},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Input=void 0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),f=r(2),h=r(3),d=p["default"].PropTypes,v=d.any,y=d.bool,b=t.Input=function(e){function t(e){a(this,t);var r=l(this,Object.getPrototypeOf(t).call(this,e));return r.onFocus=function(e){return r.setState({focused:!0})},r.onBlur=function(e){return r.setState({focused:!1})},r.onChange=function(e){null==r.props.value&&r.setState({value:e.target.value})},r.state={focused:!1,value:e.defaultValue},r}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this;(0,f.findDOMNode)(this).addEventListener("focus",function(t){return(0,f.findDOMNode)(e.refs.input).focus()})}},{key:"render",value:function(){var e=this.props,t=e.value,r=e.defaultValue,o=e.className,a=e.style,l=e.fitLineLength,i=e.placeholder,s=e.id,u=e.type,f=void 0===u?"text":u,d=n(e,["value","defaultValue","className","style","fitLineLength","placeholder","id","type"]),v=["text-input--"+f];o&&(v=v.concat(o)),this.state.focused&&v.push("text-input--focus"),l&&v.push("text-input--fit-line-length");var y=t;null==t&&(y=this.state.value);var b={};for(var g in d)/^on[A-Z]/.test(g)&&(b[g]=d[g],delete d[g]);return p["default"].createElement(h.GenericInput,c({},b,d,{style:a,className:v,value:y,placeholder:i}),p["default"].createElement("input",c({},d,{ref:"input",id:s,type:f,className:"text-input__area text-input__control",value:null==t?"":t,defaultValue:r,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur})))}}]),t}(p["default"].Component);b.propTypes={value:v,defaultValue:v,disabled:y,placeholder:v,className:v,fitLineLength:y},b.defaultProps={disabled:!1,fitLineLength:!1}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TextArea=void 0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),f=r(2),h=r(4),d=r(3),v=p["default"].PropTypes,y=v.string,b=v.bool,g=v.any,x=t.TextArea=function(e){function t(e){a(this,t);var r=l(this,Object.getPrototypeOf(t).call(this,e));return r.onFocus=function(e){return r.setState({focused:!0})},r.onBlur=function(e){return r.setState({focused:!1})},r.onChange=function(e){null==r.props.value&&r.setState({value:e.target.value})},r.state={focused:!1,value:e.defaultValue},r}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this;(0,f.findDOMNode)(this).addEventListener("focus",function(t){return(0,f.findDOMNode)(e.refs.textarea).focus()})}},{key:"render",value:function(){var e=this.props,t=e.value,r=e.propagateWheelScroll,o=e.defaultValue,a=e.className,l=e.style,i=e.fitLineLength,s=e.placeholder,u=e.onViewportScroll,f=n(e,["value","propagateWheelScroll","defaultValue","className","style","fitLineLength","placeholder","onViewportScroll"]),v=["text-input--text-area"];a&&(v=v.concat(a)),this.state.focused&&v.push("text-input--focus"),i&&v.push("text-input--fit-line-length");var y=t;null==t&&(y=this.state.value);var b={};for(var g in f)/^on[A-Z]/.test(g)&&(b[g]=f[g],delete f[g]);return p["default"].createElement(d.GenericInput,c({},b,f,{style:l,className:v,value:y,placeholder:s}),p["default"].createElement(h.GenericScrollBox,c({},f,{captureKeyboard:!1,propagateWheelScroll:r,outset:!1,onViewportScroll:u,className:"text-input__area scroll-box--wrapped"}),p["default"].createElement("textarea",c({},f,{ref:"textarea",className:"text-input__control scroll-box__viewport",value:t,defaultValue:o,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur}))))}}]),t}(p["default"].Component);x.propTypes={value:y,defaultValue:y,disabled:b,className:y,placeholder:g,fitLineLength:b,propagateWheelScroll:b},x.defaultProps={disabled:!1,fitLineLength:!1,propagateWheelScroll:!0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(5);Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return o.Input}});var n=r(6);Object.defineProperty(t,"TextArea",{enumerable:!0,get:function(){return n.TextArea}});var a=r(3);Object.defineProperty(t,"GenericInput",{enumerable:!0,get:function(){return a.GenericInput}})},function(e,t){}]);