@micrio/client-react
Version:
Wrapper for the Micrio client library for React.
21 lines (20 loc) • 1.01 kB
TypeScript
import type { HTMLMicrioElement, Models } from "@micrio/client";
import type { HTMLAttributes } from "react";
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
'micr-io': React.DetailedHTMLProps<Models.Attributes.MicrioCustomAttributes & React.HTMLAttributes<HTMLMicrioElement>, HTMLMicrioElement>;
}
}
}
type KebabToCamel<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamel<U>>}` : S;
export type CustomAttributeProps = {
[K in keyof Models.Attributes.MicrioCustomAttributes as KebabToCamel<K>]?: Models.Attributes.MicrioCustomAttributes[K];
};
export type EventProps = {
[K in keyof Models.MicrioEventDetails as `on${Capitalize<KebabToCamel<K>>}`]?: (event: CustomEvent<Models.MicrioEventDetails[K]>) => any;
};
export interface MicrioProps extends Omit<HTMLAttributes<HTMLElement>, keyof EventProps | 'lang'>, CustomAttributeProps, EventProps {
ref?: React.RefObject<HTMLMicrioElement>;
}
export {};