UNPKG

2.06 kBTypeScriptView Raw
1import type { SystemStyleObject } from "./css.types";
2import type { JsxFactoryOptions } from "./factory.types";
3import type { ConfigRecipeSlots } from "./generated/recipes.gen";
4import { type SlotRecipeKey, type UseSlotRecipeOptions } from "./use-slot-recipe";
5interface WrapElementProps<P> {
6 wrapElement?(element: React.ReactElement, props: P): React.ReactElement;
7}
8export interface WithRootProviderOptions<P> extends WrapElementProps<P> {
9 defaultProps?: Partial<P>;
10}
11export interface WithProviderOptions<P> extends JsxFactoryOptions<P>, WrapElementProps<P> {
12}
13export interface WithContextOptions<P> extends JsxFactoryOptions<P> {
14}
15export declare const createSlotRecipeContext: <R extends SlotRecipeKey>(options: UseSlotRecipeOptions<R>) => {
16 StylesProvider: import("react").Provider<Record<string, SystemStyleObject>>;
17 ClassNamesProvider: import("react").Provider<Record<string, string>>;
18 PropsProvider: import("react").Provider<Record<string, any>>;
19 usePropsContext: () => Record<string, any>;
20 useRecipeResult: (props: any) => {
21 styles: Record<string, SystemStyleObject>;
22 classNames: Record<string, string>;
23 props: {
24 [x: string]: any;
25 [x: number]: any;
26 [x: symbol]: any;
27 };
28 };
29 withProvider: <T, P>(Component: React.ElementType<any>, slot: R extends keyof ConfigRecipeSlots ? ConfigRecipeSlots[R] : string, options?: WithProviderOptions<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
30 withContext: <T, P_1>(Component: React.ElementType<any>, slot?: R extends keyof ConfigRecipeSlots ? ConfigRecipeSlots[R] : string, options?: WithContextOptions<P_1>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P_1> & React.RefAttributes<T>>;
31 withRootProvider: <P_2>(Component: React.ElementType<any>, options?: WithRootProviderOptions<P_2>) => React.FC<React.PropsWithoutRef<P_2>>;
32 useStyles: () => Record<string, SystemStyleObject>;
33 useClassNames: () => Record<string, string>;
34};
35export {};