1
1
/**
2
2
* @copyright © 2015, Rick Wong. All rights reserved.
3
3
*/
4
- var React = require ( "react" ) ;
5
-
4
+ var React = require ( "react" ) ;
5
+ var assign = React . __spread ;
6
6
var refCounter = 0 ;
7
7
8
8
/**
@@ -11,11 +11,11 @@ var refCounter = 0;
11
11
var InlineCss = React . createClass ( {
12
12
displayName : "InlineCss" ,
13
13
propTypes : {
14
+ namespace : React . PropTypes . string ,
14
15
componentName : React . PropTypes . string ,
15
- className : React . PropTypes . string ,
16
- namespace : React . PropTypes . string ,
17
- stylesheet : React . PropTypes . string . isRequired ,
18
- wrapper : React . PropTypes . string
16
+ stylesheet : React . PropTypes . string . isRequired ,
17
+ className : React . PropTypes . string ,
18
+ wrapper : React . PropTypes . string
19
19
} ,
20
20
_transformSheet : function ( stylesheet , componentName , namespace ) {
21
21
return stylesheet .
@@ -30,15 +30,22 @@ var InlineCss = React.createClass({
30
30
) ;
31
31
} ,
32
32
render : function ( ) {
33
- var componentName = this . props . componentName || "&" ;
34
- var className = this . props . className ;
35
33
var namespace = this . props . namespace || "InlineCss-" + refCounter ++ ;
34
+ var componentName = this . props . componentName || "&" ;
36
35
var stylesheet = this . _transformSheet ( this . props . stylesheet , componentName , namespace ) ;
37
36
var Wrapper = this . props . wrapper || "div" ;
38
37
38
+ var wrapperProps = assign ( { } , this . props , {
39
+ namespace : undefined ,
40
+ componentName : undefined ,
41
+ stylesheet : undefined ,
42
+ wrapper : undefined ,
43
+ id : namespace
44
+ } ) ;
45
+
39
46
return React . createElement (
40
47
Wrapper ,
41
- { id : namespace , className : className } ,
48
+ wrapperProps ,
42
49
this . props . children ,
43
50
React . createElement ( "style" , {
44
51
scoped : true ,
0 commit comments