import { SuidComponentType } from "."; import { ComponentPropsWithRef, ElementType } from "./solid"; import { JSX } from "solid-js"; export {}; /** * Remove properties `K` from `T`. * Distributive for union types. * * @internal */ export type DistributiveOmit = T extends any ? Omit : never; /** * Generate a set of string literal types with the given default record `T` and * override record `U`. * * If the property value was `true`, the property key will be added to the * string union. * * @internal */ export type OverridableStringUnion = GenerateStringUnion, U>>; /** * Like `T & U`, but using the value types from `U` where their properties overlap. * * @internal */ export type Overwrite = DistributiveOmit & U; type GenerateStringUnion = Extract<{ [Key in keyof T]: true extends T[Key] ? Key : never; }[keyof T], string>; /** * A component whose root component can be controlled via a `component` prop. * * Adjusts valid props based on the type of `component`. */ export interface OverridableComponent { (props: { /** * The component used for the root node. * Either a string to use a HTML element or a component. */ component: C; } & OverrideProps): JSX.Element; (props: DefaultComponentProps): JSX.Element; __suid: string; } /** * Props of the component if `component={Component}` is used. */ export type OverrideProps = BaseProps & DistributiveOmit, keyof BaseProps>; /** * Props if `component={Component}` is NOT used. */ export type DefaultComponentProps = M extends OverridableTypeMap ? BaseProps & DistributiveOmit, keyof BaseProps> : M extends SuidComponentType ? BaseProps : never; /** * Props defined on the component. */ export type BaseProps = M["props"] & CommonProps; export interface CommonProps { class?: string; as?: ElementType; } export interface OverridableTypeMap extends SuidComponentType { defaultComponent: ElementType; } //# sourceMappingURL=overridable.d.ts.map