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+ var _stringifyValues = require ( '../util/stringifyValues' ) ;
26+
27+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
28+
29+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
30+
31+ 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 ; }
32+
33+ 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 ; }
34+
35+ var DashboardCardBody = function DashboardCardBody ( _ref ) {
36+ var role = _ref . role ,
37+ className = _ref . className ,
38+ children = _ref . children ;
39+ return _react2 . default . createElement (
40+ 'div' ,
41+ { role : role , className : ( 0 , _classnames2 . default ) ( className , 'form-box-body' ) } ,
42+ children
43+ ) ;
44+ } ;
45+
46+ DashboardCardBody . propTypes = {
47+ children : _propTypes2 . default . node ,
48+ className : _propTypes2 . default . string ,
49+ role : _propTypes2 . default . string
50+ } ;
51+
52+ DashboardCardBody . defaultProps = {
53+ role : 'body' ,
54+ hover : false
55+ } ;
56+
57+ var DashboardCardFooter = function DashboardCardFooter ( _ref2 ) {
58+ var role = _ref2 . role ,
59+ className = _ref2 . className ,
60+ children = _ref2 . children ;
61+ return children ? _react2 . default . createElement (
62+ 'div' ,
63+ { role : role , className : ( 0 , _classnames2 . default ) ( className , 'form-box-footer' ) } ,
64+ _react2 . default . createElement (
65+ 'ul' ,
66+ { className : 'form-box-links' } ,
67+ Array . isArray ( children ) && children . map ( function ( child , key ) {
68+ return _react2 . default . createElement (
69+ 'li' ,
70+ { key : key } ,
71+ ( 0 , _react . cloneElement ) ( child )
72+ ) ;
73+ } ) || ( 0 , _react . cloneElement ) ( children , { key : 0 } )
74+ )
75+ ) : null ;
76+ } ;
77+
78+ DashboardCardFooter . propTypes = {
79+ children : _propTypes2 . default . node ,
80+ className : _propTypes2 . default . string ,
81+ role : _propTypes2 . default . string
82+ } ;
83+
84+ DashboardCardFooter . defaultProps = {
85+ role : 'footer' ,
86+ hover : false
87+ } ;
88+
89+ var DashboardCardFilterData = function DashboardCardFilterData ( _ref3 ) {
90+ var role = _ref3 . role ,
91+ data = _ref3 . data ;
92+ return _react2 . default . createElement (
93+ 'span' ,
94+ { role : role , className : 'hide isotope-search' , 'aria-hidden' : 'true' , hidden : true } ,
95+ ( 0 , _stringifyValues . stringifyValues ) ( data )
96+ ) ;
97+ } ;
98+
99+ DashboardCardFilterData . propTypes = {
100+ role : _propTypes2 . default . string ,
101+ data : _propTypes2 . default . object
102+ } ;
103+
104+ DashboardCardFilterData . defaultProps = {
105+ role : 'filterData'
106+ } ;
107+
108+ var BODY_ROLE = DashboardCardBody . defaultProps . role ;
109+ var FOOTER_ROLE = DashboardCardFooter . defaultProps . role ;
110+
111+ var DashboardCard = function ( _React$Component ) {
112+ _inherits ( DashboardCard , _React$Component ) ;
113+
114+ function DashboardCard ( ) {
115+ _classCallCheck ( this , DashboardCard ) ;
116+
117+ return _possibleConstructorReturn ( this , ( DashboardCard . __proto__ || Object . getPrototypeOf ( DashboardCard ) ) . apply ( this , arguments ) ) ;
118+ }
119+
120+ _createClass ( DashboardCard , [ {
121+ key : 'render' ,
122+ value : function render ( ) {
123+ var _props = this . props ,
124+ className = _props . className ,
125+ children = _props . children ,
126+ data = _props . data ;
127+
128+
129+ return _react2 . default . createElement (
130+ _Card2 . default ,
131+ { className : ( 0 , _classnames2 . default ) ( className , 'form-box-container' ) } ,
132+ _react2 . default . createElement (
133+ _Card2 . default . Body ,
134+ { className : 'form-box' } ,
135+ children && ( Array . isArray ( children ) && children . map ( function ( child , key ) {
136+ switch ( child . props . role ) {
137+ case BODY_ROLE :
138+ case FOOTER_ROLE :
139+ return ( 0 , _react . cloneElement ) ( child , { key : key } ) ;
140+ default :
141+ return child ;
142+ }
143+ } ) || ( 0 , _react . cloneElement ) ( children ) ) ,
144+ data && _react2 . default . createElement ( DashboardCardFilterData , { data : data } )
145+ )
146+ ) ;
147+ }
148+ } ] ) ;
149+
150+ return DashboardCard ;
151+ } ( _react2 . default . Component ) ;
152+
153+ DashboardCard . propTypes = {
154+ children : _propTypes2 . default . node ,
155+ className : _propTypes2 . default . string ,
156+ data : _propTypes2 . default . object
157+ } ;
158+
159+ DashboardCard . Body = DashboardCardBody ;
160+ DashboardCard . Footer = DashboardCardFooter ;
161+
162+ exports . default = DashboardCard ;
0 commit comments