@gouvfr-lasuite/ui-kit 0.0.1 → 0.1.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.cjs +39 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +89 -56
- package/dist/index.js +8786 -7775
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { CunninghamProvider as CunninghamProvider_2 } from '@openfun/cunningham-react';
|
|
2
2
|
import { CursorProps } from 'react-arborist';
|
|
3
3
|
import { Dispatch } from 'react';
|
|
4
|
-
import { JSX
|
|
4
|
+
import { JSX } from 'react/jsx-runtime';
|
|
5
|
+
import { Key } from 'react-stately';
|
|
5
6
|
import { LabelHTMLAttributes } from 'react';
|
|
7
|
+
import { NodeApi } from 'react-arborist';
|
|
6
8
|
import { NodeRendererProps } from 'react-arborist';
|
|
7
9
|
import { PropsWithChildren } from 'react';
|
|
8
10
|
import { ReactNode } from 'react';
|
|
9
11
|
import { SetStateAction } from 'react';
|
|
10
12
|
|
|
11
|
-
export declare type BaseTreeViewData<T> =
|
|
13
|
+
export declare type BaseTreeViewData<T> = {
|
|
12
14
|
id: string;
|
|
13
15
|
childrenCount?: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
hasLoadedChildren?: boolean;
|
|
17
|
+
subItems?: BaseTreeViewData<T>[];
|
|
18
|
+
canDrop?: boolean;
|
|
19
|
+
} & (({
|
|
20
|
+
type: TreeViewNodeTypeEnum.TITLE;
|
|
21
|
+
title: string;
|
|
22
|
+
}) | ({
|
|
23
|
+
type: TreeViewNodeTypeEnum.SEPARATOR;
|
|
24
|
+
}) | ({
|
|
25
|
+
type?: Exclude<TreeViewNodeTypeEnum, TreeViewNodeTypeEnum.TITLE | TreeViewNodeTypeEnum.SEPARATOR>;
|
|
26
|
+
} & T));
|
|
17
27
|
|
|
18
28
|
export declare const cunninghamConfig: {
|
|
19
29
|
themes: {
|
|
@@ -312,11 +322,11 @@ export declare const cunninghamConfig: {
|
|
|
312
322
|
};
|
|
313
323
|
};
|
|
314
324
|
|
|
315
|
-
export declare const CunninghamProvider: (props: Parameters<typeof CunninghamProvider_2>[0]) =>
|
|
325
|
+
export declare const CunninghamProvider: (props: Parameters<typeof CunninghamProvider_2>[0]) => JSX.Element;
|
|
316
326
|
|
|
317
|
-
export declare const CustomTabs: ({ tabs, defaultSelectedTab, fullWidth, }: TabsProps) =>
|
|
327
|
+
export declare const CustomTabs: ({ tabs, defaultSelectedTab, fullWidth, }: TabsProps) => JSX.Element | null;
|
|
318
328
|
|
|
319
|
-
export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, }: PropsWithChildren<DropdownMenuProps>) =>
|
|
329
|
+
export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, }: PropsWithChildren<DropdownMenuProps>) => JSX.Element;
|
|
320
330
|
|
|
321
331
|
export declare type DropdownMenuOption = {
|
|
322
332
|
label: string;
|
|
@@ -343,7 +353,7 @@ export declare function getLocales(): {
|
|
|
343
353
|
frFR: any;
|
|
344
354
|
};
|
|
345
355
|
|
|
346
|
-
export declare const Header: ({ leftIcon, rightIcon, languages, onTogglePanel, isPanelOpen, }: HeaderProps) =>
|
|
356
|
+
export declare const Header: ({ leftIcon, rightIcon, languages, onTogglePanel, isPanelOpen, }: HeaderProps) => JSX.Element;
|
|
347
357
|
|
|
348
358
|
export declare const headerHeight = 52;
|
|
349
359
|
|
|
@@ -355,25 +365,31 @@ export declare type HeaderProps = {
|
|
|
355
365
|
isPanelOpen?: boolean;
|
|
356
366
|
};
|
|
357
367
|
|
|
358
|
-
export declare const HorizontalSeparator: ({ withPadding }: Props_3) =>
|
|
368
|
+
export declare const HorizontalSeparator: ({ withPadding }: Props_3) => JSX.Element;
|
|
369
|
+
|
|
370
|
+
export declare const isNode: <T>(node?: TreeViewDataType<T>) => boolean;
|
|
371
|
+
|
|
372
|
+
export declare const isSeparator: <T>(node?: TreeViewDataType<T>) => boolean;
|
|
373
|
+
|
|
374
|
+
export declare const isTitle: <T>(node?: TreeViewDataType<T>) => boolean;
|
|
359
375
|
|
|
360
376
|
export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<HTMLLabelElement> & {
|
|
361
377
|
text?: string;
|
|
362
|
-
}) =>
|
|
378
|
+
}) => JSX.Element;
|
|
363
379
|
|
|
364
|
-
export declare const LanguagePicker: ({ languages }: LanguagePickerProps) =>
|
|
380
|
+
export declare const LanguagePicker: ({ languages }: LanguagePickerProps) => JSX.Element;
|
|
365
381
|
|
|
366
382
|
export declare type LanguagePickerProps = {
|
|
367
383
|
languages: DropdownMenuOption[];
|
|
368
384
|
};
|
|
369
385
|
|
|
370
|
-
export declare const LeftPanel: ({ children, isOpen, }: PropsWithChildren<LeftPanelProps>) =>
|
|
386
|
+
export declare const LeftPanel: ({ children, isOpen, }: PropsWithChildren<LeftPanelProps>) => JSX.Element;
|
|
371
387
|
|
|
372
388
|
export declare type LeftPanelProps = {
|
|
373
389
|
isOpen?: boolean;
|
|
374
390
|
};
|
|
375
391
|
|
|
376
|
-
export declare const MainLayout: ({ icon, children, leftPanelContent, rightHeaderContent, languages, enableResize, }: PropsWithChildren<MainLayoutProps>) =>
|
|
392
|
+
export declare const MainLayout: ({ icon, children, leftPanelContent, rightHeaderContent, languages, enableResize, }: PropsWithChildren<MainLayoutProps>) => JSX.Element;
|
|
377
393
|
|
|
378
394
|
export declare type MainLayoutProps = {
|
|
379
395
|
icon?: React.ReactNode;
|
|
@@ -384,7 +400,11 @@ export declare type MainLayoutProps = {
|
|
|
384
400
|
enableResize?: boolean;
|
|
385
401
|
};
|
|
386
402
|
|
|
387
|
-
export declare
|
|
403
|
+
export declare type OpenMap = {
|
|
404
|
+
[id: string]: boolean;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export declare const ProConnectButton: ({ disabled, onClick, }: ProConnectButtonProps) => JSX.Element;
|
|
388
408
|
|
|
389
409
|
export declare type ProConnectButtonProps = {
|
|
390
410
|
disabled?: boolean;
|
|
@@ -409,7 +429,7 @@ declare type Props_3 = {
|
|
|
409
429
|
withPadding?: boolean;
|
|
410
430
|
};
|
|
411
431
|
|
|
412
|
-
export declare const QuickSearch: ({ onFilter, inputContent, inputValue, loading, showInput, label, placeholder, children, }: QuickSearchProps) =>
|
|
432
|
+
export declare const QuickSearch: ({ onFilter, inputContent, inputValue, loading, showInput, label, placeholder, children, }: QuickSearchProps) => JSX.Element;
|
|
413
433
|
|
|
414
434
|
export declare type QuickSearchAction = {
|
|
415
435
|
onSelect?: () => void;
|
|
@@ -425,7 +445,7 @@ export declare type QuickSearchData<T> = {
|
|
|
425
445
|
showWhenEmpty?: boolean;
|
|
426
446
|
};
|
|
427
447
|
|
|
428
|
-
export declare const QuickSearchGroup: <T>({ group, onSelect, renderElement, }: QuickSearchGroupProps<T>) =>
|
|
448
|
+
export declare const QuickSearchGroup: <T>({ group, onSelect, renderElement, }: QuickSearchGroupProps<T>) => JSX.Element | null;
|
|
429
449
|
|
|
430
450
|
export declare type QuickSearchGroupProps<T> = {
|
|
431
451
|
group: QuickSearchData<T>;
|
|
@@ -433,11 +453,11 @@ export declare type QuickSearchGroupProps<T> = {
|
|
|
433
453
|
onSelect?: (element: T) => void;
|
|
434
454
|
};
|
|
435
455
|
|
|
436
|
-
export declare const QuickSearchInput: ({ loading, inputValue, onFilter, placeholder, children, withSeparator: separator, }: Props_2) =>
|
|
456
|
+
export declare const QuickSearchInput: ({ loading, inputValue, onFilter, placeholder, children, withSeparator: separator, }: Props_2) => JSX.Element;
|
|
437
457
|
|
|
438
|
-
export declare const QuickSearchItem: ({ children, onSelect, id, }: PropsWithChildren<Props>) =>
|
|
458
|
+
export declare const QuickSearchItem: ({ children, onSelect, id, }: PropsWithChildren<Props>) => JSX.Element;
|
|
439
459
|
|
|
440
|
-
export declare const QuickSearchItemTemplate: ({ alwaysShowRight, left, right, }: QuickSearchItemTemplateProps) =>
|
|
460
|
+
export declare const QuickSearchItemTemplate: ({ alwaysShowRight, left, right, }: QuickSearchItemTemplateProps) => JSX.Element;
|
|
441
461
|
|
|
442
462
|
export declare type QuickSearchItemTemplateProps = {
|
|
443
463
|
alwaysShowRight?: boolean;
|
|
@@ -456,7 +476,7 @@ export declare type QuickSearchProps = {
|
|
|
456
476
|
children?: ReactNode;
|
|
457
477
|
};
|
|
458
478
|
|
|
459
|
-
export declare const Spinner: ({ size }: SpinnerProps) =>
|
|
479
|
+
export declare const Spinner: ({ size }: SpinnerProps) => JSX.Element;
|
|
460
480
|
|
|
461
481
|
declare interface SpinnerProps {
|
|
462
482
|
size?: "sm" | "md" | "lg" | "xl";
|
|
@@ -475,31 +495,22 @@ export declare type TabsProps = {
|
|
|
475
495
|
fullWidth?: boolean;
|
|
476
496
|
};
|
|
477
497
|
|
|
478
|
-
export declare
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
} | {
|
|
489
|
-
id: string;
|
|
490
|
-
name: string;
|
|
491
|
-
children: {
|
|
492
|
-
id: string;
|
|
493
|
-
name: string;
|
|
494
|
-
}[];
|
|
495
|
-
childrenCount?: undefined;
|
|
496
|
-
})[];
|
|
498
|
+
export declare type TreeDataItem<T> = {
|
|
499
|
+
/** A unique key for the tree node. */
|
|
500
|
+
key: string;
|
|
501
|
+
/** The key of the parent node. */
|
|
502
|
+
parentKey?: string | null;
|
|
503
|
+
/** The value object for the tree node. */
|
|
504
|
+
value: TreeViewDataType<T>;
|
|
505
|
+
/** Children of the tree node. */
|
|
506
|
+
children: TreeDataItem<T>[] | null;
|
|
507
|
+
};
|
|
497
508
|
|
|
498
|
-
export declare const TreeView: <T>({ treeData, selectedNodeId, rootNodeId, renderNode,
|
|
509
|
+
export declare const TreeView: <T>({ treeData, initialOpenState, selectedNodeId, rootNodeId, renderNode, handleMove, canDrop, canDrag, }: TreeViewProps<T>) => JSX.Element;
|
|
499
510
|
|
|
500
511
|
export declare type TreeViewDataType<T> = BaseTreeViewData<T>;
|
|
501
512
|
|
|
502
|
-
export declare const TreeViewItem: <T>({ children, onClick, node, dragHandle, style, loadChildren, forceLoading, }: PropsWithChildren<TreeViewNodeProps<T>>) =>
|
|
513
|
+
export declare const TreeViewItem: <T>({ children, onClick, node, dragHandle, style, loadChildren, forceLoading, }: PropsWithChildren<TreeViewNodeProps<T>>) => JSX.Element;
|
|
503
514
|
|
|
504
515
|
export declare enum TreeViewMoveModeEnum {
|
|
505
516
|
FIRST_CHILD = "first-child",
|
|
@@ -509,28 +520,42 @@ export declare enum TreeViewMoveModeEnum {
|
|
|
509
520
|
}
|
|
510
521
|
|
|
511
522
|
export declare type TreeViewMoveResult = {
|
|
512
|
-
|
|
523
|
+
targetModeId: string;
|
|
513
524
|
mode: TreeViewMoveModeEnum;
|
|
514
|
-
sourceNodeId: string;
|
|
515
525
|
oldParentId?: string;
|
|
526
|
+
index: number;
|
|
527
|
+
newParentId: string | null;
|
|
528
|
+
sourceId: string;
|
|
516
529
|
};
|
|
517
530
|
|
|
518
|
-
export declare type TreeViewNodeProps<T> = NodeRendererProps<
|
|
531
|
+
export declare type TreeViewNodeProps<T> = NodeRendererProps<TreeDataItem<T>> & {
|
|
519
532
|
onClick?: () => void;
|
|
520
533
|
forceLoading?: boolean;
|
|
521
534
|
loadChildren?: (node: TreeViewDataType<T>) => Promise<TreeViewDataType<T>[]>;
|
|
522
535
|
};
|
|
523
536
|
|
|
537
|
+
export declare enum TreeViewNodeTypeEnum {
|
|
538
|
+
NODE = "node",
|
|
539
|
+
SEPARATOR = "separator",
|
|
540
|
+
TITLE = "title"
|
|
541
|
+
}
|
|
542
|
+
|
|
524
543
|
export declare type TreeViewProps<T> = {
|
|
525
|
-
treeData:
|
|
526
|
-
|
|
544
|
+
treeData: TreeDataItem<T>[];
|
|
545
|
+
initialOpenState?: OpenMap;
|
|
527
546
|
selectedNodeId?: string;
|
|
528
547
|
rootNodeId: string;
|
|
529
|
-
|
|
530
|
-
|
|
548
|
+
canDrop?: (args: {
|
|
549
|
+
parentNode: NodeApi<TreeDataItem<T>> | null;
|
|
550
|
+
dragNodes: NodeApi<TreeDataItem<T>>[];
|
|
551
|
+
index: number;
|
|
552
|
+
}) => boolean;
|
|
553
|
+
canDrag?: (node: TreeDataItem<T>) => boolean;
|
|
554
|
+
handleMove?: (result: TreeViewMoveResult) => void;
|
|
555
|
+
renderNode: (props: NodeRendererProps<TreeDataItem<T>>) => React.ReactNode;
|
|
531
556
|
};
|
|
532
557
|
|
|
533
|
-
export declare const TreeViewSeparator: ({ top, left }: CursorProps) =>
|
|
558
|
+
export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX.Element;
|
|
534
559
|
|
|
535
560
|
export declare const useDropdownMenu: () => {
|
|
536
561
|
isOpen: boolean;
|
|
@@ -543,20 +568,28 @@ export declare const useResponsive: () => {
|
|
|
543
568
|
isDesktop: boolean;
|
|
544
569
|
};
|
|
545
570
|
|
|
546
|
-
export declare const useTree: <T>(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
addChild: (parentId: string, newNode: TreeViewDataType<T>) => void;
|
|
571
|
+
export declare const useTree: <T extends object>(initialItems: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>, loadChildrenCallback?: (id: string) => Promise<TreeViewDataType<T>[]>) => {
|
|
572
|
+
nodes: TreeDataItem<TreeViewDataType<T>>[];
|
|
573
|
+
addChild: (parentId: string | null, newNode: TreeViewDataType<T>) => void;
|
|
550
574
|
updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => void;
|
|
551
575
|
deleteNode: (nodeId: string) => void;
|
|
552
576
|
addRootNode: (newNode: TreeViewDataType<T>) => void;
|
|
553
577
|
selectedNode: TreeViewDataType<T> | undefined;
|
|
554
578
|
setSelectedNode: Dispatch<SetStateAction<TreeViewDataType<T> | undefined>>;
|
|
555
579
|
refreshNode: (nodeId: string) => Promise<void>;
|
|
556
|
-
setChildren: (parentId: string, newChildren: TreeViewDataType<T>[]
|
|
580
|
+
setChildren: (parentId: string, newChildren: TreeViewDataType<T>[]) => void;
|
|
581
|
+
insertBeforeNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
|
|
582
|
+
insertAfterNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
|
|
583
|
+
handleMove: (result: TreeViewMoveResult) => void;
|
|
584
|
+
prependToNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
|
|
585
|
+
moveNode: (nodeId: string, newParentId: string | null, newIndex: number, oldParentId?: string | null) => void;
|
|
586
|
+
appendToNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
|
|
587
|
+
move: (key: Key, toParentKey: Key | null, index: number) => void;
|
|
588
|
+
resetTree: (newItems?: TreeViewDataType<T>[]) => void;
|
|
589
|
+
handleLoadChildren: (nodeId: string) => Promise<TreeViewDataType<T>[]>;
|
|
557
590
|
};
|
|
558
591
|
|
|
559
|
-
export declare const WithLabel: ({ label, text, labelSide, children, }: PropsWithChildren<WithLabelProps>) =>
|
|
592
|
+
export declare const WithLabel: ({ label, text, labelSide, children, }: PropsWithChildren<WithLabelProps>) => JSX.Element;
|
|
560
593
|
|
|
561
594
|
export declare type WithLabelProps = {
|
|
562
595
|
label: string;
|