@vuu-ui/vuu-notifications 1.0.3 → 2.0.0

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.
@@ -8,15 +8,28 @@ export declare const NotificationType: {
8
8
  readonly Workspace: "workspace";
9
9
  };
10
10
  export type NotificationType = ValueOf<typeof NotificationType>;
11
+ export type DismissalStyle = "automatic" | "manual";
11
12
  export type NotificationAnimationType = "slide-in" | "slide-out" | "slide-in,slide-out";
12
13
  interface NotificationDescriptorBase<T extends NotificationType> {
13
14
  animationType?: NotificationAnimationType;
15
+ /**
16
+ * 'automatic' dismissal means the Notification will be removed after a configurable delay
17
+ * (6 seconds by default). 'manual' means a close button will be rendered and user must
18
+ * manually dismiss by clicking the close button.
19
+ */
20
+ dismissal?: DismissalStyle;
21
+ /**
22
+ * A custom icon can be provided or false can be used to suppress rendering of any icon.
23
+ * Default icons will be rendered for the different status values.
24
+ */
25
+ icon?: string | false;
14
26
  renderPostRefresh?: boolean;
27
+ showCloseButton?: boolean;
15
28
  status: ValidationStatus;
16
29
  type: T;
17
30
  }
18
31
  export interface ToastNotificationDescriptor extends NotificationDescriptorBase<"toast"> {
19
- content: string;
32
+ content?: ReactNode;
20
33
  header: string;
21
34
  }
22
35
  export interface WorkspaceNotificationDescriptor extends NotificationDescriptorBase<"workspace"> {
@@ -1,9 +1,15 @@
1
1
  import type { ToastNotificationDescriptor } from "./NotificationsContext";
2
- export declare const TOAST_HEIGHT = 80;
3
- export declare const TOAST_WIDTH = 300;
2
+ export type ToastHoverHandler = (id?: string) => void;
4
3
  export type ToastNotificationProps = {
5
- top: number;
4
+ hidden?: boolean;
5
+ id?: string;
6
+ left?: number;
6
7
  notification: ToastNotificationDescriptor;
7
- animated?: boolean;
8
+ onMeasured?: (id: string, height: number, width: number) => void;
9
+ onDismiss?: (id?: string) => void;
10
+ onHoverEntry?: ToastHoverHandler;
11
+ onHoverExit?: ToastHoverHandler;
12
+ opacity?: number;
13
+ top?: number;
8
14
  };
9
- export declare const ToastNotification: (props: ToastNotificationProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const ToastNotification: ({ hidden, id, left, onDismiss, onMeasured, top, notification, onHoverEntry, onHoverExit, opacity, }: ToastNotificationProps) => import("react/jsx-runtime").JSX.Element;
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
+ export { NotificationType, type Notification, type NotificationAnimationType, } from "./NotificationsContext";
1
2
  export { NotificationsProvider, useNotifications, } from "./NotificationsProvider";
2
3
  export { ToastNotification, type ToastNotificationProps, } from "./ToastNotification";
3
- export { NotificationType } from "./NotificationsContext";