@gouvfr-lasuite/ui-kit 0.18.7 → 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';
@@ -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,21 +564,25 @@ 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
- subText?: string;
526
- icon?: ReactNode;
527
- callback?: () => void | Promise<unknown>;
528
- isDisabled?: boolean;
529
- showSeparator?: boolean;
530
- 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 & {
531
578
  isChecked?: boolean;
532
- testId?: string;
533
579
  value?: string;
580
+ /** @deprecated Use MenuItem with { type: "separator" } instead */
581
+ showSeparator?: boolean;
534
582
  };
535
583
 
536
584
  export declare type DropdownMenuProps = {
537
- options: DropdownMenuOption[];
585
+ options: DropdownMenuItem[];
538
586
  onOpenChange?: (isOpen: boolean) => void;
539
587
  selectedValues?: string[];
540
588
  onSelectValue?: (value: string) => void;
@@ -979,6 +1027,12 @@ export declare const getContainerSize: (iconSize: IconSize) => number;
979
1027
 
980
1028
  export declare const getIconSize: (iconSize: IconSize) => number;
981
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
+
982
1036
  export declare const getUIKitThemesFromGlobals: (globals: Parameters<typeof getThemesFromGlobals>[0], options?: Parameters<typeof getThemesFromGlobals>[1]) => Record<string, any>;
983
1037
 
984
1038
  /**
@@ -1312,6 +1366,15 @@ export declare const locales: {
1312
1366
  alt: string;
1313
1367
  };
1314
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
+ };
1315
1378
  };
1316
1379
  };
1317
1380
  "fr-FR": {
@@ -1482,6 +1545,15 @@ export declare const locales: {
1482
1545
  alt: string;
1483
1546
  };
1484
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
+ };
1485
1557
  };
1486
1558
  };
1487
1559
  };
@@ -1502,8 +1574,105 @@ export declare type MainLayoutProps = {
1502
1574
  setIsLeftPanelOpen?: (isLeftPanelOpen: boolean) => void;
1503
1575
  };
1504
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
+
1505
1606
  export { NodeRendererProps }
1506
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
+
1507
1676
  export declare type OpenMap = {
1508
1677
  [id: string]: boolean;
1509
1678
  };
@@ -1901,6 +2070,8 @@ export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX.Elem
1901
2070
  */
1902
2071
  export declare function useArrowRoving(container: HTMLElement | null): void;
1903
2072
 
2073
+ export declare const useContextMenuContext: () => ContextMenuContextValue;
2074
+
1904
2075
  /**
1905
2076
  * Hook for using custom translations with type safety.
1906
2077
  *