@gouvfr-lasuite/ui-kit 0.20.2 → 0.21.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-Cxveez8y.js +603 -0
  2. package/dist/PdfPreview-Cxveez8y.js.map +1 -0
  3. package/dist/PdfPreview-hvDLZbHc.cjs +2 -0
  4. package/dist/PdfPreview-hvDLZbHc.cjs.map +1 -0
  5. package/dist/index-6_ZFBQnz.js +28008 -0
  6. package/dist/index-6_ZFBQnz.js.map +1 -0
  7. package/dist/index-bEyUzYJm.cjs +108 -0
  8. package/dist/index-bEyUzYJm.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 +339 -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,56 @@ 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, headerRightContent, 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
+ headerRightContent?: default_2.ReactNode;
1298
+ sidebarContent?: default_2.ReactNode;
1299
+ onChangeFile?: (file?: FilePreviewType) => void;
1300
+ onFileOpen?: (file: FilePreviewType) => void;
1301
+ handleDownloadFile?: (file?: FilePreviewType) => void;
1302
+ hideCloseButton?: boolean;
1303
+ pdfWorkerSrc?: string;
1304
+ onOpenInEditor?: (file: FilePreviewType) => void;
1305
+ }
1306
+
1307
+ export declare type FilePreviewType = {
1308
+ id: string;
1309
+ size: number;
1310
+ title: string;
1311
+ mimetype: string;
1312
+ is_wopi_supported?: boolean;
1313
+ url_preview: string;
1314
+ url: string;
1315
+ isSuspicious?: boolean;
1316
+ };
1317
+
1238
1318
  export declare const FileShare: (props: IconSvgProps) => JSX.Element;
1239
1319
 
1240
1320
  export declare const Filter: (props: FilterProps) => JSX.Element;
@@ -1316,8 +1396,12 @@ export declare const GearRoundedNotif: (props: IconSvgProps) => JSX.Element;
1316
1396
 
1317
1397
  export declare const getContainerSize: (iconSize: IconSize) => number;
1318
1398
 
1399
+ export declare const getExtensionFromName: (str: string) => string | null;
1400
+
1319
1401
  export declare const getIconSize: (iconSize: IconSize) => number;
1320
1402
 
