@sikka/hawa 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import * as ToastPrimitives from "@radix-ui/react-toast";
3
+ import { type VariantProps } from "class-variance-authority";
4
+ declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
5
+ declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
6
+ declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: {
7
+ variant?: "default" | "destructive";
8
+ severity?: "info" | "warning" | "error" | "success" | "none";
9
+ } & import("class-variance-authority/dist/types").ClassProp) => string> & {
10
+ severity?: "info" | "warning" | "error" | "success" | "none";
11
+ direction?: "rtl" | "ltr";
12
+ } & React.RefAttributes<HTMLLIElement>>;
13
+ declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
14
+ declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
15
+ declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
+ declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+ type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
18
+ type ToastActionElement = React.ReactElement<typeof ToastAction>;
19
+ export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Toaster(props: any): import("react").JSX.Element;
@@ -62,3 +62,5 @@ export * from "./Popover";
62
62
  export * from "./Tabs";
63
63
  export * from "./Textarea";
64
64
  export * from "./Separator";
65
+ export * from "./Toast";
66
+ export * from "./Toaster";
@@ -1,2 +1,3 @@
1
1
  export * from "./useDiscloser";
2
2
  export * from "./useHover";
3
+ export * from "./useToast";
@@ -0,0 +1,45 @@
1
+ import * as React from "react";
2
+ import type { ToastActionElement, ToastProps } from "../elements/Toast";
3
+ type ToasterToast = ToastProps & {
4
+ id: string;
5
+ title?: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ severity?: "info" | "warning" | "error" | "success" | "none";
8
+ action?: ToastActionElement;
9
+ };
10
+ declare const actionTypes: {
11
+ readonly ADD_TOAST: "ADD_TOAST";
12
+ readonly UPDATE_TOAST: "UPDATE_TOAST";
13
+ readonly DISMISS_TOAST: "DISMISS_TOAST";
14
+ readonly REMOVE_TOAST: "REMOVE_TOAST";
15
+ };
16
+ type ActionType = typeof actionTypes;
17
+ type Action = {
18
+ type: ActionType["ADD_TOAST"];
19
+ toast: ToasterToast;
20
+ } | {
21
+ type: ActionType["UPDATE_TOAST"];
22
+ toast: Partial<ToasterToast>;
23
+ } | {
24
+ type: ActionType["DISMISS_TOAST"];
25
+ toastId?: ToasterToast["id"];
26
+ } | {
27
+ type: ActionType["REMOVE_TOAST"];
28
+ toastId?: ToasterToast["id"];
29
+ };
30
+ interface State {
31
+ toasts: ToasterToast[];
32
+ }
33
+ export declare const reducer: (state: State, action: Action) => State;
34
+ type Toast = Omit<ToasterToast, "id">;
35
+ declare function toast({ ...props }: Toast): {
36
+ id: string;
37
+ dismiss: () => void;
38
+ update: (props: ToasterToast) => void;
39
+ };
40
+ declare function useToast(): {
41
+ toast: typeof toast;
42
+ dismiss: (toastId?: string) => void;
43
+ toasts: ToasterToast[];
44
+ };
45
+ export { useToast, toast };