import type { Component, ValidComponent } from "solid-js"; import { FormControlDescription, type FormControlDescriptionCommonProps, type FormControlDescriptionOptions, type FormControlDescriptionRenderProps, } from "../form-control"; import type { ElementOf, PolymorphicProps } from "../polymorphic"; import { type SwitchDataSet, useSwitchContext } from "./switch-context"; export interface SwitchDescriptionOptions extends FormControlDescriptionOptions {} export interface SwitchDescriptionCommonProps< T extends HTMLElement = HTMLElement, > extends FormControlDescriptionCommonProps {} export interface SwitchDescriptionRenderProps extends SwitchDescriptionCommonProps, FormControlDescriptionRenderProps, SwitchDataSet {} export type SwitchDescriptionProps< T extends ValidComponent | HTMLElement = HTMLElement, > = SwitchDescriptionOptions & Partial>>; /** * The description that gives the user more information on the switch. */ export function SwitchDescription( props: PolymorphicProps>, ) { const context = useSwitchContext(); return ( > > {...context.dataset()} {...(props as SwitchDescriptionProps)} /> ); }