@llmnative/react 1.43.0 → 1.44.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.
- package/dist/index.css +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +756 -651
- package/dist/index.mjs.map +1 -1
- package/dist/types/src/I18n.d.ts +4 -0
- package/dist/types/src/components/blocks/SortableList.d.ts +37 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/llms-full.txt +22 -0
- package/package.json +1 -1
package/dist/types/src/I18n.d.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ListCardProps } from './ListCard';
|
|
3
|
+
/** What a card of the list shows: the content of a compact ListCard. */
|
|
4
|
+
export type SortableListCard = Pick<ListCardProps, 'title' | 'description' | 'meta' | 'badge' | 'icon' | 'trailing' | 'active' | 'disabled'>;
|
|
5
|
+
export type SortableListReorderMeta<TItem> = {
|
|
6
|
+
fromIndex: number;
|
|
7
|
+
toIndex: number;
|
|
8
|
+
item: TItem;
|
|
9
|
+
};
|
|
10
|
+
export interface SortableListProps<TItem> {
|
|
11
|
+
/** The items, in their order. */
|
|
12
|
+
items: TItem[];
|
|
13
|
+
/** A stable key of an item. */
|
|
14
|
+
getKey: (item: TItem) => string;
|
|
15
|
+
/** The card of an item. */
|
|
16
|
+
renderItem: (item: TItem, index: number) => SortableListCard;
|
|
17
|
+
/** The items in their new order, after a drag or a key press on a handle. */
|
|
18
|
+
onReorder?: (items: TItem[], meta: SortableListReorderMeta<TItem>) => void;
|
|
19
|
+
/** The name of the list, for assistive technologies. */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Shows the position of each item (1, 2, 3…) before its card. */
|
|
22
|
+
numbered?: boolean;
|
|
23
|
+
/** No reordering: the handles are left out. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** What the list shows without items. */
|
|
26
|
+
emptyState?: React.ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
itemClassName?: string;
|
|
29
|
+
cardClassName?: string;
|
|
30
|
+
}
|
|
31
|
+
/** `items` with the one at `from` moved to `to`. */
|
|
32
|
+
export declare function moveItem<TItem>(items: readonly TItem[], from: number, to: number): TItem[];
|
|
33
|
+
/**
|
|
34
|
+
* A list of compact cards in an order the person chooses (CR-120): each card is dragged by its handle, or
|
|
35
|
+
* moved with the arrow keys on it; `onReorder` gets the new order. A screen reader hears where it went.
|
|
36
|
+
*/
|
|
37
|
+
export default function SortableList<TItem>({ items, getKey, renderItem, onReorder, label, numbered, disabled, emptyState, className, itemClassName, cardClassName, }: SortableListProps<TItem>): React.JSX.Element | null;
|
|
@@ -61,6 +61,8 @@ export * from './ui/fields/ContextMenu';
|
|
|
61
61
|
export { default as Menu } from './blocks/Menu';
|
|
62
62
|
export { default as ListCard } from './blocks/ListCard';
|
|
63
63
|
export type { ListCardProps } from './blocks/ListCard';
|
|
64
|
+
export { default as SortableList, moveItem } from './blocks/SortableList';
|
|
65
|
+
export type { SortableListProps, SortableListCard, SortableListReorderMeta } from './blocks/SortableList';
|
|
64
66
|
export { default as SideNav } from './blocks/SideNav';
|
|
65
67
|
export type { SideNavProps, SideNavItemDef } from './blocks/SideNav';
|
|
66
68
|
export { default as Form, useFormContext } from './widgets/Form';
|
package/llms-full.txt
CHANGED
|
@@ -1022,6 +1022,28 @@ e lasciano il menu aperto salvo `closeOnClick`.
|
|
|
1022
1022
|
| `onClick` | `(e) => void` |
|
|
1023
1023
|
| Classi CSS: `titleClassName`, `descriptionClassName`, `metaClassName`, `badgeClassName`, `leadingClassName`, `bodyClassName`, `headerClassName`, `trailingClassName`, `footerClassName` | `string` |
|
|
1024
1024
|
|
|
1025
|
+
**SortableList (CR-120):** card compatte (ListCard) in un ordine che la persona sceglie: le trascina per la
|
|
1026
|
+
maniglia, o con le frecce su/giù sulla maniglia; l'annuncio della nuova posizione va agli screen reader.
|
|
1027
|
+
```tsx
|
|
1028
|
+
<SortableList
|
|
1029
|
+
items={accounts}
|
|
1030
|
+
getKey={(a) => a.id}
|
|
1031
|
+
label="Account"
|
|
1032
|
+
numbered
|
|
1033
|
+
onReorder={(next, { fromIndex, toIndex, item }) => setAccounts(next)}
|
|
1034
|
+
renderItem={(a) => ({ title: a.email, meta: a.added, badge: <Badge variant="success">Disponibile</Badge>, trailing: <ActionButton icon="trash-2" … /> })}
|
|
1035
|
+
emptyState={<p>Nessun account</p>}
|
|
1036
|
+
/>
|
|
1037
|
+
moveItem(['a', 'b', 'c'], 0, 2) // ['b', 'c', 'a']
|
|
1038
|
+
```
|
|
1039
|
+
| Prop | Tipo |
|
|
1040
|
+
|---|---|
|
|
1041
|
+
| `items` / `getKey` | `TItem[]` / `(item) => string` |
|
|
1042
|
+
| `renderItem` | `(item, index) => SortableListCard` (`title`, `description`, `meta`, `badge`, `icon`, `trailing`, `active`, `disabled` di ListCard) |
|
|
1043
|
+
| `onReorder` | `(items, { fromIndex, toIndex, item }) => void`; senza, nessuna maniglia |
|
|
1044
|
+
| `label` / `numbered` / `disabled` / `emptyState` | `string` / `boolean` / `boolean` / `ReactNode` |
|
|
1045
|
+
| Classi CSS: `className`, `itemClassName`, `cardClassName` | `string` |
|
|
1046
|
+
|
|
1025
1047
|
**Dropdown:**
|
|
1026
1048
|
| Prop | Tipo |
|
|
1027
1049
|
|---|---|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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",
|