@gouvfr-lasuite/ui-kit 0.20.2 → 0.22.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.
Files changed (35) hide show
  1. package/dist/PdfPreview-BOIgXF66.js +603 -0
  2. package/dist/PdfPreview-BOIgXF66.js.map +1 -0
  3. package/dist/PdfPreview-CnHLGN5f.cjs +2 -0
  4. package/dist/PdfPreview-CnHLGN5f.cjs.map +1 -0
  5. package/dist/index-BwV1Jx-_.js +28003 -0
  6. package/dist/index-BwV1Jx-_.js.map +1 -0
  7. package/dist/index-Bwp4cywr.cjs +108 -0
  8. package/dist/index-Bwp4cywr.cjs.map +1 -0
  9. package/dist/index.cjs +1 -103
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +340 -0
  12. package/dist/index.js +361 -26689
  13. package/dist/index.js.map +1 -1
  14. package/dist/pdf.worker.mjs +58008 -0
  15. package/dist/storybook/preview-files/Archive.7z +0 -0
  16. package/dist/storybook/preview-files/CR Conseil municipal vfvdef_maireok.pdf +0 -0
  17. package/dist/storybook/preview-files/Folders.iso +0 -0
  18. package/dist/storybook/preview-files/IMG_7665.heic +0 -0
  19. package/dist/storybook/preview-files/Rembrandt_Winterlandschap_1646.jpg +0 -0
  20. package/dist/storybook/preview-files/Tableau.xlsx +0 -0
  21. package/dist/storybook/preview-files/XFA-3_3.pdf +0 -0
  22. package/dist/storybook/preview-files/art-institute-of-chicago-ce0DXHdjbhw-unsplash 1.png +0 -0
  23. package/dist/storybook/preview-files/chantier.mp4 +0 -0
  24. package/dist/storybook/preview-files/coucou.pages +0 -0
  25. package/dist/storybook/preview-files/mixed_page_sizes.pdf +379 -0
  26. package/dist/storybook/preview-files/monet_1.jpeg +0 -0
  27. package/dist/storybook/preview-files/nuissance_sonores.mp3 +0 -0
  28. package/dist/storybook/preview-files/pdf_corrupted.pdf +1 -0
  29. package/dist/storybook/preview-files/pdf_with_js.pdf +0 -0
  30. package/dist/storybook/preview-files/pdf_with_js_link.pdf +0 -0
  31. package/dist/storybook/preview-files/pdf_with_links.pdf +0 -0
  32. package/dist/storybook/preview-files/pv_cm.pdf +0 -0
  33. package/dist/storybook/preview-files/test-unsupported.bin +1 -0
  34. package/dist/style.css +1 -1
  35. package/package.json +16 -5
package/dist/index.d.ts CHANGED
@@ -504,6 +504,19 @@ export declare const ArrowUpLeft: (props: IconSvgProps) => JSX.Element;
504
504
 
505
505
  export declare const ArrowUpRight: (props: IconSvgProps) => JSX.Element;
506
506
 
507
+ export declare const AudioPlayer: default_2.FC<AudioPlayerProps>;
508
+
509
+ declare interface AudioPlayerProps {
510
+ src: string;
511
+ title?: string;
512
+ className?: string;
513
+ autoPlay?: boolean;
514
+ onPlay?: () => void;
515
+ onPause?: () => void;
516
+ onEnded?: () => void;
517
+ onTimeUpdate?: (currentTime: number) => void;
518
+ }
519
+
507
520
  export declare const AVATAR_COLORS: string[];
508
521
 
