import { forwardRef, type HTMLAttributes, type ForwardedRef } from 'react'
import {
getFlexProps,
getFlexItemProps,
splitClassNameProp,
} from '@pluralsight/headless-styles'
import type {
FlexOptions,
FlexItemOptions,
} from '@pluralsight/headless-styles/types'
//
interface FlexProps
extends FlexOptions,
Omit, 'style'> {}
function FlexEl(props: FlexProps, ref: ForwardedRef) {
const { align, direction, gap, justify, wrap, ...nativeProps } = props
const pandoProps = getFlexProps({
align,
classNames: splitClassNameProp(nativeProps.className),
direction,
gap,
justify,
style: nativeProps.style,
wrap,
})
return
}
//
interface FlexItemProps
extends FlexItemOptions,
Omit, 'style'> {}
function FlexItemEl(props: FlexItemProps, ref: ForwardedRef) {
const { basis, grow, shrink, ...nativeProps } = props
const pandoProps = getFlexItemProps({
basis,
classNames: splitClassNameProp(nativeProps.className),
grow,
shrink,
style: nativeProps.style,
})
return
}
// exports
export const Flex = forwardRef(FlexEl)
export const FlexItem = forwardRef(FlexItemEl)