UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 2.45 kB
this.primereact=this.primereact||{},this.primereact.inputtextarea=function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=o(t);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(this,arguments)}var a=l.memo(l.forwardRef((function(e,t){var o=l.useRef(t),s=l.useRef(0),u=function(e){var t=o.current;t&&n.DomHandler.isVisible(t)&&(s.current||(s.current=t.scrollHeight,t.style.overflow="hidden"),(s.current!==t.scrollHeight||e)&&(t.style.height="",t.style.height=t.scrollHeight+"px",parseFloat(t.style.height)>=parseFloat(t.style.maxHeight)?(t.style.overflowY="scroll",t.style.height=t.style.maxHeight):t.style.overflow="hidden",s.current=t.scrollHeight))},c=o.current&&o.current.value,p=l.useMemo((function(){return n.ObjectUtils.isNotEmpty(e.value)||n.ObjectUtils.isNotEmpty(e.defaultValue)||n.ObjectUtils.isNotEmpty(c)}),[e.value,e.defaultValue,c]);l.useEffect((function(){n.ObjectUtils.combinedRefs(o,t)}),[o,t]),l.useEffect((function(){e.autoResize&&u(!0)}),[e.autoResize]);var f=n.ObjectUtils.isNotEmpty(e.tooltip),d=n.ObjectUtils.findDiffKeys(e,a.defaultProps),m=n.classNames("p-inputtextarea p-inputtext p-component",{"p-disabled":e.disabled,"p-filled":p,"p-inputtextarea-resizable":e.autoResize},e.className);return l.createElement(l.Fragment,null,l.createElement("textarea",i({ref:o},d,{className:m,onFocus:function(t){e.autoResize&&u(),e.onFocus&&e.onFocus(t)},onBlur:function(t){e.autoResize&&u(),e.onBlur&&e.onBlur(t)},onKeyUp:function(t){e.autoResize&&u(),e.onKeyUp&&e.onKeyUp(t)},onInput:function(t){e.autoResize&&u(),e.onInput&&e.onInput(t);var r=t.target;n.ObjectUtils.isNotEmpty(r.value)?n.DomHandler.addClass(r,"p-filled"):n.DomHandler.removeClass(r,"p-filled")}})),f&&l.createElement(r.Tooltip,i({target:o,content:e.tooltip},e.tooltipOptions)))})));return a.displayName="InputTextarea",a.defaultProps={__TYPE:"InputTextarea",autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null},e.InputTextarea=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.tooltip,primereact.utils);