@undp/design-system-react
Version:
React based design system for UNDP
112 lines (79 loc) • 2.79 kB
TypeScript
import { ClassProp } from 'class-variance-authority/types';
import { default as default_2 } from 'react';
import { Toast as Toast_2 } from 'radix-ui';
import { VariantProps } from 'class-variance-authority';
declare type Action = {
type: ActionType['ADD_TOAST'];
toast: ToasterToast;
} | {
type: ActionType['UPDATE_TOAST'];
toast: Partial<ToasterToast>;
} | {
type: ActionType['DISMISS_TOAST'];
toastId?: ToasterToast['id'];
} | {
type: ActionType['REMOVE_TOAST'];
toastId?: ToasterToast['id'];
};
declare type ActionType = typeof actionTypes;
declare const actionTypes: {
readonly ADD_TOAST: "ADD_TOAST";
readonly UPDATE_TOAST: "UPDATE_TOAST";
readonly DISMISS_TOAST: "DISMISS_TOAST";
readonly REMOVE_TOAST: "REMOVE_TOAST";
};
export declare const reducer: (state: State, action: Action) => State;
declare interface State {
toasts: ToasterToast[];
}
declare const Toast: default_2.ForwardRefExoticComponent<Omit<Toast_2.ToastProps & default_2.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
variant?: "default" | "warning" | "success" | "info" | "destructive" | null | undefined;
} & ClassProp) | undefined) => string> & default_2.RefAttributes<HTMLLIElement>>;
export declare function toast({ ...props }: Toast_3): {
id: string;
dismiss: () => void;
update: (props: ToasterToast) => void;
};
declare type Toast_3 = Omit<ToasterToast, 'id'>;
declare const ToastAction: default_2.ForwardRefExoticComponent<Omit<Toast_2.ToastActionProps & default_2.RefAttributes<HTMLButtonElement>, "ref"> & default_2.RefAttributes<HTMLButtonElement>>;
declare type ToastActionElement = default_2.ReactElement<typeof ToastAction>;
declare type ToasterToast = ToastProps & {
id: string;
title?: default_2.ReactNode;
description?: default_2.ReactNode;
action?: ToastActionElement;
};
declare type ToastProps = default_2.ComponentPropsWithoutRef<typeof Toast>;
export declare function useToast(): {
toast: typeof toast;
dismiss: (toastId?: string) => void;
toasts: ToasterToast[];
};
export { }
declare namespace BreadcrumbSeparator {
var displayName: string;
}
declare namespace BreadcrumbEllipsis {
var displayName: string;
}
declare namespace DialogHeader {
var displayName: string;
}
declare namespace DialogFooter {
var displayName: string;
}
declare namespace PaginationUnit {
var displayName: string;
}
declare namespace PaginationLink {
var displayName: string;
}
declare namespace PaginationPrevious {
var displayName: string;
}
declare namespace PaginationNext {
var displayName: string;
}
declare namespace PaginationEllipsis {
var displayName: string;
}