[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nindent_style = space\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\nindent_size = 2\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".eslintignore",
    "content": "node_modules\ndist\nlib\n"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"parser\": \"babel-eslint\",\n  \"extends\": \"airbnb\",\n  \"env\": {\n    \"browser\": true,\n    \"node\": true,\n    \"jest\": true,\n    \"jasmine\": true\n  },\n  \"rules\": {\n    \"arrow-parens\": [\"error\", \"as-needed\"],\n    \"class-methods-use-this\": \"off\",\n    \"comma-dangle\": \"off\",\n    \"consistent-return\": \"off\",\n    \"no-underscore-dangle\": \"off\",\n    \"import/no-extraneous-dependencies\": [\"error\", {\n      \"devDependencies\": [\n        \"**/__tests__/**.js\",\n        \"**/webpack.config.js\",\n        \"webpack.config.*.js\"\n      ],\n      \"optionalDependencies\": false\n    }],\n    \"react/jsx-filename-extension\": \"off\",\n    \"react/require-default-props\": \"off\"\n  }\n}\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\nnpm-debug.log\nnode_modules\ncoverage\nlib\ndist\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: node_js\nnode_js:\n  - '7'\n  - '6'\n  - '4'\nscript: \"npm run test:cov\"\nafter_script: \"npm install coveralls@2 && cat ./coverage/lcov.info | coveralls\"\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "0.4.11 / 2017-12-12\n===================\n- [new] Support React v16\n\n0.4.10 / 2017-04-24\n==================\n- [deps] Removes prototype reference which raises warnings in react 15.5 [#71](https://github.com/chentsulin/sweetalert-react/pull/71).\n\n0.4.9 / 2017-02-13\n==================\n- [fix] clicked comfirm button with empty string should trigger onConfirm instead of onCancel. [#56](https://github.com/chentsulin/sweetalert-react/pull/56).\n\n0.4.8 / 2017-02-05\n==================\n- [fix] `umd` build\n\n0.4.7 / 2017-01-19\n==================\n- [fix] allow `animation` prop with `pop`, `slide-from-top`, `slide-from-bottom` value. [#50](https://github.com/chentsulin/sweetalert-react/pull/50).\n\n0.4.6 / 2016-12-05\n==================\n- [fix] Don't break server rendering [#44](https://github.com/chentsulin/sweetalert-react/pull/44).\n\n0.4.5 / 2016-11-09\n==================\n- [deps] update dependencies\n- [fix] Added `inputValue` to `ALLOWS_KEYS` [#33](https://github.com/chentsulin/sweetalert-react/pull/33).\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015-present C.T. Lin <chentsulin@gmail.com> (github.com/chentsulin/sweetalert-react)\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\nall copies 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\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# sweetalert-react\n\n[![NPM version][npm-image]][npm-url]\n[![Dependency Status][david_img]][david_site]\n\n> Declarative SweetAlert in React\n\n## Introduction\n\n`sweetalert-react` is a wrapped `sweetalert` implementation with declarative React style component APIs. There is a `show` prop available for toggling alert component's visibility. And `onConfirm`, `onCancel`, `onClose`, `onEscapeKey`, `onOutsideClick` props allow you have a fine grained control over alert component events.\n\n## Install\n\n```\n$ npm install sweetalert-react\n```\n\n## Usage\n\n```js\nimport React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react';\n\n// ...\n\nrender() {\n  return (\n    <div>\n      <button onClick={() => this.setState({ show: true })}>Alert</button>\n      <SweetAlert\n        show={this.state.show}\n        title=\"Demo\"\n        text=\"SweetAlert in React\"\n        onConfirm={() => this.setState({ show: false })}\n      />\n    </div>\n  );\n}\n```\n\nYou should import `sweetalert.css` from CDN, file, node_modules(sweetalert/dist/sweetalert.css) or wherever method to include this CSS file.\n\nCheckout the full examples [here](./examples).\n\n## Removed Options\n\n- **timer**: You should use `setTimeout` and pass `show` as false.\n- **closeOnConfirm**: You should pass `show` as false via `onConfirm`.\n- **closeOnCancel**: You should pass `show` as false via `onCancel`.\n- **allowEscapeKey**: You should pass `show` as false via `onEscapeKey`.\n- **allowOutsideClick**: You should pass `show` as false via `onOutsideClick`.\n\nAll other options can be passed as props, see them in [Configuare Section in sweetalert document](http://t4t5.github.io/sweetalert/)\n\n## FAQ\n\n### Q: My alert didn't close when 'go back' or 'go forward' in browser\n\nYou can listen to history changes and set `show: false` when it is mounted. See the full example [here](https://github.com/chentsulin/sweetalert-react/blob/master/examples/history-change/components/App.js).\n\n### Q: Can I use react component to render HTML as the alert body?\n\nSure, you can achieve this with `ReactDOMServer.renderToStaticMarkup`:\n\n```js\nimport { renderToStaticMarkup } from 'react-dom/server';\n\n<SweetAlert\n  show={this.state.show}\n  title=\"Demo\"\n  html\n  text={renderToStaticMarkup(<HelloWorld />)}\n  onConfirm={() => this.setState({ show: false })}\n/>\n```\n\nSee the full example [here](https://github.com/chentsulin/sweetalert-react/blob/master/examples/component-as-body/components/App.js). Thanks @ArkadyB for discovering the approach in [issue #53](https://github.com/chentsulin/sweetalert-react/issues/53).\n\n## Relevant Projects\n\n- [react-redux-sweetalert](https://github.com/chentsulin/react-redux-sweetalert)\n\n## License\n\nMIT © [C.T. Lin](https://github.com/chentsulin/sweetalert-react)\n\n[npm-image]: https://badge.fury.io/js/sweetalert-react.svg\n[npm-url]: https://npmjs.org/package/sweetalert-react\n[travis-image]: https://travis-ci.org/chentsulin/sweetalert-react.svg\n[travis-url]: https://travis-ci.org/chentsulin/sweetalert-react\n[coveralls-image]: https://coveralls.io/repos/chentsulin/sweetalert-react/badge.svg?branch=master&service=github\n[coveralls-url]: https://coveralls.io/r/chentsulin/sweetalert-react?branch=master\n[david_img]: https://david-dm.org/chentsulin/sweetalert-react.svg\n[david_site]: https://david-dm.org/chentsulin/sweetalert-react\n"
  },
  {
    "path": "__mocks__/sweetalert.js",
    "content": "const sweetalert = jest.genMockFromModule('sweetalert');\n\nmodule.exports = sweetalert;\n"
  },
  {
    "path": "examples/cancel/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/cancel/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo with Cancel\"\n          text=\"SweetAlert in React\"\n          showCancelButton\n          onConfirm={() => {\n            console.log('confirm'); // eslint-disable-line no-console\n            this.setState({ show: false });\n          }}\n          onCancel={() => {\n            console.log('cancel'); // eslint-disable-line no-console\n            this.setState({ show: false });\n          }}\n          onClose={() => console.log('close')} // eslint-disable-line no-console\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/cancel/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/cancel/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/cancel/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/cancel/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/cancel/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/complex/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/complex/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo Complex\"\n          type=\"success\"\n          text=\"SweetAlert in React\"\n          showCancelButton\n          onConfirm={() => {\n            console.log('confirm'); // eslint-disable-line no-console\n            this.setState({ show: false });\n          }}\n          onCancel={() => {\n            console.log('cancel'); // eslint-disable-line no-console\n            this.setState({ show: false });\n          }}\n          onEscapeKey={() => this.setState({ show: false })}\n          onOutsideClick={() => this.setState({ show: false })}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/complex/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/complex/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/complex/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/complex/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/complex/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/component-as-body/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/component-as-body/components/App.js",
    "content": "import React, { Component } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\nimport HelloWorld from './HelloWorld';\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo\"\n          html\n          text={renderToStaticMarkup(<HelloWorld />)}\n          onConfirm={() => this.setState({ show: false })}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/component-as-body/components/HelloWorld.js",
    "content": "import React from 'react';\n\nconst HelloWorld = () => <h1>SweetAlert in React</h1>;\n\nexport default HelloWorld;\n"
  },
  {
    "path": "examples/component-as-body/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/component-as-body/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/component-as-body/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/component-as-body/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/component-as-body/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/esc/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/esc/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo Esc\"\n          text=\"SweetAlert in React\"\n          onConfirm={() => this.setState({ show: false })}\n          onEscapeKey={() => this.setState({ show: false })}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/esc/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/esc/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/esc/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/esc/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/esc/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/history-change/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/history-change/components/App.js",
    "content": "import React, { Component } from 'react';\nimport shortid from 'shortid';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  componentDidMount() {\n    window.addEventListener('popstate', this.hiddenAlert);\n  }\n\n  componentWillUnmount() {\n    window.removeEventListener('popstate', this.hiddenAlert);\n  }\n\n  hiddenAlert = () => {\n    this.setState({ show: false });\n  };\n\n  pushNextState = () => {\n    history.pushState(null, 'next', shortid.generate());\n  };\n\n  render() {\n    return (\n      <div>\n        <button onClick={this.pushNextState}>Next Page</button>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo\"\n          text=\"SweetAlert in React\"\n          onConfirm={this.hiddenAlert}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/history-change/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/history-change/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/history-change/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"shortid\": \"^2.2.6\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/history-change/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/history-change/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/input/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/input/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo Input\"\n          text=\"SweetAlert in React\"\n          type=\"input\"\n          inputType=\"password\"\n          inputPlaceholder=\"password\"\n          onConfirm={inputValue => {\n            console.log(inputValue); // eslint-disable-line no-console\n            this.setState({ show: false });\n          }}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/input/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/input/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/input/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/input/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/input/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/outside-click/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/outside-click/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo OutsideClick\"\n          text=\"SweetAlert in React\"\n          onConfirm={() => this.setState({ show: false })}\n          onOutsideClick={() => this.setState({ show: false })}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/outside-click/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/outside-click/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/outside-click/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n   \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/outside-click/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/outside-click/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/show-input-error/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/show-input-error/components/App.js",
    "content": "import React, { Component } from 'react';\nimport swal from 'sweetalert';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"An input!\"\n          text=\"Write something interesting:\"\n          type=\"input\"\n          showCancelButton\n          closeOnConfirm={false}\n          animation=\"slide-from-top\"\n          inputPlaceholder=\"Write something\"\n          onConfirm={inputValue => {\n            if (inputValue === '') {\n              swal.showInputError('You need to write something!');\n              return;\n            }\n            this.setState({ show: false });\n          }}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/show-input-error/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/show-input-error/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/show-input-error/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/show-input-error/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/show-input-error/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "examples/simple/.babelrc",
    "content": "{\n  \"presets\": [\"latest\", \"stage-2\", \"react\"]\n}\n"
  },
  {
    "path": "examples/simple/components/App.js",
    "content": "import React, { Component } from 'react';\nimport SweetAlert from 'sweetalert-react'; // eslint-disable-line import/no-extraneous-dependencies\nimport 'sweetalert/dist/sweetalert.css';\n\n\nclass App extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.state = {\n      show: false,\n    };\n  }\n\n  render() {\n    return (\n      <div>\n        <button onClick={() => this.setState({ show: true })}>Alert</button>\n        <SweetAlert\n          show={this.state.show}\n          title=\"Demo\"\n          text=\"SweetAlert in React\"\n          onConfirm={() => this.setState({ show: false })}\n        />\n      </div>\n    );\n  }\n}\n\n\nexport default App;\n"
  },
  {
    "path": "examples/simple/index.html",
    "content": "<html>\n  <head>\n    <title>sweetalert-react-example</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n\t<script src=\"/static/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/simple/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\n\nrender(\n  <App />,\n  document.getElementById('root')\n);\n"
  },
  {
    "path": "examples/simple/package.json",
    "content": "{\n  \"name\": \"sweetalert-react-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"sweetalert-react-example-description\",\n  \"private\": true,\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/chentsulin/sweetalert-react.git\"\n  },\n  \"keywords\": [\n    \"sweetalert-react\"\n  ],\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/chentsulin/sweetalert-react/issues\"\n  },\n  \"homepage\": \"https://github.com/chentsulin/sweetalert-react\",\n  \"dependencies\": {\n    \"react\": \"^15.0.1\",\n    \"react-dom\": \"^15.0.1\",\n    \"sweetalert\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.7.6\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-latest\": \"^6.22.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-2\": \"^6.22.0\",\n    \"css-loader\": \"^0.23.1\",\n    \"node-libs-browser\": \"^1.0.0\",\n    \"react-hot-loader\": \"^1.3.0\",\n    \"style-loader\": \"^0.13.1\",\n    \"webpack\": \"^1.12.15\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  }\n}\n"
  },
  {
    "path": "examples/simple/server.js",
    "content": "/* eslint-disable import/no-extraneous-dependencies */\n\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst config = require('./webpack.config');\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  historyApiFallback: true,\n  stats: {\n    colors: true,\n  },\n}).listen(3000, 'localhost', err => {\n  if (err) {\n    console.log(err); // eslint-disable-line no-console\n  }\n\n  console.log('Listening at localhost:3000'); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "examples/simple/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n  devtool: 'eval',\n  entry: [\n    'webpack-dev-server/client?http://localhost:3000',\n    'webpack/hot/only-dev-server',\n    './index',\n  ],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/static/',\n  },\n  plugins: [\n    new webpack.HotModuleReplacementPlugin(),\n    new webpack.NoErrorsPlugin(),\n  ],\n  resolve: {\n    alias: {\n      'sweetalert-react': path.join(__dirname, '..', '..', 'src', 'SweetAlert.js'),\n    },\n    extensions: ['', '.js'],\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loaders: ['react-hot', 'babel'],\n      exclude: /node_modules/,\n      include: __dirname,\n    }, {\n      test: /\\.js$/,\n      loaders: ['babel'],\n      include: path.join(__dirname, '..', '..', 'src'),\n    }, {\n      test: /\\.css$/,\n      loaders: ['style-loader', 'css-loader'],\n    }],\n  },\n};\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"sweetalert-react\",\n  \"version\": \"0.4.11\",\n  \"description\": \"Declarative SweetAlert in React\",\n  \"main\": \"lib/index.js\",\n  \"license\": \"MIT\",\n  \"repository\": \"chentsulin/sweetalert-react\",\n  \"scripts\": {\n    \"clean\": \"rimraf lib dist coverage\",\n    \"lint\": \"eslint .\",\n    \"test\": \"jest\",\n    \"test:watch\": \"npm test -- --watch\",\n    \"test:cov\": \"npm test -- --coverage\",\n    \"check\": \"npm run lint && npm run test\",\n    \"build:lib\": \"babel src --out-dir lib --ignore __tests__\",\n    \"build:umd\": \"webpack src/index.js dist/sweetalert-react.js --config webpack.config.development.js\",\n    \"build:umd:min\": \"webpack src/index.js dist/sweetalert-react.min.js --config webpack.config.production.js\",\n    \"build\": \"npm run clean && npm run build:lib && npm run build:umd && npm run build:umd:min\",\n    \"preversion\": \"npm run clean && npm run check\",\n    \"version\": \"npm run build\",\n    \"postversion\": \"git push && git push --tags && npm run clean\",\n    \"prepublish\": \"npm run clean && npm run build\"\n  },\n  \"author\": {\n    \"name\": \"C.T. Lin\",\n    \"email\": \"chentsulin@gmail.com\",\n    \"url\": \"github.com/chentsulin/sweetalert-react\"\n  },\n  \"engines\": {\n    \"node\": \">=0.10.0\"\n  },\n  \"files\": [\n    \"lib/\"\n  ],\n  \"keywords\": [\n    \"alert\",\n    \"sweetalert\",\n    \"react\",\n    \"component\",\n    \"react-component\"\n  ],\n  \"devDependencies\": {\n    \"babel-cli\": \"^6.18.0\",\n    \"babel-eslint\": \"^7.1.1\",\n    \"babel-jest\": \"^19.0.0\",\n    \"babel-loader\": \"^6.2.10\",\n    \"babel-polyfill\": \"^6.20.0\",\n    \"babel-preset-latest\": \"^6.16.0\",\n    \"babel-preset-react\": \"^6.16.0\",\n    \"babel-preset-stage-2\": \"^6.18.0\",\n    \"enzyme\": \"^2.7.0\",\n    \"eslint\": \"^3.13.1\",\n    \"eslint-config-airbnb\": \"^14.0.0\",\n    \"eslint-plugin-import\": \"^2.2.0\",\n    \"eslint-plugin-jsx-a11y\": \"^3.0.2\",\n    \"eslint-plugin-react\": \"^6.9.0\",\n    \"jest-cli\": \"^19.0.2\",\n    \"react\": \"^15.4.2\",\n    \"react-addons-test-utils\": \"^15.4.2\",\n    \"react-dom\": \"^15.4.2\",\n    \"rimraf\": \"^2.5.4\",\n    \"webpack\": \"^1.14.0\"\n  },\n  \"dependencies\": {\n    \"lodash.pick\": \"^4.4.0\",\n    \"mousetrap\": \"^1.6.0\",\n    \"prop-types\": \"^15.0.0\",\n    \"sweetalert\": \"^1.1.3\",\n    \"warning\": \"^3.0.0\"\n  },\n  \"peerDependencies\": {\n    \"react\": \"^0.14.0 || ^15.0.0-0 || ^16.0.0-0\"\n  },\n  \"jest\": {\n    \"verbose\": true,\n    \"collectCoverageFrom\": [\n      \"src/**/*.js\"\n    ],\n    \"testPathIgnorePatterns\": [\n      \"<rootDir>/lib\"\n    ]\n  }\n}\n"
  },
  {
    "path": "src/SweetAlert.js",
    "content": "import { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport swal from 'sweetalert';\nimport pick from 'lodash.pick';\nimport mousetrap from 'mousetrap';\nimport warning from 'warning';\nimport outsideTargetHandlerFactory from './utils/outsideTargetHandlerFactory';\n\nconst ALLOWS_KEYS = [\n  'title',\n  'text',\n  'type',\n  'customClass',\n  'showCancelButton',\n  'showConfirmButton',\n  'confirmButtonText',\n  'confirmButtonColor',\n  'cancelButtonText',\n  'imageUrl',\n  'imageSize',\n  'html',\n  'animation',\n  'inputType',\n  'inputValue',\n  'inputPlaceholder',\n  'showLoaderOnConfirm',\n];\n\nconst REMOVED_KEYS = [\n  'timer',\n  'closeOnConfirm',\n  'closeOnCancel',\n  'allowOutsideClick',\n  'allowEscapeKey',\n];\n\nconst OVERWRITE_PROPS = {\n  closeOnConfirm: false,\n  closeOnCancel: false,\n  allowOutsideClick: false,\n  allowEscapeKey: false,\n};\n\n// reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input\nconst ALLOWS_INPUT_TYPES = [\n  'button',\n  'checkbox',\n  'color',\n  'date',\n  'datetime',\n  'datetime-local',\n  'email',\n  'file',\n  'hidden',\n  'image',\n  'month',\n  'number',\n  'password',\n  'radio',\n  'range',\n  'reset',\n  'search',\n  'submit',\n  'tel',\n  'text',\n  'time',\n  'url',\n  'week',\n];\n\nfunction warningRemoved(props) {\n  REMOVED_KEYS.forEach(key => {\n    warning(\n      props[key] === undefined,\n      '%s has been removed from sweetalert-react, pass `show` props and use event hook instead.',\n      `\\`${key}\\``\n    );\n  });\n}\n\nexport default class SweetAlert extends Component {\n  /* eslint-disable react/no-unused-prop-types */\n  static propTypes = {\n    // sweetalert option\n    title: PropTypes.string.isRequired,\n    text: PropTypes.string,\n    type: PropTypes.oneOf(['warning', 'error', 'success', 'info', 'input']),\n    customClass: PropTypes.string,\n    showCancelButton: PropTypes.bool,\n    showConfirmButton: PropTypes.bool,\n    confirmButtonText: PropTypes.string,\n    confirmButtonColor: PropTypes.string,\n    cancelButtonText: PropTypes.string,\n    imageUrl: PropTypes.string,\n    imageSize(props, propName) {\n      if (!/^[1-9]\\d*x[1-9]\\d*/.test(props[propName])) {\n        return new Error('imageSize should have the format like this: \"80x80\"');\n      }\n    },\n    html: PropTypes.bool,\n    animation: PropTypes.oneOfType([\n      PropTypes.bool,\n      PropTypes.oneOf(['pop', 'slide-from-top', 'slide-from-bottom']),\n    ]),\n    inputType: PropTypes.oneOf(ALLOWS_INPUT_TYPES),\n    inputPlaceholder: PropTypes.string,\n    inputValue: PropTypes.string,\n    showLoaderOnConfirm: PropTypes.bool,\n\n    // custom option\n    show: PropTypes.bool,\n    onConfirm: PropTypes.func,\n    onCancel: PropTypes.func,\n    onClose: PropTypes.func,\n    onEscapeKey: PropTypes.func,\n    onOutsideClick: PropTypes.func,\n  };\n  /* eslint-enable react/no-unused-prop-types */\n\n  static defaultProps = {\n    // sweetalert option\n    text: null,\n    type: null,\n    customClass: null,\n    showCancelButton: false,\n    showConfirmButton: true,\n    confirmButtonText: 'OK',\n    confirmButtonColor: '#aedef4',\n    cancelButtonText: 'Cancel',\n    imageUrl: null,\n    imageSize: '80x80',\n    html: false,\n    animation: true,\n    inputType: 'text',\n    inputPlaceholder: null,\n    inputValue: null,\n    showLoaderOnConfirm: false,\n\n    // custom option\n    show: false,\n  };\n\n  constructor(props, context) {\n    super(props, context);\n    this._show = false;\n  }\n\n  componentDidMount() {\n    this.setupWithProps(this.props);\n\n    if (this.props.onOutsideClick) {\n      this.registerOutsideClickHandler(this.props.onOutsideClick);\n    }\n  }\n\n  componentWillReceiveProps(props) {\n    this.setupWithProps(props);\n\n    const oldOutsideClickHandler = this.props.onOutsideClick;\n    const newOutsideClickHandler = props.onOutsideClick;\n\n    if (oldOutsideClickHandler !== newOutsideClickHandler) {\n      if (oldOutsideClickHandler && newOutsideClickHandler) {\n        this.unregisterOutsideClickHandler();\n        this.registerOutsideClickHandler(newOutsideClickHandler);\n      } else if (oldOutsideClickHandler && !newOutsideClickHandler) {\n        this.unregisterOutsideClickHandler();\n      } else if ((!oldOutsideClickHandler) && newOutsideClickHandler) {\n        this.registerOutsideClickHandler(newOutsideClickHandler);\n      }\n    }\n  }\n\n  componentWillUnmount() {\n    this.unregisterOutsideClickHandler();\n    this.unbindEscapeKey();\n  }\n\n  setupWithProps(props) {\n    warningRemoved(props);\n    const { show, onConfirm, onCancel, onClose, onEscapeKey } = props;\n    if (show) {\n      swal({\n        ...pick(props, ALLOWS_KEYS),\n        ...OVERWRITE_PROPS,\n      }, isConfirm => this.handleClick(isConfirm, onConfirm, onCancel));\n      this._show = true;\n      if (onEscapeKey) this.bindEscapeKey(onEscapeKey);\n    } else {\n      this.handleClose(onClose);\n    }\n  }\n\n  registerOutsideClickHandler(handler) {\n    this._outsideClickHandler = outsideTargetHandlerFactory(\n      document.getElementsByClassName('sweet-alert')[0],\n      handler\n    );\n    this.enableOutsideClick();\n  }\n\n  unregisterOutsideClickHandler() {\n    this.disableOutsideClick();\n    this._outsideClickHandler = null;\n  }\n\n  enableOutsideClick() {\n    const fn = this._outsideClickHandler;\n    if (fn) {\n      document.addEventListener('mousedown', fn);\n      document.addEventListener('touchstart', fn);\n    }\n  }\n\n  disableOutsideClick() {\n    const fn = this._outsideClickHandler;\n    if (fn) {\n      document.removeEventListener('mousedown', fn);\n      document.removeEventListener('touchstart', fn);\n    }\n  }\n\n  bindEscapeKey(onEscapeKey) {\n    mousetrap.bind('esc', onEscapeKey);\n  }\n\n  unbindEscapeKey() {\n    mousetrap.unbind('esc');\n  }\n\n  handleClick(isConfirm, onConfirm, onCancel) {\n    if (isConfirm !== false) {\n      if (onConfirm) onConfirm(isConfirm);\n    } else {\n      if (onCancel) onCancel(); // eslint-disable-line no-lonely-if\n    }\n  }\n\n  handleClose(onClose) {\n    if (this._show) {\n      swal.close();\n      this.unbindEscapeKey();\n      if (onClose) onClose();\n      this._show = false;\n    }\n  }\n\n  render() {\n    return null;\n  }\n}\n"
  },
  {
    "path": "src/__tests__/SweetAlert-test.js",
    "content": "/* eslint-disable no-console */\n\nimport React from 'react';\nimport { mount } from 'enzyme';\nimport swal from 'sweetalert';\n\nimport SweetAlert from '../SweetAlert';\n\njest.mock('sweetalert');\n\nlet _error;\n\nbeforeEach(() => {\n  _error = console.error;\n  console.error = jest.fn();\n});\n\nafterEach(() => {\n  console.error = _error;\n  _error = null;\n  swal.mockClear();\n});\n\ndescribe('propTypes', () => {\n  it('should return error when imageSize invalid', () => {\n    expect(SweetAlert.propTypes.imageSize({ imageSize: '8080' }, 'imageSize'))\n      .toBeInstanceOf(Error);\n  });\n\n  it('should not return error when imageSize valid', () => {\n    expect(SweetAlert.propTypes.imageSize({ imageSize: '80x80' }, 'imageSize'))\n      .not.toBeInstanceOf(Error);\n  });\n\n  it('should warning when title is not passed down to props', () => {\n    mount(<SweetAlert />);\n    const message = console.error.mock.calls[0][0];\n    expect(message).toMatch(\n      /Failed prop type: The prop `title` is marked as required in `SweetAlert`/\n    );\n  });\n});\n\ndescribe('allow ALLOWS_KEYS as props', () => {\n  it('should not log error when props pass down', () => {\n    mount(\n      <SweetAlert\n        title=\"t\"\n        text=\"some text\"\n        type=\"warning\"\n        customClass=\"custom-class\"\n        showCancelButton\n        showConfirmButton\n        confirmButtonText=\"confirm\"\n        confirmButtonColor=\"green\"\n        cancelButtonText=\"cannel\"\n        imageUrl=\"\"\n        imageSize=\"160x160\"\n        html\n        animation\n        inputType=\"text\"\n        inputValue=\"default\"\n        inputPlaceholder=\"placeholder\"\n        showLoaderOnConfirm\n      />\n    );\n    expect(console.error).not.toBeCalled();\n  });\n});\n\ndescribe('warning REMOVED_KEYS', () => {\n  it('should warning when REMOVED_KEYS:timer is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" timer={60} />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `timer` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n\n  it('should warning when REMOVED_KEYS:timer is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" timer={60} />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `timer` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n\n  it('should warning when REMOVED_KEYS:closeOnConfirm is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" closeOnConfirm />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `closeOnConfirm` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n\n  it('should warning when REMOVED_KEYS:closeOnCancel is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" closeOnCancel />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `closeOnCancel` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n\n  it('should warning when REMOVED_KEYS:allowOutsideClick is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" allowOutsideClick />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `allowOutsideClick` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n\n  it('should warning when REMOVED_KEYS:allowEscapeKey is passed down to props', () => {\n    mount(<SweetAlert title=\"t\" allowEscapeKey />);\n    expect(console.error).toBeCalledWith(\n      'Warning: `allowEscapeKey` has been removed from sweetalert-react, ' +\n      'pass `show` props and use event hook instead.'\n    );\n  });\n});\n\ndescribe('should show prop works', () => {\n  it('should call sweetalert when show is true', async () => {\n    mount(\n      <SweetAlert title=\"t\" show />\n    );\n    expect(swal).toBeCalled();\n  });\n\n  it('should call sweetalert when show is false', async () => {\n    mount(\n      <SweetAlert title=\"t\" />\n    );\n    expect(swal).not.toBeCalled();\n  });\n});\n\ndescribe('`onConfirm`', () => {\n  xit('should  works', () => {\n    const callback = jest.fn();\n    mount(\n      <SweetAlert title=\"t\" show onConfirm={callback} />\n    );\n  });\n});\n\ndescribe('Cancel', () => {\n  // body...\n});\n\ndescribe('Outside click', () => {\n  // body...\n});\n\ndescribe('ESC', () => {\n  // body...\n});\n"
  },
  {
    "path": "src/__tests__/index-test.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport { renderToString } from 'react-dom/server';\n\nimport SweetAlert from '../';\n\nit('should not break render', () => {\n  const node = document.createElement('div');\n  expect(() => {\n    render(\n      <SweetAlert title=\"client-rendering\" />,\n      node\n    );\n  }).not.toThrow();\n});\n\n\nit('should not break renderToString', () => {\n  global.window = undefined;\n\n  expect(() => renderToString(\n    <SweetAlert title=\"server-rendering\" />\n  )).not.toThrow();\n});\n"
  },
  {
    "path": "src/index.js",
    "content": "if (typeof window === 'undefined') {\n  module.exports = () => null;\n} else {\n  module.exports = require('./SweetAlert'); // eslint-disable-line global-require\n}\n"
  },
  {
    "path": "src/utils/__mocks__/isDOMEquals.js",
    "content": "const isDOMEquals = jest.genMockFromModule('../isDOMEquals');\n\nmodule.exports = isDOMEquals;\n"
  },
  {
    "path": "src/utils/__tests__/isDOMEquals-test.js",
    "content": "import isDOMEquals from '../isDOMEquals';\n\ndescribe('isDOMEquals', () => {\n  it('should be true if dom equals', () => {\n    const div = document.createElement('div');\n    expect(isDOMEquals(div, div)).toEqual(true);\n  });\n\n  it('should be false if dom does not equal', () => {\n    const div1 = document.createElement('div');\n    const div2 = document.createElement('div');\n    expect(isDOMEquals(div1, div2)).toEqual(false);\n  });\n});\n"
  },
  {
    "path": "src/utils/__tests__/outsideTargetHandlerFactory-test.js",
    "content": "import outsideTargetHandlerFactory from '../outsideTargetHandlerFactory';\n\njest.mock('../isDOMEquals');\n\nconst isDOMEquals = require('../isDOMEquals').default;\n\ndescribe('outsideTargetHandlerFactory', () => {\n  let targetNode;\n  let eventHandler;\n  let handler;\n\n  beforeEach(() => {\n    targetNode = document.createElement('div');\n    eventHandler = jest.fn();\n    handler = outsideTargetHandlerFactory(targetNode, eventHandler);\n  });\n\n  it('handler should call stopPropagation', () => {\n    const event = {};\n    event.target = { parentNode: null };\n    event.stopPropagation = jest.fn();\n    handler(event);\n    expect(event.stopPropagation).toBeCalled();\n  });\n\n  it('eventHandler should be called when no parentNode', () => {\n    const event = {};\n    event.target = { parentNode: null };\n    event.stopPropagation = () => {};\n    handler(event);\n    expect(eventHandler).toBeCalled();\n  });\n\n  it('eventHandler should not be called when isDOMEquals return true', () => {\n    isDOMEquals.mockReturnValue(true);\n    const event = {};\n    event.target = { parentNode: document.createElement('div') };\n    event.stopPropagation = () => {};\n    handler(event);\n    expect(eventHandler.mock.calls.length).toEqual(0);\n  });\n\n  it('eventHandler should not be called when isDOMEquals return false', () => {\n    isDOMEquals.mockReturnValueOnce(false);\n    const event = {};\n    event.target = { parentNode: document.createElement('div') };\n    event.stopPropagation = () => {};\n    handler(event);\n    expect(eventHandler).toBeCalled();\n  });\n});\n"
  },
  {
    "path": "src/utils/isDOMEquals.js",
    "content": "/**\n * Determinate whether dom1 and dom2 is the same dom or not.\n *\n * @param  {HTMLElement}  dom1\n * @param  {HTMLElement}  dom2\n * @return {Boolean}\n */\nexport default function isDOMEquals(dom1, dom2) {\n  return dom1 === dom2;\n}\n"
  },
  {
    "path": "src/utils/outsideTargetHandlerFactory.js",
    "content": "import isDOMEquals from './isDOMEquals';\n\n/**\n *\n * @param  {HTMLElement}  targetNode\n * @param  {HTMLElement}  eventHandler\n * @return {Boolean}\n */\nexport default function outsideTargetHandlerFactory(targetNode, eventHandler) {\n  return evt => {\n    evt.stopPropagation();\n    let current = evt.target;\n    let found = false;\n    while (current.parentNode) {\n      found = isDOMEquals(current, targetNode);\n      if (found) return;\n      current = current.parentNode;\n    }\n    eventHandler(evt);\n  };\n}\n"
  },
  {
    "path": "webpack.config.development.js",
    "content": "const webpack = require('webpack');\n\nmodule.exports = {\n  module: {\n    loaders: [\n      { test: /\\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },\n    ],\n  },\n  output: {\n    library: 'ReactSweetAlert',\n    libraryTarget: 'umd',\n  },\n  resolve: {\n    extensions: ['', '.js'],\n  },\n  plugins: [\n    new webpack.optimize.OccurenceOrderPlugin(),\n    new webpack.DefinePlugin({\n      'process.env.NODE_ENV': JSON.stringify('development'),\n    }),\n  ],\n};\n"
  },
  {
    "path": "webpack.config.production.js",
    "content": "const webpack = require('webpack');\n\nmodule.exports = {\n  module: {\n    loaders: [\n      { test: /\\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },\n    ],\n  },\n  output: {\n    library: 'ReactSweetAlert',\n    libraryTarget: 'umd',\n  },\n  resolve: {\n    extensions: ['', '.js'],\n  },\n  plugins: [\n    new webpack.optimize.OccurenceOrderPlugin(),\n    new webpack.DefinePlugin({\n      'process.env.NODE_ENV': JSON.stringify('production'),\n    }),\n    new webpack.optimize.UglifyJsPlugin({\n      compressor: {\n        screw_ie8: true,\n        warnings: false,\n      },\n    }),\n  ],\n};\n"
  }
]