@gouvfr-lasuite/ui-kit 0.18.6 → 0.19.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
@@ -10,6 +10,7 @@ import { JSX } from 'react/jsx-runtime';
10
10
  import { Key } from 'react-stately';
11
11
  import { LabelHTMLAttributes } from 'react';
12
12
  import { MemoExoticComponent } from 'react';
13
+ import { ModalSize } from '@gouvfr-lasuite/cunningham-react';
13
14
  import { NodeApi } from 'react-arborist';
14
15
  import { NodeRendererProps } from 'react-arborist';
15
16
  import { Option as Option_2 } from '@gouvfr-lasuite/cunningham-react';
@@ -42,7 +43,7 @@ declare type AccessRoleDropdownProps = {
42
43
  canUpdate?: boolean;
43
44
  isOpen?: boolean;
44
45
  onOpenChange?: (isOpen: boolean) => void;
45
- roleTopMessage?: string;
46
+ roleTopMessage?: DropdownMenuProps["topMessage"];
46
47
  };
47
48
 
48
49
  export declare type AddShareUserListProps<UserType> = {
@@ -502,6 +503,49 @@ export declare type BaseTreeViewData<T> = {
502
503
 
503
504
  export declare const containerSizeMap: Record<IconSize, number>;
504
505
 
506
+ export declare const ContextMenu: <T>({ children, options, context, disabled, asChild, onFocus, onBlur, }: ContextMenuProps<T>) => JSX.Element;
507
+
508
+ declare type ContextMenuContextValue = {
509
+ open: (config: {
510
+ position: {
511
+ x: number;
512
+ y: number;
513
+ };
514
+ items: MenuItem[];
515
+ onBlur?: () => void;
516
+ }) => void;
517
+ close: () => void;
518
+ };
519
+
520
+ /**
521
+ * @deprecated Use MenuItem instead
522
+ */
523
+ export declare type ContextMenuItem = MenuItem;
524
+
525
+ /**
526
+ * @deprecated Use MenuItemAction instead
527
+ */
528
+ export declare type ContextMenuItemAction = MenuItemAction;
529
+
530
+ /**
531
+ * @deprecated Use MenuItemSeparator instead
532
+ */
533
+ export declare type ContextMenuItemSeparator = MenuItemSeparator;
534
+
535
+ export declare type ContextMenuProps<T = unknown> = {
536
+ children: ReactNode;
537
+ options: MenuItem[] | ((context: T) => MenuItem[]);
538
+ context?: T;
539
+ disabled?: boolean;
540
+ asChild?: boolean;
541
+ /** Called when the menu opens on this trigger */
542
+ onFocus?: () => void;
543
+ /** Called when the menu closes (if it was open on this trigger) */
544
+ onBlur?: () => void;
545
+ };
546
+
547
+ export declare const ContextMenuProvider: ({ children }: PropsWithChildren) => JSX.Element;
548
+
505
549
  export declare const cunninghamConfig: {
506
550
  themes: {
507
551
  default: any;
@@ -520,25 +564,30 @@ export declare type CustomTranslations = Partial<Record<TranslationKey, string>>
520
564
 
521
565
  export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, topMessage, shouldCloseOnInteractOutside, }: PropsWithChildren<DropdownMenuProps>) => JSX.Element;
522
566
 
523
- export declare type DropdownMenuOption = {
524
- label: string;
525
- icon?: ReactNode;
526
- callback?: () => void | Promise<unknown>;
527
- isDisabled?: boolean;
528
- showSeparator?: boolean;
529
- isHidden?: boolean;
567
+ /**
568
+ * Union type for DropdownMenu items (supports separators)
569
+ */
570
+ export declare type DropdownMenuItem = DropdownMenuOption | MenuItemSeparator;
571
+
572
+ /**
573
+ * DropdownMenu option extending the shared MenuItemAction
574
+ * Adds selection-specific props: isChecked, value
575
+ * @deprecated showSeparator - use MenuItemSeparator instead
576
+ */
577
+ export declare type DropdownMenuOption = MenuItemAction & {
530
578
  isChecked?: boolean;
531
- testId?: string;
532
579
  value?: string;
580
+ /** @deprecated Use MenuItem with { type: "separator" } instead */
581
+ showSeparator?: boolean;
533
582
  };
534
583
 
535
584
  export declare type DropdownMenuProps = {
536
- options: DropdownMenuOption[];
585
+ options: DropdownMenuItem[];
537
586
  onOpenChange?: (isOpen: boolean) => void;
538
587
  selectedValues?: string[];
539
588
  onSelectValue?: (value: string) => void;
540
589
  isOpen?: boolean;
541
- topMessage?: string;
590
+ topMessage?: string | ReactNode;
542
591
  shouldCloseOnInteractOutside?: (element: Element) => boolean;
543
592
  };
544
593
 
@@ -978,6 +1027,12 @@ export declare const getContainerSize: (iconSize: IconSize) => number;
978
1027
 
979
1028
  export declare const getIconSize: (iconSize: IconSize) => number;
980
1029
 
1030
+ /**
1031
+ * Returns the appropriate icon for the step based on active state.
1032
+ * Extracted to avoid duplication between desktop and mobile views.
1033
+ */
1034
+ export declare const getStepIcon: (step: OnboardingStep, isActive: boolean) => ReactNode;
1035
+
981
1036
  export declare const getUIKitThemesFromGlobals: (globals: Parameters<typeof getThemesFromGlobals>[0], options?: Parameters<typeof getThemesFromGlobals>[1]) => Record<string, any>;
982
1037
 
983
1038
  /**
@@ -1229,6 +1284,7 @@ export declare const locales: {
1229
1284
  ok: string;
1230
1285
  shareButton: string;
1231
1286
  modalTitle: string;
1287
+ modalAriaLabel: string;
1232
1288
  access: {
1233
1289
  delete: string;
1234
1290
  };
@@ -1262,6 +1318,10 @@ export declare const locales: {
1262
1318
  title: string;
1263
1319
  description: string;
1264
1320
  };
1321
+ authenticated: {
1322
+ title: string;
1323
+ description: string;
1324
+ };
1265
1325
  restricted: {
1266
1326
  title: string;
1267
1327
  description: string;
@@ -1306,6 +1366,15 @@ export declare const locales: {
1306
1366
  alt: string;
1307
1367
  };
1308
1368
  };
1369
+ onboarding: {
1370
+ skip: string;
1371
+ next: string;
1372
+ previous: string;
1373
+ complete: string;
1374
+ stepLabel: string;
1375
+ currentStepSuffix: string;
1376
+ contentRegionLabel: string;
1377
+ };
1309
1378
  };
1310
1379
  };
1311
1380
  "fr-FR": {
@@ -1393,6 +1462,7 @@ export declare const locales: {
1393
1462
  copyLink: string;
1394
1463
  ok: string;
1395
1464
  modalTitle: string;
1465
+ modalAriaLabel: string;
1396
1466
  shareButton: string;
1397
1467
  access: {
1398
1468
  delete: string;
@@ -1431,6 +1501,10 @@ export declare const locales: {
1431
1501
  title: string;
1432
1502
  description: string;
1433
1503
  };
1504
+ authenticated: {
1505
+ title: string;
1506
+ description: string;
1507
+ };
1434
1508
  };
1435
1509
  };
1436
1510
  role: {
@@ -1471,6 +1545,15 @@ export declare const locales: {
1471
1545
  alt: string;
1472
1546
  };
1473
1547
  };
1548
+ onboarding: {
1549
+ skip: string;
1550
+ next: string;
1551
+ previous: string;
1552
+ complete: string;
1553
+ stepLabel: string;
1554
+ currentStepSuffix: string;
1555
+ contentRegionLabel: string;
1556
+ };
1474
1557
  };
1475
1558
  };
1476
1559
  };
@@ -1491,8 +1574,105 @@ export declare type MainLayoutProps = {
1491
1574
  setIsLeftPanelOpen?: (isLeftPanelOpen: boolean) => void;
1492
1575
  };
1493
1576
 
1577
+ /**
1578
+ * Union type for all menu items
1579
+ */
1580
+ export declare type MenuItem = MenuItemAction | MenuItemSeparator;
1581
+
1582
+ /**
1583
+ * Base action item for menus (shared between ContextMenu and DropdownMenu)
1584
+ */
1585
+ export declare type MenuItemAction = {
1586
+ id?: string;
1587
+ label: string;
1588
+ subText?: string;
1589
+ icon?: ReactNode;
1590
+ callback?: () => void | Promise<unknown>;
1591
+ isDisabled?: boolean;
1592
+ isHidden?: boolean;
1593
+ variant?: "default" | "danger";
1594
+ testId?: string;
1595
+ };
1596
+
1597
+ /**
1598
+ * Separator item for menus
1599
+ */
1600
+ export declare type MenuItemSeparator = {
1601
+ type: "separator";
1602
+ };
1603
+
1604
+ export { ModalSize }
1605
+
1494
1606
  export { NodeRendererProps }
1495
1607
 
1608
+ export declare const OnboardingModal: ({ isOpen, size, appName, mainTitle, steps, initialStep, footerLink, onSkip, onComplete, onClose, labels, }: OnboardingModalProps) => JSX.Element | null;
1609
+
1610
+ export declare interface OnboardingModalProps {
1611
+ /** Whether the modal is open */
1612
+ isOpen: boolean;
1613
+ /** Size of the modal on desktop (default: ModalSize.LARGE). On mobile, always ModalSize.FULL */
1614
+ size?: ModalSize;
1615
+ /** Name of the application or module (e.g., "Discover Docs", "Welcome to Messaging") */
1616
+ appName?: string;
1617
+ /** Main heading of the onboarding modal (e.g., "Learn the core principles") */
1618
+ mainTitle: string;
1619
+ /** Array of onboarding steps */
1620
+ steps: OnboardingStep[];
1621
+ /** Initial step index (default: 0) */
1622
+ initialStep?: number;
1623
+ /** Optional footer link - requires either href or onClick */
1624
+ footerLink?: {
1625
+ label: string;
1626
+ } & ({
1627
+ href: string;
1628
+ onClick?: () => void;
1629
+ } | {
1630
+ onClick: () => void;
1631
+ href?: string;
1632
+ });
1633
+ /** Callback when user clicks Skip */
1634
+ onSkip?: () => void;
1635
+ /** Callback when user clicks Understood (last step) */
1636
+ onComplete: () => void;
1637
+ /** Callback when user clicks the close button */
1638
+ onClose: () => void;
1639
+ /** Custom labels for i18n */
1640
+ labels?: {
1641
+ skip?: string;
1642
+ next?: string;
1643
+ previous?: string;
1644
+ complete?: string;
1645
+ };
1646
+ }
1647
+
1648
+ export declare interface OnboardingStep {
1649
+ /** Icon displayed next to the step title */
1650
+ icon: ReactNode;
1651
+ /** Icon displayed when the step is active (optional, defaults to icon with brand color) */
1652
+ activeIcon?: ReactNode;
1653
+ /** Step title */
1654
+ title: string;
1655
+ /** Step description, visible only when the step is active */
1656
+ description?: string;
1657
+ /** Content displayed in the preview zone (image, video, component, etc.) */
1658
+ content: ReactNode;
1659
+ }
1660
+
1661
+ export declare interface OnboardingStepItemProps {
1662
+ /** Step data */
1663
+ step: OnboardingStep;
1664
+ /** Whether this step is active */
1665
+ isActive: boolean;
1666
+ /** Click handler */
1667
+ onClick: () => void;
1668
+ /** Step index (0-based) for accessibility */
1669
+ index: number;
1670
+ /** Total number of steps */
1671
+ totalSteps: number;
1672
+ /** Accessible label for the step */
1673
+ ariaLabel: string;
1674
+ }
1675
+
1496
1676
  export declare type OpenMap = {
1497
1677
  [id: string]: boolean;
1498
1678
  };
@@ -1561,12 +1741,13 @@ export declare const QuickSearchInput: ({ loading, inputValue, onFilter, placeho
1561
1741
 
1562
1742
  export declare const QuickSearchItem: ({ children, onSelect, id, }: PropsWithChildren<Props>) => JSX.Element;
1563
1743
 
1564
- export declare const QuickSearchItemTemplate: ({ alwaysShowRight, left, right, }: QuickSearchItemTemplateProps) => JSX.Element;
1744
+ export declare const QuickSearchItemTemplate: ({ alwaysShowRight, left, right, testId, }: QuickSearchItemTemplateProps) => JSX.Element;
1565
1745
 
1566
1746
  export declare type QuickSearchItemTemplateProps = {
1567
1747
  alwaysShowRight?: boolean;
1568
1748
  left: ReactNode;
1569
1749
  right?: ReactNode;
1750
+ testId?: string;
1570
1751
  };
1571
1752
 
1572
1753
  export declare type QuickSearchProps = {
@@ -1617,7 +1798,7 @@ export declare type ShareInvitationItemProps<UserType, InvitationType> = {
1617
1798
  showMoreActionsButton?: boolean;
1618
1799
  };
1619
1800
 
1620
- export declare const ShareMemberItem: <UserType, AccessType>({ accessData, roles, updateRole, deleteAccess, canUpdate, roleTopMessage, }: ShareMemberItemProps<UserType, AccessType>) => JSX.Element;
1801
+ export declare const ShareMemberItem: <UserType, AccessType>({ accessData, accessRoleKey, roles, updateRole, deleteAccess, canUpdate, roleTopMessage, }: ShareMemberItemProps<UserType, AccessType>) => JSX.Element;
1621
1802
 
1622
1803
  export declare type ShareMemberItemProps<UserType, AccessType> = {
1623
1804
  accessData: AccessData<UserType, AccessType>;
@@ -1625,18 +1806,20 @@ export declare type ShareMemberItemProps<UserType, AccessType> = {
1625
1806
  updateRole?: (access: AccessData<UserType, AccessType>, role: string) => void;
1626
1807
  deleteAccess?: (access: AccessData<UserType, AccessType>) => void;
1627
1808
  canUpdate?: boolean;
1628
- roleTopMessage?: string;
1809
+ roleTopMessage?: DropdownMenuProps["topMessage"];
1810
+ accessRoleKey?: keyof AccessData<UserType, AccessType>;
1629
1811
  };
1630
1812
 
1631
1813
  export declare const ShareModal: <UserType, InvitationType, AccessType>({ searchUsersResult, children, outsideSearchContent, accesses: members, invitations, hasNextMembers, canUpdate, canView, hasNextInvitations, hideInvitations, hideMembers, cannotViewChildren, customTranslations, ...props }: PropsWithChildren<ShareModalProps<UserType, InvitationType, AccessType>>) => JSX.Element;
1632
1814
 
1633
1815
  declare type ShareModalAccessProps<UserType, AccessType> = {
1634
1816
  accesses?: AccessData<UserType, AccessType>[];
1817
+ accessRoleKey?: keyof AccessData<UserType, AccessType>;
1635
1818
  hasNextMembers?: boolean;
1636
1819
  onLoadNextMembers?: () => void;
1637
1820
  onDeleteAccess?: (access: AccessData<UserType, AccessType>) => void;
1638
1821
  onUpdateAccess?: (access: AccessData<UserType, AccessType>, role: string) => void;
1639
- accessRoleTopMessage?: (access: AccessData<UserType, AccessType>) => string | undefined;
1822
+ accessRoleTopMessage?: (access: AccessData<UserType, AccessType>) => string | ReactNode | undefined;
1640
1823
  };
1641
1824
 
1642
1825
  export declare const ShareModalCopyLinkFooter: ({ onCopyLink, onOk, }: ShareModalCopyLinkFooterProps) => JSX.Element;
@@ -1664,6 +1847,8 @@ declare type ShareModalLinkSettingsProps = {
1664
1847
  linkRole?: "reader" | "editor";
1665
1848
  showLinkRole?: boolean;
1666
1849
  onUpdateLinkRole?: (value: string) => void;
1850
+ topLinkReachMessage?: DropdownMenuProps["topMessage"];
1851
+ topLinkRoleMessage?: DropdownMenuProps["topMessage"];
1667
1852
  };
1668
1853
 
1669
1854
  /**
@@ -1805,11 +1990,11 @@ export declare type TreeProviderProps<T> = {
1805
1990
  onLoadChildren?: (id: string, page: number) => Promise<PaginatedChildrenResult<T>>;
1806
1991
  };
1807
1992
 
1808
- export declare const TreeView: <T>({ initialOpenState, dndRootElement, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, rowProps, }: TreeViewProps<T>) => JSX.Element | undefined;
1993
+ export declare const TreeView: <T>({ initialOpenState, dndRootElement, selectedNodeId, rootNodeId, renderNode, canDrop, canDrag, afterMove, beforeMove, paddingTop, paddingBottom, rowProps, }: TreeViewProps<T>) => JSX.Element | undefined;
1809
1994
 
1810
1995
  export declare type TreeViewDataType<T> = BaseTreeViewData<T>;
1811
1996
 
1812
- export declare const TreeViewItem: <T>({ children, itemProps, onClick, onKeyDown, node, dragHandle, style, forceLoading, }: PropsWithChildren<TreeViewNodeProps<T>>) => JSX.Element;
1997
+ export declare const TreeViewItem: <T>({ children, itemProps, testId, onClick, onKeyDown, node, dragHandle, style, forceLoading, }: PropsWithChildren<TreeViewNodeProps<T>>) => JSX.Element;
1813
1998
 
1814
1999
  export declare enum TreeViewMoveModeEnum {
1815
2000
  FIRST_CHILD = "first-child",
@@ -1832,6 +2017,7 @@ export declare type TreeViewNodeProps<T> = NodeRendererProps<TreeDataItem<T>> &
1832
2017
  onClick?: () => void;
1833
2018
  onKeyDown?: (e: default_2.KeyboardEvent) => void;
1834
2019
  forceLoading?: boolean;
2020
+ testId?: string;
1835
2021
  };
1836
2022
 
1837
2023
  export declare enum TreeViewNodeTypeEnum {
@@ -1856,6 +2042,8 @@ export declare type TreeViewProps<T> = {
1856
2042
  beforeMove?: (result: TreeViewMoveResult, moveCallback: () => void) => void;
1857
2043
  afterMove?: (result: TreeViewMoveResult) => void;
1858
2044
  renderNode: (props: NodeRendererProps<TreeDataItem<T>>) => React.ReactNode;
2045
+ paddingTop?: number;
2046
+ paddingBottom?: number;
1859
2047
  rowProps?: React.HTMLAttributes<HTMLDivElement>;
1860
2048
  };
1861
2049
 
@@ -1882,6 +2070,8 @@ export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX.Elem
1882
2070
  */
1883
2071
  export declare function useArrowRoving(container: HTMLElement | null): void;
1884
2072
 
2073
+ export declare const useContextMenuContext: () => ContextMenuContextValue;
2074
+
1885
2075
  /**
1886
2076
  * Hook for using custom translations with type safety.
1887
2077
  *