@gouvfr-lasuite/ui-kit 0.1.10 → 0.3.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.d.ts CHANGED
@@ -12,6 +12,41 @@ import { ReactNode } from 'react';
12
12
  import { SetStateAction } from 'react';
13
13
  import { TreeApi } from 'react-arborist';
14
14
 
15
+ export declare type AccessData<UserType, T> = T & {
16
+ id: string;
17
+ role: string;
18
+ user: UserData<UserType>;
19
+ };
20
+
21
+ export declare const AccessRoleDropdown: ({ roles, onSelect, canUpdate, selectedRole, isOpen, onOpenChange, roleTopMessage, }: AccessRoleDropdownProps) => JSX.Element;
22
+
23
+ declare type AccessRoleDropdownProps = {
24
+ selectedRole: string;
25
+ roles: DropdownMenuOption[];
26
+ onSelect: (role: string) => void;
27
+ canUpdate?: boolean;
28
+ isOpen?: boolean;
29
+ onOpenChange?: (isOpen: boolean) => void;
30
+ roleTopMessage?: string;
31
+ };
32
+
33
+ export declare type AddShareUserListProps<UserType> = {
34
+ users: UserData<UserType>[];
35
+ onRemoveUser: (user: UserData<UserType>) => void;
36
+ rightActions?: ReactNode;
37
+ onShare: () => void;
38
+ roles: DropdownMenuOption[];
39
+ selectedRole: string;
40
+ shareButtonLabel?: string;
41
+ onSelectRole: (role: string) => void;
42
+ };
43
+
44
+ export declare type AvatarProps = {
45
+ fullName: string;
46
+ size?: "xsmall" | "small" | "medium" | "large";
47
+ forceColor?: string;
48
+ };
49
+
15
50
  export declare type BaseTreeViewData<T> = {
16
51
  id: string;
17
52
  childrenCount?: number;
@@ -112,6 +147,17 @@ export declare const cunninghamConfig: {
112
147
  "danger-700": string;
113
148
  "danger-800": string;
114
149
  "danger-900": string;
150
+ "blue-500": string;
151
+ "brown-500": string;
152
+ "cyan-500": string;
153
+ "gold-500": string;
154
+ "green-500": string;
155
+ "olive-500": string;
156
+ "orange-500": string;
157
+ "purple-500": string;
158
+ "red-500": string;
159
+ "yellow-500": string;
160
+ "rose-500": string;
115
161
  };
116
162
  font: {
117
163
  sizes: {
@@ -145,12 +191,6 @@ export declare const cunninghamConfig: {
145
191
  base: string;
146
192
  };
147
193
  };
148
- logo: {
149
- src: string;
150
- widthHeader: string;
151
- widthFooter: string;
152
- alt: string;
153
- };
154
194
  spacings: {
155
195
  "0": string;
156
196
  none: string;
@@ -333,7 +373,7 @@ export declare const CunninghamProvider: (props: Parameters<typeof CunninghamPro
333
373
 
334
374
  export declare const CustomTabs: ({ tabs, defaultSelectedTab, fullWidth, }: TabsProps) => JSX.Element | null;
335
375
 
336
- export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, }: PropsWithChildren<DropdownMenuProps>) => JSX.Element;
376
+ export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, topMessage, shouldCloseOnInteractOutside, }: PropsWithChildren<DropdownMenuProps>) => JSX.Element;
337
377
 