509
522
  export declare type AvatarProps = {
@@ -584,6 +597,8 @@ export declare const BulletedList: (props: IconSvgProps) => JSX.Element;
584
597
 
585
598
  export declare const Burger: (props: IconSvgProps) => JSX.Element;
586
599
 
600
+ export declare const CALC_EXTENSIONS: string[];
601
+
587
602
  export declare const Calendar: (props: IconSvgProps) => JSX.Element;
588
603
 
589
604
  export declare const Calendar2: (props: IconSvgProps) => JSX.Element;
@@ -707,6 +722,8 @@ export declare type CustomTranslations = Partial<Record<TranslationKey, string>>
707
722
 
708
723
  export declare const Datagouv: (props: IconSvgProps) => JSX.Element;
709
724
 
725
+ export declare const DEFAULT_PDF_WORKER_SRC = "/pdf.worker.mjs";
726
+
710
727
  export declare const Divergence: (props: IconSvgProps) => JSX.Element;
711
728
 
712
729
  export declare const Divider: (props: IconSvgProps) => JSX.Element;
@@ -1157,8 +1174,23 @@ export declare const dsfrGlobals: {
1157
1174
  };
1158
1175
  };
1159
1176
 
1177
+ export declare const DurationBar: ({ duration, currentTime, handleSeek, }: DurationBarProps) => JSX.Element;
1178
+
1179
+ declare type DurationBarProps = {
1180
+ duration: number;
1181
+ currentTime: number;
1182
+ handleSeek: (e: React.ChangeEvent<HTMLInputElement>) => void;
1183
+ };
1184
+
1160
1185
  export declare const Edit: (props: IconSvgProps) => JSX.Element;
1161
1186
 
1187
+ export declare const ErrorPreview: ({ file, onDownload }: ErrorPreviewProps) => JSX.Element;
1188
+
1189
+ declare interface ErrorPreviewProps {
1190
+ file: FilePreviewType;
1191
+ onDownload?: (file: FilePreviewType) => void;
1192
+ }
1193
+
1162
1194
  export declare const EuroFilled: (props: IconSvgProps) => JSX.Element;
1163
1195
 
1164
1196
  /**
@@ -1233,8 +1265,57 @@ export declare const FileError: (props: IconSvgProps) => JSX.Element;
1233
1265
 
1234
1266
  export declare const FileFilled: (props: IconSvgProps) => JSX.Element;
1235
1267
 
1268
+ /**
1269
+ * Used by the FilePreview component to display the file icon.
1270
+ * Mirrors the variant in drive that operates on a FilePreviewType
1271
+ * rather than the drive-specific Item.
1272
+ */
1273
+ export declare const FileIcon: ({ file, size, type, }: FileIconProps) => JSX.Element;
1274
+
1275
+ export declare const FileIconContent: ({ icon, size, }: {
1276
+ icon: string;
1277
+ size: IconSize | number;
1278
+ }) => JSX.Element;
1279
+
1280
+ declare type FileIconProps = {
1281
+ file: Partial<FilePreviewType> & Pick<FilePreviewType, "mimetype" | "title">;
1282
+ size?: IconSize | number;
1283
+ type?: "mini" | "normal";
1284
+ };
1285
+
1236
1286
  export declare const FileImport: (props: IconSvgProps) => JSX.Element;
1237
1287
 
1288
+ export declare const FilePreview: ({ isOpen, onClose, title, files, initialIndexFile, openedFileId, sidebarContent, customHeaderActions, headerActionsMenuOptions, onChangeFile, onFileOpen, handleDownloadFile, hideCloseButton, pdfWorkerSrc, onOpenInEditor, }: FilePreviewProps) => JSX.Element | null;
1289
+
1290
+ declare interface FilePreviewProps {
1291
+ isOpen: boolean;
1292
+ onClose?: () => void;
1293
+ title?: string;
1294
+ files?: FilePreviewType[];
1295
+ initialIndexFile?: number;
1296
+ openedFileId?: string;
1297
+ customHeaderActions?: (headerActions: default_2.ReactNode) => default_2.ReactNode;
1298
+ headerActionsMenuOptions?: (file: FilePreviewType) => MenuItemAction[];
1299
+ sidebarContent?: default_2.ReactNode;
1300
+ onChangeFile?: (file?: FilePreviewType) => void;
1301
+ onFileOpen?: (file: FilePreviewType) => void;
1302
+ handleDownloadFile?: (file?: FilePreviewType) => void;
1303
+ hideCloseButton?: boolean;
1304
+ pdfWorkerSrc?: string;
1305
+ onOpenInEditor?: (file: FilePreviewType) => void;
1306
+ }
1307
+
1308
+ export declare type FilePreviewType = {
1309
+ id: string;
1310
+ size: number;
1311
+ title: string;
1312
+ mimetype: string;
1313
+ is_wopi_supported?: boolean;
1314
+ url_preview: string;
1315
+ url: string;
1316
+ isSuspicious?: boolean;
1317
+ };
1318
+
1238
1319
  export declare const FileShare: (props: IconSvgProps) => JSX.Element;
