lucid-ui
Version:
A UI component library from Xandr.
114 lines • 4.38 kB
TypeScript
import React from 'react';
export interface StandardProps {
/** Appended to the component-specific class names set on the root element.
* Value is run through the `classnames` library. */
className?: string;
/** Any valid React children. */
children?: React.ReactNode;
/** Styles that are passed through to native control. */
style?: React.CSSProperties;
/** A "magic" prop that's always excluded from DOM elements.
* `callbackId` can be used to identify a component in a list
* without having to create extra closures. */
callbackId?: string | number;
}
export declare type Overwrite<T, U> = Omit<T, keyof T & keyof U> & U;
export interface FC<P> extends React.FC<P> {
peek?: {
description: string;
notes?: {
overview: string;
intendedUse: string;
technicalRecommendations: string;
};
categories?: string[];
extend?: string;
madeFrom?: string[];
};
categories?: string[];
description?: string;
propTypes?: object;
propName?: string | string[];
_isPrivate?: boolean;
}
declare type TypesType<P> = ICreateClassComponentClass<P> | Array<ICreateClassComponentClass<P>> | FC<P> | Array<FC<P>> | {
propName?: string | string[];
} | any;
interface ICreateClassComponentSpec<P, S> extends React.Mixin<P, S> {
_isPrivate?: boolean;
initialState?: S;
propName?: string | string[];
propTypes?: Required<{
[key in keyof P]: any;
}>;
components?: {
[key: string]: ICreateClassComponentClass<{}>;
};
statics?: {
definition?: ICreateClassComponentSpec<P, S>;
[key: string]: any;
};
reducers?: {
[K in keyof P]?: (arg0: S, ...args: any[]) => S;
};
selectors?: {
[K in keyof P]?: (arg0: S) => any;
};
render?(this: {
props: P;
} & {
[k: string]: any;
}): React.ReactNode;
[key: string]: any;
}
export interface ICreateClassComponentClass<P> extends React.ClassicComponentClass<P> {
propName?: string | string[];
}
/**
* creates a React component
*/
export declare function createClass<P, S = {}>(spec: ICreateClassComponentSpec<P, S>): ICreateClassComponentClass<P>;
/**
* Return all elements matching the specified types
*/
export declare function filterTypes<P>(children: React.ReactNode, types?: TypesType<P>): React.ReactElement[];
/**
* Return all elements found in props and children of the specified types
*/
export declare function findTypes<P extends {
children?: React.ReactNode;
}>(props: P, types?: TypesType<P>): React.ReactNode[];
/**
* Return all elements not matching the specified types
*/
export declare function rejectTypes<P>(children: React.ReactNode, types: TypesType<P> | Array<TypesType<P>>): React.ReactNode[];
/**
* Return an array of elements (of the given type) for each of the values
*/
export declare function createElements<P>(type: ICreateClassComponentClass<P>, values?: Array<React.ReactElement<P> | P>): React.ReactElement[];
/**
* Return the first element found in props and children of the specificed type(s)
*/
export declare function getFirst<P>(props: P, types: TypesType<P> | undefined, defaultValue?: React.ReactNode): React.ReactNode | null | undefined;
/**
* Adds any speicial omitted props to an array
* @param {string[]} componentProps - an array of the component's props
* @param {boolean} targetIsDOMElement - true by default; specifies if the top-level element of the component is a plain DOM Element or a React Component Element
* @return {string[]} the array of component props plus the additional omitted keys
* */
export declare function addSpecialOmittedProps<P>(componentProps?: string[], targetIsDOMElement?: boolean): {
[key: string]: any;
};
/**
* Deprecated from lucid-ui May 25, 2022 by Noah Yasskin
* Do not use this method because
* the import PropTypes from 'prop-types' stopped working as desired
* component.propTypes does not compile correctly
* and props in the passThroughs object leak through
* because they are not being omitted.
*/
export declare function omitProps<P extends object>(props: Partial<P>, component: ICreateClassComponentClass<P> | undefined, keys?: string[], targetIsDOMElement?: boolean): {
[key: string]: any;
};
export {};
//# sourceMappingURL=component-types.d.ts.map