338
378
  export declare type DropdownMenuOption = {
339
379
  label: string;
@@ -353,11 +393,15 @@ export declare type DropdownMenuProps = {
353
393
  selectedValues?: string[];
354
394
  onSelectValue?: (value: string) => void;
355
395
  isOpen?: boolean;
396
+ topMessage?: string;
397
+ shouldCloseOnInteractOutside?: (element: Element) => boolean;
356
398
  };
357
399
 
400
+ export declare const Footer: () => JSX.Element;
401
+
358
402
  export declare function getLocales(): {
359
- enUS: any;
360
- frFR: any;
403
+ "en-US": any;
404
+ "fr-FR": any;
361
405
  };
362
406
 
363
407
  export declare const Header: ({ leftIcon, rightIcon, languages, onTogglePanel, isPanelOpen, }: HeaderProps) => JSX.Element;
@@ -372,8 +416,31 @@ export declare type HeaderProps = {
372
416
  isPanelOpen?: boolean;
373
417
  };
374
418
 
419
+ export declare const Hero: ({ logo, mainButton, banner, title, subtitle, }: {
420
+ logo: React.ReactNode;
421
+ mainButton?: React.ReactNode;
422
+ banner: string;
423
+ title: string;
424
+ subtitle: string;
425
+ }) => JSX.Element;
426
+
427
+ export declare const HomeGutter: ({ children }: {
428
+ children: React.ReactNode;
429
+ }) => JSX.Element;
430
+
375
431
  export declare const HorizontalSeparator: ({ withPadding }: Props_3) => JSX.Element;
376
432
 
433
+ export declare type InvitationData<UserType, T> = T & {
434
+ id: string;
435
+ role: string;
436
+ email: string;
437
+ user: UserData<UserType>;
438
+ };
439
+
440
+ export declare const InvitationUserSelectorItem: <UserType>({ user, onRemoveUser, }: ShareSelectedUserItemProps<UserType>) => JSX.Element;
441
+
442
+ export declare const InvitationUserSelectorList: <UserType>({ users, onRemoveUser, rightActions, onShare, shareButtonLabel, roles, selectedRole, onSelectRole, }: AddShareUserListProps<UserType>) => JSX.Element;
443
+
377
444
  export declare const isNode: <T>(node?: TreeViewDataType<T>) => boolean;
378
445
 
379
446
  export declare const isSeparator: <T>(node?: TreeViewDataType<T>) => boolean;
@@ -384,6 +451,8 @@ export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<H
384
451
  text?: string;
385
452
  }) => JSX.Element;
386
453
 
454
+ export declare const LaGaufre: () => JSX.Element;
455
+
387
456
  export declare const LanguagePicker: ({ languages }: LanguagePickerProps) => JSX.Element;
388
457
 
