@@ -9,80 +9,80 @@ Neither the name of salesforce.com, inc. nor the names of its contributors may b
99THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1010*/
1111
12- ' use strict' ;
12+ " use strict" ;
1313
1414var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
1515
16- 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 ; } ; } ) ( ) ;
16+ 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 ; } ; } ) ( ) ;
1717
18- var _get = function get ( _x , _x2 , _x3 ) { var _again = true ; _function: while ( _again ) { var object = _x , property = _x2 , receiver = _x3 ; _again = false ; if ( object === null ) object = Function . prototype ; var desc = Object . getOwnPropertyDescriptor ( object , property ) ; if ( desc === undefined ) { var parent = Object . getPrototypeOf ( object ) ; if ( parent === null ) { return undefined ; } else { _x = parent ; _x2 = property ; _x3 = receiver ; _again = true ; desc = parent = undefined ; continue _function; } } else if ( ' value' in desc ) { return desc . value ; } else { var getter = desc . get ; if ( getter === undefined ) { return undefined ; } return getter . call ( receiver ) ; } } } ;
18+ var _get = function get ( _x , _x2 , _x3 ) { var _again = true ; _function: while ( _again ) { var object = _x , property = _x2 , receiver = _x3 ; desc = parent = getter = undefined ; _again = false ; if ( object === null ) object = Function . prototype ; var desc = Object . getOwnPropertyDescriptor ( object , property ) ; if ( desc === undefined ) { var parent = Object . getPrototypeOf ( object ) ; if ( parent === null ) { return undefined ; } else { _x = parent ; _x2 = property ; _x3 = receiver ; _again = true ; continue _function; } } else if ( " value" in desc ) { return desc . value ; } else { var getter = desc . get ; if ( getter === undefined ) { return undefined ; } return getter . call ( receiver ) ; } } } ;
1919
20- function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { ' default' : obj } ; }
20+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { " default" : obj } ; }
2121
2222function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
2323
24- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( ' Cannot call a class as a function' ) ; } }
24+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( " Cannot call a class as a function" ) ; } }
2525
26- 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 ; }
26+ 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 ; }
2727
28- var _react = require ( ' react' ) ;
28+ var _react = require ( " react" ) ;
2929
3030var _react2 = _interopRequireDefault ( _react ) ;
3131
32- var _utilsCreateChainedFunction = require ( ' ../utils/create-chained-function' ) ;
32+ var _utilsCreateChainedFunction = require ( " ../utils/create-chained-function" ) ;
3333
3434var _utilsCreateChainedFunction2 = _interopRequireDefault ( _utilsCreateChainedFunction ) ;
3535
36- var _SLDSIconsJs = require ( ' ../SLDSIcons.js' ) ;
36+ var _SLDSIconsJs = require ( " ../SLDSIcons.js" ) ;
3737
38- var _lodashOmit = require ( ' lodash.omit' ) ;
38+ var _lodashOmit = require ( " lodash.omit" ) ;
3939
4040var _lodashOmit2 = _interopRequireDefault ( _lodashOmit ) ;
4141
42- var classNames = require ( ' classnames' ) ;
42+ var classNames = require ( " classnames" ) ;
4343
4444var Button = ( function ( _React$Component ) {
4545 _inherits ( Button , _React$Component ) ;
4646
4747 function Button ( props ) {
4848 _classCallCheck ( this , Button ) ;
4949
50- _get ( Object . getPrototypeOf ( Button . prototype ) , ' constructor' , this ) . call ( this , props ) ;
51- this . displayName = ' SLDSButton' ;
50+ _get ( Object . getPrototypeOf ( Button . prototype ) , " constructor" , this ) . call ( this , props ) ;
51+ this . displayName = " SLDSButton" ;
5252 this . state = { active : false } ;
5353 }
5454
5555 _createClass ( Button , [ {
56- key : ' componentWillMount' ,
56+ key : " componentWillMount" ,
5757 value : function componentWillMount ( ) {
5858 /*===============================
59- TODO: refactor so that React doesn' t throw warnings in console
59+ TODO: refactor so that React doesn" t throw warnings in console
6060 for (var key in this.props) {
61- if(this.props.hasOwnProperty(key) && typeof(this.props[key]) === ' string' && key !== ' label' ){
61+ if(this.props.hasOwnProperty(key) && typeof(this.props[key]) === " string" && key !== " label" ){
6262 this.props[key] = this.props[key].toLowerCase();
6363 }
6464 }
6565 ===============================*/
6666 }
6767 } , {
68- key : ' onClick' ,
69- value : function onClick ( e ) {
68+ key : " onClick" ,
69+ value : function onClick ( ) {
7070 this . setState ( { active : ! this . state . active } ) ;
7171 }
7272 } , {
73- key : ' getClassName' ,
73+ key : " getClassName" ,
7474 value : function getClassName ( ) {
7575 var _classNames ;
7676
7777 var isSelected = this . props . stateful && this . state . active ? true : false ;
7878 var notSelected = this . props . stateful && ! this . state . active ? true : false ;
79- return classNames ( this . props . className , ' slds-button' , ( _classNames = { } , _defineProperty ( _classNames , ' slds-button--' + this . props . variant , this . props . variant ) , _defineProperty ( _classNames , ' slds-button--icon-' + this . props . iconVariant , this . props . iconVariant ) , _defineProperty ( _classNames , ' slds-max-small-button--stretch' , this . props . responsive ) , _defineProperty ( _classNames , ' slds-not-selected' , notSelected ) , _defineProperty ( _classNames , ' slds-is-selected' , isSelected ) , _defineProperty ( _classNames , ' slds-button--icon-inverse' , this . props . inverse ) , _classNames ) ) ;
79+ return classNames ( this . props . className , " slds-button" , ( _classNames = { } , _defineProperty ( _classNames , " slds-button--" + this . props . variant , this . props . variant ) , _defineProperty ( _classNames , " slds-button--icon-" + this . props . iconVariant , this . props . iconVariant ) , _defineProperty ( _classNames , " slds-max-small-button--stretch" , this . props . responsive ) , _defineProperty ( _classNames , " slds-not-selected" , notSelected ) , _defineProperty ( _classNames , " slds-is-selected" , isSelected ) , _defineProperty ( _classNames , " slds-button--icon-inverse" , this . props . inverse ) , _classNames ) ) ;
8080 }
8181 } , {
82- key : ' renderIcon' ,
82+ key : " renderIcon" ,
8383 value : function renderIcon ( name ) {
8484 if ( this . props . iconName || this . props . notSelectedIcon || this . props . selectedIcon || this . props . selectedFocusIcon ) {
85- return _react2 [ ' default' ] . createElement ( _SLDSIconsJs . ButtonIcon , {
85+ return _react2 [ " default" ] . createElement ( _SLDSIconsJs . ButtonIcon , {
8686 variant : this . props . variant ,
8787 disabled : this . props . disabled ,
8888 inverse : this . props . inverse ,
@@ -95,64 +95,64 @@ var Button = (function (_React$Component) {
9595 }
9696 }
9797 } , {
98- key : ' renderIconMore' ,
98+ key : " renderIconMore" ,
9999 value : function renderIconMore ( ) {
100- if ( this . props . iconVariant === ' more' ) {
101- return _react2 [ ' default' ] . createElement ( _SLDSIconsJs . ButtonIcon , {
100+ if ( this . props . iconVariant === " more" ) {
101+ return _react2 [ " default" ] . createElement ( _SLDSIconsJs . ButtonIcon , {
102102 variant : this . props . variant ,
103103 disabled : this . props . disabled ,
104104 inverse : this . props . inverse ,
105- name : ' down' ,
106- size : ' x-small'
105+ name : " down" ,
106+ size : " x-small"
107107 } ) ;
108108 }
109109 }
110110 } , {
111- key : ' render' ,
111+ key : " render" ,
112112 value : function render ( ) {
113- var props = ( 0 , _lodashOmit2 [ ' default' ] ) ( this . props , ' className' ) ;
114- var click = ( 0 , _utilsCreateChainedFunction2 [ ' default' ] ) ( this . props . onClick , this . onClick . bind ( this ) ) ;
115- var labelClasses = this . props . variant === ' icon' ? ' slds-assistive-text' : '' ;
113+ var props = ( 0 , _lodashOmit2 [ " default" ] ) ( this . props , " className" ) ;
114+ var click = ( 0 , _utilsCreateChainedFunction2 [ " default" ] ) ( this . props . onClick , this . onClick . bind ( this ) ) ;
115+ var labelClasses = this . props . variant === " icon" ? " slds-assistive-text" : "" ;
116116 if ( this . props . disabled ) {
117- props [ ' disabled' ] = ' disabled' ;
117+ props [ " disabled" ] = " disabled" ;
118118 } ;
119119
120120 if ( this . props . stateful ) {
121- return _react2 [ ' default' ] . createElement (
122- ' button' ,
121+ return _react2 [ " default" ] . createElement (
122+ " button" ,
123123 _extends ( { tabIndex : this . props . tabindex , className : this . getClassName ( ) } , props , { onClick : click } ) ,
124- _react2 [ ' default' ] . createElement (
125- ' span' ,
126- { className : ' slds-text-not-selected' } ,
124+ _react2 [ " default" ] . createElement (
125+ " span" ,
126+ { className : " slds-text-not-selected" } ,
127127 this . renderIcon ( this . props . notSelectedIcon ) ,
128128 this . props . notSelectedLabel
129129 ) ,
130- _react2 [ ' default' ] . createElement (
131- ' span' ,
132- { className : ' slds-text-selected' } ,
130+ _react2 [ " default" ] . createElement (
131+ " span" ,
132+ { className : " slds-text-selected" } ,
133133 this . renderIcon ( this . props . selectedIcon ) ,
134134 this . props . selectedLabel
135135 ) ,
136- _react2 [ ' default' ] . createElement (
137- ' span' ,
138- { className : ' slds-text-selected-focus' } ,
136+ _react2 [ " default" ] . createElement (
137+ " span" ,
138+ { className : " slds-text-selected-focus" } ,
139139 this . renderIcon ( this . props . selectedFocusIcon ) ,
140140 this . props . selectedFocusLabel
141141 )
142142 ) ;
143143 } else {
144- return _react2 [ ' default' ] . createElement (
145- ' button' ,
144+ return _react2 [ " default" ] . createElement (
145+ " button" ,
146146 _extends ( { tabIndex : this . props . tabindex , className : this . getClassName ( ) } , props , { onClick : click } ) ,
147- this . props . iconPosition === ' right' ? _react2 [ ' default' ] . createElement (
148- ' span' ,
147+ this . props . iconPosition === " right" ? _react2 [ " default" ] . createElement (
148+ " span" ,
149149 { className : labelClasses } ,
150150 this . props . label
151151 ) : null ,
152152 this . renderIcon ( this . props . iconName ) ,
153153 this . renderIconMore ( ) ,
154- this . props . iconPosition === ' left' || ! this . props . iconPosition ? _react2 [ ' default' ] . createElement (
155- ' span' ,
154+ this . props . iconPosition === " left" || ! this . props . iconPosition ? _react2 [ " default" ] . createElement (
155+ " span" ,
156156 { className : labelClasses } ,
157157 this . props . label
158158 ) : null ,
@@ -163,22 +163,22 @@ var Button = (function (_React$Component) {
163163 } ] ) ;
164164
165165 return Button ;
166- } ) ( _react2 [ ' default' ] . Component ) ;
166+ } ) ( _react2 [ " default" ] . Component ) ;
167167
168168Button . propTypes = {
169- label : _react2 [ ' default' ] . PropTypes . string . isRequired ,
170- variant : _react2 [ ' default' ] . PropTypes . oneOf ( [ ' base' , ' neutral' , ' brand' , ' destructive' , ' icon' ] ) ,
171- tabindex : _react2 [ ' default' ] . PropTypes . string ,
172- disabled : _react2 [ ' default' ] . PropTypes . bool ,
173- inverse : _react2 [ ' default' ] . PropTypes . bool ,
174- hint : _react2 [ ' default' ] . PropTypes . bool ,
175- stateful : _react2 [ ' default' ] . PropTypes . bool ,
176- responsive : _react2 [ ' default' ] . PropTypes . bool ,
177- iconName : _react2 [ ' default' ] . PropTypes . string ,
178- iconVariant : _react2 [ ' default' ] . PropTypes . oneOf ( [ ' bare' , ' container' , ' border' , ' border-filled' , ' small' , ' more' ] ) ,
179- iconSize : _react2 [ ' default' ] . PropTypes . oneOf ( [ ' x-small' , ' small' , ' medium' , ' large' ] ) ,
180- iconPosition : _react2 [ ' default' ] . PropTypes . oneOf ( [ ' left' , ' right' ] ) ,
181- onClick : _react2 [ ' default' ] . PropTypes . func
169+ label : _react2 [ " default" ] . PropTypes . string . isRequired ,
170+ variant : _react2 [ " default" ] . PropTypes . oneOf ( [ " base" , " neutral" , " brand" , " destructive" , " icon" ] ) ,
171+ tabindex : _react2 [ " default" ] . PropTypes . string ,
172+ disabled : _react2 [ " default" ] . PropTypes . bool ,
173+ inverse : _react2 [ " default" ] . PropTypes . bool ,
174+ hint : _react2 [ " default" ] . PropTypes . bool ,
175+ stateful : _react2 [ " default" ] . PropTypes . bool ,
176+ responsive : _react2 [ " default" ] . PropTypes . bool ,
177+ iconName : _react2 [ " default" ] . PropTypes . string ,
178+ iconVariant : _react2 [ " default" ] . PropTypes . oneOf ( [ " bare" , " container" , " border" , " border-filled" , " small" , " more" ] ) ,
179+ iconSize : _react2 [ " default" ] . PropTypes . oneOf ( [ " x-small" , " small" , " medium" , " large" ] ) ,
180+ iconPosition : _react2 [ " default" ] . PropTypes . oneOf ( [ " left" , " right" ] ) ,
181+ onClick : _react2 [ " default" ] . PropTypes . func
182182} ;
183183
184184module . exports = Button ;
0 commit comments