@etsoo/materialui
Version:
TypeScript Material-UI Implementation
71 lines (70 loc) • 1.87 kB
TypeScript
import { IdType } from "@etsoo/shared";
import { TypographyProps } from "@mui/material/Typography";
import React from "react";
import { InputFieldProps } from "./InputField";
import { EmailInput } from "./EmailInput";
import { MobileInput } from "./MobileInput";
import { PhoneInput } from "./PhoneInput";
type ItemType = {
id: IdType;
};
declare const componentMap: {
email: typeof EmailInput;
phone: typeof PhoneInput;
mobile: typeof MobileInput;
};
type ComponentMap = typeof componentMap;
type ComponentKey = keyof ComponentMap;
type ComponentProps<T extends ItemType> = {
/**
* Load data
* @param value Duplicate test value
*/
loadData(value: string): Promise<[T[]?, string?]>;
/**
* Label props
*/
labelProps?: Omit<TypographyProps, "onClick">;
/**
* Custom item label
* @param item List item data
* @returns Result
*/
itemLabel?: (item: T) => React.ReactNode;
/**
* Custom render item
* @param item List item data
* @returns Result
*/
renderItem?: (item: T) => React.ReactNode;
};
/**
* InputField with tips properties
*/
export type InputTipFieldProps<T extends ItemType = ItemType> = {
/**
* Component properties
*/
componentProps: ComponentProps<T>;
} & (({
/**
* Component properties
*/
componentProps: ComponentProps<T>;
} & {
[K in ComponentKey]: {
/**
* Component key
*/
component: K;
} & Omit<React.ComponentProps<ComponentMap[K]>, "component">;
}[ComponentKey]) | ({
component?: "input";
} & Omit<InputFieldProps, "component">));
/**
* InputField with tips
* @param props Props
* @returns Component
*/
export declare function InputTipField<T extends ItemType = ItemType>(props: InputTipFieldProps<T>): import("react/jsx-runtime").JSX.Element;
export {};