@@ -157,6 +157,7 @@ function renderSliders(inputRange) {
157157 ariaLabelledby : inputRange . props . ariaLabelledby ,
158158 ariaControls : inputRange . props . ariaControls ,
159159 classNames : classNames ,
160+ formatLabel : inputRange . formatLabel ,
160161 key : key ,
161162 maxValue : maxValue ,
162163 minValue : minValue ,
@@ -231,7 +232,7 @@ var InputRange = (function (_React$Component) {
231232
232233 internals . set ( this , { } ) ;
233234
234- ( 0 , _util . autobind ) ( [ 'handleInteractionEnd' , 'handleInteractionStart' , 'handleKeyDown' , 'handleKeyUp' , 'handleMouseDown' , 'handleMouseUp' , 'handleSliderKeyDown' , 'handleSliderMouseMove' , 'handleTouchStart' , 'handleTouchEnd' , 'handleTrackMouseDown' ] , this ) ;
235+ ( 0 , _util . autobind ) ( [ 'formatLabel' , ' handleInteractionEnd', 'handleInteractionStart' , 'handleKeyDown' , 'handleKeyUp' , 'handleMouseDown' , 'handleMouseUp' , 'handleSliderKeyDown' , 'handleSliderMouseMove' , 'handleTouchStart' , 'handleTouchEnd' , 'handleTrackMouseDown' ] , this ) ;
235236 }
236237
237238 _createClass ( InputRange , [ {
@@ -297,6 +298,20 @@ var InputRange = (function (_React$Component) {
297298
298299 this . updateValue ( key , value ) ;
299300 }
301+ } , {
302+ key : 'formatLabel' ,
303+ value : function formatLabel ( labelValue ) {
304+ var _props = this . props ;
305+ var formatLabel = _props . formatLabel ;
306+ var labelPrefix = _props . labelPrefix ;
307+ var labelSuffix = _props . labelSuffix ;
308+
309+ if ( formatLabel ) {
310+ return formatLabel ( labelValue , { labelPrefix : labelPrefix , labelSuffix : labelSuffix } ) ;
311+ }
312+
313+ return '' + labelPrefix + labelValue + labelSuffix ;
314+ }
300315 } , {
301316 key : 'handleSliderMouseMove' ,
302317 value : function handleSliderMouseMove ( event , slider ) {
@@ -443,7 +458,8 @@ var InputRange = (function (_React$Component) {
443458 _Label2 [ 'default' ] ,
444459 {
445460 className : classNames . labelMin ,
446- containerClassName : classNames . labelContainer } ,
461+ containerClassName : classNames . labelContainer ,
462+ formatLabel : this . formatLabel } ,
447463 this . props . minValue
448464 ) ,
449465 _react2 [ 'default' ] . createElement (
@@ -459,7 +475,8 @@ var InputRange = (function (_React$Component) {
459475 _Label2 [ 'default' ] ,
460476 {
461477 className : classNames . labelMax ,
462- containerClassName : classNames . labelContainer } ,
478+ containerClassName : classNames . labelContainer ,
479+ formatLabel : this . formatLabel } ,
463480 this . props . maxValue
464481 ) ,
465482 renderHiddenInputs ( this )
@@ -499,6 +516,9 @@ InputRange.propTypes = {
499516 classNames : _react2 [ 'default' ] . PropTypes . objectOf ( _react2 [ 'default' ] . PropTypes . string ) ,
500517 defaultValue : _propTypes . maxMinValuePropType ,
501518 disabled : _react2 [ 'default' ] . PropTypes . bool ,
519+ formatLabel : _react2 [ 'default' ] . PropTypes . func ,
520+ labelPrefix : _react2 [ 'default' ] . PropTypes . string ,
521+ labelSuffix : _react2 [ 'default' ] . PropTypes . string ,
502522 maxValue : _propTypes . maxMinValuePropType ,
503523 minValue : _propTypes . maxMinValuePropType ,
504524 name : _react2 [ 'default' ] . PropTypes . string ,
@@ -512,6 +532,8 @@ InputRange.defaultProps = {
512532 classNames : _defaultClassNames2 [ 'default' ] ,
513533 defaultValue : 0 ,
514534 disabled : false ,
535+ labelPrefix : '' ,
536+ labelSuffix : '' ,
515537 maxValue : 10 ,
516538 minValue : 0 ,
517539 step : 1 ,
@@ -558,13 +580,15 @@ var Label = (function (_React$Component) {
558580 var className = _props . className ;
559581 var containerClassName = _props . containerClassName ;
560582
583+ var labelValue = this . props . formatLabel ? this . props . formatLabel ( this . props . children ) : this . props . children ;
584+
561585 return _react2 [ 'default' ] . createElement (
562586 'span' ,
563587 { className : className } ,
564588 _react2 [ 'default' ] . createElement (
565589 'span' ,
566590 { className : containerClassName } ,
567- this . props . children
591+ labelValue
568592 )
569593 ) ;
570594 }
@@ -578,7 +602,8 @@ exports['default'] = Label;
578602Label . propTypes = {
579603 children : _react2 [ 'default' ] . PropTypes . node ,
580604 className : _react2 [ 'default' ] . PropTypes . string ,
581- containerClassName : _react2 [ 'default' ] . PropTypes . string
605+ containerClassName : _react2 [ 'default' ] . PropTypes . string ,
606+ formatLabel : _react2 [ 'default' ] . PropTypes . func
582607} ;
583608module . exports = exports [ 'default' ] ;
584609
@@ -710,7 +735,8 @@ var Slider = (function (_React$Component) {
710735 _Label2 [ 'default' ] ,
711736 {
712737 className : classNames . labelValue ,
713- containerClassName : classNames . labelContainer } ,
738+ containerClassName : classNames . labelContainer ,
739+ formatLabel : this . props . formatLabel } ,
714740 this . props . value
715741 ) ,
716742 _react2 [ 'default' ] . createElement ( 'a' , {
@@ -740,6 +766,7 @@ Slider.propTypes = {
740766 ariaLabelledby : _react2 [ 'default' ] . PropTypes . string ,
741767 ariaControls : _react2 [ 'default' ] . PropTypes . string ,
742768 classNames : _react2 [ 'default' ] . PropTypes . objectOf ( _react2 [ 'default' ] . PropTypes . string ) ,
769+ formatLabel : _react2 [ 'default' ] . PropTypes . func ,
743770 maxValue : _react2 [ 'default' ] . PropTypes . number ,
744771 minValue : _react2 [ 'default' ] . PropTypes . number ,
745772 onSliderKeyDown : _react2 [ 'default' ] . PropTypes . func . isRequired ,
@@ -933,6 +960,20 @@ function maxMinValuePropType(props) {
933960Object . defineProperty ( exports , '__esModule' , {
934961 value : true
935962} ) ;
963+ exports . clamp = clamp ;
964+ exports . extend = extend ;
965+ exports . includes = includes ;
966+ exports . omit = omit ;
967+ exports . captialize = captialize ;
968+ exports . distanceTo = distanceTo ;
969+ exports . length = length ;
970+ exports . isNumber = isNumber ;
971+ exports . isObject = isObject ;
972+ exports . isDefined = isDefined ;
973+ exports . isEmpty = isEmpty ;
974+ exports . arrayOf = arrayOf ;
975+ exports . objectOf = objectOf ;
976+ exports . autobind = autobind ;
936977
937978function clamp ( value , min , max ) {
938979 return Math . min ( Math . max ( value , min ) , max ) ;
@@ -1033,23 +1074,6 @@ function autobind(methodNames, instance) {
10331074 } ) ;
10341075}
10351076
1036- exports [ 'default' ] = {
1037- arrayOf : arrayOf ,
1038- autobind : autobind ,
1039- captialize : captialize ,
1040- clamp : clamp ,
1041- distanceTo : distanceTo ,
1042- extend : extend ,
1043- isDefined : isDefined ,
1044- isEmpty : isEmpty ,
1045- isNumber : isNumber ,
1046- isObject : isObject ,
1047- length : length ,
1048- objectOf : objectOf ,
1049- omit : omit
1050- } ;
1051- module . exports = exports [ 'default' ] ;
1052-
10531077} , { } ] , 8 :[ function ( require , module , exports ) {
10541078'use strict' ;
10551079
0 commit comments