@kystverket/styrbord 1.2.2 → 1.2.4

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.
@@ -2,31 +2,25 @@ type ButtonOptions = {
2
2
  showDownload?: boolean;
3
3
  showOpenInNew?: boolean;
4
4
  };
5
- export type PdfFile = {
6
- contentType: 'pdf';
7
- src: string;
5
+ export type FileInfo = {
8
6
  fileName: string;
9
7
  fileSize?: string;
10
8
  buttons?: ButtonOptions;
9
+ } & (PdfFile | ImageFile | JsonFile);
10
+ type PdfFile = {
11
+ contentType: 'pdf';
12
+ src: string;
11
13
  };
12
- export type ImageFile = {
14
+ type ImageFile = {
13
15
  contentType: 'image';
14
16
  src: string;
15
- fileName: string;
16
- fileSize?: string;
17
- buttons?: ButtonOptions;
18
17
  };
19
- export type JsonFile = {
18
+ type JsonFile = {
20
19
  contentType: 'json';
21
20
  data: Record<string, unknown>;
22
- fileName: string;
23
- fileSize?: string;
24
- buttons?: ButtonOptions;
25
- };
26
- export declare const defaultButtonsByType: {
27
- pdf: ButtonOptions;
28
- image: ButtonOptions;
29
- json: ButtonOptions;
30
21
  };
31
- export type FileInfo = PdfFile | ImageFile | JsonFile;
22
+ export type FileInfoByContentType<T extends FileInfo['contentType']> = Extract<FileInfo, {
23
+ contentType: T;
24
+ }>;
25
+ export declare const defaultButtonsByType: Record<FileInfo['contentType'], ButtonOptions>;
32
26
  export {};