@llmnative/react 1.30.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.
@@ -69,7 +69,18 @@ interface DropdownButtonProps extends Pick<MotionUIProps, 'motion'> {
69
69
  menuId?: string;
70
70
  buttonRef?: React.RefObject<HTMLButtonElement | null>;
71
71
  }
72
+ /** A secondary action of a menu item: an icon at its end, shown on hover or focus (CR-107). */
73
+ export interface DropdownItemAction {
74
+ icon: string;
75
+ /** Accessible name and tooltip. */
76
+ label: string;
77
+ onClick: () => void;
78
+ /** Closes the menu after the action; by default it stays open. */
79
+ closeOnClick?: boolean;
80
+ }
72
81
  interface DropdownItemProps {
82
+ /** Secondary actions, e.g. archive a row: icons shown on hover or focus (always on touch screens). */
83
+ actions?: DropdownItemAction[];
73
84
  /** Link URL. When set, renders as `<a>`, otherwise as `<button>`. */
74
85
  url?: string;
75
86
  onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
@@ -92,7 +103,7 @@ export declare const Dropdown: ({ children, trigger, badge, header, footer, defa
92
103
  */
93
104
  export declare function AsyncDropdown<TItem>({ loadItems, getItemId, renderItem, onSelect, selectedId, searchPlaceholder, emptyState, loadingState, errorState, debounceMs, closeOnSelect, inputClassName, selectedClassName, header, open: controlledOpen, defaultOpen, onOpenChange, footer, headerClassName, staticOpen, ...dropdownProps }: AsyncDropdownProps<TItem>): React.JSX.Element;
94
105
  export declare const DropdownButton: ({ children, badge, display, className, badgeClassName, motion: motionConfig, title, onToggle, open, menuId, buttonRef }: DropdownButtonProps) => React.JSX.Element;
95
- export declare const DropdownItem: ({ children, url, onClick, icon, className }: DropdownItemProps) => React.JSX.Element;
106
+ export declare const DropdownItem: ({ children, url, onClick, icon, className, actions }: DropdownItemProps) => React.JSX.Element;
96
107
  export declare const DropdownHeader: ({ children, className }: DropdownHeaderProps) => React.JSX.Element;
97
108
  export declare const DropdownDivider: ({ className }: DropdownDividerProps) => React.JSX.Element;
98
109
  interface DropdownMenuProps {
@@ -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';
@@ -16,7 +16,13 @@ export type ChatbotAction = {
16
16
  key: string;
17
17
  icon: string;
18
18
  label?: string;
19
+ /** A menu opened by the action; without it the action is a button (`onClick`). */
19
20
  content?: React.ReactNode;
21
+ /** What a button action does (CR-107). */
22
+ onClick?: () => void;
23
+ disabled?: boolean;
24
+ /** Shows `label` next to the icon: a command that has to be read, not guessed. */
25
+ showLabel?: boolean;
20
26
  };
21
27
  export interface ChatbotSubmitPayload {
22
28
  text: string;