@llmnative/react 1.30.0 → 1.31.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 {
@@ -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;
package/llms-full.txt CHANGED
@@ -766,6 +766,17 @@ Albero accessibile di nodi (cartelle e file, gerarchie): pattern WAI-ARIA tree,
766
766
  </Dropdown>
767
767
  ```
768
768
 
769
+ Azioni secondarie di una voce (CR-107): `actions` mostra icone in fondo alla riga, al passaggio
770
+ del mouse o al focus (sempre sui dispositivi touch). Non selezionano la voce e lasciano il menu aperto
771
+ salvo `closeOnClick`.
772
+
773
+ ```tsx
774
+ <DropdownItem icon="messages-square" onClick={() => open(chat)}
775
+ actions={[{ icon: 'archive', label: 'Archivia', onClick: () => archive(chat) }]}>
776
+ {chat.title}
777
+ </DropdownItem>
778
+ ```
779
+
769
780
  Per elenchi caricati dinamicamente usare `AsyncDropdown`: gestisce ricerca con debounce,
770
781
  cancellazione delle richieste precedenti tramite `AbortSignal` e stati loading/empty/error.
771
782
 
@@ -998,6 +1009,9 @@ class MyAIProvider implements AIProviderAdapter {
998
1009
 
999
1010
  // Factory per registri esterni
1000
1011
  const registry = createAIProviderRegistry(definitions)
1012
+ // Azioni di Chatbot (CR-107): con `content` aprono un menu; senza, sono pulsanti con `onClick`.
1013
+ // <Chatbot actions={[{ key: 'finish', icon: 'git-pull-request', label: 'Concludi', showLabel: true,
1014
+ // disabled: running, onClick: finish }]} … />
1001
1015
  ```
1002
1016
 
1003
1017
  ### Identità dei modelli indipendente dal provider (CR-103)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmnative/react",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "LLM-native React framework for deterministic UI generation. Data-driven by default, schema-driven optional. Ultra-low token consumption — built for AI agents, not just humans.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",