1403
+ export declare const getMimeCategory: (mimetype: string, extension?: string | null) => MimeCategory;
1404
+
1321
1405
  /**
1322
1406
  * Returns the appropriate icon for the step based on active state.
1323
1407
  * Extracted to avoid duplication between desktop and mobile views.
@@ -1496,6 +1580,37 @@ export declare type IconProps = {
1496
1580
 
1497
1581
  export declare const IconRightPanel: (props: IconSvgProps) => JSX.Element;
1498
1582
 
1583
+ export declare const ICONS: {
1584
+ mini: {
1585
+ calc: string;
1586
+ doc: string;
1587
+ image: string;
1588
+ other: string;
1589
+ pdf: string;
1590
+ powerpoint: string;
1591
+ audio: string;
1592
+ video: string;
1593
+ archive: string;
1594
+ suspicious: string;
1595
+ sqlite: string;
1596
+ grist: string;
1597
+ };
1598
+ normal: {
1599
+ calc: string;
1600
+ doc: string;
1601
+ image: string;
1602
+ other: string;
1603
+ pdf: string;
1604
+ powerpoint: string;
1605
+ audio: string;
1606
+ video: string;
1607
+ archive: string;
1608
+ suspicious: string;
1609
+ sqlite: string;
1610
+ grist: string;
1611
+ };
1612
+ };
1613
+
1499
1614
  export declare enum IconSize {
1500
1615
  X_SMALL = "xsmall",
1501
1616
  SMALL = "small",
@@ -1517,6 +1632,18 @@ export declare enum IconType {
1517
1632
 
1518
1633
  export declare const Identity: (props: IconSvgProps) => JSX.Element;
1519
1634
 
1635
+ export declare const ImageViewer: default_2.FC<ImageViewerProps>;
1636
+
1637
+ declare interface ImageViewerProps {
1638
+ src: string;
1639
+ alt?: string;
1640
+ className?: string;
1641
+ initialZoom?: number;
1642
+ minZoom?: number;
1643
+ maxZoom?: number;
1644
+ zoomStep?: number;
1645
+ }
1646
+
1520
1647
  export declare const Info: (props: IconSvgProps) => JSX.Element;
1521
1648
 
1522
1649
  export declare const Info2: (props: IconSvgProps) => JSX.Element;
@@ -1552,6 +1679,8 @@ export declare const KeyboardHide: (props: IconSvgProps) => JSX.Element;
1552
1679
 
1553
1680
  export declare const KeyFilled: (props: IconSvgProps) => JSX.Element;
1554
1681
 
1682
+ export declare const KNOWN_EXTENSIONS: Set<string>;
1683
+
1555
1684
  export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<HTMLLabelElement> & {
1556
1685
  text?: string;
1557
1686
  }) => JSX.Element;
@@ -1623,6 +1752,8 @@ export declare type LeftPanelProps = {
1623
1752
  footer?: default_2.ReactNode;
1624
1753
  };
1625
1754
 
1755
+ export declare const LeftSidebarIcon: (props: IconSvgProps) => JSX.Element;
1756
+
1626
1757
  export declare const Link: (props: IconSvgProps) => JSX.Element;
1627
1758
 
1628
1759
  declare type Link_2 = {
@@ -1830,6 +1961,47 @@ export declare const locales: {
1830
1961
  category: string;
1831
1962
  closeAriaLabel: string;
1832
1963
  };
1964
+ filePreview: {
1965
+ title: string;
1966
+ unsupported: {
1967
+ title: string;
1968
+ disclaimer: string;
1969
+ description: string;
1970
+ download: string;
1971
+ heicTitle: string;
1972
+ };
1973
+ suspicious: {
1974
+ title: string;
1975
+ description: string;
1976
+ download: string;
1977
+ };
1978
+ error: {
1979
+ title: string;
1980
+ description: string;
1981
+ };
1982
+ wopi: {
1983
+ loading: string;
1984
+ error: string;
1985
+ openInEditor: string;
1986
+ openInEditorDescription: string;
1987
+ };
1988
+ image: {
1989
+ loading: string;
1990
+ };
1991
+ externalLink: {
1992
+ title: string;
1993
+ description: string;
1994
+ confirmQuestion: string;
1995
+ };
1996
+ outdatedBrowser: {
1997
+ title: string;
1998
+ description: string;
1999
+ };
2000
+ actions: {
2001
+ download: string;
2002
+ print: string;
2003
+ };
2004
+ };
1833
2005
  };
1834
2006
  };
1835
2007
  "fr-FR": {
@@ -2031,8 +2203,50 @@ export declare const locales: {
2031
2203
  category: string;
2032
2204
  closeAriaLabel: string;
2033
2205
  };
2206
+ filePreview: {
2207
+ title: string;
2208
+ unsupported: {
2209
+ title: string;
2210
+ disclaimer: string;
2211
+ description: string;
2212
+ download: string;
2213
+ heicTitle: string;
2214
+ };
2215
+ suspicious: {
2216
+ title: string;
2217
+ description: string;
2218
+ download: string;
2219
+ };
2220
+ error: {
2221
+ title: string;
2222
+ description: string;
2223
+ };
2224
+ wopi: {
2225
+ loading: string;
2226
+ error: string;
2227
+ openInEditor: string;
2228
+ openInEditorDescription: string;
2229
+ };
2230
+ image: {
2231
+ loading: string;
2232
+ };
2233
+ externalLink: {
2234
+ title: string;
2235
+ description: string;
2236
+ confirmQuestion: string;
2237
+ };
2238
+ outdatedBrowser: {
2239
+ title: string;
2240
+ description: string;
2241
+ };
2242
+ actions: {
2243
+ download: string;
2244
+ print: string;
2245
+ };
2246
+ };
2034
2247
  };
2035
2248
  };
2249
+ "nl-NL": any;
2036
2250
  };
2037
2251
 
2038
2252
  declare const Lock_2: (props: IconSvgProps) => JSX.Element;
@@ -2096,6 +2310,32 @@ export declare type MenuItemSeparator = {
2096
2310
 
2097
2311
  export declare const MicOffAlert: (props: IconSvgProps) => JSX.Element;
2098
2312
 
2313
+ export declare const MIME_MAP: {
2314
+ calc: string[];
2315
+ pdf: string[];
2316
+ doc: string[];
2317
+ powerpoint: string[];
2318
+ archive: string[];
2319
+ sqlite: string[];
2320
+ };
2321
+
2322
+ export declare const MIME_TO_CATEGORY: Record<string, MimeCategory>;
2323
+
2324
+ export declare enum MimeCategory {
2325
+ CALC = "calc",
2326
+ DOC = "doc",
2327
+ IMAGE = "image",
2328
+ OTHER = "other",
2329
+ PDF = "pdf",
2330
+ POWERPOINT = "powerpoint",
2331
+ AUDIO = "audio",
2332
+ VIDEO = "video",
2333
+ ARCHIVE = "archive",
2334
+ SUSPICIOUS = "suspicious",
2335
+ SQLITE = "sqlite",
2336
+ GRIST = "grist"
2337
+ }
2338
+
2099
2339
  export declare const Minus: (props: IconSvgProps) => JSX.Element;
2100
2340
 
2101
2341
  export { ModalSize }
@@ -2108,6 +2348,14 @@ export declare const Mute: (props: IconSvgProps) => JSX.Element;
2108
2348
 
2109
2349
  export { NodeRendererProps }
2110
2350
 
2351
+ export declare const NotSupportedPreview: ({ file, onDownload, title, }: NotSupportedPreviewProps) => JSX.Element;
2352
+
2353
+ declare interface NotSupportedPreviewProps {
2354
+ file: FilePreviewType;
2355
+ onDownload?: (file: FilePreviewType) => void;
2356
+ title?: string;
2357
+ }
2358
+
2111
2359
  export declare const NumberedList: (props: IconSvgProps) => JSX.Element;
2112
2360
 
2113
2361
  export declare const OnboardingModal: ({ isOpen, size, appName, mainTitle, steps, initialStep, footerLink, hideContent, onSkip, onComplete, onClose, labels, }: OnboardingModalProps) => JSX.Element | null;
@@ -2225,6 +2473,8 @@ export declare const Play: (props: IconSvgProps) => JSX.Element;
2225
2473
 
2226
2474
  export declare const Play2: (props: IconSvgProps) => JSX.Element;
2227
2475
 
2476
+ export declare const PlayerPreviewControls: ({ togglePlay, isPlaying, rewind10Seconds, forward10Seconds, volume, isMuted, toggleMute, handleVolumeChange, toggleFullscreen, isFullscreen, showFullscreenBtn, }: PreviewControlsProps) => JSX.Element;
2477
+
2228
2478
  export declare const Plus: (props: IconSvgProps) => JSX.Element;
2229
2479
 
2230
2480
  export declare const PlusDashed: (props: IconSvgProps) => JSX.Element;
@@ -2233,6 +2483,41 @@ export declare const PlusDashedEdit: (props: IconSvgProps) => JSX.Element;
2233
2483
 
2234
2484
  export declare const Present: (props: IconSvgProps) => JSX.Element;
2235
2485
 
2486
+ export declare type PreviewControlsProps = {
2487
+ togglePlay: () => void;
2488
+ isPlaying: boolean;
2489
+ rewind10Seconds: () => void;
2490
+ forward10Seconds: () => void;
2491
+ volume: number;
2492
+ isMuted: boolean;
2493
+ toggleMute: () => void;
2494
+ handleVolumeChange: (newVolume: number) => void;
2495
+ toggleFullscreen: () => void;
2496
+ isFullscreen: boolean;
2497
+ showFullscreenBtn?: boolean;
2498
+ };
2499
+
2500
+ export declare const PreviewMessage: ({ icon, title, description, action, variant, closeOnBackdrop, }: PreviewMessageProps) => JSX.Element;
2501
+
2502
+ declare interface PreviewMessageProps {
2503
+ icon: default_2.ReactNode;
2504
+ title: default_2.ReactNode;
2505
+ description?: default_2.ReactNode;
2506
+ action?: default_2.ReactNode;
2507
+ variant?: "neutral" | "error";
2508
+ closeOnBackdrop?: boolean;
2509
+ }
2510
+
2511
+ /**
2512
+ * Open the browser print dialog for an image without navigating away.
2513
+ *
2514
+ * The image is loaded inside a hidden same-origin iframe built with `srcdoc`
2515
+ * (not `src`) so we can call `contentWindow.print()` from the parent without
2516
+ * running into the cross-origin restriction that would apply if the iframe's
2517
+ * document came from the image URL's origin.
2518
+ */
2519
+ export declare const printImage: (imageUrl: string) => void;
2520
+
2236
2521
  export declare const ProConnectButton: ({ disabled, onClick, }: ProConnectButtonProps) => JSX.Element;
