* The wrapper component provides the canonical wrapper for components whose * size depends on the children. This is often the opposite of the * `ContainWrapper`. * @param {import('./types').WrapperComponentProps} props * @param {import('preact').RefObject } ref * @return {import('preact
(
{
as: Comp = 'div',
children,
'style': style,
wrapperClassName,
wrapperStyle,
[propName('class')]: className,
...rest
},
ref
)
| 11 | * @return {import('preact').VNode} |
| 12 | */ |
| 13 | function WrapperWithRef( |
| 14 | { |
| 15 | as: Comp = 'div', |
| 16 | children, |
| 17 | 'style': style, |
| 18 | wrapperClassName, |
| 19 | wrapperStyle, |
| 20 | [propName('class')]: className, |
| 21 | ...rest |
| 22 | }, |
| 23 | ref |
| 24 | ) { |
| 25 | return ( |
| 26 | <Comp |
| 27 | {...rest} |
| 28 | ref={ref} |
| 29 | class={`${className || ''} ${wrapperClassName || ''}`.trim() || null} |
| 30 | style={{...style, ...wrapperStyle}} |
| 31 | > |
| 32 | {children} |
| 33 | </Comp> |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | const Wrapper = forwardRef(WrapperWithRef); |
| 38 |
nothing calls this directly
no test coverage detected