react-appointment-picker
Version:
A React component to pick appointments.
46 lines (43 loc) • 1.85 kB
TypeScript
/// <reference types="react" />
declare type IdentifierType = string | number;
interface AddedAppointmentInterface {
day: string;
number: IdentifierType;
time: string;
id?: IdentifierType;
}
declare type AddCallbackType = (day: string, number: IdentifierType, time: string, id?: IdentifierType) => void;
declare type RemoveCallbackType = (day: string, number: IdentifierType) => void;
interface SimpleAddCaseInterface {
addedAppointment: AddedAppointmentInterface;
addCb: AddCallbackType;
}
interface ContinuousAddCaseInterface extends SimpleAddCaseInterface {
removedAppointment: AddedAppointmentInterface;
removeCb: RemoveCallbackType;
}
declare type AddAppointmentType = (args: ContinuousAddCaseInterface | SimpleAddCaseInterface) => void;
declare type RemoveAppointmentType = (appointment: AddedAppointmentInterface, removeCb: RemoveCallbackType) => void;
declare type AppointmentAttributesType = {
id?: IdentifierType;
number: IdentifierType;
isReserved?: boolean;
isSelected?: boolean;
periods?: number;
} | null;
interface AppointmentPickerPropsInterface {
addAppointmentCallback?: AddAppointmentType;
removeAppointmentCallback?: RemoveAppointmentType;
alpha?: boolean;
continuous?: boolean;
selectedByDefault?: boolean;
maxReservableAppointments?: number;
initialDay?: Date;
unitTime?: number;
local?: string;
visible?: boolean;
loading?: boolean;
days: AppointmentAttributesType[][];
}
declare const AppointmentPicker: ({ alpha, selectedByDefault, continuous, loading, addAppointmentCallback, removeAppointmentCallback, days, maxReservableAppointments, initialDay, unitTime, visible, local }: AppointmentPickerPropsInterface) => JSX.Element;
export { AppointmentAttributesType, AppointmentPicker };