@gouvfr-lasuite/ui-kit 0.17.2 → 0.18.1

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
@@ -77,14 +77,25 @@ export declare type BaseTreeViewData<T> = {
77
77
  childrenCount?: number;
78
78
  hasLoadedChildren?: boolean;
79
79
  children?: BaseTreeViewData<T>[];
80
+ pagination?: {
81
+ currentPage: number;
82
+ totalCount?: number;
83
+ hasMore: boolean;
84
+ };
80
85
  canDrop?: boolean;
81
86
  } & (({
87
+ nodeType: TreeViewNodeTypeEnum.SIMPLE_NODE;
88
+ label: string;
89
+ }) | ({
82
90
  nodeType: TreeViewNodeTypeEnum.TITLE;
83
91
  headerTitle: string;
84
92
  }) | ({
85
93
  nodeType: TreeViewNodeTypeEnum.SEPARATOR;
86
94
  }) | ({
87
- nodeType?: Exclude<TreeViewNodeTypeEnum, TreeViewNodeTypeEnum.TITLE | TreeViewNodeTypeEnum.SEPARATOR>;
95
+ nodeType: TreeViewNodeTypeEnum.VIEW_MORE;
96
+ label?: string;
97
+ }) | ({
98
+ nodeType?: Exclude<TreeViewNodeTypeEnum, TreeViewNodeTypeEnum.TITLE | TreeViewNodeTypeEnum.SEPARATOR | TreeViewNodeTypeEnum.VIEW_MORE | TreeViewNodeTypeEnum.SIMPLE_NODE>;
88
99
  } & T));
89
100
 
90
101
  export declare const containerSizeMap: Record<IconSize, number>;
@@ -672,6 +683,8 @@ export declare const isSeparator: <T>(node?: TreeViewDataType<T>) => boolean;
672
683
 
673
684
  export declare const isTitle: <T>(node?: TreeViewDataType<T>) => boolean;
674
685
 
686
+ export declare const isViewMore: <T>(node?: TreeViewDataType<T>) => boolean;
687
+
675
688
  export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<HTMLLabelElement> & {
676
689
  text?: string;
677
690
  }) => JSX.Element;
@@ -687,15 +700,20 @@ export declare const LaGaufre: () => JSX.Element;
687
700
  * - `size`: The size of the CTA.
688
701
  * - `color`: The color of the CTA.
689
702
  */
690
- export declare const LanguagePicker: ({ languages, onChange, size, color, variant, fullWidth, }: LanguagePickerProps) => JSX.Element;
703
+ export declare const LanguagePicker: ({ languages, onChange, size, color, variant, fullWidth, compact: lightMode, }: LanguagePickerProps) => JSX.Element;
691
704
 
692
705
  export declare type LanguagePickerProps = {
693
- languages: DropdownMenuOption[];
706
+ languages: LanguagesOption[];
694
707
  onChange?: (language: string) => void;
695
708
  color?: ButtonProps["color"];
696
709
  variant?: ButtonProps["variant"];
697
710
  size?: ButtonProps["size"];
698
711
  fullWidth?: ButtonProps["fullWidth"];
712
+ compact?: boolean;
713
+ };
714
+
715
+ export declare type LanguagesOption = DropdownMenuOption & {
716
+ shortLabel?: string;
699
717
  };
700
718
 
701
719
  export declare const LeftPanel: ({ children, isOpen, hasHeader, }: PropsWithChildren<LeftPanelProps>) => JSX.Element;
@@ -848,13 +866,25 @@ export declare const locales: {
848
866
  };
849
867
  };
850
868
  };
869
+ laGaufre: {
870
+ label: string;
871
+ closeLabel: string;
872
+ loadingText: string;
873
+ newWindowLabelSuffix: string;
874
+ headerLabel: string;
875
+ };
851
876
  userMenu: {
877
+ term_of_service: string;
878
+ manage_account: string;
852
879
  open: string;
853
880
  close: string;
854
881
  accountSettings: string;
855
882
  logout: string;
856
883
  dialogTitle: string;
857
884
  };
885
+ treeView: {
886
+ viewMore: string;
887
+ };
858
888
  footer: {
859
889
  logo: {
860
890
  alt: string;
@@ -999,12 +1029,24 @@ export declare const locales: {
999
1029
  };
1000
1030
  };
1001
1031
  };
1032
+ laGaufre: {
1033
+ label: string;
1034
+ closeLabel: string;
1035
+ loadingText: string;
1036
+ newWindowLabelSuffix: string;
1037
+ headerLabel: string;
1038
+ };
1002
1039
  userMenu: {
1040
+ term_of_service: string;
1003
1041
  open: string;
1004
1042
  close: string;
1005
1043
  accountSettings: string;
1006
1044
  logout: string;
1007
1045
  dialogTitle: string;
1046
+ manage_account: string;
1047
+ };
1048
+ treeView: {
1049
+ viewMore: string;
1008
1050
  };
