@gouvfr-lasuite/ui-kit 0.16.0 → 0.16.2

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.d.ts CHANGED
@@ -4,6 +4,7 @@ import { CunninghamProvider as CunninghamProvider_2 } from '@openfun/cunningham-
4
4
  import { CursorProps } from 'react-arborist';
5
5
  import { default as default_2 } from 'react';
6
6
  import { Dispatch } from 'react';
7
+ import { HTMLAttributes } from 'react';
7
8
  import { JSX } from 'react/jsx-runtime';
8
9
  import { Key } from 'react-stately';
9
10
  import { LabelHTMLAttributes } from 'react';
@@ -16,7 +17,6 @@ import { ReactNode } from 'react';
16
17
  import { SelectProps } from 'react-aria-components';
17
18
  import { SetStateAction } from 'react';
18
19
  import { TreeApi } from 'react-arborist';
19
- import { TreeNode } from '@react-stately/data';
20
20
 
21
21
  declare type AbstractSeparatorProps = {
22
22
  withPadding?: boolean;
@@ -60,6 +60,15 @@ export declare type AvatarProps = {
60
60
  forceColor?: string;
61
61
  };
62
62
 
63
+ export declare const Badge: ({ children, uppercased, type, className, ...props }: PropsWithChildren<BadgeProps>) => JSX.Element;
64
+
65
+ declare type BadgeProps = HTMLAttributes<HTMLDivElement> & {
66
+ uppercased?: boolean;
67
+ type?: BadgeType;
68
+ };
69
+
70
+ declare type BadgeType = "accent" | "neutral" | "danger" | "success" | "warning" | "info";
71
+
63
72
  export declare type BaseTreeViewData<T> = {
64
73
  id: string;
65
74
  childrenCount?: number;
@@ -1224,7 +1233,7 @@ export declare type TreeProviderProps<T> = {
1224
1233
  onLoadChildren?: (id: string) => Promise<TreeViewDataType<T>[]>;
1225
1234
  };
1226
1235
 
1227
- export declare const TreeView: <T>({ initialOpenState, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, }: TreeViewProps<T>) => JSX.Element | undefined;
1236
+ export declare const TreeView: <T>({ initialOpenState, dndRootElement, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, }: TreeViewProps<T>) => JSX.Element | undefined;
1228
1237
 
1229
1238
  export declare type TreeViewDataType<T> = BaseTreeViewData<T>;
1230
1239
 
@@ -1259,6 +1268,7 @@ export declare enum TreeViewNodeTypeEnum {
1259
1268
 
1260
1269
  export declare type TreeViewProps<T> = {
1261
1270
  initialOpenState?: OpenMap;
1271
+ dndRootElement?: HTMLElement | null;
1262
1272
  selectedNodeId?: string;
1263
1273
  rootNodeId: string;
1264
1274
  canDrop?: (args: {
@@ -1274,6 +1284,27 @@ export declare type TreeViewProps<T> = {
1274
1284
 
1275
1285
  export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX.Element;
1276
1286
 
1287
+ /**
1288
+ * useArrowRoving
1289
+ *
1290
+ * Hook to manage keyboard navigation with ArrowLeft / ArrowRight inside a toolbar of actions.
1291
+ * - ArrowLeft / ArrowRight → move focus between buttons in the same container (roving focus).
1292
+ * - Enter → still activate the focused button normally, except right after roving
1293
+ * where the hook suppresses the "phantom click" (to avoid triggering actions by mistake).
1294
+ *
1295
+ * Usage:
1296
+ * const actionsRef = useRef<HTMLDivElement | null>(null);
1297
+ * useArrowRoving(actionsRef.current);
1298
+ *
1299
+ * return (
1300
+ * <div ref={actionsRef}>
1301
+ * <button>Option 1</button>
1302
+ * <button>Option 2</button>
1303
+ * </div>
1304
+ * );
1305
+ */
1306
+ export declare function useArrowRoving(container: HTMLElement | null): void;
1307
+
1277
1308
  /**
1278
1309
  * Hook for using custom translations with type safety.
1279
1310
  *
@@ -1345,7 +1376,7 @@ export declare const UserRow: ({ fullName: full_name, email, showEmail, }: UserP
1345
1376
  export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>, loadChildrenCallback?: (id: string) => Promise<TreeViewDataType<T>[]>) => {
1346
1377
  nodes: TreeDataItem<TreeViewDataType<T>>[];
1347
1378
  addChild: (parentId: string | null, newNode: TreeViewDataType<T>, index?: number) => void;
1348
- updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => TreeViewDataType<T> | undefined;
1379
+ updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => void;
1349
1380
  deleteNode: (nodeId: string) => void;
1350
1381
  deleteNodes: (nodeIds: string[]) => void;
1351
1382
  addRootNode: (newNode: TreeViewDataType<T>, index?: number) => void;
@@ -1353,7 +1384,7 @@ export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCa
1353
1384
  selectedNode: T | undefined;
1354
1385
  setSelectedNode: Dispatch<SetStateAction<T | undefined>>;
1355
1386
  refreshNode: (nodeId: string) => Promise<void>;
1356
- setChildren: (parentId: string, newChildren: TreeViewDataType<T>[]) => TreeViewDataType<T> | undefined;
1387
+ setChildren: (parentId: string, newChildren: TreeViewDataType<T>[]) => void;
1357
1388
  insertBeforeNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
1358
1389
  insertAfterNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
1359
1390
  handleMove: (result: TreeViewMoveResult) => void;
@@ -1362,7 +1393,6 @@ export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCa
1362
1393
  appendToNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
1363
1394
  move: (key: Key, toParentKey: Key | null, index: number) => void;
1364
1395
  resetTree: (newItems?: TreeViewDataType<T>[]) => void;
1365
- getItem: (key: Key) => TreeNode<TreeViewDataType<T>> | undefined;
1366
1396
  handleLoadChildren: (nodeId: string) => Promise<TreeViewDataType<T>[]>;
1367
1397
  selectNodeById: (nodeId: string) => void;
1368
1398
  getParent: (nodeId: string) => TreeViewDataType<T> | null;