@@ -32,11 +32,39 @@ var RadioGroup = (function (_React$Component) {
3232 _createClass ( RadioGroup , null , [ {
3333 key : 'propTypes' ,
3434 value : {
35+ /**
36+ * The name that will be applied to all radio buttons inside it.
37+ */
3538 name : _react2 [ 'default' ] . PropTypes . string . isRequired ,
36- value : _react2 [ 'default' ] . PropTypes . string ,
39+
40+ /**
41+ * Sets the default radio button to be the one whose
42+ * value matches defaultValue (case-sensitive).
43+ * This will override any individual radio button with
44+ * the defaultChecked or checked property stated.
45+ */
3746 defaultValue : _react2 [ 'default' ] . PropTypes . string ,
47+
48+ /**
49+ * The value of the currently selected radio button.
50+ */
51+ value : _react2 [ 'default' ] . PropTypes . string ,
52+
53+ /**
54+ * Callback function that is fired when a radio button has
55+ * been clicked. Returns the event and the value of the radio
56+ * button that has been selected.
57+ */
3858 onChange : _react2 [ 'default' ] . PropTypes . func ,
59+
60+ /**
61+ * Should be used to pass `Radio` components.
62+ */
3963 children : _react2 [ 'default' ] . PropTypes . node ,
64+
65+ /**
66+ * The css class name of the root element.
67+ */
4068 className : _react2 [ 'default' ] . PropTypes . string
4169 } ,
4270 enumerable : true
@@ -107,8 +135,8 @@ var RadioGroup = (function (_React$Component) {
107135 }
108136 }
109137 } , {
110- key : 'handleRadioChange ' ,
111- value : function handleRadioChange ( e /* TODO , newValue */ ) {
138+ key : 'handleChange ' ,
139+ value : function handleChange ( e /* TODO , newValue */ ) {
112140 var newValue = e . target . value ;
113141
114142 this . updateRadioButtons ( newValue ) ;
@@ -125,30 +153,30 @@ var RadioGroup = (function (_React$Component) {
125153 value : function render ( ) {
126154 var _this2 = this ;
127155
128- var children = _react2 [ 'default' ] . Children . map ( this . props . children , function ( radio ) {
129- var _radio $props = radio . props ;
130- var name = _radio $props. name ;
131- var value = _radio $props. value ;
132- var label = _radio $props. label ;
133- var onChange = _radio $props. onChange ;
156+ var options = _react2 [ 'default' ] . Children . map ( this . props . children , function ( option ) {
157+ var _option $props = option . props ;
158+ var name = _option $props. name ;
159+ var value = _option $props. value ;
160+ var label = _option $props. label ;
161+ var onChange = _option $props. onChange ;
134162
135- var other = _objectWithoutProperties ( _radio $props, [ 'name' , 'value' , 'label' , 'onChange' ] ) ;
163+ var other = _objectWithoutProperties ( _option $props, [ 'name' , 'value' , 'label' , 'onChange' ] ) ;
136164
137165 return _react2 [ 'default' ] . createElement ( _Radio2 [ 'default' ] , _extends ( { } , other , {
138- ref : radio . props . value ,
166+ ref : option . props . value ,
139167 name : _this2 . props . name ,
140- key : radio . props . value ,
141- value : radio . props . value ,
142- label : radio . props . label ,
143- onChange : _this2 . handleRadioChange . bind ( _this2 ) ,
144- checked : radio . props . value === _this2 . state . value
168+ key : option . props . value ,
169+ value : option . props . value ,
170+ label : option . props . label ,
171+ onChange : _this2 . handleChange . bind ( _this2 ) ,
172+ checked : option . props . value === _this2 . state . value
145173 } ) ) ;
146174 } , this ) ;
147175
148176 return _react2 [ 'default' ] . createElement (
149177 'div' ,
150- { className : this . props . className || '' } ,
151- children
178+ { className : this . props . className } ,
179+ options
152180 ) ;
153181 }
154182 } ] ) ;
0 commit comments