@prismicio/editor-fields 0.4.11 → 0.4.15

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 (59) hide show
  1. package/dist/DocumentEditor.d.ts +4 -7
  2. package/dist/EditorConfig.d.ts +15 -5
  3. package/dist/GroupEditor.d.ts +1 -1
  4. package/dist/Selection.d.ts +25 -3
  5. package/dist/UID.d.ts +5 -0
  6. package/dist/constants/images.d.ts +8 -0
  7. package/dist/fields/EmbedField/EmbedFooter.d.ts +2 -2
  8. package/dist/fields/GeoPointField/geoPointFieldUtils.d.ts +1 -1
  9. package/dist/fields/ImageField/Components/EmptyCardContent.d.ts +2 -2
  10. package/dist/fields/ImageField/Components/ImageFieldCard.d.ts +4 -4
  11. package/dist/fields/ImageField/CropperDialog/CropperDialog.d.ts +1 -1
  12. package/dist/fields/ImageField/CropperDialog/croppedImage.d.ts +2 -2
  13. package/dist/fields/ImageField/MediaPicker/MediaLibrary/MediaLibrary.d.ts +3 -2
  14. package/dist/fields/ImageField/MediaPicker/MediaLibrary/mediaLibraryData.d.ts +28 -6
  15. package/dist/fields/ImageField/MediaPicker/MediaPicker.d.ts +5 -4
  16. package/dist/fields/ImageField/MediaPicker/UnsplashLibrary/unsplashData.d.ts +14 -3
  17. package/dist/fields/ImageField/MediaPicker/externalImage.d.ts +3 -2
  18. package/dist/fields/ImageField/MediaPicker/mediaPickerData.d.ts +3 -3
  19. package/dist/fields/ImageField/imageFieldUtils.d.ts +1 -1
  20. package/dist/fields/ImageField/useImageField.d.ts +2 -2
  21. package/dist/fields/LinkField/Documents/DocumentsModal.d.ts +6 -0
  22. package/dist/fields/LinkField/Documents/Filters.d.ts +1 -1
  23. package/dist/fields/LinkField/Documents/documentsData.d.ts +10 -0
  24. package/dist/fields/LinkField/Documents/useFilters.d.ts +5 -3
  25. package/dist/fields/LinkField/LinkFieldActions.d.ts +1 -1
  26. package/dist/fields/LinkField/index.d.ts +1 -0
  27. package/dist/fields/LinkField/useLinkField.d.ts +48 -4
  28. package/dist/fields/NumberField.d.ts +1 -1
  29. package/dist/fields/RichTextField/BubbleMenu/BubbleMenu.d.ts +1 -1
  30. package/dist/fields/RichTextField/BubbleMenu/Link/LinkPopover.d.ts +1 -0
  31. package/dist/fields/RichTextField/BubbleMenu/Link/SetMediaLinkModal.d.ts +8 -0
  32. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +2 -2
  33. package/dist/fields/RichTextField/coreExtensions/Placeholder.d.ts +1 -1
  34. package/dist/fields/RichTextField/coreExtensions/index.d.ts +3 -2
  35. package/dist/fields/RichTextField/extensions/Embed/EmbedView.d.ts +1 -1
  36. package/dist/fields/RichTextField/extensions/Embed/useEmbedView.d.ts +20 -1
  37. package/dist/fields/RichTextField/extensions/Heading/Heading.d.ts +3 -4
  38. package/dist/fields/RichTextField/extensions/Image/ImageView.d.ts +1 -1
  39. package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +2 -2
  40. package/dist/fields/RichTextField/extensions/Link/Link.d.ts +7 -1
  41. package/dist/fields/RichTextField/extensions/Link/LinkModel.d.ts +3 -3
  42. package/dist/fields/RichTextField/models/EditorExtension.d.ts +13 -15
  43. package/dist/fields/RichTextField/models/MenuItems.d.ts +2 -2
  44. package/dist/fields/RichTextField/models/RichTextConfig.d.ts +1 -1
  45. package/dist/fields/RichTextField/useEditor.d.ts +6 -1
  46. package/dist/fields/UIDField/UIDField.d.ts +3 -3
  47. package/dist/fields/utils.d.ts +2 -2
  48. package/dist/index.d.ts +3 -1
  49. package/dist/index.es.js +35429 -34974
  50. package/dist/slices/CompositeSliceEditor.d.ts +4 -4
  51. package/dist/slices/LegacySliceEditor.d.ts +4 -4
  52. package/dist/slices/SharedSliceEditor.d.ts +4 -2
  53. package/dist/slices/defaults.d.ts +23 -0
  54. package/dist/slices/utils.d.ts +34 -0
  55. package/dist/zones/NonRepeatableZoneEditor.d.ts +4 -5
  56. package/dist/zones/SliceZoneEditor.d.ts +0 -1
  57. package/dist/zones/StaticZone.d.ts +2 -2
  58. package/package.json +6 -6
  59. package/dist/fields/UIDField/uidUtils.d.ts +0 -1
