@vuu-ui/vuu-notifications 3.3.9 → 3.3.10

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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.9",
2
+ "version": "3.3.10",
3
3
  "description": "VUU notifications - Toast, WorkspaceNotification etc",
4
4
  "main": "./src/index.js",
5
5
  "author": "heswell",
@@ -13,8 +13,8 @@
13
13
  "@salt-ds/core": "1.54.1",
14
14
  "@salt-ds/styles": "0.2.1",
15
15
  "@salt-ds/window": "0.1.1",
16
- "@vuu-ui/vuu-ui-controls": "3.3.9",
17
- "@vuu-ui/vuu-utils": "3.3.9"
16
+ "@vuu-ui/vuu-ui-controls": "3.3.10",
17
+ "@vuu-ui/vuu-utils": "3.3.10"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "clsx": "^2.0.0",
@@ -0,0 +1,6 @@
1
+ import { NotificationsContextProps, ToastNotificationDescriptor } from "./NotificationsContext";
2
+ export interface NotificationsCenterProps {
3
+ notificationsContext: NotificationsContextProps;
4
+ startupToastNotification?: ToastNotificationDescriptor;
5
+ }
6
+ export declare const NotificationsCenter: ({ notificationsContext, startupToastNotification, }: NotificationsCenterProps) => import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import type { ValidationStatus } from "@salt-ds/core";
2
+ import type { ValueOf } from "@vuu-ui/vuu-utils";
3
+ import type { ReactNode } from "react";
4
+ export type DispatchShowNotification = (notification: Notification) => string | undefined;
5
+ export type DispatchHideNotification = (id?: string) => void;
6
+ export declare const NotificationType: {
7
+ readonly Toast: "toast";
8
+ readonly Workspace: "workspace";
9
+ };
10
+ export type NotificationType = ValueOf<typeof NotificationType>;
11
+ export type DismissalStyle = "automatic" | "manual";
12
+ export type NotificationAnimationType = "slide-in" | "slide-out" | "slide-in,slide-out";
13
+ interface NotificationDescriptorBase<T extends NotificationType> {
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;
26
+ renderPostRefresh?: boolean;
27
+ showCloseButton?: boolean;
28
+ status: ValidationStatus;
29
+ type: T;
30
+ }
31
+ export interface ToastNotificationDescriptor extends NotificationDescriptorBase<"toast"> {
32
+ className?: string;
33
+ content?: ReactNode;
34
+ header: string;
35
+ }
36
+ export interface WorkspaceNotificationDescriptor extends NotificationDescriptorBase<"workspace"> {
37
+ content: ReactNode;
38
+ }
39
+ export type Notification = ToastNotificationDescriptor | WorkspaceNotificationDescriptor;
40
+ export declare const isToastNotification: (n: Notification) => n is ToastNotificationDescriptor;
41
+ export declare const isWorkspaceNotification: (n: Notification) => n is WorkspaceNotificationDescriptor;
42
+ export type NotificationsContextProps = {
43
+ hideNotification: DispatchHideNotification;
44
+ showNotification: DispatchShowNotification;
45
+ setNotify: (showNotificationDispatcher: DispatchShowNotification, hideNotificationDispatcher: DispatchHideNotification) => void;
46
+ };
47
+ export {};
@@ -0,0 +1,9 @@
1
+ import React, { type ReactElement } from "react";
2
+ import type { DispatchHideNotification, DispatchShowNotification } from "./NotificationsContext";
3
+ export declare const NotificationsProvider: (props: {
4
+ children: ReactElement | ReactElement[];
5
+ }) => React.JSX.Element;
6
+ export declare const useNotifications: () => {
7
+ hideNotification: DispatchHideNotification;
8
+ showNotification: DispatchShowNotification;
9
+ };
@@ -0,0 +1,15 @@
1
+ import type { ToastNotificationDescriptor } from "./NotificationsContext";
2
+ export type ToastHoverHandler = (id?: string) => void;
3
+ export type ToastNotificationProps = {
4
+ hidden?: boolean;
5
+ id?: string;
6
+ left?: number;
7
+ notification: ToastNotificationDescriptor;
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;
14
+ };
15
+ export declare const ToastNotification: ({ hidden, id, left, onDismiss, onMeasured, top, notification, onHoverEntry, onHoverExit, opacity, }: ToastNotificationProps) => import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ export interface WorkspaceNotificationProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ }
5
+ export declare const WorkspaceNotification: ({ children, className, style: styleProp, ...htmlAttributes }: WorkspaceNotificationProps) => import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { NotificationType, type Notification, type NotificationAnimationType, } from "./NotificationsContext";
2
+ export { NotificationsProvider, useNotifications, } from "./NotificationsProvider";
3
+ export { ToastNotification, type ToastNotificationProps, } from "./ToastNotification";