{"version":3,"sources":["../src/hooks/misc/use-autosize-textarea.tsx"],"sourcesContent":["import { Ref, RefObject, useEffect } from \"react\";\n\n// Updates the height of a <textarea> when the value changes.\nconst useAutosizeTextArea = (textAreaRef: RefObject<HTMLTextAreaElement>, value: string) => {\n  useEffect(() => {\n    if (textAreaRef.current !== null) {\n      // We need to reset the height momentarily to get the correct scrollHeight for the textarea\n      textAreaRef.current.style.height = \"0px\";\n      const scrollHeight = textAreaRef.current.scrollHeight;\n\n      // We then set the height directly, outside of the render loop\n      // Trying to set this with state or a ref will product an incorrect value.\n      textAreaRef.current.style.height = scrollHeight + \"px\";\n    }\n  }, [textAreaRef, value]);\n};\n\nexport default useAutosizeTextArea;\n"],"mappings":";AAAA,SAAyB,iBAAiB;AAG1C,IAAM,sBAAsB,CAAC,aAA6C,UAAkB;AAC1F,YAAU,MAAM;AACd,QAAI,YAAY,YAAY,MAAM;AAEhC,kBAAY,QAAQ,MAAM,SAAS;AACnC,YAAM,eAAe,YAAY,QAAQ;AAIzC,kBAAY,QAAQ,MAAM,SAAS,eAAe;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,aAAa,KAAK,CAAC;AACzB;AAEA,IAAO,gCAAQ;","names":[]}