1+ 'use strict' ;
2+
3+ Object . defineProperty ( exports , "__esModule" , {
4+ value : true
5+ } ) ;
6+
7+ 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 ; } ; } ( ) ;
8+
9+ var _react = require ( 'react' ) ;
10+
11+ var _react2 = _interopRequireDefault ( _react ) ;
12+
13+ var _propTypes = require ( 'prop-types' ) ;
14+
15+ var _propTypes2 = _interopRequireDefault ( _propTypes ) ;
16+
17+ var _classnames = require ( 'classnames' ) ;
18+
19+ var _classnames2 = _interopRequireDefault ( _classnames ) ;
20+
21+ var _Card = require ( '../Card/Card' ) ;
22+
23+ var _Card2 = _interopRequireDefault ( _Card ) ;
24+
25+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
26+
27+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
28+
29+ function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
30+
31+ 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 ; }
32+
33+ var DashboardCardBody = function DashboardCardBody ( _ref ) {
34+ var role = _ref . role ,
35+ className = _ref . className ,
36+ children = _ref . children ;
37+ return _react2 . default . createElement (
38+ 'div' ,
39+ { role : role , className : ( 0 , _classnames2 . default ) ( className , 'form-box-body' ) } ,
40+ children
41+ ) ;
42+ } ;
43+
44+ DashboardCardBody . propTypes = {
45+ children : _propTypes2 . default . node ,
46+ className : _propTypes2 . default . string ,
47+ role : _propTypes2 . default . string
48+ } ;
49+
50+ DashboardCardBody . defaultProps = {
51+ role : 'body' ,
52+ hover : false
53+ } ;
54+
55+ var DashboardCardFooter = function DashboardCardFooter ( _ref2 ) {
56+ var role = _ref2 . role ,
57+ className = _ref2 . className ,
58+ children = _ref2 . children ;
59+ return children ? _react2 . default . createElement (
60+ 'div' ,
61+ { role : role , className : ( 0 , _classnames2 . default ) ( className , 'form-box-footer' ) } ,
62+ _react2 . default . createElement (
63+ 'ul' ,
64+ { className : 'form-box-links' } ,
65+ Array . isArray ( children ) && children . map ( function ( child , key ) {
66+ return _react2 . default . createElement (
67+ 'li' ,
68+ { key : key } ,
69+ undefined . renderChild ( child )
70+ ) ;
71+ } ) || undefined . renderChild ( children , 0 )
72+ )
73+ ) : null ;
74+ } ;
75+
76+ DashboardCardFooter . propTypes = {
77+ children : _propTypes2 . default . node ,
78+ className : _propTypes2 . default . string ,
79+ role : _propTypes2 . default . string
80+ } ;
81+
82+ DashboardCardFooter . defaultProps = {
83+ role : 'footer' ,
84+ hover : false
85+ } ;
86+
87+ var BODY_ROLE = DashboardCardBody . defaultProps . role ;
88+ var FOOTER_ROLE = DashboardCardFooter . defaultProps . role ;
89+
90+ var DashboardCard = function ( _React$Component ) {
91+ _inherits ( DashboardCard , _React$Component ) ;
92+
93+ function DashboardCard ( ) {
94+ _classCallCheck ( this , DashboardCard ) ;
95+
96+ return _possibleConstructorReturn ( this , ( DashboardCard . __proto__ || Object . getPrototypeOf ( DashboardCard ) ) . apply ( this , arguments ) ) ;
97+ }
98+
99+ _createClass ( DashboardCard , [ {
100+ key : 'render' ,
101+ value : function render ( ) {
102+ var _this2 = this ;
103+
104+ var _props = this . props ,
105+ className = _props . className ,
106+ children = _props . children ,
107+ cardStyle = _props . cardStyle ;
108+
109+
110+ return _react2 . default . createElement (
111+ _Card2 . default ,
112+ { className : ( 0 , _classnames2 . default ) ( className , 'form-box' ) , cardStyle : cardStyle } ,
113+ _react2 . default . createElement (
114+ _Card2 . default . Body ,
115+ null ,
116+ children && ( Array . isArray ( children ) && children . map ( function ( child , key ) {
117+ switch ( child . props . role ) {
118+ case BODY_ROLE :
119+ case FOOTER_ROLE :
120+ return _this2 . renderChild ( child , key ) ;
121+ default :
122+ return child ;
123+ }
124+ } ) || this . renderChild ( children , 0 ) )
125+ )
126+ ) ;
127+ }
128+ } ] ) ;
129+
130+ return DashboardCard ;
131+ } ( _react2 . default . Component ) ;
132+
133+ DashboardCard . propTypes = {
134+ children : _propTypes2 . default . node ,
135+ className : _propTypes2 . default . string ,
136+ cardStyle : _propTypes2 . default . object
137+ } ;
138+
139+ DashboardCard . Body = DashboardCardBody ;
140+ DashboardCard . Footer = DashboardCardFooter ;
141+
142+ exports . default = DashboardCard ;
0 commit comments