import * as React from "react"; import type { PolymorphicWithRef } from "../types"; import BaseDrawerItems from "./BaseDrawerItems"; import { DrawerItem } from "../DrawerItem"; type Props = { label: React.ComponentProps & { [`data-label`]?: string; }; icon: React.ComponentProps & { [`data-icon`]?: string; }; }; type DrawerItemsProps = PolymorphicWithRef< T, { children: (Item: typeof DrawerItem, props: Props) => React.ReactNode; } >; type DrawerItemsElement = ( props: DrawerItemsProps ) => React.ReactElement>; const DrawerItems: DrawerItemsElement = React.forwardRef( ( props: DrawerItemsProps, innerRef: typeof props.ref ) => { const { component = "ul", children, ...rest } = props; return ( {children(DrawerItem, { label: { component: "span", size: "large", ["data-label"]: "drawer", }, icon: { ["data-icon"]: "drawer" }, })} ); } ); export default DrawerItems;