'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _react3 = require('talend-icons/dist/react');

var _react4 = _interopRequireDefault(_react3);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * If you want to use Icon with SVG you have to load this
 * component in your app.
 * If you don't pass any props you will have our default
 * iconset (please look at talend-icons in that case)
 * @param {object} props react props
 * @example
<IconsProvider />
 */
function IconsProvider(_ref) {
	var defaultIcons = _ref.defaultIcons,
	    icons = _ref.icons;

	var iconset = _extends({}, defaultIcons, icons);
	var ids = Object.keys(iconset);
	var style = { display: 'none' };
	return _react2.default.createElement(
		'svg',
		{ xmlns: 'http://www.w3.org/2000/svg', focusable: 'false', style: style },
		ids.map(function (id, index) {
			return _react2.default.createElement(
				'symbol',
				{ key: index, id: id },
				iconset[id]
			);
		})
	);
}

IconsProvider.propTypes = {
	defaultIcons: _react.PropTypes.object, // eslint-disable-line react/forbid-prop-types
	icons: _react.PropTypes.object // eslint-disable-line react/forbid-prop-types
};

IconsProvider.defaultProps = {
	defaultIcons: _react4.default,
	icons: {}
};

exports.default = IconsProvider;