@@ -33,10 +33,12 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
3333 const [ innerPath , setInnerPath ] = useState ( 'Z' )
3434
3535 const div = useRef ( )
36+ const slotWrapper = useRef ( )
3637
3738 const updateStatesWithArgs = ( ) => {
3839 updateStates ( {
3940 div,
41+ slotWrapper,
4042 style,
4143 setBoxSizing,
4244 setOverflow,
@@ -108,11 +110,10 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
108110 const pathIsEmpty = path . startsWith ( 'Z' ) || path === ''
109111 const divStyle = {
110112 ...style ,
111- ...( pathIsEmpty ? {
112- borderImage : 'none' ,
113- } : {
113+ borderImage : 'none' ,
114+ ...( pathIsEmpty ? { } : {
114115 ...invisibleBorderStyles ,
115- borderImage : 'none ' ,
116+ padding : '0 ' ,
116117 background : 'transparent' ,
117118 boxShadow : dontConvertShadow
118119 // "box-shadow" must be overridden for the style extraction to work (with nth: 1, and not nth: 0)
@@ -125,13 +126,12 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
125126 }
126127
127128 const shapeComponentStyles = {
128- height : boxSizing === 'border-box' ? height : height - ( border . width [ 0 ] + padding [ 0 ] + border . width [ 2 ] + padding [ 2 ] ) ,
129- width : boxSizing === 'border-box' ? width : width - ( border . width [ 1 ] + padding [ 1 ] + border . width [ 3 ] + padding [ 3 ] ) ,
130- padding : padding . map ( n => n + 'px' ) . join ( ' ' ) ,
129+ height : boxSizing === 'border-box' ? height : height - ( border . width [ 0 ] + border . width [ 2 ] ) ,
130+ width : boxSizing === 'border-box' ? width : width - ( border . width [ 1 ] + border . width [ 3 ] ) ,
131131 position : 'fixed' ,
132132 left : 0 ,
133133 top : 0 ,
134- transform : `translate(-${ padding [ 3 ] + border . width [ 3 ] } px, -${ padding [ 0 ] + border . width [ 0 ] } px)` ,
134+ transform : `translate(-${ border . width [ 3 ] } px, -${ border . width [ 0 ] } px)` ,
135135 zIndex : - 1 ,
136136 }
137137
@@ -142,9 +142,7 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
142142
143143 return < div { ...props } style = { divStyle } ref = { div } >
144144 { pathIsEmpty ? null : < ShadowRoot >
145- < div style = { {
146- transform : 'scale(1)'
147- } } >
145+ < div style = { { transform : 'scale(1)' } } >
148146 < div style = { {
149147 ...shapeComponentStyles ,
150148 ...invisibleBorderStyles ,
@@ -165,7 +163,7 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
165163 < div style = { {
166164 height : height - ( widenedBorderWidth [ 0 ] + widenedBorderWidth [ 2 ] ) ,
167165 width : width - ( widenedBorderWidth [ 1 ] + widenedBorderWidth [ 3 ] ) ,
168- transform : `translate(-${ padding [ 3 ] + border . width [ 3 ] } px, -${ padding [ 0 ] + border . width [ 0 ] } px)` ,
166+ transform : `translate(-${ border . width [ 3 ] } px, -${ border . width [ 0 ] } px)` ,
169167 clipPath : `path("M0,0V${ height } H${ width } V0Z${ innerPath } ")` ,
170168 borderRadius : radius . map ( n => ( n * .95 ) + 'px' ) . join ( ' ' ) ,
171169 borderColor : border . color ,
@@ -181,13 +179,14 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
181179 } } />
182180 </ div >
183181 < div style = { {
184- height : height - ( border . width [ 0 ] + border . width [ 2 ] ) * 2 ,
185- width : width - ( border . width [ 1 ] + border . width [ 3 ] ) * 2 ,
182+ display : 'inline-flex' ,
186183 ...invisibleBorderStyles ,
187- transform : `translate(- ${ padding [ 3 ] + border . width [ 3 ] } px, - ${ padding [ 0 ] + border . width [ 0 ] } px)` ,
184+ padding : padding . map ( n => n + 'px' ) . join ( ' ' ) ,
188185 clipPath : overflow === 'hidden' ? `path("${ innerPath } ")` : null ,
189- } } >
190- < slot style = { { overflow : 'visible' } } />
186+ transform : `translate(-${ border . width [ 3 ] } px, -${ border . width [ 0 ] } px)` ,
187+ boxSizing : 'border-box' ,
188+ } } ref = { slotWrapper } >
189+ < slot />
191190 </ div >
192191 </ div >
193192 </ ShadowRoot > }
0 commit comments