@llmnative/react 1.31.0 → 1.32.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.
@@ -1,12 +1,32 @@
1
1
  import React from "react";
2
2
  import type { BadgeProps } from "../ui/Badge";
3
3
  import type { MotionReference } from "../../motion";
4
- interface NotificationItem {
4
+ /** A button on a notification: it acts without opening the notification. */
5
+ export interface NotificationAction {
6
+ label: string;
7
+ icon?: string;
8
+ /** May return a promise: the button shows it is working until it settles. */
9
+ onClick: () => void | Promise<unknown>;
10
+ /** `primary` stands out; the default is quiet. */
11
+ variant?: "primary" | "default";
12
+ /** Closes the menu once the action is done; by default it stays open. */
13
+ closeOnClick?: boolean;
14
+ }
15
+ export interface NotificationItem {
16
+ /** Stable key of the notification (the index otherwise). */
17
+ id?: string;
5
18
  title: string;
6
- url: string;
19
+ /** A line under the title: what and where. */
20
+ description?: React.ReactNode;
21
+ /** Where the notification leads: a route of the app, or an address when `external`. Without it, it only shows. */
22
+ url?: string;
23
+ /** Opens `url` as an address in a new tab instead of a route of the app. */
24
+ external?: boolean;
7
25
  time: string;
8
26
  icon: string;
9
27
  read?: boolean;
28
+ /** Buttons under the notification, to act on it from the menu. */
29
+ actions?: NotificationAction[];
10
30
  }
11
31
  interface NotificationsProps {
12
32
  items?: NotificationItem[];
@@ -15,9 +35,11 @@ interface NotificationsProps {
15
35
  seeAllUrl?: string;
16
36
  /** Callback for "mark all as read" — shown in the header only when there are items */
17
37
  onMarkAllRead?: () => void;
38
+ /** Called when a notification is opened (e.g. to mark it read); the menu closes. */
39
+ onItemClick?: (item: NotificationItem, index: number) => void;
18
40
  /** Named motion preset for notification items appearance. */
19
41
  motion?: MotionReference;
20
42
  className?: string;
21
43
  }
22
- declare function Notifications({ items, badge, seeAllUrl, onMarkAllRead, motion, className, }: NotificationsProps): React.JSX.Element;
44
+ declare function Notifications({ items, badge, seeAllUrl, onMarkAllRead, onItemClick, motion, className, }: NotificationsProps): React.JSX.Element;
23
45
  export default Notifications;
@@ -5,6 +5,7 @@ export type { BreadcrumbItem, BreadcrumbsProps, BreadcrumbSchemaOptions } from '
5
5
  export { default as Carousel } from './blocks/Carousel';
6
6
  export * from './blocks/Dropdown';
7
7
  export { default as Notifications } from './blocks/Notifications';
8
+ export type { NotificationItem, NotificationAction } from './blocks/Notifications';
8
9
  export { default as Search } from './blocks/Search';
9
10
  export { default as Toolbar } from './blocks/Toolbar';
10
11
  export type { ToolbarProps } from './blocks/Toolbar';