1239
1320
 
1240
1321
  export declare const Filter: (props: FilterProps) => JSX.Element;
@@ -1316,8 +1397,12 @@ export declare const GearRoundedNotif: (props: IconSvgProps) => JSX.Element;
1316
1397
 
1317
1398
  export declare const getContainerSize: (iconSize: IconSize) => number;
1318
1399
 
1400
+ export declare const getExtensionFromName: (str: string) => string | null;
1401
+
1319
1402
  export declare const getIconSize: (iconSize: IconSize) => number;
1320
1403
 
1404
+ export declare const getMimeCategory: (mimetype: string, extension?: string | null) => MimeCategory;
1405
+
1321
1406
  /**
1322
1407
  * Returns the appropriate icon for the step based on active state.
1323
1408
  * Extracted to avoid duplication between desktop and mobile views.
@@ -1496,6 +1581,37 @@ export declare type IconProps = {
1496
1581
 
1497
1582
  export declare const IconRightPanel: (props: IconSvgProps) => JSX.Element;
1498
1583
 
1584
+ export declare const ICONS: {
1585
+ mini: {
1586
+ calc: string;
1587
+ doc: string;
1588
+ image: string;
1589
+ other: string;
1590
+ pdf: string;
1591
+ powerpoint: string;
1592
+ audio: string;
1593
+ video: string;
1594
+ archive: string;
1595
+ suspicious: string;
1596
+ sqlite: string;
1597
+ grist: string;
1598
+ };
1599
+ normal: {
1600
+ calc: string;
1601
+ doc: string;
1602
+ image: string;
1603
+ other: string;
1604
+ pdf: string;
1605
+ powerpoint: string;
1606
+ audio: string;
1607
+ video: string;
1608
+ archive: string;
1609
+ suspicious: string;
1610
+ sqlite: string;
1611
+ grist: string;
1612
+ };
1613
+ };
1614
+
1499
1615
  export declare enum IconSize {
1500
1616
  X_SMALL = "xsmall",
1501
1617
  SMALL = "small",
@@ -1517,6 +1633,18 @@ export declare enum IconType {
1517
1633
 
1518
1634
  export declare const Identity: (props: IconSvgProps) => JSX.Element;
1519
1635
 
1636
+ export declare const ImageViewer: default_2.FC<ImageViewerProps>;
1637
+
1638
+ declare interface ImageViewerProps {
1639
+ src: string;
1640
+ alt?: string;
1641
+ className?: string;
1642
+ initialZoom?: number;
1643
+ minZoom?: number;
1644
+ maxZoom?: number;
1645
+ zoomStep?: number;
1646
+ }
1647
+
1520
1648
  export declare const Info: (props: IconSvgProps) => JSX.Element;
1521
1649
 
1522
1650
  export declare const Info2: (props: IconSvgProps) => JSX.Element;
@@ -1552,6 +1680,8 @@ export declare const KeyboardHide: (props: IconSvgProps) => JSX.Element;
1552
1680
 
1553
1681
  export declare const KeyFilled: (props: IconSvgProps) => JSX.Element;
1554
1682
 
1683
+ export declare const KNOWN_EXTENSIONS: Set<string>;
1684
+
1555
1685
  export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<HTMLLabelElement> & {
1556
1686
  text?: string;
1557
1687
  }) => JSX.Element;
@@ -1623,6 +1753,8 @@ export declare type LeftPanelProps = {
1623
1753
  footer?: default_2.ReactNode;
1624
1754
  };
1625
1755
 
1756
+ export declare const LeftSidebarIcon: (props: IconSvgProps) => JSX.Element;
1757
+
1626
1758
  export declare const Link: (props: IconSvgProps) => JSX.Element;
1627
1759
 
1628
1760
  declare type Link_2 = {
@@ -1830,6 +1962,47 @@ export declare const locales: {
1830
1962
  category: string;
1831
1963
  closeAriaLabel: string;
1832
1964
  };
1965
+ filePreview: {
1966
+ title: string;
1967
+ unsupported: {
1968
+ title: string;
1969
+ disclaimer: string;
1970
+ description: string;
1971
+ download: string;
1972
+ heicTitle: string;
1973
+ };
1974
+ suspicious: {
1975
+ title: string;
1976
+ description: string;
1977
+ download: string;
1978
+ };
1979
+ error: {
1980
+ title: string;
1981
+ description: string;
1982
+ };
1983
+ wopi: {
1984
+ loading: string;
1985
+ error: string;
1986
+ openInEditor: string;
1987
+ openInEditorDescription: string;
1988
+ };
1989
+ image: {
1990
+ loading: string;
1991
+ };
1992
+ externalLink: {
1993
+ title: string;
1994
+ description: string;
1995
+ confirmQuestion: string;
1996
+ };
1997
+ outdatedBrowser: {
1998
+ title: string;
1999
+ description: string;
2000
+ };
2001
+ actions: {
2002
+ download: string;
2003
+ print: string;
2004
+ };
2005
+ };
1833
2006
  };
1834
2007
  };
1835
2008
  "fr-FR": {
@@ -2031,8 +2204,50 @@ export declare const locales: {
2031
2204
  category: string;
2032
2205
  closeAriaLabel: string;
2033
2206
  };
2207
+ filePreview: {
2208
+ title: string;
2209
+ unsupported: {
2210
+ title: string;
2211
+ disclaimer: string;
2212
+ description: string;
2213
+ download: string;
2214
+ heicTitle: string;
2215
+ };
2216
+ suspicious: {
2217
+ title: string;
2218
+ description: string;
2219
+ download: string;
2220
+ };
2221
+ error: {
2222
+ title: string;
2223
+ description: string;
2224
+ };
2225
+ wopi: {
2226
+ loading: string;
2227
+ error: string;
2228
+ openInEditor: string;
2229
+ openInEditorDescription: string;
2230
+ };
2231
+ image: {
2232
+ loading: string;
2233
+ };
2234
+ externalLink: {
2235
+ title: string;
2236
+ description: string;
2237
+ confirmQuestion: string;
2238
+ };
2239
+ outdatedBrowser: {
2240
+ title: string;
2241
+ description: string;
2242
+ };
2243
+ actions: {
2244
+ download: string;
2245
+ print: string;
2246
+ };
2247
+ };
2034
2248
  };
2035
2249
  };
2250
+ "nl-NL": any;
2036
2251
  };
2037
2252
 
2038
2253
  declare const Lock_2: (props: IconSvgProps) => JSX.Element;
@@ -2096,6 +2311,32 @@ export declare type MenuItemSeparator = {
2096
2311
 
2097
2312
  export declare const MicOffAlert: (props: IconSvgProps) => JSX.Element;
2098
2313
 
2314
+ export declare const MIME_MAP: {
2315
+ calc: string[];
2316
+ pdf: string[];
2317
+ doc: string[];
2318
+ powerpoint: string[];
2319
+ archive: string[];
2320
+ sqlite: string[];
2321
+ };
2322
+
2323
+ export declare const MIME_TO_CATEGORY: Record<string, MimeCategory>;
2324
+
2325
+ export declare enum MimeCategory {
2326
+ CALC = "calc",
2327
+ DOC = "doc",
2328
+ IMAGE = "image",
2329
+ OTHER = "other",
2330
+ PDF = "pdf",
2331
+ POWERPOINT = "powerpoint",
2332
+ AUDIO = "audio",
2333
+ VIDEO = "video",
2334
+ ARCHIVE = "archive",
2335
+ SUSPICIOUS = "suspicious",
2336
+ SQLITE = "sqlite",
2337
+ GRIST = "grist"
2338
+ }
2339
+
2099
2340
  export declare const Minus: (props: IconSvgProps) => JSX.Element;
2100
2341
 
2101
2342
  export { ModalSize }
@@ -2108,6 +2349,14 @@ export declare const Mute: (props: IconSvgProps) => JSX.Element;
2108
2349
 
2109
2350
  export { NodeRendererProps }
2110
2351
 
2352
+ export declare const NotSupportedPreview: ({ file, onDownload, title, }: NotSupportedPreviewProps) => JSX.Element;
2353
+
2354
+ declare interface NotSupportedPreviewProps {
2355
+ file: FilePreviewType;
2356
+ onDownload?: (file: FilePreviewType) => void;
2357
+ title?: string;
2358
+ }
2359
+
2111
2360
  export declare const NumberedList: (props: IconSvgProps) => JSX.Element;
2112
2361
 
2113
2362
  export declare const OnboardingModal: ({ isOpen, size, appName, mainTitle, steps, initialStep, footerLink, hideContent, onSkip, onComplete, onClose, labels, }: OnboardingModalProps) => JSX.Element | null;
@@ -2225,6 +2474,8 @@ export declare const Play: (props: IconSvgProps) => JSX.Element;
2225
2474
 
2226
2475
  export declare const Play2: (props: IconSvgProps) => JSX.Element;
2227
2476
 
2477
+ export declare const PlayerPreviewControls: ({ togglePlay, isPlaying, rewind10Seconds, forward10Seconds, volume, isMuted, toggleMute, handleVolumeChange, toggleFullscreen, isFullscreen, showFullscreenBtn, }: PreviewControlsProps) => JSX.Element;
2478
+
2228
2479
  export declare const Plus: (props: IconSvgProps) => JSX.Element;
2229
2480
 
2230
2481
  export declare const PlusDashed: (props: IconSvgProps) => JSX.Element;
@@ -2233,6 +2484,41 @@ export declare const PlusDashedEdit: (props: IconSvgProps) => JSX.Element;
2233
2484
 
2234
2485
  export declare const Present: (props: IconSvgProps) => JSX.Element;
2235
2486
 
2487
+ export declare type PreviewControlsProps = {
2488
+ togglePlay: () => void;
2489
+ isPlaying: boolean;
2490
+ rewind10Seconds: () => void;
2491
+ forward10Seconds: () => void;
2492
+ volume: number;
2493
+ isMuted: boolean;
2494
+ toggleMute: () => void;
2495
+ handleVolumeChange: (newVolume: number) => void;
2496
+ toggleFullscreen: () => void;
2497
+ isFullscreen: boolean;
2498
+ showFullscreenBtn?: boolean;
2499
+ };
2500
+
2501
+ export declare const PreviewMessage: ({ icon, title, description, action, variant, closeOnBackdrop, }: PreviewMessageProps) => JSX.Element;
2502
+
2503
+ declare interface PreviewMessageProps {
2504
+ icon: default_2.ReactNode;
2505
+ title: default_2.ReactNode;
2506
+ description?: default_2.ReactNode;
2507
+ action?: default_2.ReactNode;
2508
+ variant?: "neutral" | "error";
2509
+ closeOnBackdrop?: boolean;
2510
+ }
2511
+
2512
+ /**
2513
+ * Open the browser print dialog for an image without navigating away.
2514
+ *
2515
+ * The image is loaded inside a hidden same-origin iframe built with `srcdoc`
2516
+ * (not `src`) so we can call `contentWindow.print()` from the parent without
2517
+ * running into the cross-origin restriction that would apply if the iframe's
2518
+ * document came from the image URL's origin.
2519
+ */
2520
+ export declare const printImage: (imageUrl: string) => void;
2521
+
2236
2522
  export declare const ProConnectButton: ({ disabled, onClick, }: ProConnectButtonProps) => JSX.Element;