1009
1051
  footer: {
1010
1052
  logo: {
@@ -1037,6 +1079,11 @@ export declare type OpenMap = {
1037
1079
  [id: string]: boolean;
1038
1080
  };
1039
1081
 
1082
+ export declare type PaginatedChildrenResult<T> = {
1083
+ children?: TreeViewDataType<T>[];
1084
+ pagination?: BaseTreeViewData<T>["pagination"];
1085
+ };
1086
+
1040
1087
  export declare const ProConnectButton: ({ disabled, onClick, }: ProConnectButtonProps) => JSX.Element;
1041
1088
 
1042
1089
  export declare type ProConnectButtonProps = {
@@ -1311,14 +1358,14 @@ export declare type TreeDataItem<T> = {
1311
1358
  children: TreeDataItem<T>[] | null;
1312
1359
  };
1313
1360
 
1314
- export declare const TreeProvider: <T>({ children, onRefresh: refreshCallback, initialNodeId, onLoadChildren: loadChildrenCallback, initialTreeData, }: TreeProviderProps<T>) => JSX.Element;
1361
+ export declare const TreeProvider: <T>({ children, onRefresh: refreshCallback, initialNodeId, onLoadChildren, initialTreeData, }: TreeProviderProps<T>) => JSX.Element;
1315
1362
 
1316
1363
  export declare type TreeProviderProps<T> = {
1317
1364
  children: React.ReactNode;
1318
1365
  initialTreeData?: TreeViewDataType<T>[];
1319
1366
  initialNodeId?: string;
1320
1367
  onRefresh?: (id: string) => Promise<Partial<TreeViewDataType<T>>>;
1321
- onLoadChildren?: (id: string) => Promise<TreeViewDataType<T>[]>;
1368
+ onLoadChildren?: (id: string, page: number) => Promise<PaginatedChildrenResult<T>>;
1322
1369
  };
1323
1370
 
1324
1371
  export declare const TreeView: <T>({ initialOpenState, dndRootElement, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, }: TreeViewProps<T>) => JSX.Element | undefined;
@@ -1351,7 +1398,9 @@ export declare type TreeViewNodeProps<T> = NodeRendererProps<TreeDataItem<T>> &
1351
1398
  export declare enum TreeViewNodeTypeEnum {
1352
1399
  NODE = "node",
1353
1400
  SEPARATOR = "separator",
1354
- TITLE = "title"
1401
+ TITLE = "title",
1402
+ SIMPLE_NODE = "simpleNode",
1403
+ VIEW_MORE = "viewMore"
1355
1404
  }
1356
1405
 
1357
1406
  export declare type TreeViewProps<T> = {
@@ -1435,7 +1484,15 @@ export declare const useResponsive: () => ResponsiveStates;
1435
1484
  * - `shouldCloseOnInteractOutside`: A function to call when the menu should be closed.
1436
1485
  * - `footerAction`: The child to render inside the footer.
1437
1486
  */
1438
- export declare const UserMenu: ({ user, settingsCTA, logout, isInitialOpen, shouldCloseOnInteractOutside, footerAction, }: UserMenuProps) => JSX.Element | null;
1487
+ export declare const UserMenu: ({ user, settingsCTA, logout, isInitialOpen, shouldCloseOnInteractOutside, termOfServiceUrl, footerAction, }: UserMenuProps) => JSX.Element | null;
1488
+
1489
+ export declare const UserMenuItem: ({ label, icon, onClick }: UserMenuItemProps) => JSX.Element;
1490
+
1491
+ declare type UserMenuItemProps = {
1492
+ label: string;
1493
+ icon: string;
1494
+ onClick?: () => void;
1495
+ };
1439
1496
 
1440
1497
  export declare type UserMenuProps = {
1441
1498
  user?: {
@@ -1444,6 +1501,7 @@ export declare type UserMenuProps = {
1444
1501
  } | null;
1445
1502
  settingsCTA?: string | (() => void);
1446
1503
  logout?: () => void;
1504
+ termOfServiceUrl?: string;
1447
1505
  isInitialOpen?: boolean;
1448
1506
  shouldCloseOnInteractOutside?: (element: Element) => boolean;
1449
1507
  footerAction?: ReactElement;
@@ -1457,7 +1515,7 @@ declare type UserProps = {
1457
1515
 
1458
1516
  export declare const UserRow: ({ fullName: full_name, email, showEmail, }: UserProps) => JSX.Element;
1459
1517
 
1460
- export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>, loadChildrenCallback?: (id: string) => Promise<TreeViewDataType<T>[]>) => {
1518
+ export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>, onLoadChildren?: (id: string, page: number) => Promise<PaginatedChildrenResult<T>>) => {
1461
1519
  nodes: TreeDataItem<TreeViewDataType<T>>[];
1462
1520
  addChild: (parentId: string | null, newNode: TreeViewDataType<T>, index?: number) => void;
1463
1521
  updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => void;
@@ -1477,7 +1535,7 @@ export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCa
1477
1535
  appendToNode: (nodeId: string, newNode: TreeViewDataType<T>) => void;
1478
1536
  move: (key: Key, toParentKey: Key | null, index: number) => void;
1479
1537
  resetTree: (newItems?: TreeViewDataType<T>[]) => void;
1480
- handleLoadChildren: (nodeId: string) => Promise<TreeViewDataType<T>[]>;
1538
+ handleLoadChildren: (nodeId: string) => Promise<never[] | undefined>;
1481
1539
  selectNodeById: (nodeId: string) => void;
1482
1540
  getParent: (nodeId: string) => TreeViewDataType<T> | null;
1483
1541
  getNode: (nodeId: string) => TreeViewDataType<T> | undefined;