@gouvfr-lasuite/ui-kit 0.18.7 → 0.19.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/README.md +705 -1
- package/dist/index.cjs +33 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +216 -17
- package/dist/index.js +5169 -4820
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
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';
|
|
@@ -31,9 +32,10 @@ export declare type AccessData<UserType, T> = T & {
|
|
|
31
32
|
id: string;
|
|
32
33
|
role: string;
|
|
33
34
|
user: UserData<UserType>;
|
|
35
|
+
is_explicit?: boolean;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
export declare const AccessRoleDropdown: ({ roles, onSelect, canUpdate, selectedRole, isOpen, onOpenChange, roleTopMessage, }: AccessRoleDropdownProps) => JSX.Element;
|
|
38
|
+
export declare const AccessRoleDropdown: ({ roles, onSelect, canUpdate, selectedRole, isOpen, onOpenChange, roleTopMessage, onDelete, }: AccessRoleDropdownProps) => JSX.Element;
|
|
37
39
|
|
|
38
40
|
declare type AccessRoleDropdownProps = {
|
|
39
41
|
selectedRole: string;
|
|
@@ -43,6 +45,7 @@ declare type AccessRoleDropdownProps = {
|
|
|
43
45
|
isOpen?: boolean;
|
|
44
46
|
onOpenChange?: (isOpen: boolean) => void;
|
|
45
47
|
roleTopMessage?: DropdownMenuProps["topMessage"];
|
|
48
|
+
onDelete?: () => void;
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
export declare type AddShareUserListProps<UserType> = {
|
|
@@ -502,6 +505,49 @@ export declare type BaseTreeViewData<T> = {
|
|
|
502
505
|
|
|
503
506
|
export declare const containerSizeMap: Record<IconSize, number>;
|
|
504
507
|
|
|
508
|
+
export declare const ContextMenu: <T>({ children, options, context, disabled, asChild, onFocus, onBlur, }: ContextMenuProps<T>) => JSX.Element;
|
|
509
|
+
|
|
510
|
+
declare type ContextMenuContextValue = {
|
|
511
|
+
open: (config: {
|
|
512
|
+
position: {
|
|
513
|
+
x: number;
|
|
514
|
+
y: number;
|
|
515
|
+
};
|
|
516
|
+
items: MenuItem[];
|
|
517
|
+
onBlur?: () => void;
|
|
518
|
+
}) => void;
|
|
519
|
+
close: () => void;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @deprecated Use MenuItem instead
|
|
524
|
+
*/
|
|
525
|
+
export declare type ContextMenuItem = MenuItem;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* @deprecated Use MenuItemAction instead
|
|
529
|
+
*/
|
|
530
|
+
export declare type ContextMenuItemAction = MenuItemAction;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @deprecated Use MenuItemSeparator instead
|
|
534
|
+
*/
|
|
535
|
+
export declare type ContextMenuItemSeparator = MenuItemSeparator;
|
|
536
|
+
|
|
537
|
+
export declare type ContextMenuProps<T = unknown> = {
|
|
538
|
+
children: ReactNode;
|
|
539
|
+
options: MenuItem[] | ((context: T) => MenuItem[]);
|
|
540
|
+
context?: T;
|
|
541
|
+
disabled?: boolean;
|
|
542
|
+
asChild?: boolean;
|
|
543
|
+
/** Called when the menu opens on this trigger */
|
|
544
|
+
onFocus?: () => void;
|
|
545
|
+
/** Called when the menu closes (if it was open on this trigger) */
|
|
546
|
+
onBlur?: () => void;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
export declare const ContextMenuProvider: ({ children }: PropsWithChildren) => JSX.Element;
|
|
550
|
+
|
|
505
551
|
export declare const cunninghamConfig: {
|
|
506
552
|
themes: {
|
|
507
553
|
default: any;
|
|
@@ -520,21 +566,25 @@ export declare type CustomTranslations = Partial<Record<TranslationKey, string>>
|
|
|
520
566
|
|
|
521
567
|
export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, topMessage, shouldCloseOnInteractOutside, }: PropsWithChildren<DropdownMenuProps>) => JSX.Element;
|
|
522
568
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
569
|
+
/**
|
|
570
|
+
* Union type for DropdownMenu items (supports separators)
|
|
571
|
+
*/
|
|
572
|
+
export declare type DropdownMenuItem = DropdownMenuOption | MenuItemSeparator;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* DropdownMenu option extending the shared MenuItemAction
|
|
576
|
+
* Adds selection-specific props: isChecked, value
|
|
577
|
+
* @deprecated showSeparator - use MenuItemSeparator instead
|
|
578
|
+
*/
|
|
579
|
+
export declare type DropdownMenuOption = MenuItemAction & {
|
|
531
580
|
isChecked?: boolean;
|
|
532
|
-
testId?: string;
|
|
533
581
|
value?: string;
|
|
582
|
+
/** @deprecated Use MenuItem with { type: "separator" } instead */
|
|
583
|
+
showSeparator?: boolean;
|
|
534
584
|
};
|
|
535
585
|
|
|
536
586
|
export declare type DropdownMenuProps = {
|
|
537
|
-
options:
|
|
587
|
+
options: DropdownMenuItem[];
|
|
538
588
|
onOpenChange?: (isOpen: boolean) => void;
|
|
539
589
|
selectedValues?: string[];
|
|
540
590
|
onSelectValue?: (value: string) => void;
|
|
@@ -979,6 +1029,12 @@ export declare const getContainerSize: (iconSize: IconSize) => number;
|
|
|
979
1029
|
|
|
980
1030
|
export declare const getIconSize: (iconSize: IconSize) => number;
|
|
981
1031
|
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns the appropriate icon for the step based on active state.
|
|
1034
|
+
* Extracted to avoid duplication between desktop and mobile views.
|
|
1035
|
+
*/
|
|
1036
|
+
export declare const getStepIcon: (step: OnboardingStep, isActive: boolean) => ReactNode;
|
|
1037
|
+
|
|
982
1038
|
export declare const getUIKitThemesFromGlobals: (globals: Parameters<typeof getThemesFromGlobals>[0], options?: Parameters<typeof getThemesFromGlobals>[1]) => Record<string, any>;
|
|
983
1039
|
|
|
984
1040
|
/**
|
|
@@ -1088,10 +1144,18 @@ export declare const LaGaufre: () => JSX.Element;
|
|
|
1088
1144
|
|
|
1089
1145
|
export declare const LaGaufreV2: MemoExoticComponent<({ apiUrl, data, ...props }: LaGaufreV2Props) => JSX.Element>;
|
|
1090
1146
|
|
|
1091
|
-
|
|
1092
|
-
widgetPath: string;
|
|
1147
|
+
declare type LaGaufreV2API = {
|
|
1093
1148
|
apiUrl: string;
|
|
1094
|
-
data?:
|
|
1149
|
+
data?: never;
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
declare type LaGaufreV2Data = {
|
|
1153
|
+
apiUrl?: never;
|
|
1154
|
+
data: ServicesResponse;
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
export declare type LaGaufreV2Props = {
|
|
1158
|
+
widgetPath?: string;
|
|
1095
1159
|
fontFamily?: string;
|
|
1096
1160
|
background?: string;
|
|
1097
1161
|
headerLogo?: string;
|
|
@@ -1104,7 +1168,7 @@ export declare type LaGaufreV2Props = {
|
|
|
1104
1168
|
showMoreLimit?: number;
|
|
1105
1169
|
viewMoreLabel?: string;
|
|
1106
1170
|
viewLessLabel?: string;
|
|
1107
|
-
};
|
|
1171
|
+
} & (LaGaufreV2API | LaGaufreV2Data);
|
|
1108
1172
|
|
|
1109
1173
|
/**
|
|
1110
1174
|
* A DropdownMenu specific to languages.
|
|
@@ -1312,6 +1376,15 @@ export declare const locales: {
|
|
|
1312
1376
|
alt: string;
|
|
1313
1377
|
};
|
|
1314
1378
|
};
|
|
1379
|
+
onboarding: {
|
|
1380
|
+
skip: string;
|
|
1381
|
+
next: string;
|
|
1382
|
+
previous: string;
|
|
1383
|
+
complete: string;
|
|
1384
|
+
stepLabel: string;
|
|
1385
|
+
currentStepSuffix: string;
|
|
1386
|
+
contentRegionLabel: string;
|
|
1387
|
+
};
|
|
1315
1388
|
};
|
|
1316
1389
|
};
|
|
1317
1390
|
"fr-FR": {
|
|
@@ -1482,6 +1555,15 @@ export declare const locales: {
|
|
|
1482
1555
|
alt: string;
|
|
1483
1556
|
};
|
|
1484
1557
|
};
|
|
1558
|
+
onboarding: {
|
|
1559
|
+
skip: string;
|
|
1560
|
+
next: string;
|
|
1561
|
+
previous: string;
|
|
1562
|
+
complete: string;
|
|
1563
|
+
stepLabel: string;
|
|
1564
|
+
currentStepSuffix: string;
|
|
1565
|
+
contentRegionLabel: string;
|
|
1566
|
+
};
|
|
1485
1567
|
};
|
|
1486
1568
|
};
|
|
1487
1569
|
};
|
|
@@ -1502,8 +1584,107 @@ export declare type MainLayoutProps = {
|
|
|
1502
1584
|
setIsLeftPanelOpen?: (isLeftPanelOpen: boolean) => void;
|
|
1503
1585
|
};
|
|
1504
1586
|
|
|
1587
|
+
/**
|
|
1588
|
+
* Union type for all menu items
|
|
1589
|
+
*/
|
|
1590
|
+
export declare type MenuItem = MenuItemAction | MenuItemSeparator;
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Base action item for menus (shared between ContextMenu and DropdownMenu)
|
|
1594
|
+
*/
|
|
1595
|
+
export declare type MenuItemAction = {
|
|
1596
|
+
id?: string;
|
|
1597
|
+
label: string;
|
|
1598
|
+
subText?: string;
|
|
1599
|
+
icon?: ReactNode;
|
|
1600
|
+
callback?: () => void | Promise<unknown>;
|
|
1601
|
+
isDisabled?: boolean;
|
|
1602
|
+
isHidden?: boolean;
|
|
1603
|
+
variant?: "default" | "danger";
|
|
1604
|
+
testId?: string;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Separator item for menus
|
|
1609
|
+
*/
|
|
1610
|
+
export declare type MenuItemSeparator = {
|
|
1611
|
+
type: "separator";
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
export { ModalSize }
|
|
1615
|
+
|
|
1505
1616
|
export { NodeRendererProps }
|
|
1506
1617
|
|
|
1618
|
+
export declare const OnboardingModal: ({ isOpen, size, appName, mainTitle, steps, initialStep, footerLink, hideContent, onSkip, onComplete, onClose, labels, }: OnboardingModalProps) => JSX.Element | null;
|
|
1619
|
+
|
|
1620
|
+
export declare interface OnboardingModalProps {
|
|
1621
|
+
/** Whether the modal is open */
|
|
1622
|
+
isOpen: boolean;
|
|
1623
|
+
/** Size of the modal on desktop (default: ModalSize.LARGE). On mobile, always ModalSize.FULL */
|
|
1624
|
+
size?: ModalSize;
|
|
1625
|
+
/** Name of the application or module (e.g., "Discover Docs", "Welcome to Messaging") */
|
|
1626
|
+
appName?: string;
|
|
1627
|
+
/** Main heading of the onboarding modal (e.g., "Learn the core principles") */
|
|
1628
|
+
mainTitle: string;
|
|
1629
|
+
/** Array of onboarding steps */
|
|
1630
|
+
steps: OnboardingStep[];
|
|
1631
|
+
/** Initial step index (default: 0) */
|
|
1632
|
+
initialStep?: number;
|
|
1633
|
+
/** Optional footer link - requires either href or onClick */
|
|
1634
|
+
footerLink?: {
|
|
1635
|
+
label: string;
|
|
1636
|
+
} & ({
|
|
1637
|
+
href: string;
|
|
1638
|
+
onClick?: () => void;
|
|
1639
|
+
} | {
|
|
1640
|
+
onClick: () => void;
|
|
1641
|
+
href?: string;
|
|
1642
|
+
});
|
|
1643
|
+
/** Callback when user clicks Skip */
|
|
1644
|
+
onSkip?: () => void;
|
|
1645
|
+
/** Callback when user clicks Understood (last step) */
|
|
1646
|
+
onComplete: () => void;
|
|
1647
|
+
/** Callback when user clicks the close button */
|
|
1648
|
+
onClose: () => void;
|
|
1649
|
+
/** Hide the content/preview zone (text-only mode) */
|
|
1650
|
+
hideContent?: boolean;
|
|
1651
|
+
/** Custom labels for i18n */
|
|
1652
|
+
labels?: {
|
|
1653
|
+
skip?: string;
|
|
1654
|
+
next?: string;
|
|
1655
|
+
previous?: string;
|
|
1656
|
+
complete?: string;
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
export declare interface OnboardingStep {
|
|
1661
|
+
/** Icon displayed next to the step title */
|
|
1662
|
+
icon: ReactNode;
|
|
1663
|
+
/** Icon displayed when the step is active (optional, defaults to icon with brand color) */
|
|
1664
|
+
activeIcon?: ReactNode;
|
|
1665
|
+
/** Step title */
|
|
1666
|
+
title: string;
|
|
1667
|
+
/** Step description, visible only when the step is active */
|
|
1668
|
+
description?: string;
|
|
1669
|
+
/** Content displayed in the preview zone (image, video, component, etc.) */
|
|
1670
|
+
content?: ReactNode;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
export declare interface OnboardingStepItemProps {
|
|
1674
|
+
/** Step data */
|
|
1675
|
+
step: OnboardingStep;
|
|
1676
|
+
/** Whether this step is active */
|
|
1677
|
+
isActive: boolean;
|
|
1678
|
+
/** Click handler */
|
|
1679
|
+
onClick: () => void;
|
|
1680
|
+
/** Step index (0-based) for accessibility */
|
|
1681
|
+
index: number;
|
|
1682
|
+
/** Total number of steps */
|
|
1683
|
+
totalSteps: number;
|
|
1684
|
+
/** Accessible label for the step */
|
|
1685
|
+
ariaLabel: string;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1507
1688
|
export declare type OpenMap = {
|
|
1508
1689
|
[id: string]: boolean;
|
|
1509
1690
|
};
|
|
@@ -1592,6 +1773,23 @@ export declare type QuickSearchProps = {
|
|
|
1592
1773
|
children?: ReactNode;
|
|
1593
1774
|
};
|
|
1594
1775
|
|
|
1776
|
+
export declare const ReleaseNoteModal: ({ steps, ...props }: ReleaseNoteModalProps) => JSX.Element;
|
|
1777
|
+
|
|
1778
|
+
export declare interface ReleaseNoteModalProps extends Omit<OnboardingModalProps, "hideContent" | "steps"> {
|
|
1779
|
+
steps: ReleaseNoteStep[];
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
export declare interface ReleaseNoteStep {
|
|
1783
|
+
/** Icon displayed next to the step title */
|
|
1784
|
+
icon: ReactNode;
|
|
1785
|
+
/** Icon displayed when the step is active */
|
|
1786
|
+
activeIcon?: ReactNode;
|
|
1787
|
+
/** Step title */
|
|
1788
|
+
title: string;
|
|
1789
|
+
/** Step description, visible only when the step is active */
|
|
1790
|
+
description?: string;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1595
1793
|
declare type ResponsiveStates = {
|
|
1596
1794
|
isMobile: boolean;
|
|
1597
1795
|
isTablet: boolean;
|
|
@@ -1617,7 +1815,7 @@ declare type ServicesResponse = {
|
|
|
1617
1815
|
error?: unknown;
|
|
1618
1816
|
};
|
|
1619
1817
|
|
|
1620
|
-
export declare const ShareInvitationItem: <UserType, InvitationType>({ invitation, roles, updateRole, deleteInvitation, canUpdate,
|
|
1818
|
+
export declare const ShareInvitationItem: <UserType, InvitationType>({ invitation, roles, updateRole, deleteInvitation, canUpdate, roleTopMessage, }: ShareInvitationItemProps<UserType, InvitationType>) => JSX.Element;
|
|
1621
1819
|
|
|
1622
1820
|
export declare type ShareInvitationItemProps<UserType, InvitationType> = {
|
|
1623
1821
|
invitation: InvitationData<UserType, InvitationType>;
|
|
@@ -1626,7 +1824,6 @@ export declare type ShareInvitationItemProps<UserType, InvitationType> = {
|
|
|
1626
1824
|
deleteInvitation?: (invitation: InvitationData<UserType, InvitationType>) => void;
|
|
1627
1825
|
canUpdate?: boolean;
|
|
1628
1826
|
roleTopMessage?: string;
|
|
1629
|
-
showMoreActionsButton?: boolean;
|
|
1630
1827
|
};
|
|
1631
1828
|
|
|
1632
1829
|
export declare const ShareMemberItem: <UserType, AccessType>({ accessData, accessRoleKey, roles, updateRole, deleteAccess, canUpdate, roleTopMessage, }: ShareMemberItemProps<UserType, AccessType>) => JSX.Element;
|
|
@@ -1901,6 +2098,8 @@ export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX.Elem
|
|
|
1901
2098
|
*/
|
|
1902
2099
|
export declare function useArrowRoving(container: HTMLElement | null): void;
|
|
1903
2100
|
|
|
2101
|
+
export declare const useContextMenuContext: () => ContextMenuContextValue;
|
|
2102
|
+
|
|
1904
2103
|
/**
|
|
1905
2104
|
* Hook for using custom translations with type safety.
|
|
1906
2105
|
*
|