import type { JSX, ValidComponent } from "solid-js"; import { type ElementOf, Polymorphic, type PolymorphicProps, } from "../polymorphic"; import { useFileFieldItemContext } from "./file-field-item-context"; export interface FileFieldItemNameOptions {} export interface FileFieldItemNameCommonProps< T extends HTMLElement = HTMLElement, > { children: JSX.Element; } export interface FileFieldItemNameRenderProps extends FileFieldItemNameCommonProps {} export type FileFieldItemNameProps< T extends ValidComponent | HTMLElement = HTMLElement, > = FileFieldItemNameOptions & Partial>>; export function FileFieldItemName( props: PolymorphicProps>, ) { const { file } = useFileFieldItemContext(); return ( as="span" {...(props as FileFieldItemNameProps)} > {props.children ?? file.name} ); }