bananas-commerce-admin
Version:
What's this, an admin for apes?
26 lines (25 loc) • 1.28 kB
TypeScript
import React from "react";
import { SvgIconComponent } from "@mui/icons-material";
export type ChipType = "code" | "email" | "name" | "phone" | "purchase_number" | "query" | "search" | "site_code" | "variant";
export declare function assertChipType(type: string): asserts type is ChipType;
export declare const ChipIcons: Record<ChipType, SvgIconComponent>;
export declare const getChipIcon: (type: ChipType) => SvgIconComponent;
/**
* Parses a string as into the {@link ChipsSearchInput} type returning undefined if it was not specified
* which type or if it could not be inferred from its format. This function currently supports
* parsing or infering emails, phone numbers and purchase numbers as {@link ChipsSearchInput}s.
*/
export declare const parseSearchInput: (allowedTypes: ChipType[], fallbackType: string) => (input: string) => ChipsSearchInput | undefined;
export type ChipsSearchInput = {
[K in ChipType]: {
[P in K]: string;
};
}[ChipType];
export interface SearchBarProps {
allowedTypes: ChipType[];
fallbackType?: string;
onChange?: (inputs: ChipsSearchInput[]) => void;
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
placeholder: string;
}
export declare const ChipsSearchBar: React.FC<SearchBarProps>;