apphouse
Version:
Component library for React that uses observable state management and theme-able components.
48 lines (47 loc) • 1.71 kB
TypeScript
export type FeedbackPositionOptions = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top' | undefined;
export type FeedbackTypeOptions = 'full-width' | 'hanging' | 'floating' | undefined;
export type FeedbackVariantType = 'regular' | 'error' | 'info' | 'success' | 'warning' | undefined;
type dismissButtonLabel = string | undefined;
type autoHideDuration = number | null | undefined;
export interface FeedbackType {
autoHideDuration?: autoHideDuration;
dismissButtonLabel?: dismissButtonLabel;
message?: string;
onClose?: () => void;
position?: FeedbackPositionOptions;
showLoader?: boolean;
error?: string;
type?: FeedbackTypeOptions;
variant?: FeedbackVariantType;
}
/**
* The Feedback class is a model for the feedback component
* This model allows you to show a feedback
* from anywhere in the app simply calling feedback.setMessage()
* Example usage:
* feedback.setFeedback({
message: "Error saving data...",
variant: "error",
});
*/
export declare class Feedback {
autoHideDuration?: autoHideDuration;
dismissButtonLabel?: dismissButtonLabel;
message?: string;
onClose: () => void;
open: boolean;
error?: string;
position?: FeedbackPositionOptions;
showLoader?: boolean;
type?: FeedbackTypeOptions;
variant?: FeedbackVariantType;
constructor(feedback?: FeedbackType);
setFeedback(feedback: FeedbackType): void;
setOpen: (value: boolean) => void;
resetToDefault(): void;
showFeedback(): void;
hideFeedback(): void;
dismiss(): void;
defaultOnClose(): void;
}
export {};