389
458
  export declare type LanguagePickerProps = {
@@ -396,7 +465,7 @@ export declare type LeftPanelProps = {
396
465
  isOpen?: boolean;
397
466
  };
398
467
 
399
- export declare const MainLayout: ({ icon, children, leftPanelContent, rightPanelContent, rightHeaderContent, languages, enableResize, rightPanelIsOpen, }: PropsWithChildren<MainLayoutProps>) => JSX.Element;
468
+ export declare const MainLayout: ({ icon, children, hideLeftPanelOnDesktop, leftPanelContent, rightPanelContent, rightHeaderContent, languages, enableResize, rightPanelIsOpen, }: PropsWithChildren<MainLayoutProps>) => JSX.Element;
400
469
 
401
470
  export declare type MainLayoutProps = {
402
471
  icon?: React.ReactNode;
@@ -407,6 +476,7 @@ export declare type MainLayoutProps = {
407
476
  onToggleRightPanel?: () => void;
408
477
  enableResize?: boolean;
409
478
  rightPanelIsOpen?: boolean;
479
+ hideLeftPanelOnDesktop?: boolean;
410
480
  };
411
481
 
412
482
  export { NodeRendererProps }
@@ -487,11 +557,94 @@ export declare type QuickSearchProps = {
487
557
  children?: ReactNode;
488
558
  };
489
559
 
560
+ export declare const SearchUserItem: <UserType>({ user, }: SearchUserItemProps<UserType>) => JSX.Element;
561
+
562
+ declare type SearchUserItemProps<UserType> = {
563
+ user: UserData<UserType>;
564
+ };
565
+
566
+ export declare const ShareInvitationItem: <UserType, InvitationType>({ invitation, roles, updateRole, deleteInvitation, canUpdate, roleTopMessage, }: ShareInvitationItemProps<UserType, InvitationType>) => JSX.Element;
567
+
568
+ export declare type ShareInvitationItemProps<UserType, InvitationType> = {
569
+ invitation: InvitationData<UserType, InvitationType>;
570
+ roles: DropdownMenuOption[];
571
+ updateRole?: (invitation: InvitationData<UserType, InvitationType>, role: string) => void;
572
+ deleteInvitation?: (invitation: InvitationData<UserType, InvitationType>) => void;
573
+ canUpdate?: boolean;
574
+ roleTopMessage?: string;
575
+ };
576
+
577
+ export declare const ShareMemberItem: <UserType, AccessType>({ accessData, roles, updateRole, deleteAccess, canUpdate, roleTopMessage, }: ShareMemberItemProps<UserType, AccessType>) => JSX.Element;
578
+
579
+ export declare type ShareMemberItemProps<UserType, AccessType> = {
580
+ accessData: AccessData<UserType, AccessType>;
581
+ roles: DropdownMenuOption[];
582
+ updateRole?: (access: AccessData<UserType, AccessType>, role: string) => void;
583
+ deleteAccess?: (access: AccessData<UserType, AccessType>) => void;
584
+ canUpdate?: boolean;
585
+ roleTopMessage?: string;
586
+ };
587
+
588
+ export declare const ShareModal: <UserType, InvitationType, AccessType>({ searchUsersResult, children, outsideSearchContent, accesses: members, invitations, hasNextMembers, canUpdate, hasNextInvitations, ...props }: PropsWithChildren<ShareModalProps<UserType, InvitationType, AccessType>>) => JSX.Element;
589
+
590
+ declare type ShareModalAccessProps<UserType, AccessType> = {
591
+ accesses?: AccessData<UserType, AccessType>[];
592
+ hasNextMembers?: boolean;
593
+ onLoadNextMembers?: () => void;
594
+ onDeleteAccess?: (access: AccessData<UserType, AccessType>) => void;
595
+ onUpdateAccess?: (access: AccessData<UserType, AccessType>, role: string) => void;
596
+ accessRoleTopMessage?: (access: AccessData<UserType, AccessType>) => string | undefined;
597
+ };
598
+
599
+ export declare const ShareModalCopyLinkFooter: ({ onCopyLink, onOk, }: ShareModalCopyLinkFooterProps) => JSX.Element;
600
+
601
+ export declare type ShareModalCopyLinkFooterProps = {
602
+ onCopyLink: () => void;
603
+ onOk: () => void;
604
+ };
605
+
606
+ declare type ShareModalInvitationProps<UserType, InvitationType> = {
607
+ invitations?: InvitationData<UserType, InvitationType>[];
608
+ onUpdateInvitation?: (invitation: InvitationData<UserType, InvitationType>, role: string) => void;
609
+ onDeleteInvitation?: (invitation: InvitationData<UserType, InvitationType>) => void;
610
+ hasNextInvitations?: boolean;
611
+ onLoadNextInvitations?: () => void;
612
+ invitationRoleTopMessage?: (invitation: InvitationData<UserType, InvitationType>) => string;
613
+ };
614
+
615
+ /**
616
+ * Only the props for the modal and generic props
617
+ * The modal is generic and can be with all types as long as the types meet the minimum requirements
618
+ * Like the modal, we can search users, list invitations and members and modify them, that's why we give the corresponding types
619
+ */
620
+ export declare type ShareModalProps<UserType, InvitationType, AccessType> = {
621
+ modalTitle?: string;
622
+ isOpen: boolean;
623
+ canUpdate?: boolean;
624
+ onClose: () => void;
625
+ invitationRoles: DropdownMenuOption[];
626
+ getAccessRoles?: (access: AccessData<UserType, AccessType>) => DropdownMenuOption[];
627
+ outsideSearchContent?: ReactNode;
628
+ } & ShareModalInvitationProps<UserType, InvitationType> & ShareModalAccessProps<UserType, AccessType> & ShareModalSearchProps<UserType>;
629
+
630
+ declare type ShareModalSearchProps<UserType> = {
631
+ searchUsersResult?: UserData<UserType>[];
632
+ onSearchUsers: (search: string) => void;
633
+ searchPlaceholder?: string;
634
+ onInviteUser: (users: UserData<UserType>[], role: string) => void;
635
+ loading?: boolean;
636
+ };
637
+
638
+ export declare type ShareSelectedUserItemProps<UserType> = {
639
+ user: UserData<UserType>;
640
+ onRemoveUser: (user: UserData<UserType>) => void;
641
+ };
642
+
490
643
  export declare const Spinner: ({ size }: SpinnerProps) => JSX.Element;
491
644
 
492
- declare interface SpinnerProps {
645
+ declare type SpinnerProps = {
493
646
  size?: "sm" | "md" | "lg" | "xl";
494
- }
647
+ };
495
648
 
496
649
  export declare type TabData = {
497
650
  id: string;
@@ -540,7 +693,7 @@ export declare type TreeProviderProps<T> = {
540
693
  onLoadChildren?: (id: string) => Promise<TreeViewDataType<T>[]>;
541
694
  };
542
695
 
543
- export declare const TreeView: <T>({ initialOpenState, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, }: TreeViewProps<T>) => JSX.Element | undefined;
696
+ export declare const TreeView: <T>({ initialOpenState, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, }: TreeViewProps<T>) => JSX.Element | undefined;
544
697
 
545
698
  export declare type TreeViewDataType<T> = BaseTreeViewData<T>;
546
699
 
@@ -583,6 +736,7 @@ export declare type TreeViewProps<T> = {
583
736
  index: number;
584
737
  }) => boolean;
585
738
  canDrag?: (node: TreeDataItem<T>) => boolean;
739
+ beforeMove?: (result: TreeViewMoveResult, moveCallback: () => void) => void;
586
740
  afterMove?: (result: TreeViewMoveResult) => void;
587
741
  renderNode: (props: NodeRendererProps<TreeDataItem<T>>) => React.ReactNode;
588
742
  };
@@ -594,18 +748,36 @@ export declare const useDropdownMenu: () => {
594
748
  setIsOpen: Dispatch<SetStateAction<boolean>>;
595
749
  };
596
750
 
751
+ export declare const UserAvatar: ({ fullName, size, forceColor, }: AvatarProps) => JSX.Element;
752
+
753
+ export declare type UserData<T> = T & {
754
+ id: string;
755
+ full_name: string;
756
+ email: string;
757
+ };
758
+
597
759
  export declare const useResponsive: () => {
598
760
  isMobile: boolean;
599
761
  isTablet: boolean;
600
762
  isDesktop: boolean;
601
763
  };
602
764
 
765
+ declare type UserProps = {
766
+ fullName?: string;
767
+ email?: string;
768
+ showEmail?: boolean;
769
+ };
770
+
771
+ export declare const UserRow: ({ fullName: full_name, email, showEmail, }: UserProps) => JSX.Element;
772
+
603
773
  export declare const useTree: <T>(initialItems: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>, loadChildrenCallback?: (id: string) => Promise<TreeViewDataType<T>[]>) => {
604
774
  nodes: TreeDataItem<TreeViewDataType<T>>[];
605
775
  addChild: (parentId: string | null, newNode: TreeViewDataType<T>, index?: number) => void;
606
776
  updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => void;
607
777
  deleteNode: (nodeId: string) => void;
778
+ deleteNodes: (nodeIds: string[]) => void;
608
779
  addRootNode: (newNode: TreeViewDataType<T>, index?: number) => void;
780
+ addRootNodes: (newNodes: TreeViewDataType<T>[], index?: number) => void;
609
781
  selectedNode: T | undefined;
610
782
  setSelectedNode: Dispatch<SetStateAction<T | undefined>>;
611
783
  refreshNode: (nodeId: string) => Promise<void>;