2237
2523
 
2238
2524
  export declare type ProConnectButtonProps = {
@@ -2335,6 +2621,12 @@ export declare interface ReleaseNoteStep {
2335
2621
  description?: string;
2336
2622
  }
2337
2623
 
2624
+ /**
2625
+ * Removes the file extension from a filename.
2626
+ * Only removes extensions present in KNOWN_EXTENSIONS.
2627
+ */
2628
+ export declare const removeFileExtension: (filename: string) => string;
2629
+
2338
2630
  export declare const Reply: (props: IconSvgProps) => JSX.Element;
2339
2631
 
2340
2632
  declare type ResponsiveStates = {
@@ -2530,6 +2822,12 @@ export declare const Strikethrough: (props: IconSvgProps) => JSX.Element;
2530
2822
 
2531
2823
  export declare const Sun: (props: IconSvgProps) => JSX.Element;
2532
2824
 
2825
+ export declare const SuspiciousPreview: ({ handleDownload, }: SuspiciousPreviewProps) => JSX.Element;
2826
+
2827
+ declare interface SuspiciousPreviewProps {
2828
+ handleDownload?: () => void;
2829
+ }
2830
+
2533
2831
  export declare type TabData = {
2534
2832
  id: string;
2535
2833
  label: string;
@@ -2855,8 +3153,35 @@ export declare const useTreeContext: <T>() => TreeContextType<T> | null;
2855
3153
 
2856
3154
  export declare const VerticalSeparator: (props: Props_4) => JSX.Element;
2857
3155
 
3156
+ export declare const VideoPlayer: default_2.FC<VideoPlayerProps>;
3157
+
3158
+ declare interface VideoPlayerProps {
3159
+ src: string;
3160
+ poster?: string;
3161
+ className?: string;
3162
+ autoPlay?: boolean;
3163
+ muted?: boolean;
3164
+ loop?: boolean;
3165
+ controls?: boolean;
3166
+ width?: string | number;
3167
+ height?: string | number;
3168
+ onPlay?: () => void;
3169
+ onPause?: () => void;
3170
+ onEnded?: () => void;
3171
+ onTimeUpdate?: (currentTime: number) => void;
3172
+ }
3173
+
2858
3174
  export declare const Volume2: (props: IconSvgProps) => JSX.Element;
2859
3175
 
3176
+ export declare const VolumeBar: ({ volume, isMuted, toggleMute, handleVolumeChange, }: VolumeBarProps) => JSX.Element;
3177
+
3178
+ export declare type VolumeBarProps = {
3179
+ volume: number;
3180
+ isMuted: boolean;
3181
+ toggleMute: () => void;
3182
+ handleVolumeChange: (newVolume: number) => void;
3183
+ };
3184
+
2860
3185
  export declare const VolumeX: (props: IconSvgProps) => JSX.Element;
2861
3186
 
2862
3187
  export declare const WandAndStars: (props: IconSvgProps) => JSX.Element;
@@ -3274,12 +3599,27 @@ export declare type WithLabelProps = {
3274
3599
  labelSide?: "left" | "right";
3275
3600
  };
3276
3601
 
3602
+ export declare const WopiOpenInEditor: ({ file, onOpenInEditor, }: WopiOpenInEditorProps) => JSX.Element;
3603
+
3604
+ declare interface WopiOpenInEditorProps {
3605
+ file: FilePreviewType;
3606
+ onOpenInEditor: (file: FilePreviewType) => void;
3607
+ }
3608
+
3277
3609
  export declare const XMark: (props: IconSvgProps) => JSX.Element;
3278
3610
 
3279
3611
  export declare const Zoom: (props: IconSvgProps) => JSX.Element;
3280
3612
 
3281
3613
  export declare const Zoom1: (props: IconSvgProps) => JSX.Element;
3282
3614
 
3615
+ export declare const ZoomControls: ({ zoomOut, zoomIn, resetView, }: ZoomControlsProps) => JSX.Element;
3616
+
3617
+ declare interface ZoomControlsProps {
3618
+ zoomOut: () => void;
3619
+ zoomIn: () => void;
3620
+ resetView: () => void;
3621
+ }
3622
+
3283
3623
  export declare const ZoomMinus: (props: IconSvgProps) => JSX.Element;
3284
3624
 
3285
3625
  export declare const ZoomPlus: (props: IconSvgProps) => JSX.Element;