import * as React from 'react'
import { Box, PolymorphicComponentProps } from 'react-polymorphic-box'
import './BoundedView.css'
const defaultElement = 'div'
export type BoundedViewPropsBase = {
/** Maximum width of the content. Any valid CSS measurement can be used. */
maxWidth?: string | number
/** Props applied to the inner `
`. */
innerProps?: React.DetailedHTMLProps<
React.HTMLAttributes
,
HTMLDivElement
>
/** Children contained within the inner constrained `` */
children?: React.ReactNode
}
export type BoundedViewProps<
E extends React.ElementType
> = PolymorphicComponentProps
/**
* `` with a horizontally centered nested `` with an optional
* maximum width. Gutter width should be added directly to `
` as
* padding.
*
* @example
* With no inner maximum width:
* Content
*
* @example
* With inner maximum width of `48rem`:
* Content
*/
export const BoundedView: (
props: BoundedViewProps,
) => React.ReactElement | null = React.forwardRef(
(
{ ref, maxWidth, innerProps, children, ...props }: BoundedViewProps,
innerRef: typeof ref,
) => (
{children}
),
)
// @ts-expect-error: Component type does not currently include displayName
BoundedView.displayName = 'BoundedView'