@@ -33,10 +33,17 @@ export const styles = theme => {
33
33
textAlign : 'left' ,
34
34
padding : 0 ,
35
35
lineHeight : '11px' ,
36
- transition : theme . transitions . create ( 'width' , {
36
+ fontSize : '0.75rem' ,
37
+ maxWidth : 0 ,
38
+ transition : theme . transitions . create ( 'max-width' , {
37
39
duration : theme . transitions . duration . shorter ,
38
40
easing : theme . transitions . easing . easeOut ,
39
41
} ) ,
42
+ visibility : 'hidden' ,
43
+ '& span' : {
44
+ paddingLeft : 4 ,
45
+ paddingRight : 6 ,
46
+ } ,
40
47
} ,
41
48
} ;
42
49
} ;
@@ -49,6 +56,7 @@ const NotchedOutline = React.forwardRef(function NotchedOutline(props, ref) {
49
56
children,
50
57
classes,
51
58
className,
59
+ label = '\u200B' ,
52
60
labelWidth : labelWidthProp ,
53
61
notched,
54
62
style,
@@ -62,25 +70,17 @@ const NotchedOutline = React.forwardRef(function NotchedOutline(props, ref) {
62
70
< fieldset
63
71
aria-hidden
64
72
style = { {
65
- [ `padding${ capitalize ( align ) } ` ] : 8 + ( notched ? 0 : labelWidth / 2 ) ,
73
+ [ `padding${ capitalize ( align ) } ` ] : 8 ,
66
74
...style ,
67
75
} }
68
76
className = { clsx ( classes . root , className ) }
69
77
ref = { ref }
70
78
{ ...other }
71
79
>
72
- < legend
73
- className = { classes . legend }
74
- style = { {
75
- // IE 11: fieldset with legend does not render
76
- // a border radius. This maintains consistency
77
- // by always having a legend rendered
78
- width : notched ? labelWidth : 0.01 ,
79
- } }
80
- >
80
+ < legend className = { classes . legend } style = { { maxWidth : notched ? '150px' : '0px' } } >
81
81
{ /* Use the nominal use case of the legend, avoid rendering artefacts. */ }
82
82
{ /* eslint-disable-next-line react/no-danger */ }
83
- < span dangerouslySetInnerHTML = { { __html : '​' } } / >
83
+ < span > { label } </ span >
84
84
</ legend >
85
85
</ fieldset >
86
86
) ;
0 commit comments