@kystverket/styrbord 1.8.0 → 1.8.2

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.
@@ -8,7 +8,7 @@ export type FileInfo = {
8
8
  /** @deprecated Use `fileSizeInBytes` instead. */
9
9
  fileSize?: string;
10
10
  buttons?: ButtonOptions;
11
- } & (PdfFile | ImageFile | JsonFile);
11
+ } & (PdfFile | ImageFile | JsonFile | TextFile);
12
12
  type PdfFile = {
13
13
  contentType: 'pdf';
14
14
  src: string;
@@ -17,6 +17,10 @@ type ImageFile = {
17
17
  contentType: 'image';
18
18
  src: string;
19
19
  };
20
+ type TextFile = {
21
+ contentType: 'txt';
22
+ src: string;
23
+ };
20
24
  type JsonFile = {
21
25
  contentType: 'json';
22
26
  data: Record<string, unknown>;
@@ -1,6 +1,7 @@
1
- import { FileInfo, UploadFileResult } from './FileUploader.types';
1
+ import { ExtraFileInfo, FileInfo, UploadFileResult } from './FileUploader.types';
2
2
  export type FileChangeCallback = (files: FileInfo[]) => void;
3
3
  export interface FileUploaderContextProps {
4
+ deriveFileInfosFromStorageIds?: (storageId: string[]) => Promise<ExtraFileInfo[]>;
4
5
  uploadFile: (file: FormData) => Promise<UploadFileResult>;
5
6
  deleteFile: (fileId: string) => Promise<void>;
6
7
  }
@@ -20,6 +20,7 @@ export declare const WithError: Story;
20
20
  export declare const WithCaptureButton: Story;
21
21
  export declare const WithExistingFiles: Story;
22
22
  export declare const withFileSizeLimit: Story;
23
+ export declare const withPreviews: Story;
23
24
  export declare const withAllowedFileTypes: Story;
24
25
  export declare const withFileScanFailed: Story;
25
26
  export declare const WithFilePreview: Story;
@@ -4,11 +4,14 @@ export type FileInfo = {
4
4
  fileName: string;
5
5
  storageId?: string;
6
6
  contentType: string;
7
- thumbnailUri?: string;
8
- previewUri?: string;
9
7
  status: FileStatus;
10
8
  exif?: Exif;
11
9
  error?: string;
10
+ };
11
+ export type ExtraFileInfo = {
12
+ storageId?: string;
13
+ thumbnailUri?: string;
14
+ previewUri?: string;
12
15
  sizeInBytes?: number;
13
16
  };
14
17
  export interface UploadFileResponse {
@@ -1,11 +1,12 @@
1
- import { FileInfo } from '../FileUploader.types';
1
+ import { ExtraFileInfo, FileInfo } from '../FileUploader.types';
2
2
  import { MaterialIconProps } from '~/components/kystverket/Icon/icon';
3
3
  type FileUploaderItemProps = {
4
4
  file: FileInfo;
5
+ extraInfo?: ExtraFileInfo;
5
6
  t: (key: string) => string;
6
7
  onDeleteFile: (file: FileInfo) => void;
7
8
  onPreviewFile?: () => void;
8
9
  };
9
10
  export declare const getPrefixIcon: (contentType: FileInfo["contentType"]) => MaterialIconProps["material"];
10
- export declare function FileUploaderItem({ file, t, onDeleteFile, onPreviewFile }: FileUploaderItemProps): React.JSX.Element;
11
+ export declare function FileUploaderItem({ file, extraInfo, t, onDeleteFile, onPreviewFile }: FileUploaderItemProps): React.JSX.Element;
11
12
  export {};
@@ -1,2 +1,2 @@
1
- export declare const iconIdList: readonly ["add", "add_box", "add_location", "add_location_alt", "adjust", "anchor", "apps", "archive", "arrow_back", "arrow_forward", "arrow_right_alt", "article", "calendar_month", "change_history", "chat", "check", "check_circle", "chevron_left", "chevron_right", "circle", "close", "cloud_alert", "cloud_done", "code_blocks", "content_copy", "data_table", "delete", "description", "directions_boat", "distance", "domain", "download", "edit", "edit_document", "edit_location", "edit_location_alt", "edit_square", "error", "event", "explore", "explore_nearby", "export_notes", "favorite", "file_map", "file_save", "folder_open", "format_align_center", "format_align_left", "format_align_right", "forward", "globe_uk", "groups", "image", "inbox", "info", "info_i", "keyboard_arrow_down", "keyboard_arrow_up", "language", "layers", "lightbulb", "link", "location_chip", "lock", "login", "logout", "mail", "map", "map_pin_heart", "menu", "mode_cool", "more_vert", "move", "numbers", "open_in_new", "pan_zoom", "pending_actions", "person", "person_add", "person_pin", "person_pin_circle", "photo_camera", "picture_as_pdf", "pin_drop", "radio_button_checked", "radio_button_unchecked", "sailing", "save", "send", "settings", "settings_input_antenna", "severe_cold", "source_environment", "stylus", "timeline", "upload", "video_library", "videocam", "view_list", "warning", "zoom_in_map", "zoom_out_map", "format_italic", "format_bold", "format_list_bulleted", "format_list_numbered", "format_align_justify", "undo", "redo", "visibility", "left_panel_close", "left_panel_open", "right_panel_close", "right_panel_open"];
1
+ export declare const iconIdList: readonly ["add", "add_box", "add_location", "add_location_alt", "adjust", "anchor", "apps", "archive", "arrow_back", "arrow_forward", "arrow_right_alt", "article", "calendar_month", "change_history", "chat", "check", "check_circle", "chevron_left", "chevron_right", "circle", "close", "cloud_alert", "cloud_done", "code_blocks", "content_copy", "data_table", "delete", "description", "directions_boat", "distance", "domain", "download", "edit", "edit_document", "edit_location", "edit_location_alt", "edit_square", "error", "event", "explore", "explore_nearby", "export_notes", "favorite", "file_map", "file_save", "folder_open", "format_align_center", "format_align_left", "format_align_right", "forward", "globe_uk", "groups", "image", "inbox", "info", "info_i", "keyboard_arrow_down", "keyboard_arrow_up", "language", "layers", "lightbulb", "link", "location_chip", "lock", "login", "logout", "mail", "map", "map_pin_heart", "menu", "mode_cool", "more_vert", "move", "numbers", "open_in_new", "pan_zoom", "pending_actions", "person", "person_add", "person_pin", "person_pin_circle", "photo_camera", "picture_as_pdf", "pin_drop", "radio_button_checked", "radio_button_unchecked", "sailing", "save", "send", "settings", "settings_input_antenna", "severe_cold", "source_environment", "stylus", "text_snippet", "timeline", "upload", "video_library", "videocam", "view_list", "warning", "zoom_in_map", "zoom_out_map", "format_italic", "format_bold", "format_list_bulleted", "format_list_numbered", "format_align_justify", "undo", "redo", "visibility", "left_panel_close", "left_panel_open", "right_panel_close", "right_panel_open"];
2
2
  export type IconId = (typeof iconIdList)[number];