├── .gitignore
├── example
├── BarChart.css
├── index.html
└── index.jsx
├── LICENSE
├── package.json
├── src
├── utils
│ └── assign.js
└── BarChart.jsx
├── webpack.config.js
├── README.md
└── lib
├── react-bar-chart.min.js
└── react-bar-chart.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/example/BarChart.css:
--------------------------------------------------------------------------------
1 | .bar {
2 | fill: steelblue;
3 | }
4 |
5 | .bar:hover {
6 | fill: brown;
7 | }
8 |
9 | .axis {
10 | font: 10px sans-serif;
11 | }
12 |
13 | .axis path,
14 | .axis line {
15 | fill: none;
16 | stroke: #000;
17 | shape-rendering: crispEdges;
18 | }
19 |
20 | .x.axis path {
21 | display: none;
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | React Bar Chart
6 |
7 |
8 |
9 | _-React_Pie-_
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/index.jsx:
--------------------------------------------------------------------------------
1 | var data = [
2 | {text: 'Man', value: 500},
3 | {text: 'Woman', value: 300}
4 | ];
5 |
6 | var margin = {top: 20, right: 20, bottom: 30, left: 40};
7 |
8 | var Index = React.createClass({
9 | getInitialState: function() {
10 | return {
11 | width: 500
12 | };
13 | },
14 |
15 | componentDidMount: function () {
16 | var _this = this;
17 | window.onresize = function(){
18 | _this.setState({width: this.refs.root.offsetWidth});
19 | };
20 | },
21 |
22 | handleBarClick(element, id){
23 | console.log('The bin ' + element.text + ' with id ' + id + ' was clicked');
24 | },
25 |
26 | render: function() {
27 | return (
28 |
33 | );
34 | }
35 | });
36 |
37 | ReactDOM.render(
38 | ,
39 | document.getElementById('container')
40 | );
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mateus Zitelli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-bar-chart",
3 | "version": "0.1.2",
4 | "description": "A bar chart component made with React.js and D3.js",
5 | "main": "lib/react-bar-chart.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "devbuild": "NODE_ENV='devel' webpack",
9 | "build": "NODE_ENV='production' webpack",
10 | "prepublish": "npm run build && npm run devbuild"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "https://github.com/MateusZitelli/react-bar-chart.git"
15 | },
16 | "keywords": [
17 | "react",
18 | "graph",
19 | "d3",
20 | "javascript",
21 | "react-component",
22 | "bar-chart"
23 | ],
24 | "author": {
25 | "name": "Mateus Zitelli Dantas",
26 | "email": "zitellimateus@gmail.com"
27 | },
28 | "license": "MIT",
29 | "peerDependencies": {
30 | "d3": "^3.5.16",
31 | "react": "^15.0.1"
32 | },
33 | "devDependencies": {
34 | "babel-core": "^5.4.4",
35 | "babel-loader": "^5.1.3",
36 | "css-loader": "^0.13.0",
37 | "style-loader": "^0.12.2",
38 | "webpack": "^1.9.7"
39 | },
40 | "dependencies": {
41 | "d3": "3.5.16",
42 | "prop-types": "^15.5.8",
43 | "react": "15.0.1"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/utils/assign.js:
--------------------------------------------------------------------------------
1 | if (!Object.assign) {
2 | Object.defineProperty(Object, "assign", {
3 | enumerable: false,
4 | configurable: true,
5 | writable: true,
6 | value: function(target, firstSource) {
7 | "use strict";
8 | if (target === undefined || target === null)
9 | throw new TypeError("Cannot convert first argument to object");
10 |
11 | var to = Object(target);
12 |
13 | var hasPendingException = false;
14 | var pendingException;
15 |
16 | for (var i = 1; i < arguments.length; i++) {
17 | var nextSource = arguments[i];
18 | if (nextSource === undefined || nextSource === null)
19 | continue;
20 |
21 | var keysArray = Object.keys(Object(nextSource));
22 | for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
23 | var nextKey = keysArray[nextIndex];
24 | try {
25 | var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
26 | if (desc !== undefined && desc.enumerable)
27 | to[nextKey] = nextSource[nextKey];
28 | } catch (e) {
29 | if (!hasPendingException) {
30 | hasPendingException = true;
31 | pendingException = e;
32 | }
33 | }
34 | }
35 |
36 | if (hasPendingException)
37 | throw pendingException;
38 | }
39 | return to;
40 | }
41 | });
42 | }
43 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | var webpack = require('webpack');
3 |
4 | var IS_PRODUCTION = 'production' === process.env.NODE_ENV;
5 |
6 | var webpackConfig = module.exports = {
7 | entry: __dirname + "/src/BarChart.jsx",
8 | output: {
9 | path: __dirname + '/lib',
10 | filename: 'react-bar-chart.js',
11 | library: 'BarChart',
12 | libraryTarget: 'umd'
13 | },
14 | externals: {
15 | react: {
16 | root: 'React',
17 | commonjs: 'react',
18 | commonjs2: 'react',
19 | amd: 'react'
20 | },
21 | d3: {
22 | root: 'd3',
23 | commonjs: 'd3',
24 | commonjs2: 'd3',
25 | amd: 'd3'
26 | }
27 | },
28 | module: {
29 | loaders: [
30 | {
31 | test: /\.(js|jsx)$/,
32 | loader: 'babel-loader?stage=0',
33 | exclude: 'node_modules'
34 | },
35 | {
36 | test: /\.css$/,
37 | loader: 'style!css'
38 | }
39 | ]
40 | },
41 | resolve: {
42 | moduleDirectories: ['node_modules'],
43 | extensions: ['', '.js', '.jsx', '.es6']
44 | },
45 | plugins: [
46 | new webpack.DefinePlugin({
47 | 'process.env': {
48 | NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'production')
49 | }
50 | })
51 | ]
52 | };
53 |
54 | if(IS_PRODUCTION){
55 | webpackConfig.plugins.push(
56 | new webpack.optimize.UglifyJsPlugin(),
57 | new webpack.optimize.DedupePlugin()
58 | );
59 |
60 | webpackConfig.output.filename = 'react-bar-chart.min.js';
61 | }
62 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-bar-chart
2 | > A resizible bar chart component made with React.js and D3.js
3 |
4 |
5 |
6 | ## Usage
7 |
8 | First install the component:
9 | ```sh
10 | npm install --save react-bar-chart
11 | ```
12 |
13 | And them use the component like this to generate the image on top:
14 | ```jsx
15 | import React from 'react';
16 | import BarChart from 'react-bar-chart';
17 |
18 | const data = [
19 | {text: 'Man', value: 500},
20 | {text: 'Woman', value: 300}
21 | ];
22 |
23 | const margin = {top: 20, right: 20, bottom: 30, left: 40};
24 |
25 | const Example = React.createClass({
26 | getInitialState() {
27 | return { width: 500 };
28 | },
29 |
30 | componentDidMount: () => {
31 | window.onresize = () => {
32 | this.setState({width: this.refs.root.offsetWidth});
33 | };
34 | },
35 |
36 | handleBarClick(element, id){
37 | console.log(`The bin ${element.text} with id ${id} was clicked`);
38 | },
39 |
40 | render() {
41 | return (
42 |
52 | );
53 | }
54 | });
55 |
56 | React.render(
57 | ,
58 | document.getElementById('react-container')
59 | );
60 | ```
61 |
--------------------------------------------------------------------------------
/src/BarChart.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { array, number, object, string } from 'prop-types';
3 | import d3 from 'd3';
4 |
5 | require('./utils/assign');
6 |
7 | const merge = function(one, two) {
8 | return Object.assign({}, one, two);
9 | };
10 |
11 | export default class BarChart extends React.Component {
12 | static propTypes = {
13 | data : array.isRequired,
14 | width : number.isRequired,
15 | height : number.isRequired,
16 | margin : object,
17 | ylabel : string
18 | };
19 |
20 | static defaultProps = { margin: {top: 0, right: 0, bottom: 0, left: 0} };
21 |
22 | _handleBarClick(element, id){
23 | if(this.props.onBarClick){
24 | this.props.onBarClick(element, id);
25 | }
26 | }
27 |
28 | _renderGraph(props){
29 | const margin = props.margin;
30 | const width = props.width;
31 | const height = props.height;
32 |
33 | let svg = d3.select(this.svg)
34 | .attr('width', width + margin.left + margin.right)
35 | .attr('height', height + margin.top + margin.bottom);
36 |
37 | svg = svg.select('.graph')
38 | .attr('transform', `translate(${margin.left}, ${margin.top})`);
39 |
40 | this._reusableGraph(props);
41 | }
42 |
43 | _reusableGraph(props){
44 | const margin = props.margin;
45 | const width = props.width;
46 | const maxWidth = props.maxWidth;
47 | const height = props.height;
48 |
49 | let svg = d3.select(this.svg)
50 | .attr('width', width + margin.left + margin.right)
51 | .attr('height', height + margin.top + margin.bottom);
52 |
53 | svg = svg.select('.graph')
54 | .attr('transform', `translate(${margin.left}, ${margin.top})`);
55 |
56 | svg.selectAll('rect').remove();
57 |
58 | svg.select('.x.axis').remove();
59 | svg.select('.y.axis').remove();
60 |
61 | svg.append('g')
62 | .attr('class', 'x axis')
63 | .attr('transform', `translate(0, ${height})`)
64 | .call(this.xAxis);
65 |
66 | svg.append('g')
67 | .attr('class', 'y axis')
68 | .call(this.yAxis)
69 | .append('text')
70 | .attr('transform', 'rotate(-90)')
71 | .attr('y', 6)
72 | .attr('dy', '.71em')
73 | .style('text-anchor', 'end')
74 | .text(props.ylabel);
75 |
76 | svg.selectAll('.bar')
77 | .data(props.data)
78 | .enter().append('rect')
79 | .on('click', ::this._handleBarClick)
80 | .attr('class', 'bar')
81 | .attr("x", d => {
82 | let width = this.x.rangeBand()
83 | let padding = width > maxWidth ? width - maxWidth : 0
84 | let xPos = this.x(d.text)
85 | return maxWidth ? xPos + padding / 2 : xPos
86 | })
87 | .attr("width", () => {
88 | let width = this.x.rangeBand()
89 | width = maxWidth && width > maxWidth ? maxWidth : width
90 | return width
91 | })
92 | .attr('y', d => this.y(d.value))
93 | .attr('height', d => height - this.y(d.value));
94 | }
95 |
96 | _defineAxis(props){
97 | props.width = props.width - props.margin.left - props.margin.right;
98 | props.height = props.height - props.margin.top - props.margin.bottom;
99 |
100 | this.x = d3.scale.ordinal().rangeRoundBands([0, props.width], 0.1);
101 | this.y = d3.scale.linear().range([props.height, 0]);
102 |
103 | this.x.domain(props.data.map(d => d.text));
104 | this.y.domain([0, d3.max(props.data, d => d.value)]);
105 |
106 | this.xAxis = d3.svg.axis().scale(this.x).orient('bottom');
107 | this.yAxis = d3.svg.axis().scale(this.y).orient('left');
108 | }
109 |
110 | componentDidMount(){
111 | const props = merge(this.props);
112 | this._defineAxis(props);
113 | this._renderGraph(props);
114 | }
115 |
116 | shouldComponentUpdate(nextProps){
117 | const props = merge(nextProps);
118 | this._defineAxis(props);
119 | this._reusableGraph(props);
120 | return false;
121 | }
122 |
123 | render() {
124 | return (
125 |
128 | );
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/lib/react-bar-chart.min.js:
--------------------------------------------------------------------------------
1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("d3")):"function"==typeof define&&define.amd?define(["react","d3"],e):"object"==typeof exports?exports.BarChart=e(require("react"),require("d3")):t.BarChart=e(t.React,t.d3)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;rs;s++){var c=u[s];try{var f=Object.getOwnPropertyDescriptor(i,c);void 0!==f&&f.enumerable&&(n[c]=i[c])}catch(p){a||(a=!0,r=p)}}if(a)throw r}}return n}})}])});
--------------------------------------------------------------------------------
/lib/react-bar-chart.js:
--------------------------------------------------------------------------------
1 | (function webpackUniversalModuleDefinition(root, factory) {
2 | if(typeof exports === 'object' && typeof module === 'object')
3 | module.exports = factory(require("react"), require("d3"));
4 | else if(typeof define === 'function' && define.amd)
5 | define(["react", "d3"], factory);
6 | else if(typeof exports === 'object')
7 | exports["BarChart"] = factory(require("react"), require("d3"));
8 | else
9 | root["BarChart"] = factory(root["React"], root["d3"]);
10 | })(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_9__) {
11 | return /******/ (function(modules) { // webpackBootstrap
12 | /******/ // The module cache
13 | /******/ var installedModules = {};
14 |
15 | /******/ // The require function
16 | /******/ function __webpack_require__(moduleId) {
17 |
18 | /******/ // Check if module is in cache
19 | /******/ if(installedModules[moduleId])
20 | /******/ return installedModules[moduleId].exports;
21 |
22 | /******/ // Create a new module (and put it into the cache)
23 | /******/ var module = installedModules[moduleId] = {
24 | /******/ exports: {},
25 | /******/ id: moduleId,
26 | /******/ loaded: false
27 | /******/ };
28 |
29 | /******/ // Execute the module function
30 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31 |
32 | /******/ // Flag the module as loaded
33 | /******/ module.loaded = true;
34 |
35 | /******/ // Return the exports of the module
36 | /******/ return module.exports;
37 | /******/ }
38 |
39 |
40 | /******/ // expose the modules object (__webpack_modules__)
41 | /******/ __webpack_require__.m = modules;
42 |
43 | /******/ // expose the module cache
44 | /******/ __webpack_require__.c = installedModules;
45 |
46 | /******/ // __webpack_public_path__
47 | /******/ __webpack_require__.p = "";
48 |
49 | /******/ // Load entry module and return exports
50 | /******/ return __webpack_require__(0);
51 | /******/ })
52 | /************************************************************************/
53 | /******/ ([
54 | /* 0 */
55 | /***/ function(module, exports, __webpack_require__) {
56 |
57 | 'use strict';
58 |
59 | Object.defineProperty(exports, '__esModule', {
60 | value: true
61 | });
62 |
63 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
64 |
65 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
66 |
67 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
68 |
69 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
70 |
71 | function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
72 |
73 | var _react = __webpack_require__(1);
74 |
75 | var _react2 = _interopRequireDefault(_react);
76 |
77 | var _propTypes = __webpack_require__(2);
78 |
79 | var _d3 = __webpack_require__(9);
80 |
81 | var _d32 = _interopRequireDefault(_d3);
82 |
83 | __webpack_require__(10);
84 |
85 | var merge = function merge(one, two) {
86 | return Object.assign({}, one, two);
87 | };
88 |
89 | var BarChart = (function (_React$Component) {
90 | _inherits(BarChart, _React$Component);
91 |
92 | function BarChart() {
93 | _classCallCheck(this, BarChart);
94 |
95 | _get(Object.getPrototypeOf(BarChart.prototype), 'constructor', this).apply(this, arguments);
96 | }
97 |
98 | _createClass(BarChart, [{
99 | key: '_handleBarClick',
100 | value: function _handleBarClick(element, id) {
101 | if (this.props.onBarClick) {
102 | this.props.onBarClick(element, id);
103 | }
104 | }
105 | }, {
106 | key: '_renderGraph',
107 | value: function _renderGraph(props) {
108 | var margin = props.margin;
109 | var width = props.width;
110 | var height = props.height;
111 |
112 | var svg = _d32['default'].select(this.svg).attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom);
113 |
114 | svg = svg.select('.graph').attr('transform', 'translate(' + margin.left + ', ' + margin.top + ')');
115 |
116 | this._reusableGraph(props);
117 | }
118 | }, {
119 | key: '_reusableGraph',
120 | value: function _reusableGraph(props) {
121 | var _this = this;
122 |
123 | var margin = props.margin;
124 | var width = props.width;
125 | var height = props.height;
126 |
127 | var svg = _d32['default'].select(this.svg).attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom);
128 |
129 | svg = svg.select('.graph').attr('transform', 'translate(' + margin.left + ', ' + margin.top + ')');
130 |
131 | svg.selectAll('rect').remove();
132 |
133 | svg.select('.x.axis').remove();
134 | svg.select('.y.axis').remove();
135 |
136 | svg.append('g').attr('class', 'x axis').attr('transform', 'translate(0, ' + height + ')').call(this.xAxis);
137 |
138 | svg.append('g').attr('class', 'y axis').call(this.yAxis).append('text').attr('transform', 'rotate(-90)').attr('y', 6).attr('dy', '.71em').style('text-anchor', 'end').text(props.ylabel);
139 |
140 | svg.selectAll('.bar').data(props.data).enter().append('rect').on('click', this._handleBarClick.bind(this)).attr('class', 'bar').attr('x', function (d) {
141 | return _this.x(d.text);
142 | }).attr('width', this.x.rangeBand()).attr('y', function (d) {
143 | return _this.y(d.value);
144 | }).attr('height', function (d) {
145 | return height - _this.y(d.value);
146 | });
147 | }
148 | }, {
149 | key: '_defineAxis',
150 | value: function _defineAxis(props) {
151 | props.width = props.width - props.margin.left - props.margin.right;
152 | props.height = props.height - props.margin.top - props.margin.bottom;
153 |
154 | this.x = _d32['default'].scale.ordinal().rangeRoundBands([0, props.width], 0.1);
155 | this.y = _d32['default'].scale.linear().range([props.height, 0]);
156 |
157 | this.x.domain(props.data.map(function (d) {
158 | return d.text;
159 | }));
160 | this.y.domain([0, _d32['default'].max(props.data, function (d) {
161 | return d.value;
162 | })]);
163 |
164 | this.xAxis = _d32['default'].svg.axis().scale(this.x).orient('bottom');
165 | this.yAxis = _d32['default'].svg.axis().scale(this.y).orient('left');
166 | }
167 | }, {
168 | key: 'componentDidMount',
169 | value: function componentDidMount() {
170 | var props = merge(this.props);
171 | this._defineAxis(props);
172 | this._renderGraph(props);
173 | }
174 | }, {
175 | key: 'shouldComponentUpdate',
176 | value: function shouldComponentUpdate(nextProps) {
177 | var props = merge(nextProps);
178 | this._defineAxis(props);
179 | this._reusableGraph(props);
180 | return false;
181 | }
182 | }, {
183 | key: 'render',
184 | value: function render() {
185 | var _this2 = this;
186 |
187 | return _react2['default'].createElement(
188 | 'svg',
189 | { ref: function (ref) {
190 | return _this2.svg = ref;
191 | } },
192 | _react2['default'].createElement('g', { className: 'graph' })
193 | );
194 | }
195 | }], [{
196 | key: 'propTypes',
197 | value: {
198 | data: _propTypes.array.isRequired,
199 | width: _propTypes.number.isRequired,
200 | height: _propTypes.number.isRequired,
201 | margin: _propTypes.object,
202 | ylabel: _propTypes.string
203 | },
204 | enumerable: true
205 | }, {
206 | key: 'defaultProps',
207 | value: { margin: { top: 0, right: 0, bottom: 0, left: 0 } },
208 | enumerable: true
209 | }]);
210 |
211 | return BarChart;
212 | })(_react2['default'].Component);
213 |
214 | exports['default'] = BarChart;
215 | module.exports = exports['default'];
216 |
217 | /***/ },
218 | /* 1 */
219 | /***/ function(module, exports) {
220 |
221 | module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
222 |
223 | /***/ },
224 | /* 2 */
225 | /***/ function(module, exports, __webpack_require__) {
226 |
227 | /**
228 | * Copyright 2013-present, Facebook, Inc.
229 | * All rights reserved.
230 | *
231 | * This source code is licensed under the BSD-style license found in the
232 | * LICENSE file in the root directory of this source tree. An additional grant
233 | * of patent rights can be found in the PATENTS file in the same directory.
234 | */
235 |
236 | 'use strict';
237 |
238 | if (true) {
239 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
240 |
241 | var isValidElement = function isValidElement(object) {
242 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
243 | };
244 |
245 | // By explicitly using `prop-types` you are opting into new development behavior.
246 | // http://fb.me/prop-types-in-prod
247 | var throwOnDirectAccess = true;
248 | module.exports = __webpack_require__(3)(isValidElement, throwOnDirectAccess);
249 | } else {
250 | // By explicitly using `prop-types` you are opting into new production behavior.
251 | // http://fb.me/prop-types-in-prod
252 | module.exports = require('./factoryWithThrowingShims')();
253 | }
254 |
255 | /***/ },
256 | /* 3 */
257 | /***/ function(module, exports, __webpack_require__) {
258 |
259 | /**
260 | * Copyright 2013-present, Facebook, Inc.
261 | * All rights reserved.
262 | *
263 | * This source code is licensed under the BSD-style license found in the
264 | * LICENSE file in the root directory of this source tree. An additional grant
265 | * of patent rights can be found in the PATENTS file in the same directory.
266 | */
267 |
268 | 'use strict';
269 |
270 | var emptyFunction = __webpack_require__(4);
271 | var invariant = __webpack_require__(5);
272 | var warning = __webpack_require__(6);
273 |
274 | var ReactPropTypesSecret = __webpack_require__(7);
275 | var checkPropTypes = __webpack_require__(8);
276 |
277 | module.exports = function (isValidElement, throwOnDirectAccess) {
278 | /* global Symbol */
279 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
280 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
281 |
282 | /**
283 | * Returns the iterator method function contained on the iterable object.
284 | *
285 | * Be sure to invoke the function with the iterable as context:
286 | *
287 | * var iteratorFn = getIteratorFn(myIterable);
288 | * if (iteratorFn) {
289 | * var iterator = iteratorFn.call(myIterable);
290 | * ...
291 | * }
292 | *
293 | * @param {?object} maybeIterable
294 | * @return {?function}
295 | */
296 | function getIteratorFn(maybeIterable) {
297 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
298 | if (typeof iteratorFn === 'function') {
299 | return iteratorFn;
300 | }
301 | }
302 |
303 | /**
304 | * Collection of methods that allow declaration and validation of props that are
305 | * supplied to React components. Example usage:
306 | *
307 | * var Props = require('ReactPropTypes');
308 | * var MyArticle = React.createClass({
309 | * propTypes: {
310 | * // An optional string prop named "description".
311 | * description: Props.string,
312 | *
313 | * // A required enum prop named "category".
314 | * category: Props.oneOf(['News','Photos']).isRequired,
315 | *
316 | * // A prop named "dialog" that requires an instance of Dialog.
317 | * dialog: Props.instanceOf(Dialog).isRequired
318 | * },
319 | * render: function() { ... }
320 | * });
321 | *
322 | * A more formal specification of how these methods are used:
323 | *
324 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
325 | * decl := ReactPropTypes.{type}(.isRequired)?
326 | *
327 | * Each and every declaration produces a function with the same signature. This
328 | * allows the creation of custom validation functions. For example:
329 | *
330 | * var MyLink = React.createClass({
331 | * propTypes: {
332 | * // An optional string or URI prop named "href".
333 | * href: function(props, propName, componentName) {
334 | * var propValue = props[propName];
335 | * if (propValue != null && typeof propValue !== 'string' &&
336 | * !(propValue instanceof URI)) {
337 | * return new Error(
338 | * 'Expected a string or an URI for ' + propName + ' in ' +
339 | * componentName
340 | * );
341 | * }
342 | * }
343 | * },
344 | * render: function() {...}
345 | * });
346 | *
347 | * @internal
348 | */
349 |
350 | var ANONYMOUS = '<>';
351 |
352 | // Important!
353 | // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
354 | var ReactPropTypes = {
355 | array: createPrimitiveTypeChecker('array'),
356 | bool: createPrimitiveTypeChecker('boolean'),
357 | func: createPrimitiveTypeChecker('function'),
358 | number: createPrimitiveTypeChecker('number'),
359 | object: createPrimitiveTypeChecker('object'),
360 | string: createPrimitiveTypeChecker('string'),
361 | symbol: createPrimitiveTypeChecker('symbol'),
362 |
363 | any: createAnyTypeChecker(),
364 | arrayOf: createArrayOfTypeChecker,
365 | element: createElementTypeChecker(),
366 | instanceOf: createInstanceTypeChecker,
367 | node: createNodeChecker(),
368 | objectOf: createObjectOfTypeChecker,
369 | oneOf: createEnumTypeChecker,
370 | oneOfType: createUnionTypeChecker,
371 | shape: createShapeTypeChecker
372 | };
373 |
374 | /**
375 | * inlined Object.is polyfill to avoid requiring consumers ship their own
376 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
377 | */
378 | /*eslint-disable no-self-compare*/
379 | function is(x, y) {
380 | // SameValue algorithm
381 | if (x === y) {
382 | // Steps 1-5, 7-10
383 | // Steps 6.b-6.e: +0 != -0
384 | return x !== 0 || 1 / x === 1 / y;
385 | } else {
386 | // Step 6.a: NaN == NaN
387 | return x !== x && y !== y;
388 | }
389 | }
390 | /*eslint-enable no-self-compare*/
391 |
392 | /**
393 | * We use an Error-like object for backward compatibility as people may call
394 | * PropTypes directly and inspect their output. However, we don't use real
395 | * Errors anymore. We don't inspect their stack anyway, and creating them
396 | * is prohibitively expensive if they are created too often, such as what
397 | * happens in oneOfType() for any type before the one that matched.
398 | */
399 | function PropTypeError(message) {
400 | this.message = message;
401 | this.stack = '';
402 | }
403 | // Make `instanceof Error` still work for returned errors.
404 | PropTypeError.prototype = Error.prototype;
405 |
406 | function createChainableTypeChecker(validate) {
407 | if (true) {
408 | var manualPropTypeCallCache = {};
409 | var manualPropTypeWarningCount = 0;
410 | }
411 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
412 | componentName = componentName || ANONYMOUS;
413 | propFullName = propFullName || propName;
414 |
415 | if (secret !== ReactPropTypesSecret) {
416 | if (throwOnDirectAccess) {
417 | // New behavior only for users of `prop-types` package
418 | invariant(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
419 | } else if (("devel") !== 'production' && typeof console !== 'undefined') {
420 | // Old behavior for people using React.PropTypes
421 | var cacheKey = componentName + ':' + propName;
422 | if (!manualPropTypeCallCache[cacheKey] &&
423 | // Avoid spamming the console because they are often not actionable except for lib authors
424 | manualPropTypeWarningCount < 3) {
425 | warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName);
426 | manualPropTypeCallCache[cacheKey] = true;
427 | manualPropTypeWarningCount++;
428 | }
429 | }
430 | }
431 | if (props[propName] == null) {
432 | if (isRequired) {
433 | if (props[propName] === null) {
434 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
435 | }
436 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
437 | }
438 | return null;
439 | } else {
440 | return validate(props, propName, componentName, location, propFullName);
441 | }
442 | }
443 |
444 | var chainedCheckType = checkType.bind(null, false);
445 | chainedCheckType.isRequired = checkType.bind(null, true);
446 |
447 | return chainedCheckType;
448 | }
449 |
450 | function createPrimitiveTypeChecker(expectedType) {
451 | function validate(props, propName, componentName, location, propFullName, secret) {
452 | var propValue = props[propName];
453 | var propType = getPropType(propValue);
454 | if (propType !== expectedType) {
455 | // `propValue` being instance of, say, date/regexp, pass the 'object'
456 | // check, but we can offer a more precise error message here rather than
457 | // 'of type `object`'.
458 | var preciseType = getPreciseType(propValue);
459 |
460 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
461 | }
462 | return null;
463 | }
464 | return createChainableTypeChecker(validate);
465 | }
466 |
467 | function createAnyTypeChecker() {
468 | return createChainableTypeChecker(emptyFunction.thatReturnsNull);
469 | }
470 |
471 | function createArrayOfTypeChecker(typeChecker) {
472 | function validate(props, propName, componentName, location, propFullName) {
473 | if (typeof typeChecker !== 'function') {
474 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
475 | }
476 | var propValue = props[propName];
477 | if (!Array.isArray(propValue)) {
478 | var propType = getPropType(propValue);
479 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
480 | }
481 | for (var i = 0; i < propValue.length; i++) {
482 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
483 | if (error instanceof Error) {
484 | return error;
485 | }
486 | }
487 | return null;
488 | }
489 | return createChainableTypeChecker(validate);
490 | }
491 |
492 | function createElementTypeChecker() {
493 | function validate(props, propName, componentName, location, propFullName) {
494 | var propValue = props[propName];
495 | if (!isValidElement(propValue)) {
496 | var propType = getPropType(propValue);
497 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
498 | }
499 | return null;
500 | }
501 | return createChainableTypeChecker(validate);
502 | }
503 |
504 | function createInstanceTypeChecker(expectedClass) {
505 | function validate(props, propName, componentName, location, propFullName) {
506 | if (!(props[propName] instanceof expectedClass)) {
507 | var expectedClassName = expectedClass.name || ANONYMOUS;
508 | var actualClassName = getClassName(props[propName]);
509 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
510 | }
511 | return null;
512 | }
513 | return createChainableTypeChecker(validate);
514 | }
515 |
516 | function createEnumTypeChecker(expectedValues) {
517 | if (!Array.isArray(expectedValues)) {
518 | true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
519 | return emptyFunction.thatReturnsNull;
520 | }
521 |
522 | function validate(props, propName, componentName, location, propFullName) {
523 | var propValue = props[propName];
524 | for (var i = 0; i < expectedValues.length; i++) {
525 | if (is(propValue, expectedValues[i])) {
526 | return null;
527 | }
528 | }
529 |
530 | var valuesString = JSON.stringify(expectedValues);
531 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
532 | }
533 | return createChainableTypeChecker(validate);
534 | }
535 |
536 | function createObjectOfTypeChecker(typeChecker) {
537 | function validate(props, propName, componentName, location, propFullName) {
538 | if (typeof typeChecker !== 'function') {
539 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
540 | }
541 | var propValue = props[propName];
542 | var propType = getPropType(propValue);
543 | if (propType !== 'object') {
544 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
545 | }
546 | for (var key in propValue) {
547 | if (propValue.hasOwnProperty(key)) {
548 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
549 | if (error instanceof Error) {
550 | return error;
551 | }
552 | }
553 | }
554 | return null;
555 | }
556 | return createChainableTypeChecker(validate);
557 | }
558 |
559 | function createUnionTypeChecker(arrayOfTypeCheckers) {
560 | if (!Array.isArray(arrayOfTypeCheckers)) {
561 | true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
562 | return emptyFunction.thatReturnsNull;
563 | }
564 |
565 | function validate(props, propName, componentName, location, propFullName) {
566 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
567 | var checker = arrayOfTypeCheckers[i];
568 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
569 | return null;
570 | }
571 | }
572 |
573 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
574 | }
575 | return createChainableTypeChecker(validate);
576 | }
577 |
578 | function createNodeChecker() {
579 | function validate(props, propName, componentName, location, propFullName) {
580 | if (!isNode(props[propName])) {
581 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
582 | }
583 | return null;
584 | }
585 | return createChainableTypeChecker(validate);
586 | }
587 |
588 | function createShapeTypeChecker(shapeTypes) {
589 | function validate(props, propName, componentName, location, propFullName) {
590 | var propValue = props[propName];
591 | var propType = getPropType(propValue);
592 | if (propType !== 'object') {
593 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
594 | }
595 | for (var key in shapeTypes) {
596 | var checker = shapeTypes[key];
597 | if (!checker) {
598 | continue;
599 | }
600 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
601 | if (error) {
602 | return error;
603 | }
604 | }
605 | return null;
606 | }
607 | return createChainableTypeChecker(validate);
608 | }
609 |
610 | function isNode(propValue) {
611 | switch (typeof propValue) {
612 | case 'number':
613 | case 'string':
614 | case 'undefined':
615 | return true;
616 | case 'boolean':
617 | return !propValue;
618 | case 'object':
619 | if (Array.isArray(propValue)) {
620 | return propValue.every(isNode);
621 | }
622 | if (propValue === null || isValidElement(propValue)) {
623 | return true;
624 | }
625 |
626 | var iteratorFn = getIteratorFn(propValue);
627 | if (iteratorFn) {
628 | var iterator = iteratorFn.call(propValue);
629 | var step;
630 | if (iteratorFn !== propValue.entries) {
631 | while (!(step = iterator.next()).done) {
632 | if (!isNode(step.value)) {
633 | return false;
634 | }
635 | }
636 | } else {
637 | // Iterator will provide entry [k,v] tuples rather than values.
638 | while (!(step = iterator.next()).done) {
639 | var entry = step.value;
640 | if (entry) {
641 | if (!isNode(entry[1])) {
642 | return false;
643 | }
644 | }
645 | }
646 | }
647 | } else {
648 | return false;
649 | }
650 |
651 | return true;
652 | default:
653 | return false;
654 | }
655 | }
656 |
657 | function isSymbol(propType, propValue) {
658 | // Native Symbol.
659 | if (propType === 'symbol') {
660 | return true;
661 | }
662 |
663 | // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
664 | if (propValue['@@toStringTag'] === 'Symbol') {
665 | return true;
666 | }
667 |
668 | // Fallback for non-spec compliant Symbols which are polyfilled.
669 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
670 | return true;
671 | }
672 |
673 | return false;
674 | }
675 |
676 | // Equivalent of `typeof` but with special handling for array and regexp.
677 | function getPropType(propValue) {
678 | var propType = typeof propValue;
679 | if (Array.isArray(propValue)) {
680 | return 'array';
681 | }
682 | if (propValue instanceof RegExp) {
683 | // Old webkits (at least until Android 4.0) return 'function' rather than
684 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
685 | // passes PropTypes.object.
686 | return 'object';
687 | }
688 | if (isSymbol(propType, propValue)) {
689 | return 'symbol';
690 | }
691 | return propType;
692 | }
693 |
694 | // This handles more types than `getPropType`. Only used for error messages.
695 | // See `createPrimitiveTypeChecker`.
696 | function getPreciseType(propValue) {
697 | var propType = getPropType(propValue);
698 | if (propType === 'object') {
699 | if (propValue instanceof Date) {
700 | return 'date';
701 | } else if (propValue instanceof RegExp) {
702 | return 'regexp';
703 | }
704 | }
705 | return propType;
706 | }
707 |
708 | // Returns class name of the object, if any.
709 | function getClassName(propValue) {
710 | if (!propValue.constructor || !propValue.constructor.name) {
711 | return ANONYMOUS;
712 | }
713 | return propValue.constructor.name;
714 | }
715 |
716 | ReactPropTypes.checkPropTypes = checkPropTypes;
717 | ReactPropTypes.PropTypes = ReactPropTypes;
718 |
719 | return ReactPropTypes;
720 | };
721 |
722 | /***/ },
723 | /* 4 */
724 | /***/ function(module, exports) {
725 |
726 | "use strict";
727 |
728 | /**
729 | * Copyright (c) 2013-present, Facebook, Inc.
730 | * All rights reserved.
731 | *
732 | * This source code is licensed under the BSD-style license found in the
733 | * LICENSE file in the root directory of this source tree. An additional grant
734 | * of patent rights can be found in the PATENTS file in the same directory.
735 | *
736 | *
737 | */
738 |
739 | function makeEmptyFunction(arg) {
740 | return function () {
741 | return arg;
742 | };
743 | }
744 |
745 | /**
746 | * This function accepts and discards inputs; it has no side effects. This is
747 | * primarily useful idiomatically for overridable function endpoints which
748 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
749 | */
750 | var emptyFunction = function emptyFunction() {};
751 |
752 | emptyFunction.thatReturns = makeEmptyFunction;
753 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
754 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
755 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
756 | emptyFunction.thatReturnsThis = function () {
757 | return this;
758 | };
759 | emptyFunction.thatReturnsArgument = function (arg) {
760 | return arg;
761 | };
762 |
763 | module.exports = emptyFunction;
764 |
765 | /***/ },
766 | /* 5 */
767 | /***/ function(module, exports, __webpack_require__) {
768 |
769 | /**
770 | * Copyright (c) 2013-present, Facebook, Inc.
771 | * All rights reserved.
772 | *
773 | * This source code is licensed under the BSD-style license found in the
774 | * LICENSE file in the root directory of this source tree. An additional grant
775 | * of patent rights can be found in the PATENTS file in the same directory.
776 | *
777 | */
778 |
779 | 'use strict';
780 |
781 | /**
782 | * Use invariant() to assert state which your program assumes to be true.
783 | *
784 | * Provide sprintf-style format (only %s is supported) and arguments
785 | * to provide information about what broke and what you were
786 | * expecting.
787 | *
788 | * The invariant message will be stripped in production, but the invariant
789 | * will remain to ensure logic does not differ in production.
790 | */
791 |
792 | var validateFormat = function validateFormat(format) {};
793 |
794 | if (true) {
795 | validateFormat = function validateFormat(format) {
796 | if (format === undefined) {
797 | throw new Error('invariant requires an error message argument');
798 | }
799 | };
800 | }
801 |
802 | function invariant(condition, format, a, b, c, d, e, f) {
803 | validateFormat(format);
804 |
805 | if (!condition) {
806 | var error;
807 | if (format === undefined) {
808 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
809 | } else {
810 | var args = [a, b, c, d, e, f];
811 | var argIndex = 0;
812 | error = new Error(format.replace(/%s/g, function () {
813 | return args[argIndex++];
814 | }));
815 | error.name = 'Invariant Violation';
816 | }
817 |
818 | error.framesToPop = 1; // we don't care about invariant's own frame
819 | throw error;
820 | }
821 | }
822 |
823 | module.exports = invariant;
824 |
825 | /***/ },
826 | /* 6 */
827 | /***/ function(module, exports, __webpack_require__) {
828 |
829 | /**
830 | * Copyright 2014-2015, Facebook, Inc.
831 | * All rights reserved.
832 | *
833 | * This source code is licensed under the BSD-style license found in the
834 | * LICENSE file in the root directory of this source tree. An additional grant
835 | * of patent rights can be found in the PATENTS file in the same directory.
836 | *
837 | */
838 |
839 | 'use strict';
840 |
841 | var emptyFunction = __webpack_require__(4);
842 |
843 | /**
844 | * Similar to invariant but only logs a warning if the condition is not met.
845 | * This can be used to log issues in development environments in critical
846 | * paths. Removing the logging code for production environments will keep the
847 | * same logic and follow the same code paths.
848 | */
849 |
850 | var warning = emptyFunction;
851 |
852 | if (true) {
853 | (function () {
854 | var printWarning = function printWarning(format) {
855 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
856 | args[_key - 1] = arguments[_key];
857 | }
858 |
859 | var argIndex = 0;
860 | var message = 'Warning: ' + format.replace(/%s/g, function () {
861 | return args[argIndex++];
862 | });
863 | if (typeof console !== 'undefined') {
864 | console.error(message);
865 | }
866 | try {
867 | // --- Welcome to debugging React ---
868 | // This error was thrown as a convenience so that you can use this stack
869 | // to find the callsite that caused this warning to fire.
870 | throw new Error(message);
871 | } catch (x) {}
872 | };
873 |
874 | warning = function warning(condition, format) {
875 | if (format === undefined) {
876 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
877 | }
878 |
879 | if (format.indexOf('Failed Composite propType: ') === 0) {
880 | return; // Ignore CompositeComponent proptype check.
881 | }
882 |
883 | if (!condition) {
884 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
885 | args[_key2 - 2] = arguments[_key2];
886 | }
887 |
888 | printWarning.apply(undefined, [format].concat(args));
889 | }
890 | };
891 | })();
892 | }
893 |
894 | module.exports = warning;
895 |
896 | /***/ },
897 | /* 7 */
898 | /***/ function(module, exports) {
899 |
900 | /**
901 | * Copyright 2013-present, Facebook, Inc.
902 | * All rights reserved.
903 | *
904 | * This source code is licensed under the BSD-style license found in the
905 | * LICENSE file in the root directory of this source tree. An additional grant
906 | * of patent rights can be found in the PATENTS file in the same directory.
907 | */
908 |
909 | 'use strict';
910 |
911 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
912 |
913 | module.exports = ReactPropTypesSecret;
914 |
915 | /***/ },
916 | /* 8 */
917 | /***/ function(module, exports, __webpack_require__) {
918 |
919 | /**
920 | * Copyright 2013-present, Facebook, Inc.
921 | * All rights reserved.
922 | *
923 | * This source code is licensed under the BSD-style license found in the
924 | * LICENSE file in the root directory of this source tree. An additional grant
925 | * of patent rights can be found in the PATENTS file in the same directory.
926 | */
927 |
928 | 'use strict';
929 |
930 | if (true) {
931 | var invariant = __webpack_require__(5);
932 | var warning = __webpack_require__(6);
933 | var ReactPropTypesSecret = __webpack_require__(7);
934 | var loggedTypeFailures = {};
935 | }
936 |
937 | /**
938 | * Assert that the values match with the type specs.
939 | * Error messages are memorized and will only be shown once.
940 | *
941 | * @param {object} typeSpecs Map of name to a ReactPropType
942 | * @param {object} values Runtime values that need to be type-checked
943 | * @param {string} location e.g. "prop", "context", "child context"
944 | * @param {string} componentName Name of the component for error messages.
945 | * @param {?Function} getStack Returns the component stack.
946 | * @private
947 | */
948 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
949 | if (true) {
950 | for (var typeSpecName in typeSpecs) {
951 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
952 | var error;
953 | // Prop type validation may throw. In case they do, we don't want to
954 | // fail the render phase where it didn't fail before. So we log it.
955 | // After these have been cleaned up, we'll let them throw.
956 | try {
957 | // This is intentionally an invariant that gets caught. It's the same
958 | // behavior as without this statement except with a better message.
959 | invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
960 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
961 | } catch (ex) {
962 | error = ex;
963 | }
964 | warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
965 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
966 | // Only monitor this failure once because there tends to be a lot of the
967 | // same error.
968 | loggedTypeFailures[error.message] = true;
969 |
970 | var stack = getStack ? getStack() : '';
971 |
972 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
973 | }
974 | }
975 | }
976 | }
977 | }
978 |
979 | module.exports = checkPropTypes;
980 |
981 | /***/ },
982 | /* 9 */
983 | /***/ function(module, exports) {
984 |
985 | module.exports = __WEBPACK_EXTERNAL_MODULE_9__;
986 |
987 | /***/ },
988 | /* 10 */
989 | /***/ function(module, exports) {
990 |
991 | "use strict";
992 |
993 | if (!Object.assign) {
994 | Object.defineProperty(Object, "assign", {
995 | enumerable: false,
996 | configurable: true,
997 | writable: true,
998 | value: function value(target, firstSource) {
999 | "use strict";
1000 | if (target === undefined || target === null) throw new TypeError("Cannot convert first argument to object");
1001 |
1002 | var to = Object(target);
1003 |
1004 | var hasPendingException = false;
1005 | var pendingException;
1006 |
1007 | for (var i = 1; i < arguments.length; i++) {
1008 | var nextSource = arguments[i];
1009 | if (nextSource === undefined || nextSource === null) continue;
1010 |
1011 | var keysArray = Object.keys(Object(nextSource));
1012 | for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
1013 | var nextKey = keysArray[nextIndex];
1014 | try {
1015 | var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
1016 | if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey];
1017 | } catch (e) {
1018 | if (!hasPendingException) {
1019 | hasPendingException = true;
1020 | pendingException = e;
1021 | }
1022 | }
1023 | }
1024 |
1025 | if (hasPendingException) throw pendingException;
1026 | }
1027 | return to;
1028 | }
1029 | });
1030 | }
1031 |
1032 | /***/ }
1033 | /******/ ])
1034 | });
1035 | ;
--------------------------------------------------------------------------------