@ucloud-pccl/react-components
Version:
UCloud pccl react components
23 lines (22 loc) • 1.1 kB
TypeScript
import React, { DetailedHTMLProps, HTMLAttributes } from 'react';
import { StyledComponent } from '@emotion/styled';
import { defaultDesignTokens } from 'src/components/ThemeProvider/theme';
type Input<Props extends {
className?: string;
}> = Omit<Partial<Props>, 'className'> & {
className?: string | ((props: Props) => string);
};
export type DesignTokens = typeof defaultDesignTokens;
export type DesignToken = keyof DesignTokens;
export interface Theme {
designTokens: DesignTokens;
[key: string]: unknown;
}
/**
* 包裹组件,注入默认主题,添加默认的 props
* @param input {object} 需要注入组件的 props
*/
declare const styledWrap: <Props, HTMLElement_1 = HTMLDivElement>(input: Input<Props>) => (Comp: StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement_1>, HTMLElement_1>, Props & React.HTMLAttributes<HTMLElement_1> & {
theme?: Theme | undefined;
}, Theme>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Props & React.HTMLAttributes<HTMLElement_1>> & React.RefAttributes<HTMLElement_1>>;
export default styledWrap;