import { For, type JSX, type ValidComponent, splitProps } from "solid-js"; import { type ElementOf, Polymorphic, type PolymorphicProps, } from "../polymorphic"; import { useFileFieldContext } from "./file-field-context"; import { FileFieldItemContext } from "./file-field-item-context"; export interface FileFieldItemListOptions { children: (file: File) => JSX.Element; } export interface FileFieldItemListCommonProps< T extends HTMLElement = HTMLElement, > {} export interface FileFieldItemListRenderProps extends FileFieldItemListCommonProps { children: JSX.Element; } export type FileFieldItemListProps< T extends ValidComponent | HTMLElement = HTMLElement, > = FileFieldItemListOptions & Partial>>; export function FileFieldItemList( props: PolymorphicProps>, ) { const context = useFileFieldContext(); const [local, others] = splitProps(props as FileFieldItemListProps, [ "children", ]); return ( as="ul" {...others}> {(file) => ( {local.children(file)} )} ); }