@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
25 lines (24 loc) • 1.27 kB
text/typescript
import { AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, IntrinsicElementAttributes, VNodeProps, h } from 'vue';
type DOMElements = keyof IntrinsicElementAttributes;
type ElementType = Parameters<typeof h>[0];
export interface PolymorphicProps {
/**
* Use the provided child element as the default rendered element, combining their props and behavior.
*/
asChild?: boolean;
}
export type AsChildComponent<Component extends ElementType, P extends Record<string, unknown> = Record<never, never>> = {
new (): {
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & ExtractPropTypes<Component> & (Component extends keyof IntrinsicElementAttributes ? IntrinsicElementAttributes[Component] : Record<never, never>) & P & PolymorphicProps;
};
};
export type HTMLPolymorphicComponents = {
[E in DOMElements]: AsChildComponent<E>;
};
export type HTMLPolymorphicProps<T extends ElementType> = Omit<ExtractPropTypes<T extends DOMElements ? IntrinsicElementAttributes[T] : T>, 'ref'> & {
asChild?: boolean;
};
export type HTMLArkProps<T extends DOMElements> = HTMLPolymorphicProps<T>;
export declare function jsxFactory(): HTMLPolymorphicComponents;
export declare const ark: HTMLPolymorphicComponents;
export {};