@@ -24,7 +24,10 @@ import { size } from 'polished';
24
24
import HtmlElement from '../HtmlElement' ;
25
25
import { textMega , disableVisually } from '../../styles/style-helpers' ;
26
26
import { directions } from '../../styles/constants' ;
27
- import { childrenPropType } from '../../util/shared-prop-types' ;
27
+ import {
28
+ childrenPropType ,
29
+ deprecatedPropType
30
+ } from '../../util/shared-prop-types' ;
28
31
29
32
import Tooltip from '../Tooltip' ;
30
33
@@ -268,8 +271,12 @@ const StyledInput = ({
268
271
inline,
269
272
disabled,
270
273
wrapperClassName,
274
+ wrapperStyles,
271
275
inputClassName,
276
+ inputStyles,
272
277
deepRef,
278
+ element,
279
+ as,
273
280
...props
274
281
} ) => {
275
282
const prefix = RenderPrefix && < RenderPrefix css = { prefixStyles } /> ;
@@ -284,7 +291,13 @@ const StyledInput = ({
284
291
285
292
return (
286
293
< InputContainer
287
- { ...{ noMargin, inline, disabled, className : wrapperClassName } }
294
+ { ...{
295
+ noMargin,
296
+ inline,
297
+ disabled,
298
+ className : wrapperClassName ,
299
+ css : wrapperStyles
300
+ } }
288
301
>
289
302
{ prefix }
290
303
< InputElement
@@ -294,9 +307,11 @@ const StyledInput = ({
294
307
disabled,
295
308
hasWarning,
296
309
deepRef,
310
+ element : element || as ,
297
311
hasPrefix : ! ! prefix ,
298
312
hasSuffix : ! ! suffix ,
299
- className : inputClassName
313
+ className : inputClassName ,
314
+ css : inputStyles
300
315
} }
301
316
aria-invalid = { invalid }
302
317
blacklist = { {
@@ -327,9 +342,20 @@ Input.RIGHT = directions.RIGHT;
327
342
Input . propTypes = {
328
343
children : childrenPropType ,
329
344
/**
345
+ * @deprecated
330
346
* The HTML input element to render.
331
347
*/
332
- element : PropTypes . oneOf ( [ 'input' , 'textarea' ] ) ,
348
+ element : deprecatedPropType (
349
+ PropTypes . oneOf ( [ 'input' , 'textarea' ] ) ,
350
+ [
351
+ 'Emotion 10 introduced the ability to change the HTML element.' ,
352
+ 'Use the "as" prop instead.'
353
+ ] . join ( ' ' )
354
+ ) ,
355
+ /**
356
+ * The HTML input element to render.
357
+ */
358
+ as : PropTypes . oneOf ( [ 'input' , 'textarea' ] ) ,
333
359
/**
334
360
* Render prop that should render a left-aligned overlay icon or element.
335
361
* Receives a className prop.
@@ -382,13 +408,35 @@ Input.propTypes = {
382
408
*/
383
409
textAlign : PropTypes . oneOf ( [ Input . LEFT , Input . RIGHT ] ) ,
384
410
/**
411
+ * @deprecated
385
412
* Class name to overwrite the <input> element styles.
386
413
*/
387
- inputClassName : PropTypes . string ,
414
+ inputClassName : deprecatedPropType (
415
+ PropTypes . string ,
416
+ [
417
+ 'Emotion 10 uses style objects instead of classnames.' ,
418
+ 'Use the "inputStyles" prop instead.'
419
+ ] . join ( ' ' )
420
+ ) ,
388
421
/**
422
+ * Emotion style object to overwrite the <input> element styles.
423
+ */
424
+ inputStyles : PropTypes . object ,
425
+ /**
426
+ * @deprecated
389
427
* Class name to overwrite the input wrapper element styles.
390
428
*/
391
- wrapperClassName : PropTypes . string ,
429
+ wrapperClassName : deprecatedPropType (
430
+ PropTypes . string ,
431
+ [
432
+ 'Emotion 10 uses style objects instead of classnames.' ,
433
+ 'Use the "wrapperStyles" prop instead.'
434
+ ] . join ( ' ' )
435
+ ) ,
436
+ /**
437
+ * Emotion style object to overwrite the input wrapper element styles.
438
+ */
439
+ wrapperStyles : PropTypes . object ,
392
440
/**
393
441
* DOM node to be forwarded to the actual input being rendered by
394
442
* styled.
@@ -400,7 +448,7 @@ StyledInput.propTypes = Input.propTypes;
400
448
401
449
Input . defaultProps = {
402
450
children : null ,
403
- element : 'input' ,
451
+ as : 'input' ,
404
452
renderPrefix : null ,
405
453
renderSuffix : null ,
406
454
validationHint : null ,
0 commit comments