react-toastr
Advanced tools
Comparing version 2.9.5 to 3.0.0
@@ -5,2 +5,49 @@ # Change Log | ||
<a name="3.0.0"></a> | ||
# [3.0.0](https://github.com/tomchentw/react-toastr/compare/v2.9.5...v3.0.0) (2017-10-28) | ||
### Features | ||
* **index.js:** export components ([b702c2a](https://github.com/tomchentw/react-toastr/commit/b702c2a)) | ||
* **package.json:** add `dom-helpers` to dependencies ([66cb57f](https://github.com/tomchentw/react-toastr/commit/66cb57f)) | ||
* **package.json:** drop support for `react@^0.14` ([e5fa767](https://github.com/tomchentw/react-toastr/commit/e5fa767)) | ||
* **package.json:** remove unused dependencies ([fbe75e1](https://github.com/tomchentw/react-toastr/commit/fbe75e1)) | ||
* **ToastContainer:** rewrite ([a3cd015](https://github.com/tomchentw/react-toastr/commit/a3cd015)) | ||
* **ToastMessage:** rewrite ([b8a3b29](https://github.com/tomchentw/react-toastr/commit/b8a3b29)) | ||
* **ToastMessageAnimated:** rewrite ([9469454](https://github.com/tomchentw/react-toastr/commit/9469454)) | ||
* **ToastMessagejQuery:** rewrite ([f239dee](https://github.com/tomchentw/react-toastr/commit/f239dee)) | ||
### BREAKING CHANGES | ||
* **index.js:** named exports changes for ToastMessage | ||
Before: | ||
```js | ||
import { ToastContainer, ToastMessage } from "react-toastr" | ||
const ToastMessageFactory = React.createFactory(ToastMessage.animation); | ||
const jQueryFactory = React.createFactory(ToastMessage.jQuery); | ||
<ToastContainer toastMessageFactory={ToastMessageFactory} /> | ||
<ToastContainer toastMessageFactory={jQueryFactory} /> | ||
``` | ||
After: | ||
```js | ||
import { ToastContainer, ToastMessageAnimated } from "react-toastr" | ||
import ToastMessagejQuery from "react-toastr/lib/components/ToastMessage/ToastMessagejQuery"; | ||
const ToastMessageFactory = React.createFactory(ToastMessageAnimated); | ||
const jQueryFactory = React.createFactory(ToastMessagejQuery); | ||
<ToastContainer toastMessageFactory={ToastMessageFactory} /> | ||
<ToastContainer toastMessageFactory={jQueryFactory} /> | ||
``` | ||
<a name="2.9.5"></a> | ||
@@ -7,0 +54,0 @@ ## [2.9.5](https://github.com/tomchentw/react-toastr/compare/v2.9.4...v2.9.5) (2017-10-06) |
@@ -1,19 +0,32 @@ | ||
"use strict"; | ||
"use strict" | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ToastMessage = exports.ToastContainer = undefined; | ||
value: true, | ||
}) | ||
var _ToastContainer = require("./ToastContainer"); | ||
var _ToastContainer = require("./components/ToastContainer") | ||
var _ToastContainer2 = _interopRequireDefault(_ToastContainer); | ||
Object.defineProperty(exports, "ToastContainer", { | ||
enumerable: true, | ||
get: function get() { | ||
return _ToastContainer.ToastContainer | ||
}, | ||
}) | ||
var _ToastMessage = require("./ToastMessage"); | ||
var _ToastMessage = require("./components/ToastMessage/ToastMessage") | ||
var _ToastMessage2 = _interopRequireDefault(_ToastMessage); | ||
Object.defineProperty(exports, "ToastMessage", { | ||
enumerable: true, | ||
get: function get() { | ||
return _ToastMessage.ToastMessage | ||
}, | ||
}) | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _ToastMessageAnimated = require("./components/ToastMessage/ToastMessageAnimated") | ||
exports.ToastContainer = _ToastContainer2.default; | ||
exports.ToastMessage = _ToastMessage2.default; | ||
Object.defineProperty(exports, "ToastMessageAnimated", { | ||
enumerable: true, | ||
get: function get() { | ||
return _ToastMessageAnimated.ToastMessageAnimated | ||
}, | ||
}) |
135
package.json
{ | ||
"name": "react-toastr", | ||
"version": "2.9.5", | ||
"version": "3.0.0", | ||
"description": "React.js toastr component", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib/", | ||
"src/lib", | ||
"AUTHORS", | ||
"CHANGELOG.md" | ||
], | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"test": "react-scripts test --env=jsdom", | ||
"eject": "react-scripts eject", | ||
"pretest": "npm run lint", | ||
"test:once": "cross-env CI=true npm test", | ||
"build:app": "react-scripts build", | ||
"clean": "rimraf lib", | ||
"lint": "cross-env NODE_ENV=test eslint .", | ||
"prebuild:lib": "npm run lint && npm run clean", | ||
"build:lib": "cross-env NODE_ENV=production babel src/lib --out-dir lib", | ||
"precommit:lib": "npm run build:lib", | ||
"commit:lib": "git add -A && git commit -m 'chore(lib): compile from src/lib using babel'", | ||
"precommit:app": "npm run build:app", | ||
"commit:app": "git add -A && git commit -m 'docs: compile from src/app with react-scripts'", | ||
"prerelease": "npm run commit:lib && npm run commit:app", | ||
"release": "standard-version" | ||
"license": "MIT", | ||
"author": { | ||
"name": "tomchentw", | ||
"email": "developer@tomchentw.com", | ||
"url": "https://github.com/tomchentw" | ||
}, | ||
@@ -34,2 +15,8 @@ "repository": { | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tomchentw/react-toastr/issues" | ||
}, | ||
"homepage": "https://tomchentw.github.io/react-toastr/", | ||
"main": "lib/index.js", | ||
"files": ["lib/", "src/", "CHANGELOG.md"], | ||
"keywords": [ | ||
@@ -46,52 +33,80 @@ "React.js", | ||
], | ||
"author": { | ||
"name": "tomchentw", | ||
"email": "developer@tomchentw.com", | ||
"url": "https://github.com/tomchentw" | ||
"scripts": { | ||
"precommit": "lint-staged", | ||
"styleguide": "styleguidist server", | ||
"styleguide:build": "styleguidist build", | ||
"test": "react-scripts test", | ||
"test:once": "cross-env CI=true npm test", | ||
"prebuild:lib": "rimraf lib", | ||
"build:lib": "cross-env NODE_ENV=production babel src --out-dir lib", | ||
"precommit:lib": "npm run build:lib", | ||
"commit:lib": | ||
"git add -A && git commit -m 'chore(lib): compile from src with `babel`'", | ||
"precommit:docs": "npm run styleguide:build", | ||
"commit:docs": | ||
"git add -A && git commit -m 'docs: compile from src with `styleguidist`'", | ||
"prerelease": "npm run commit:lib && npm run commit:docs", | ||
"release": "standard-version" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/tomchentw/react-toastr/issues" | ||
"lint-staged": { | ||
"*.{js,jsx,json,css}": ["prettier --write", "git add"] | ||
}, | ||
"homepage": "https://tomchentw.github.io/react-toastr/", | ||
"babel": { | ||
"plugins": [ | ||
"lodash", | ||
"transform-class-properties", | ||
"transform-object-rest-spread", | ||
"transform-runtime" | ||
], | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"ie": 9 | ||
} | ||
} | ||
], | ||
"react" | ||
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": false, | ||
"trailingComma": "es5" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
"classnames": "^2.2.5", | ||
"dom-helpers": "^3.2.1", | ||
"lodash": "^4.17.4" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.0.0 || ^16.0.0", | ||
"react-dom": "^15.0.0 || ^16.0.0" | ||
}, | ||
"devDependencies": { | ||
"animate.css": "^3.5.2", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^7.2.3", | ||
"babel-plugin-lodash": "^3.2.11", | ||
"babel-plugin-transform-flow-comments": "^6.22.0", | ||
"babel-plugin-typecheck": "^3.9.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"codeclimate-test-reporter": "^0.5.0", | ||
"cross-env": "^5.0.5", | ||
"eslint": "^4.5.0", | ||
"eslint-config-react-app": "^2.0.0", | ||
"eslint-plugin-flowtype": "^2.35.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.2", | ||
"eslint-plugin-react": "^7.2.1", | ||
"husky": "^0.14.3", | ||
"jquery": "^3.2.1", | ||
"lint-staged": "^4.1.3", | ||
"prettier": "^1.6.1", | ||
"prismjs": "^1.6.0", | ||
"raw-loader": "^0.5.1", | ||
"react": "^15.0.0", | ||
"react-dom": "^15.0.0", | ||
"react-github-fork-ribbon": "^0.5.0", | ||
"react-scripts": "^1.0.11", | ||
"react-styleguidist": "^6.0.24", | ||
"react-test-renderer": "^15.0.0", | ||
"rimraf": "^2.6.1", | ||
"standard-version": "^4.2.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^0.14.0 || ^15.0.0 || ^16.0.0", | ||
"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0" | ||
}, | ||
"dependencies": { | ||
"classnames": "^2.2.5", | ||
"create-react-class": "^15.6.0", | ||
"element-class": "^0.2.2", | ||
"immutability-helper": "^2.3.1", | ||
"lodash": "^4.17.4", | ||
"prop-types": "^15.5.10" | ||
"standard-version": "^4.2.0", | ||
"toastr": "^2.1.2" | ||
} | ||
} |
172
README.md
@@ -7,169 +7,16 @@ # react-toastr | ||
## Installation | ||
## [Introduction](https://tomchentw.github.io/react-toastr/#introduction) | ||
```sh | ||
npm i --save react-toastr | ||
``` | ||
## [Installation](https://tomchentw.github.io/react-toastr/#installation) | ||
## Demo | ||
Static hosted [demo site][demo] on GitHub. Check out the source in [src/app][src/app]. | ||
## [Usage & Configuration](https://tomchentw.github.io/react-toastr/#usage--configuration) | ||
## Usage | ||
## [Changelog][changelog-url] | ||
This module requires bundling via [webpack][webpack]/browserify and loads `react/addons` internally. | ||
You'll need to download animate.css from here: [Animate @github](https://raw.github.com/daneden/animate.css/master/animate.css) | ||
The changelog is automatically generated via [standard-version][standard-version] and can be found in project root as well as npm tarball. | ||
#### Styling links (CSS): | ||
```html | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.css"> | ||
``` | ||
#### Example (within a React component or wrapper): | ||
```javascript | ||
var ReactToastr = require("react-toastr"); | ||
var {ToastContainer} = ReactToastr; // This is a React Element. | ||
// For Non ES6... | ||
// var ToastContainer = ReactToastr.ToastContainer; | ||
var ToastMessageFactory = React.createFactory(ReactToastr.ToastMessage.animation); | ||
... | ||
addAlert () { | ||
this.container.success( | ||
"my-title", | ||
"my-fascinating-toast-message", { | ||
timeOut: 5000, | ||
extendedTimeOut: 3000 | ||
}); | ||
} | ||
render () { | ||
return ( | ||
<div> | ||
<ToastContainer ref={(input) => {this.container = input;}} | ||
toastMessageFactory={ToastMessageFactory} | ||
className="toast-top-right" | ||
preventDuplicates="true" /> | ||
<button onClick={this.addAlert}>Add Toast</button> | ||
</div> | ||
); | ||
} | ||
``` | ||
Integrated with your [flux][flux] architecture: | ||
```javascript | ||
componentDidMount: function() { | ||
InInDerStore.addChangeListener(this.addAlert); | ||
} | ||
``` | ||
### ToastContainer | ||
This is the container where all `ToastMessage` elements will go. Use it by retaining a [ref][react-ref] to publish a new **ToastMessage**: | ||
```javascript | ||
addAlert () { | ||
this.container.success( | ||
"my-title", | ||
"my-fascinating-toast-message", { | ||
timeOut: 5000, | ||
extendedTimeOut: 3000 | ||
}); | ||
} | ||
``` | ||
#### Options | ||
Directly migrated from `toastr.js` library. Set these as props on **ToastContainer** to override the defaults. | ||
* [`ToastContainer::getDefaultProps`](http://git.io/RagItA) | ||
##### Prevent Duplicates | ||
Prevent identical toast messages from displaying. | ||
```javascript | ||
preventDuplicates: true | ||
``` | ||
##### Newest on Top | ||
Display new toast messages at the top or bottom of the queue. | ||
```javascript | ||
newestOnTop: true | ||
``` | ||
#### Displaying HTML | ||
To display HTML, simply pass JSX instead of strings for title and message arguments: | ||
```javascript | ||
this.container.success( | ||
<strong>I am a strong title</strong>, | ||
<em>I am an emphasized message</em> | ||
}); | ||
``` | ||
### ToastMessage | ||
Base class for holding a toast message. | ||
#### Options | ||
Directly migrated from `toastr.js` library. Set these as props on **ToastMessage** to override the defaults. | ||
* [`ToastMessage::getDefaultProps`](http://git.io/90CzSA) | ||
##### Close Button | ||
Show or hide an optional close button. | ||
```javascript | ||
closeButton: false | ||
``` | ||
##### Tap to Dismiss | ||
Enable dismissing toasts on click. | ||
```javascript | ||
tapToDismiss: true | ||
``` | ||
### Animation | ||
For animation, choose between **`ToastMessage.animation`** or **`ToastMessage.jQuery`**. | ||
```javascript | ||
var ToastMessageFactory = React.createFactory(ReactToastr.ToastMessage.animation); | ||
//or... | ||
var ToastMessageFactory = React.createFactory(ReactToastr.ToastMessage.jQuery); | ||
``` | ||
#### Options | ||
* [`ToastMessage.animation::getDefaultProps`](http://git.io/vU2sz) | ||
(Credits go to **@Janekk**) | ||
* [`ToastMessage.jQuery::getDefaultProps`](http://git.io/YcbXvA) | ||
##### Time Out | ||
Set the time (in ms) after which the toast message should automatically close. | ||
```javascript | ||
timeOut: 5000 | ||
``` | ||
##### Extended Time Out | ||
Set the time (in ms) after which the toast message should automatically close after being hovered on. Applied on hover exit. | ||
```javascript | ||
extendedTimeOut: 3000 | ||
``` | ||
[npm-image]: https://img.shields.io/npm/v/react-toastr.svg?style=flat-square | ||
@@ -189,6 +36,5 @@ [npm-url]: https://www.npmjs.org/package/react-toastr | ||
[demo]: https://tomchentw.github.io/react-toastr/ | ||
[src/app]: https://github.com/tomchentw/react-toastr/tree/master/src/app | ||
[webpack]: https://webpack.github.io/docs/tutorials/getting-started/ | ||
[react-ref]: https://facebook.github.io/react/docs/more-about-refs.html | ||
[flux]: https://facebook.github.io/flux/docs/overview.html | ||
[changelog-url]: https://github.com/tomchentw/react-toastr/blob/master/CHANGELOG.md | ||
[standard-version]: https://github.com/conventional-changelog/standard-version | ||
[conventional-commits-specification]: https://conventionalcommits.org/ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1545764
6
22
26
1573
39
1
+ Addedbabel-runtime@^6.26.0
+ Addeddom-helpers@^3.2.1
+ Added@babel/runtime@7.24.5(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addeddom-helpers@3.4.0(transitive)
+ Addedregenerator-runtime@0.11.10.14.1(transitive)
- Removedcreate-react-class@^15.6.0
- Removedelement-class@^0.2.2
- Removedimmutability-helper@^2.3.1
- Removedprop-types@^15.5.10
- Removedcreate-react-class@15.7.0(transitive)
- Removedelement-class@0.2.2(transitive)
- Removedimmutability-helper@2.9.1(transitive)
- Removedinvariant@2.2.4(transitive)