2237
2522
 
2238
2523
  export declare type ProConnectButtonProps = {
@@ -2335,6 +2620,12 @@ export declare interface ReleaseNoteStep {
2335
2620
  description?: string;
2336
2621
  }
2337
2622
 
2623
+ /**
2624
+ * Removes the file extension from a filename.
2625
+ * Only removes extensions present in KNOWN_EXTENSIONS.
2626
+ */
2627
+ export declare const removeFileExtension: (filename: string) => string;
2628
+
2338
2629
  export declare const Reply: (props: IconSvgProps) => JSX.Element;
2339
2630
 
2340
2631
  declare type ResponsiveStates = {
@@ -2530,6 +2821,12 @@ export declare const Strikethrough: (props: IconSvgProps) => JSX.Element;
2530
2821
 
2531
2822
  export declare const Sun: (props: IconSvgProps) => JSX.Element;
2532
2823
 
2824
+ export declare const SuspiciousPreview: ({ handleDownload, }: SuspiciousPreviewProps) => JSX.Element;
2825
+
2826
+ declare interface SuspiciousPreviewProps {
2827
+ handleDownload?: () => void;
2828
+ }
2829
+
2533
2830
  export declare type TabData = {
2534
2831
  id: string;
2535
2832
  label: string;
@@ -2855,8 +3152,35 @@ export declare const useTreeContext: <T>() => TreeContextType<T> | null;
2855
3152
 
2856
3153
  export declare const VerticalSeparator: (props: Props_4) => JSX.Element;
2857
3154
 
3155
+ export declare const VideoPlayer: default_2.FC<VideoPlayerProps>;
3156
+
3157
+ declare interface VideoPlayerProps {
3158
+ src: string;
3159
+ poster?: string;
3160
+ className?: string;
3161
+ autoPlay?: boolean;
3162
+ muted?: boolean;
3163
+ loop?: boolean;
3164
+ controls?: boolean;
3165
+ width?: string | number;
3166
+ height?: string | number;
3167
+ onPlay?: () => void;
3168
+ onPause?: () => void;
3169
+ onEnded?: () => void;
3170
+ onTimeUpdate?: (currentTime: number) => void;
3171
+ }
3172
+
2858
3173
  export declare const Volume2: (props: IconSvgProps) => JSX.Element;
2859
3174
 
3175
+ export declare const VolumeBar: ({ volume, isMuted, toggleMute, handleVolumeChange, }: VolumeBarProps) => JSX.Element;
3176
+
3177
+ export declare type VolumeBarProps = {
3178
+ volume: number;
3179
+ isMuted: boolean;
3180
+ toggleMute: () => void;
3181
+ handleVolumeChange: (newVolume: number) => void;
3182
+ };
3183
+
2860
3184
  export declare const VolumeX: (props: IconSvgProps) => JSX.Element;
2861
3185
 
2862
3186
  export declare const WandAndStars: (props: IconSvgProps) => JSX.Element;
@@ -3274,12 +3598,27 @@ export declare type WithLabelProps = {
3274
3598
  labelSide?: "left" | "right";
3275
3599
  };
3276
3600
 
3601
+ export declare const WopiOpenInEditor: ({ file, onOpenInEditor, }: WopiOpenInEditorProps) => JSX.Element;
3602
+
3603
+ declare interface WopiOpenInEditorProps {
3604
+ file: FilePreviewType;
3605
+ onOpenInEditor: (file: FilePreviewType) => void;
3606
+ }
3607
+
3277
3608
  export declare const XMark: (props: IconSvgProps) => JSX.Element;
3278
3609
 
3279
3610
  export declare const Zoom: (props: IconSvgProps) => JSX.Element;
3280
3611
 
3281
3612
  export declare const Zoom1: (props: IconSvgProps) => JSX.Element;
3282
3613
 
3614
+ export declare const ZoomControls: ({ zoomOut, zoomIn, resetView, }: ZoomControlsProps) => JSX.Element;
3615
+
3616
+ declare interface ZoomControlsProps {
3617
+ zoomOut: () => void;
3618
+ zoomIn: () => void;
3619
+ resetView: () => void;
3620
+ }
3621
+
3283
3622
  export declare const ZoomMinus: (props: IconSvgProps) => JSX.Element;
3284
3623
 
3285
3624
  export declare const ZoomPlus: (props: IconSvgProps) => JSX.Element;