@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
28 lines (27 loc) • 1.25 kB
TypeScript
/// <reference types="react" />
/**
* Calls all functions in the order they were chained with the same arguments.
* @internal
*/
export declare function chain(...callbacks: any[]): (...args: any[]) => void;
interface Props {
[key: string]: any;
}
type TupleTypes<T> = {
[P in keyof T]: T[P];
} extends {
[key: number]: infer V;
} ? V : never;
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
/**
* Merges multiple props objects together. Event handlers are chained,
* classNames are combined, and ids are deduplicated - different ids
* will trigger a side-effect and re-render components hooked up with `useId`.
* For all other props, the last prop object overrides all previous ones.
* @param args - Multiple sets of props to merge together.
* @internal
*/
export declare function mergePropsReactAria<T extends Props[]>(...args: T): UnionToIntersection<TupleTypes<T>>;
export declare function isProp<U extends HTMLElement, T extends React.HTMLAttributes<U>>(prop: T | undefined): prop is T;
export declare function mergeProps<U extends HTMLElement, T extends Array<React.HTMLAttributes<U> | undefined>>(...props: T): import("react").HTMLAttributes<U>;
export {};