@@ -1,16 +1,13 @@
1
1
  import type { Document } from "@prismicio/types-internal/lib/content";
2
2
  import type { StaticCustomType } from "@prismicio/types-internal/lib/customtypes";
3
- import { type FC } from "react";
4
- import { EditorConfig } from "./EditorConfig";
5
- import type { Selection } from "./Selection";
6
- declare type DocumentEditorProps = Readonly<{
3
+ import { type EditorConfig } from "./EditorConfig";
4
+ interface Props {
7
5
  config: EditorConfig;
8
6
  readOnly?: boolean;
9
7
  customType: StaticCustomType;
10
8
  sectionName: string;
11
- selection?: Selection;
12
9
  content: Document;
13
10
  onContentChange: (content: Document) => void;
14
- }>;
15
- export declare const DocumentEditor: FC<DocumentEditorProps>;
11
+ }
12
+ export declare function DocumentEditor(props: Props): JSX.Element | null;
16
13
  export {};
@@ -1,17 +1,26 @@
1
- export declare type EditorConfig = {
1
+ export type EditorConfig = {
2
2
  embedsUrl: string;
3
3
  unsplashUrl: string;
4
4
  env: Env;
5
5
  } & OptionalConfigs;
6
- declare type OptionalConfigs = SearchDocuments & MediaLibrary;
7
- declare type MediaLibrary = {
6
+ type OptionalConfigs = SearchDocuments & MediaLibrary & UIDField;
7
+ type MediaLibrary = {
8
8
  mediaLibrary?: never;
9
9
  } | {
10
10
  mediaLibrary: true;
11
11
  assetsUrl: string;
12
12
  repository: string;
13
13
  };
14
- declare type SearchDocuments = {
14
+ type UIDField = {
15
+ uidField?: never;
16
+ } | {
17
+ uidField: true;
18
+ coreApiUrl: string;
19
+ documentId?: string;
20
+ localeId: string;
21
+ customTypeId: string;
22
+ };
23
+ type SearchDocuments = {
15
24
  searchDocuments?: never;
16
25
  } | {
17
26
  searchDocuments: true;
@@ -20,8 +29,9 @@ declare type SearchDocuments = {
20
29
  repository: string;
21
30
  status: "published" | "release" | "archived" | "unclassified";
22
31
  localeId?: string;
32
+ customTypeId?: string;
23
33
  };
24
- export declare type Env = "dev" | "stage" | "prod";
34
+ export type Env = "dev" | "stage" | "prod";
25
35
  export declare const EditorConfigContext: import("react").Context<EditorConfig | undefined>;
26
36
  export declare function useEditorConfig(): EditorConfig;
27
37
  export declare function throwConfigError(configKey: string): never;
@@ -1,7 +1,7 @@
1
1
  import type { GroupContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Group } from "@prismicio/types-internal/lib/customtypes";
3
3
  import type { FC } from "react";
4
- declare type GroupEditorProps = Readonly<{
4
+ type GroupEditorProps = Readonly<{
5
5
  content: GroupContent | undefined;
6
6
  group: Group;
7
7
  id: string;
@@ -1,5 +1,27 @@
1
1
  export interface Selection {
2
- id: string;
3
- key: string;
4
- offset?: number;
2
+ /**
3
+ * The logical id of the content to select.
4
+ */
5
+ id?: string;
6
+ /**
7
+ * Update the current selection.
8
+ */
9
+ update: (requestedFrom: SelectionArea, newId: string) => void;
5
10
  }
11
+ export type SelectionArea = "sliceTable" | "sliceFieldSet";
12
+ export declare function getSelectionDOMId(area: SelectionArea, id?: string): string | undefined;
13
+ export declare const SelectionContext: import("react").Context<Selection>;
14
+ interface UseSelectionArgs {
15
+ /**
16
+ * Initial slice key.
17
+ * Used to determine if the slice is selected.
18
+ * @param {string} sliceKey
19
+ */
20
+ sliceKey?: string;
21
+ }
22
+ export declare function useSelection(args?: UseSelectionArgs): {
23
+ selectionId: string | undefined;
24
+ selected: boolean;
25
+ selection: Selection;
26
+ };
27
+ export {};
package/dist/UID.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface UIDContext {
2
+ isDirty: boolean;
3
+ markDirty: () => void;
4
+ }
5
+ export declare const UIDContext: import("react").Context<UIDContext>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Default only applied to SVG's which do not have height and width.
3
+ *
4
+ * Fix planned in ticket https://linear.app/prismic/issue/PBD-926/apply-a-default-height-and-width-for-an-svg
5
+ *
6
+ * This will add a default height and width which is more accurate in the BE.
7
+ */
8
+ export declare const defaultImageDimension = 2000;
@@ -1,9 +1,9 @@
1
1
  import type { EmbedContent } from "@prismicio/types-internal/lib/content";
2
2
  interface FooterProps {
3
3
  debouncedUrl: string;
4
- content?: EmbedContent;
4
+ content: EmbedContent | undefined;
5
5
  onContentChange: (content?: EmbedContent) => void;
6
6
  selected?: boolean;
7
7
  }
8
- export declare function Footer(props: FooterProps): JSX.Element;
8
+ export declare function Footer(props: FooterProps): JSX.Element | null;
9
9
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { GeoPointContent } from "@prismicio/types-internal/lib/content";
2
- declare type Coordinates = GeoPointContent["position"];
2
+ type Coordinates = GeoPointContent["position"];
3
3
  export declare function parseGoogleMapsUrl(url: string): Coordinates | undefined;
4
4
  export declare function coordinatesToString(coordinates?: Coordinates): string;
5
5
  export declare function parseString(str: string): Coordinates | undefined;
@@ -1,8 +1,8 @@
1
- import type { ExternalImage } from "../MediaPicker/externalImage";
1
+ import type { MediaAssetOrExternalImage } from "../MediaPicker/MediaLibrary/mediaLibraryData";
2
2
  interface EmptyCardContentProps {
3
3
  isUpdating: boolean;
4
4
  readOnly: boolean;
5
- onMediaSelected: (media: ExternalImage) => void;
5
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
6
6
  }
7
7
  export declare function EmptyCardContent(props: EmptyCardContentProps): JSX.Element;
8
8
  export {};
@@ -1,15 +1,15 @@
1
1
  import type { ImageContent } from "@prismicio/types-internal/lib/content";
2
- import type { ReactNode } from "react";
3
- import { CroppedImages } from "../CropperDialog";
2
+ import { type ReactNode } from "react";
3
+ import { type CroppedImages } from "../CropperDialog";
4
4
  import type { CropperImage } from "../imageFieldUtils";
5
- import type { ExternalImage } from "../MediaPicker/externalImage";
5
+ import type { MediaAssetOrExternalImage } from "../MediaPicker/MediaLibrary/mediaLibraryData";
6
6
  interface ImageFieldCardProps {
7
7
  content: ImageContent | undefined;
8
8
  selected?: boolean;
9
9
  fieldLabel: string;
10
10
  readOnly: boolean;
11
11
  imageLabel: string[];
12
- onMediaSelected: (media: ExternalImage) => void;
12
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
13
13
  initialImages: CropperImage[];
14
14
  initialOption?: number;
15
15
  onCropperDialogClose: (result: {
@@ -1,6 +1,6 @@
1
1
  import type { CropperImage } from "../imageFieldUtils";
2
2
  import { type CroppedImage } from "./croppedImage";
3
- export declare type CroppedImages = Record<string, CroppedImage>;
3
+ export type CroppedImages = Record<string, CroppedImage>;
4
4
  interface Props {
5
5
  trigger: React.ReactNode;
6
6
  initialImages: CropperImage[];
@@ -9,7 +9,7 @@ export interface Size {
9
9
  width: number;
10
10
  height: number;
11
11
  }
12
- export declare type CroppedImage = Point & Size & {
12
+ export type CroppedImage = Point & Size & {
13
13
  zoom: number;
14
14
  };
15
15
  export declare const updateImage: ({ field, content, thumbnail, croppedImage }: {
@@ -36,7 +36,7 @@ export declare const updateImage: ({ field, content, thumbnail, croppedImage }:
36
36
  thumbnail: string;
37
37
  croppedImage: CroppedImage;
38
38
  }) => ImageContent;
39
- declare type Constraints = Pick<Thumbnail, "width" | "height">;
39
+ type Constraints = Pick<Thumbnail, "width" | "height">;
40
40
  /**
41
41
  * Given a content view and optional constraints, it provides the cropped area
42
42
  * and the zoom to initialize the cropper.
@@ -1,11 +1,12 @@
1
- import type { ExternalImage } from "../externalImage";
2
1
  import type { UploadFile } from "../mediaPickerData";
2
+ import { type MediaAsset, type MediaAssetType } from "./mediaLibraryData";
3
3
  interface MediaLibraryProps {
4
4
  isUploading: boolean;
5
5
  uploadingFiles: UploadFile[];
6
6
  onFilesSelected: (uploadingFiles: File[]) => void;
7
- onMediaSelected: (media: ExternalImage) => void;
7
+ onMediaSelected: (media: MediaAsset) => void;
8
8
  onRetry: () => void;
9
+ assetType?: MediaAssetType;
9
10
  }
10
11
  export declare function MediaLibrary(props: MediaLibraryProps): JSX.Element;
11
12
  export {};
@@ -1,5 +1,6 @@
1
- import { TypeOf } from "zod";
2
- export declare const mediaLibraryImageOkType: import("zod").ZodObject<{
1
+ import { type TypeOf } from "zod";
2
+ import type { ExternalImage } from "../externalImage";
3
+ export declare const mediaAssetOkType: import("zod").ZodObject<{
3
4
  id: import("zod").ZodString;
4
5
  kind: import("zod").ZodString;
5
6
  extension: import("zod").ZodString;
@@ -9,9 +10,11 @@ export declare const mediaLibraryImageOkType: import("zod").ZodObject<{
9
10
  last_modified: import("zod").ZodNumber;
10
11
  url: import("zod").ZodString;
11
12
  alt: import("zod").ZodOptional<import("zod").ZodString>;
13
+ size: import("zod").ZodNumber;
12
14
  }, "strip", import("zod").ZodTypeAny, {
13
15
  id: string;
14
16
  url: string;
17
+ size: number;
15
18
  kind: string;
16
19
  extension: string;
17
20
  filename: string;
@@ -22,6 +25,7 @@ export declare const mediaLibraryImageOkType: import("zod").ZodObject<{
22
25
  }, {
23
26
  id: string;
24
27
  url: string;
28
+ size: number;
25
29
  kind: string;
26
30
  extension: string;
27
31
  filename: string;
@@ -43,9 +47,11 @@ export declare const mediaLibrarySearchAPISchemaOkType: import("zod").ZodObject<
43
47
  last_modified: import("zod").ZodNumber;
44
48
  url: import("zod").ZodString;
45
49
  alt: import("zod").ZodOptional<import("zod").ZodString>;
50
+ size: import("zod").ZodNumber;
46
51
  }, "strip", import("zod").ZodTypeAny, {
47
52
  id: string;
48
53
  url: string;
54
+ size: number;
49
55
  kind: string;
50
56
  extension: string;
51
57
  filename: string;
@@ -56,6 +62,7 @@ export declare const mediaLibrarySearchAPISchemaOkType: import("zod").ZodObject<
56
62
  }, {
57
63
  id: string;
58
64
  url: string;
65
+ size: number;
59
66
  kind: string;
60
67
  extension: string;
61
68
  filename: string;
@@ -69,6 +76,7 @@ export declare const mediaLibrarySearchAPISchemaOkType: import("zod").ZodObject<
69
76
  items: {
70
77
  id: string;
71
78
  url: string;
79
+ size: number;
72
80
  kind: string;
73
81
  extension: string;
74
82
  filename: string;
@@ -83,6 +91,7 @@ export declare const mediaLibrarySearchAPISchemaOkType: import("zod").ZodObject<
83
91
  items: {
84
92
  id: string;
85
93
  url: string;
94
+ size: number;
86
95
  kind: string;
87
96
  extension: string;
88
97
  filename: string;
@@ -93,12 +102,23 @@ export declare const mediaLibrarySearchAPISchemaOkType: import("zod").ZodObject<
93
102
  }[];
94
103
  cursor?: string | undefined;
95
104
  }>;
96
- export declare type MediaLibrarySearchApi = TypeOf<typeof mediaLibrarySearchAPISchemaOkType>;
97
- export declare type MediaLibraryImage = TypeOf<typeof mediaLibraryImageOkType>;
98
- export declare function useMediaLibrarySearch(): {
105
+ export type MediaLibrarySearchApi = TypeOf<typeof mediaLibrarySearchAPISchemaOkType>;
106
+ export type MediaAsset = TypeOf<typeof mediaAssetOkType>;
107
+ export type MediaAssetOrExternalImage = MediaAsset | ExternalImage;
108
+ /**
109
+ * set the allowed media type for the media library
110
+ * @param all for both images and PDFs
111
+ * @param image for only images
112
+ */
113
+ export type MediaAssetType = "all" | "image";
114
+ interface UseMediaLibrarySearchArgs {
115
+ assetType?: MediaAssetType;
116
+ }
117
+ export declare function useMediaLibrarySearch(args: UseMediaLibrarySearchArgs): {
99
118
  media: {
100
119
  id: string;
101
120
  url: string;
121
+ size: number;
102
122
  kind: string;
103
123
  extension: string;
104
124
  filename: string;
@@ -114,6 +134,7 @@ export declare function useMediaLibrarySearch(): {
114
134
  items: {
115
135
  id: string;
116
136
  url: string;
137
+ size: number;
117
138
  kind: string;
118
139
  extension: string;
119
140
  filename: string;
@@ -124,5 +145,6 @@ export declare function useMediaLibrarySearch(): {
124
145
  }[];
125
146
  cursor?: string | undefined;
126
147
  };
127
- updateMedia: (newFiles: MediaLibraryImage[]) => void;
148
+ updateMedia: (newFiles: MediaAsset[]) => void;
128
149
  };
150
+ export {};
@@ -1,8 +1,9 @@
1
- import { ReactNode } from "react";
2
- import type { ExternalImage } from "./externalImage";
1
+ import type { MediaAssetOrExternalImage, MediaAssetType } from "./MediaLibrary/mediaLibraryData";
3
2
  interface MediaPickerProps {
4
- trigger: ReactNode;
5
- onMediaSelected: (media: ExternalImage) => void;
3
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
4
+ assetType?: MediaAssetType;
5
+ open: boolean;
6
+ onOpenChange: (open: boolean) => void;
6
7
  }
7
8
  export declare function MediaPicker(props: MediaPickerProps): JSX.Element;
8
9
  export {};
@@ -1,4 +1,4 @@
1
- import { TypeOf } from "zod";
1
+ import { type TypeOf } from "zod";
2
2
  declare const unsplashImage: import("zod").ZodObject<{
3
3
  id: import("zod").ZodString;
4
4
  width: import("zod").ZodNumber;
@@ -13,6 +13,7 @@ declare const unsplashImage: import("zod").ZodObject<{
13
13
  small: string;
14
14
  full: string;
15
15
  }>;
16
+ alt_description: import("zod").ZodOptional<import("zod").ZodString>;
16
17
  }, "strip", import("zod").ZodTypeAny, {
17
18
  id: string;
18
19
  width: number;
@@ -21,6 +22,7 @@ declare const unsplashImage: import("zod").ZodObject<{
21
22
  small: string;
22
23
  full: string;
23
24
  };
25
+ alt_description?: string | undefined;
24
26
  }, {
25
27
  id: string;
26
28
  width: number;
@@ -29,6 +31,7 @@ declare const unsplashImage: import("zod").ZodObject<{
29
31
  small: string;
30
32
  full: string;
31
33
  };
34
+ alt_description?: string | undefined;
32
35
  }>;
33
36
  export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod").ZodObject<{
34
37
  results: import("zod").ZodArray<import("zod").ZodObject<{
@@ -45,6 +48,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
45
48
  small: string;
46
49
  full: string;
47
50
  }>;
51
+ alt_description: import("zod").ZodOptional<import("zod").ZodString>;
48
52
  }, "strip", import("zod").ZodTypeAny, {
49
53
  id: string;
50
54
  width: number;
@@ -53,6 +57,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
53
57
  small: string;
54
58
  full: string;
55
59
  };
60
+ alt_description?: string | undefined;
56
61
  }, {
57
62
  id: string;
58
63
  width: number;
@@ -61,6 +66,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
61
66
  small: string;
62
67
  full: string;
63
68
  };
69
+ alt_description?: string | undefined;
64
70
  }>, "many">;
65
71
  }, "strip", import("zod").ZodTypeAny, {
66
72
  results: {
@@ -71,6 +77,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
71
77
  small: string;
72
78
  full: string;
73
79
  };
80
+ alt_description?: string | undefined;
74
81
  }[];
75
82
  }, {
76
83
  results: {
@@ -81,6 +88,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
81
88
  small: string;
82
89
  full: string;
83
90
  };
91
+ alt_description?: string | undefined;
84
92
  }[];
85
93
  }>, {
86
94
  id: string;
@@ -90,6 +98,7 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
90
98
  small: string;
91
99
  full: string;
92
100
  };
101
+ alt_description?: string | undefined;
93
102
  }[], {
94
103
  results: {
95
104
  id: string;
@@ -99,10 +108,11 @@ export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod
99
108
  small: string;
100
109
  full: string;
101
110
  };
111
+ alt_description?: string | undefined;
102
112
  }[];
103
113
  }>;
104
- export declare type UnplashSearchApi = TypeOf<typeof unsplashSearchApiType>;
105
- export declare type UnsplashImage = TypeOf<typeof unsplashImage>;
114
+ export type UnplashSearchApi = TypeOf<typeof unsplashSearchApiType>;
115
+ export type UnsplashImage = TypeOf<typeof unsplashImage>;
106
116
  export declare function useUnsplashSearch(baseUrl: string, term: string): {
107
117
  id: string;
108
118
  width: number;
@@ -111,5 +121,6 @@ export declare function useUnsplashSearch(baseUrl: string, term: string): {
111
121
  small: string;
112
122
  full: string;
113
123
  };
124
+ alt_description?: string | undefined;
114
125
  }[];
115
126
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { ImageContent, ImageContentView } from "@prismicio/types-internal/lib/content";
2
2
  import type { Image, ImageConstraint } from "@prismicio/types-internal/lib/customtypes";
3
+ import type { MediaAssetOrExternalImage } from "./MediaLibrary/mediaLibraryData";
3
4
  export interface ExternalImage {
4
5
  id: string;
5
6
  url: string;
@@ -7,8 +8,8 @@ export interface ExternalImage {
7
8
  height: number;
8
9
  alt?: string;
9
10
  }
10
- export declare function replaceImage(thumbnailName: string, field: Image, content: ImageContent | undefined, extImage: ExternalImage): ImageContent;
11
- export declare function createContentView(extImage: ExternalImage, constraints?: ImageConstraint): ImageContentView;
11
+ export declare function replaceImage(thumbnailName: string, field: Image, content: ImageContent | undefined, extImage: MediaAssetOrExternalImage): ImageContent;
12
+ export declare function createContentView(extImage: MediaAssetOrExternalImage, constraints?: ImageConstraint): ImageContentView;
12
13
  export declare function fitImage(extImage: {
13
14
  width: number;
14
15
  height: number;
@@ -1,5 +1,5 @@
1
- import { MediaLibraryImage } from "./MediaLibrary/mediaLibraryData";
2
- export declare type UploadFile = NewUploadFile | UploadedFile;
1
+ import { type MediaAsset } from "./MediaLibrary/mediaLibraryData";
2
+ export type UploadFile = NewUploadFile | UploadedFile;
3
3
  interface NewUploadFile {
4
4
  id: string;
5
5
  file: File;
@@ -9,7 +9,7 @@ interface UploadedFile {
9
9
  id: string;
10
10
  file: File;
11
11
  status: "success";
12
- response: MediaLibraryImage;
12
+ response: MediaAsset;
13
13
  }
14
14
  export declare function useMediaLibraryUpload(open: boolean): {
15
15
  uploadingFiles: UploadFile[];
@@ -1,6 +1,6 @@
1
1
  import type { ImageContent, ImageContentView } from "@prismicio/types-internal/lib/content";
2
2
  import type { Image, ImageConstraint } from "@prismicio/types-internal/lib/customtypes";
3
- export declare type Thumbnail = Readonly<ImageConstraint & {
3
+ export type Thumbnail = Readonly<ImageConstraint & {
4
4
  name: string;
5
5
  }>;
6
6
  export declare const MAIN_THUMBNAIL_NAME = "__MAIN_THUMBNAIL__";
@@ -1,7 +1,7 @@
1
1
  import type { ImageContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Image } from "@prismicio/types-internal/lib/customtypes";
3
3
  import type { CroppedImages } from "./CropperDialog";
4
- import { type ExternalImage } from "./MediaPicker/externalImage";
4
+ import type { MediaAssetOrExternalImage } from "./MediaPicker/MediaLibrary/mediaLibraryData";
5
5
  interface useImageFieldProps {
6
6
  content: ImageContent | undefined;
7
7
  field: Image;
@@ -13,7 +13,7 @@ export declare function useImageField(props: useImageFieldProps): {
13
13
  croppedImages: CroppedImages;
14
14
  }) => void;
15
15
  onPageChange: (page: number) => void;
16
- onMediaSelected: (media: ExternalImage) => void;
16
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
17
17
  isUpdating: boolean;
18
18
  page: number;
19
19
  thumbnail: Readonly<{
@@ -1,3 +1,4 @@
1
+ import { type FilterOption } from "@prismicio/editor-ui";
1
2
  interface DocumentsModalProps {
2
3
  open: boolean;
3
4
  onOpenChange: (open: boolean) => void;
@@ -6,4 +7,9 @@ interface DocumentsModalProps {
6
7
  fixedTags?: Set<string>;
7
8
  }
8
9
  export declare function DocumentsModal(props: DocumentsModalProps): JSX.Element;
10
+ interface SortTagsByFilteredTagsArgs {
11
+ tagsFilter: Set<FilterOption>;
12
+ tags: string[];
13
+ }
14
+ export declare function sortTagsByFilteredTags(args: SortTagsByFilteredTagsArgs): string[];
9
15
  export {};
@@ -1,4 +1,4 @@
1
- import { FilterOption } from "@prismicio/editor-ui";
1
+ import { type FilterOption } from "@prismicio/editor-ui";
2
2
  interface DocumentsListFiltersProps {
3
3
  filteredLocales: Set<FilterOption>;
4
4
  setFilteredLocales: (newValue: Set<FilterOption>) => void;
@@ -22,6 +22,11 @@ export declare function useDocuments(params: {
22
22
  version_id: string;
23
23
  tags: string[];
24
24
  custom_type_label: string;
25
+ last_modified_date: Date;
26
+ author: {
27
+ first_name?: string | undefined;
28
+ last_name?: string | undefined;
29
+ };
25
30
  preview_summary?: string | undefined;
26
31
  preview_image?: string | undefined;
27
32
  })[];
@@ -48,6 +53,11 @@ export declare function useDocuments(params: {
48
53
  version_id: string;
49
54
  tags: string[];
50
55
  custom_type_label: string;
56
+ last_modified_date: Date;
57
+ author: {
58
+ first_name?: string | undefined;
59
+ last_name?: string | undefined;
60
+ };
51
61
  preview_summary?: string | undefined;
52
62
  preview_image?: string | undefined;
53
63
  })[];
@@ -1,8 +1,10 @@
1
1
  import type { FilterOption } from "@prismicio/editor-ui";
2
2
  export declare function useFilters(fixedCustomTypes?: Set<string>, fixedTags?: Set<string>): {
3
- searchTerm: string;
4
- setSearchTerm: import("react").Dispatch<import("react").SetStateAction<string>>;
5
- debouncedSearchTerm: string;
3
+ searchTerm: {
4
+ debouncedValue: string;
5
+ set: import("react").Dispatch<import("react").SetStateAction<string>>;
6
+ value: string;
7
+ };
6
8
  filteredTags: Set<FilterOption>;
7
9
  setFilteredTags: import("react").Dispatch<import("react").SetStateAction<Set<FilterOption>>>;
8
10
  filteredCustomTypes: Set<FilterOption>;
@@ -1,4 +1,4 @@
1
- export declare type FieldSelectTypes = "web" | "document" | "media";
1
+ export type FieldSelectTypes = "web" | "document" | "media";
2
2
  interface Props {
3
3
  hasLink: boolean;
4
4
  onUnlink: () => void;
@@ -1,2 +1,3 @@
1
1
  export { LinkField } from "./LinkField";
2
2
  export { LinkFieldActions } from "./LinkFieldActions";
3
+ export { mapMediaToLinkContent } from "./useLinkField";
@@ -1,8 +1,9 @@
1
1
  import type { ErrorBoundary } from "@prismicio/editor-ui";
2
2
  import type { LinkContent } from "@prismicio/types-internal/lib/content";
3
3
  import type { Link } from "@prismicio/types-internal/lib/customtypes";
4
- import { TypeOf } from "zod";
5
- import { Env } from "../../EditorConfig";
4
+ import { type TypeOf } from "zod";
5
+ import { type Env } from "../../EditorConfig";
6
+ import { type MediaAssetOrExternalImage } from "../ImageField/MediaPicker/MediaLibrary/mediaLibraryData";
6
7
  import type { FieldSelectTypes } from "./LinkFieldActions";
7
8
  interface useLinkFieldParams {
8
9
  field: Link;
@@ -12,7 +13,6 @@ interface useLinkFieldParams {
12
13
  export declare function useLinkField(params: useLinkFieldParams): {
13
14
  contentType: "ImageLink" | "FileLink" | "DocumentLink" | "ExternalLink" | undefined;
14
15
  selectType: "media" | "web" | "document" | undefined;
15
- isUnsupportedField: boolean | undefined;
16
16
  fieldValue: string;
17
17
  onValueChange: (value: string) => void;
18
18
  onTypeChange: (newValue: FieldSelectTypes) => void;
@@ -23,6 +23,7 @@ export declare function useLinkField(params: useLinkFieldParams): {
23
23
  errorBoundaryRef: import("react").RefObject<ErrorBoundary>;
24
24
  isTargetNewTab: boolean;
25
25
  updateWebLinkTarget: (newTab: boolean) => void;
26
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
26
27
  };
27
28
  export declare function useDocumentTitle(id: string): string;
28
29
  declare const documentMeta: import("zod").ZodObject<{
@@ -35,6 +36,49 @@ declare const documentMeta: import("zod").ZodObject<{
35
36
  id: string;
36
37
  title: string;
37
38
  }>;
38
- export declare type DocumentMeta = TypeOf<typeof documentMeta>;
39
+ export type DocumentMeta = TypeOf<typeof documentMeta>;
39
40
  export declare function getDocumentTitleRequest(baseUrl: string, env: Env, id: string): Promise<DocumentMeta>;
41
+ interface MapMediaToLinkContentArgs {
42
+ media: MediaAssetOrExternalImage;
43
+ }
44
+ export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs): {
45
+ __TYPE__: "LinkContent";
46
+ value: {
47
+ __TYPE__: "FileLink";
48
+ id: string;
49
+ name: string;
50
+ kind: string;
51
+ url: string;
52
+ size: string;
53
+ date: string;
54
+ height?: undefined;
55
+ width?: undefined;
56
+ };
57
+ } | {
58
+ __TYPE__: "LinkContent";
59
+ value: {
60
+ __TYPE__: "ImageLink";
61
+ id: string;
62
+ name: string;
63
+ url: string;
64
+ kind: string;
65
+ size: string;
66
+ height: string;
67
+ width: string;
68
+ date: string;
69
+ };
70
+ } | {
71
+ __TYPE__: "LinkContent";
72
+ value: {
73
+ __TYPE__: "ImageLink";
74
+ id: string;
75
+ name: string;
76
+ kind: string;
77
+ url: string;
78
+ size: string;
79
+ height: string;
80
+ width: string;
81
+ date?: undefined;
82
+ };
83
+ };
40
84
  export {};