styled-components
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -11,4 +11,2 @@ 'use strict'; | ||
var _HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig'); | ||
var _ComponentStyle = require('../models/ComponentStyle'); | ||
@@ -18,2 +16,6 @@ | ||
var _validAttr = require('../utils/validAttr'); | ||
var _validAttr2 = _interopRequireDefault(_validAttr); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -64,2 +66,3 @@ | ||
} | ||
/* eslint-disable react/prop-types */ | ||
@@ -76,10 +79,7 @@ | ||
// const contextForStyles | ||
var propsForElement = {}; | ||
/* Don't pass through non HTML tags through to HTML elements */ | ||
Object.keys(this.props).filter(function (propName) { | ||
return ( | ||
/* Don't pass through non HTML tags through to HTML elements */ | ||
!isTag || _HTMLDOMPropertyConfig.Properties[propName] !== undefined | ||
); | ||
return !isTag || (0, _validAttr2.default)(propName); | ||
}).forEach(function (propName) { | ||
@@ -86,0 +86,0 @@ propsForElement[propName] = _this3.props[propName]; |
{ | ||
"name": "styled-components", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
// @flow | ||
import { Component, createElement, PropTypes } from 'react' | ||
import { Properties as ValidAttrs } from 'react/lib/HTMLDOMPropertyConfig' | ||
import type RuleSet from '../utils/flatten' | ||
import ComponentStyle from '../models/ComponentStyle' | ||
import validAttr from '../utils/validAttr' | ||
import type RuleSet from '../utils/flatten' | ||
export default (tagName: any, rules: RuleSet) => { | ||
@@ -19,5 +20,7 @@ const isTag = typeof tagName === 'string' | ||
} | ||
componentWillMount() { | ||
this.componentWillReceiveProps(this.props, this.context) | ||
} | ||
componentWillReceiveProps(newProps: Object, newContext: ?any) { | ||
@@ -33,2 +36,3 @@ this.theme = newContext ? newContext.theme : {} // pass through theme | ||
} | ||
/* eslint-disable react/prop-types */ | ||
@@ -38,10 +42,9 @@ render() { | ||
// const contextForStyles | ||
const propsForElement = {} | ||
Object.keys(this.props).filter(propName => ( | ||
/* Don't pass through non HTML tags through to HTML elements */ | ||
!isTag || ValidAttrs[propName] !== undefined | ||
)).forEach(propName => { | ||
propsForElement[propName] = this.props[propName] | ||
}) | ||
/* Don't pass through non HTML tags through to HTML elements */ | ||
Object.keys(this.props) | ||
.filter(propName => !isTag || validAttr(propName)) | ||
.forEach(propName => { | ||
propsForElement[propName] = this.props[propName] | ||
}) | ||
propsForElement.className = [className, this.generatedClassName].filter(x => x).join(' ') | ||
@@ -48,0 +51,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
493935
100
12313