1
- import _ from 'lodash'
2
1
import cx from 'classnames'
2
+ import _ from 'lodash'
3
3
import React , { Component , PropTypes } from 'react'
4
4
5
5
import {
@@ -156,15 +156,6 @@ function formSerializer(formNode) {
156
156
return json
157
157
}
158
158
159
- const _meta = {
160
- name : 'Form' ,
161
- type : META . TYPES . COLLECTION ,
162
- props : {
163
- widths : [ 'equal' ] ,
164
- size : _ . without ( SUI . SIZES , 'medium' ) ,
165
- } ,
166
- }
167
-
168
159
/**
169
160
* A Form displays a set of related user input fields in a structured way.
170
161
* @see Button
@@ -177,11 +168,6 @@ const _meta = {
177
168
* @see TextArea
178
169
*/
179
170
export default class Form extends Component {
180
- static defaultProps = {
181
- as : 'form' ,
182
- serializer : formSerializer ,
183
- }
184
-
185
171
static propTypes = {
186
172
/** An element type to render as (string or function). */
187
173
as : customPropTypes . as ,
@@ -192,13 +178,13 @@ export default class Form extends Component {
192
178
/** Additional classes. */
193
179
className : PropTypes . string ,
194
180
195
- /** Automatically show any error Message children */
181
+ /** Automatically show any error Message children. */
196
182
error : PropTypes . bool ,
197
183
198
- /** A form can have its color inverted for contrast */
184
+ /** A form can have its color inverted for contrast. */
199
185
inverted : PropTypes . bool ,
200
186
201
- /** Automatically show a loading indicator */
187
+ /** Automatically show a loading indicator. */
202
188
loading : PropTypes . bool ,
203
189
204
190
/**
@@ -212,23 +198,31 @@ export default class Form extends Component {
212
198
/** A comment can contain a form to reply to a comment. This may have arbitrary content. */
213
199
reply : PropTypes . bool ,
214
200
215
- /** Called onSubmit with the form node that returns the serialized form object */
201
+ /** Called onSubmit with the form node that returns the serialized form object. */
216
202
serializer : PropTypes . func ,
217
203
218
- /** A form can vary in size */
219
- size : PropTypes . oneOf ( _meta . props . size ) ,
204
+ /** A form can vary in size. */
205
+ size : PropTypes . oneOf ( _ . without ( SUI . SIZES , 'medium' ) ) ,
220
206
221
- /** Automatically show any success Message children */
207
+ /** Automatically show any success Message children. */
222
208
success : PropTypes . bool ,
223
209
224
- /** Automatically show any warning Message children */
210
+ /** Automatically show any warning Message children . */
225
211
warning : PropTypes . bool ,
226
212
227
- /** Forms can automatically divide fields to be equal width */
228
- widths : PropTypes . oneOf ( _meta . props . widths ) ,
213
+ /** Forms can automatically divide fields to be equal width. */
214
+ widths : PropTypes . oneOf ( [ 'equal' ] ) ,
229
215
}
230
216
231
- static _meta = _meta
217
+ static defaultProps = {
218
+ as : 'form' ,
219
+ serializer : formSerializer ,
220
+ }
221
+
222
+ static _meta = {
223
+ name : 'Form' ,
224
+ type : META . TYPES . COLLECTION ,
225
+ }
232
226
233
227
static Field = FormField
234
228
static Button = FormButton
0 commit comments