<filename>node_modules/.cache/babel-loader/7a2da789fd641e4b944c3b39f66ef526.json
{"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports['default'] = injectSheet;\n\nvar _hoistNonReactStatics = require('hoist-non-react-statics');\n\nvar _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);\n\nvar _createHoc = require('./createHoc');\n\nvar _createHoc2 = _interopRequireDefault(_createHoc);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : {\n    'default': obj\n  };\n}\n/**\n * Global index counter to preserve source order.\n * As we create the style sheet during componentWillMount lifecycle,\n * children are handled after the parents, so the order of style elements would\n * be parent->child. It is a problem though when a parent passes a className\n * which needs to override any childs styles. StyleSheet of the child has a higher\n * specificity, because of the source order.\n * So our solution is to render sheets them in the reverse order child->sheet, so\n * that parent has a higher specificity.\n *\n * @type {Number}\n */\n\n\nvar indexCounter = -100000;\n\nvar NoRenderer = function NoRenderer(_ref) {\n  var children = _ref.children;\n  return children || null;\n};\n/**\n * HOC creator function that wrapps the user component.\n *\n * `injectSheet(styles, [options])(Component)`\n *\n * @api public\n */\n\n\nfunction injectSheet(stylesOrSheet) {\n  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n  if (options.index === undefined) {\n    options.index = indexCounter++;\n  }\n\n  return function () {\n    var InnerComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NoRenderer;\n    var Jss = (0, _createHoc2['default'])(stylesOrSheet, InnerComponent, options);\n    return (0, _hoistNonReactStatics2['default'])(Jss, InnerComponent, {\n      inner: true\n    });\n  };\n}","map":null,"metadata":{},"sourceType":"script"}