diff options
author | Francesco <firefelix@gmail.com> | 2015-06-19 13:22:27 +0200 |
---|---|---|
committer | Francesco <firefelix@gmail.com> | 2015-06-19 13:28:34 +0200 |
commit | d4867b2d0bc99f50781c8d577b054d034b567623 (patch) | |
tree | 03fb7a0ec9832ec62f8b3a47d423d96db7b9c8bd | |
parent | e627fbb0b9c2eb3ba2e3bacfdb1c9f1c8d49421b (diff) | |
download | react-autosize-textarea-d4867b2d0bc99f50781c8d577b054d034b567623.zip react-autosize-textarea-d4867b2d0bc99f50781c8d577b054d034b567623.tar.gz react-autosize-textarea-d4867b2d0bc99f50781c8d577b054d034b567623.tar.bz2 |
updated to new web-lib-seed release
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .npmignore | 7 | ||||
-rw-r--r-- | index.js | 1 | ||||
-rw-r--r-- | karma.conf.js | 2 | ||||
-rw-r--r-- | lib/.gitkeep | 0 | ||||
-rw-r--r-- | lib/TextareaAutosize.js | 70 | ||||
-rw-r--r-- | lib/index.js | 12 | ||||
-rw-r--r-- | package.json | 8 |
8 files changed, 15 insertions, 86 deletions
@@ -1,3 +1,4 @@ node_modules npm-debug.log coverage +lib diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..8ca7d5c --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +node_modules +coverage +npm-debug.log +.git +test +karma* +.eslintrc
\ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..4cc88b3 --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +module.exports = require('./lib');
\ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index d6ea1eb..b716d94 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -15,7 +15,7 @@ module.exports = function (config) { browsers: [ 'Chrome' ], - singleRun: true, + singleRun: false, frameworks: [ 'mocha' ], diff --git a/lib/.gitkeep b/lib/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/lib/.gitkeep +++ /dev/null diff --git a/lib/TextareaAutosize.js b/lib/TextareaAutosize.js deleted file mode 100644 index 822dcbc..0000000 --- a/lib/TextareaAutosize.js +++ /dev/null @@ -1,70 +0,0 @@ -'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 = require('react'), - autosize = require('autosize'), - UPDATE = 'autosize:update', - DESTROY = 'autosize:destroy', - RESIZED = 'autosize:resized'; - -var TextareaAutosize = React.createClass({ - displayName: 'TextareaAutosize', - - propTypes: { - onResize: React.PropTypes.func - }, - - getDefaultProps: function getDefaultProps() { - return { - rows: 1 - }; - }, - - componentDidMount: function componentDidMount() { - autosize(this.refs.textarea.getDOMNode()); - if (this.props.onResize) { - this.refs.textarea.getDOMNode().addEventListener(RESIZED, this.props.onResize); - } - }, - - componentWillUnmount: function componentWillUnmount() { - if (this.props.onResize) { - this.refs.textarea.getDOMNode().removeEventListener(RESIZED); - } - this.dispatchEvent(DESTROY); - }, - - dispatchEvent: function dispatchEvent(EVENT_TYPE) { - var _this = this; - - var event = document.createEvent('Event'); - event.initEvent(EVENT_TYPE, true, false); - setTimeout(function () { - return _this.refs.textarea.getDOMNode().dispatchEvent(event); - }); - }, - - getValue: function getValue(props) { - if (props) { - return props.valueLink ? props.valueLink.value : props.value; - } - }, - - render: function render() { - return React.createElement( - 'textarea', - _extends({}, this.props, { ref: 'textarea' }), - this.props.children - ); - }, - - componentWillReceiveProps: function componentWillReceiveProps(nextProps) { - if (this.getValue(nextProps) !== this.getValue(this.props)) { - this.dispatchEvent(UPDATE); - } - } - -}); - -module.exports = TextareaAutosize;
\ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 3722863..0000000 --- a/lib/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _TextareaAutosizeJs = require('./TextareaAutosize.js'); - -var _TextareaAutosizeJs2 = _interopRequireDefault(_TextareaAutosizeJs); - -exports['default'] = _TextareaAutosizeJs2['default']; -module.exports = exports['default'];
\ No newline at end of file diff --git a/package.json b/package.json index 75d58ee..4bcccda 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,13 @@ "name": "react-autosize-textarea", "version": "0.2.2", "description": "replacement for built-in textarea which auto resizes itself", - "main": "lib", + "main": "index.js", "scripts": { "test": "./node_modules/karma/bin/karma start", - "build": "babel --loose --stage 0 --out-dir lib src", - "lint": "eslint src" + "build": "rm -rf lib && mkdir lib && babel --loose --stage 0 --out-dir lib src", + "lint": "eslint src", + "preversion": "npm run lint && npm run test", + "prepublish": "npm run build" }, "repository": { "type": "git", |