{"_id":"@bonobolabs/react-autosize-textarea","_rev":"4-8813839d84b738bef4936cf6d710ada3","name":"@bonobolabs/react-autosize-textarea","dist-tags":{"latest":"7.0.0"},"versions":{"7.0.0":{"name":"@bonobolabs/react-autosize-textarea","version":"7.0.0","description":"replacement for built-in textarea which auto resizes itself","main":"lib","typings":"lib","scripts":{"test":"jest","build":"rm -rf lib && mkdir lib && tsc","preversion":"yarn run test","prepublish":"yarn run build","start":"styleguidist server","typecheck":"tsc --noEmit","release-version":"smooth-release --validations --npm-version --changelog --gh-release --npm-publish"},"repository":{"type":"git","url":"https://github.com/buildo/react-autosize-textarea.git"},"keywords":["react","react-component","textarea","autosize","resize","height","growing","size"],"author":{"name":"Francesco Cioria","email":"francesco@buildo.io"},"license":"MIT","bugs":{"url":"https://github.com/buildo/react-autosize-textarea/issues"},"homepage":"https://github.com/buildo/react-autosize-textarea","devDependencies":{"@types/autosize":"3.0.6","@types/jest":"21.1.8","@types/node":"8.0.54","@types/prop-types":"15.5.2","@types/react":"^16.8.3","babel-loader":"^7.1.2","babel-preset-buildo":"^0.1.1","css-loader":"^0.28.5","file-loader":"^1.1.5","jest":"^21.2.1","node-sass":"^4.8.3","progress-bar-webpack-plugin":"^1.10.0","raw-loader":"^0.5.1","react":"^16","react-docgen-typescript":"^1.1.0","react-dom":"^16","react-styleguidist":"^6.0.33","react-test-renderer":"^16.2.0","require-dir":"^0.3.0","sass-loader":"^6.0.6","smooth-release":"^8.0.0","styled-components":"^3.2.5","ts-jest":"^21.2.3","ts-loader":"^2.3.3","typescript":"^2.4.2","url-loader":"^0.5.9","webpack":"3.5.5"},"peerDependencies":{"react":"^0.14.0 || ^15.0.0 || ^16.0.0","react-dom":"^0.14.0 || ^15.0.0 || ^16.0.0"},"dependencies":{"autosize":"^4.0.2","line-height":"^0.3.1","prop-types":"^15.5.6"},"jest":{"transform":{"^.+\\.tsx?$":"<rootDir>/node_modules/ts-jest/preprocessor.js"},"testRegex":"(.*[.](test))[.](tsx?)$","moduleFileExtensions":["js","ts","tsx"]},"licenseText":"The MIT License (MIT)\n\nCopyright (c) 2016 buildo s.r.l.s.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@bonobolabs/react-autosize-textarea@7.0.0","dist":{"shasum":"462a7d3667584f3d686f0f98602747a35fdf0105","integrity":"sha512-voAyBVlt2VRgxDJ1XInmAQeihzM//bsZSHTfJsk7Xf6sD1oHCHfFBiRKMCKeC1cTjzR7yN4f3PY5ERERNXZMjQ==","tarball":"https://registry.npmjs.org/@bonobolabs/react-autosize-textarea/-/react-autosize-textarea-7.0.0.tgz","fileCount":23,"unpackedSize":38724,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZRPVCRA9TVsSAnZWagAAo+MP/1RfepBzR1dNkYtJh/Nv\nZB7v9okcmGZex3StJCjPk5S1dhupxhQhJ1BZi4R8JoXYWghIooFE8BzMfzA4\npaN9e1UnWgsBxUhnONdJCGBnFcB+F/Bv7FFoWNBuvnLOSpAAq7sxKT6UJBTM\nnSfwaGO87y7AM8opig8cHgTPip69bCkNNgg+kboTZphwN5vU/MEeYvkp1klz\nRGPmUAaBd88/UADAtP5aw2nqwniMSanIEZWx73SrApulvM0DyUxw8SHDOe6X\nA5UB3Lh1gLOOr6Bn4PLihduCFiz02cNDrwhF0gyFh7qUsGs3z5yz58BZ9Er2\nM4VDqqf1XmTJxq8lXJWOz+36Tu6aSkFUXi9ErgfpC3dpphh5fJYHoaZ+EIBj\nxZfr4DIwcR94TFfBPnrhFSgYgpXObF05x1Zh5eQfkmGUGjIn6YO0p/Whi7DB\nROk4kFY3tLNRDJD9RnxbtPqaTHH+J7/TjDdzCSsPlcuVqA2fCj6sPHo48kSX\nOImgdI+IgwLZkiBowGCPosw3xfhywceGRcccMCnbWv8hCf7dOnGCi1Y2DzoY\nyQFG7teOZxPBC9SXv58QUh/oovxgc5P7D5iXoOf5UgtOwP5tuj12mAcNnuvo\nyQVxkU/HZrtB+4Oc3M8VM2ezsX98g1pgM2vXVSg/dANA9cWCmF/GowLiP6UX\nrem7\r\n=ctp6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4x+3P73m7YXv51VRWCZbGeFr6gOLEGA0N7ekddlq7nwIgD27MM1xIwDRB5AFviophqiLUMROFzwSJXbeo5v7XhuU="}]},"maintainers":[{"name":"alexlouden","email":"alex@louden.com"}],"_npmUser":{"name":"alexlouden","email":"alex@louden.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-autosize-textarea_7.0.0_1550128084415_0.2759232036950654"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-14T07:08:04.254Z","7.0.0":"2019-02-14T07:08:04.583Z","modified":"2022-04-04T20:06:52.820Z"},"maintainers":[{"email":"benmccormick@bonobolabs.com","name":"benmccormickbonobo"},{"email":"alex@louden.com","name":"alexlouden"}],"description":"replacement for built-in textarea which auto resizes itself","homepage":"https://github.com/buildo/react-autosize-textarea","keywords":["react","react-component","textarea","autosize","resize","height","growing","size"],"repository":{"type":"git","url":"https://github.com/buildo/react-autosize-textarea.git"},"author":{"name":"Francesco Cioria","email":"francesco@buildo.io"},"bugs":{"url":"https://github.com/buildo/react-autosize-textarea/issues"},"license":"MIT","readme":"# React Autosize Textarea\nA light replacement for built-in `<textarea />` component which automatically adjusts its height to match the content.\n\n**NB: It does not require any polyfill**\n\n```jsx\nimport ReactDOM from 'react-dom';\nimport TextareaAutosize from 'react-autosize-textarea';\n\nReactDOM.renderComponent(\n  <TextareaAutosize {...textareaProps} onResize={(e) => {}} />,\n  document.body\n);\n```\n\n## Install\n```\nnpm install --save react-autosize-textarea\n```\n\n## Demo\n[Live Examples](http://react-components.buildo.io/#textareaautosize)\n\n## Usage\n`TextareaAutosize` is perfectly compatible with ReactJS default one, so to get started you can simply replace any `<textarea></textarea>` with `<TextareaAutosize></TextareaAutosize>`. It's that easy :)\n\n### Props\nYou can pass any prop you're allowed to use with the default React `textarea` (`valueLink` too).\n\nIn addition to them, `TextareaAutosize` comes with some optional custom `props` to facilitate its usage:\n\n|Name|Type|Default|Description|\n|----|----|-------|-----------|\n| **onResize** | <code>Function</code> |  | *optional*. Called whenever the textarea resizes |\n| **rows** | <code>Number</code> |  | *optional*. Minimum number of visible rows |\n| **maxRows** | <code>Number</code> |  | *optional*. Maximum number of visible rows |\n| **async** | <code>Boolean</code> | <code>false</code> | *optional*. Initialize `autosize` asynchronously. Enable it if you are using StyledComponents. This is forced to true when `maxRows` is set. Async initialization will make your page \"jump\" when the component appears, as it will first be rendered with the normal size, then resized to content.\n\n\n#### `onResize`\n\nSometimes you may need to react any time `TextareaAutosize` resizes itself. To do so, you should use the optional callback **onResize** which will be triggered at any resize with the `autosize:resized` event object:\n\n```jsx\nfunction onResize(event) {\n  console.log(event.type); // -> \"autosize:resized\"\n}\n\n<TextareaAutosize onResize={onResize} />\n```\n\n#### Set min/max height\nYou can set `minHeight` and `maxHeight` through CSS or inline-style as usual:\n\n```jsx\n<TextareaAutosize style={{ minHeight: 20, maxHeight: 80 }} /> // min-height: 20px; max-height: 80px;\n```\n\n**NB:** you may need to take into account borders and/or padding.\n\n\nIn addition to `minHeight`, you can force `TextareaAutosize` to have a minimum number of rows by passing the prop `rows`:\n\n```jsx\n<TextareaAutosize rows={3} /> // minimun height is three rows\n```\n\nIn addition to `maxHeight`, you can force `TextareaAutosize` to have a maximum number of rows by passing the prop `maxRows`:\n\n```jsx\n<TextareaAutosize maxRows={3} /> // maximum height is three rows\n```\n\n#### Refs to DOM nodes\nIn order to manually call `textarea`'s DOM element functions like `focus()` or `blur()`, you need a ref to the DOM node.\n\nYou get one by using the prop `innerRef` as shown in the example below:\n\n```jsx\nclass Form extends React.Component {\n  componentDidMount() {\n    this.textarea.focus();\n  }\n\n  render() {\n    return (\n      <TextareaAutosize innerRef={ref => this.textarea = ref} />\n    );\n  }\n}\n```\n\n## Browser Compatibility\n| Chrome        | Firefox       | IE    | Safari | Android |\n| ------------- | ------------- | ----- | ------ | ------- |\n| Yes           | Yes           | 9+    | Yes    | 4+      |\n\n\n## Credits\nThis module is based on the very popular autosize script written by [Jack Moore](https://github.com/jackmoore).\n\nCheck out his [repo](https://github.com/jackmoore/autosize) or [website](http://www.jacklmoore.com/autosize/) for more documentation.\n","readmeFilename":"README.md"}