@prismicio/editor-fields 0.4.57 → 0.4.58-alpha.repeatable-link-base.1

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 (39) hide show
  1. package/dist/EditorConfig.d.ts +2 -0
  2. package/dist/FieldContext.d.ts +5 -0
  3. package/dist/core/MediaLibrary/hooks/mediaLibraryData.d.ts +75 -75
  4. package/dist/core/MediaLibrary/hooks/tagData.d.ts +3 -3
  5. package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +7 -7
  6. package/dist/core/repeatable.d.ts +3 -0
  7. package/dist/core/service/customType.d.ts +38 -0
  8. package/dist/core/service/document.d.ts +1674 -422
  9. package/dist/core/service/documentSearch.d.ts +415 -0
  10. package/dist/core/service/index.d.ts +2 -0
  11. package/dist/core/service/repository.d.ts +158 -21
  12. package/dist/core/service/role.d.ts +141 -0
  13. package/dist/core/service/teamSpace.d.ts +48 -0
  14. package/dist/core/service/user.d.ts +11 -5
  15. package/dist/fields/ImageField/useImageField.d.ts +1 -1
  16. package/dist/fields/IntegrationField/integrationData.d.ts +5 -5
  17. package/dist/fields/LinkField/Documents/DocumentCard.d.ts +1 -1
  18. package/dist/fields/LinkField/Documents/documentsData.d.ts +73 -44
  19. package/dist/fields/LinkField/LinkField.d.ts +4 -3
  20. package/dist/fields/LinkField/LinkOrRepeatableLinkField.d.ts +12 -0
  21. package/dist/fields/LinkField/RepeatableLinkField/RepeatableLinkField.d.ts +11 -0
  22. package/dist/fields/LinkField/RepeatableLinkField/RepeatableLinkFieldActions.d.ts +11 -0
  23. package/dist/fields/LinkField/RepeatableLinkField/index.d.ts +1 -0
  24. package/dist/fields/LinkField/RepeatableLinkField/useRepeatableLinkField.d.ts +84 -0
  25. package/dist/fields/LinkField/index.d.ts +1 -0
  26. package/dist/fields/LinkField/useLinkField.d.ts +5 -2
  27. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +6 -6
  28. package/dist/fields/RichTextField/extensions/Embed/EmbedView.d.ts +1 -1
  29. package/dist/fields/RichTextField/extensions/Image/ImageLinkControl.d.ts +0 -9
  30. package/dist/fields/RichTextField/extensions/Image/ImageView.d.ts +1 -1
  31. package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +1 -1
  32. package/dist/fields/RichTextField/extensions/Link/LinkModel.d.ts +2 -2
  33. package/dist/fields/RichTextField/extensions/extensions.d.ts +1 -1
  34. package/dist/index.cjs.js +37 -39
  35. package/dist/index.d.ts +8 -8
  36. package/dist/index.es.js +25739 -22410
  37. package/dist/slices/utils.d.ts +101 -27
  38. package/package.json +25 -24
  39. package/dist/fields/LinkField/RepeatableLinkField.d.ts +0 -12
@@ -5,17 +5,60 @@ export declare function useDocuments(params: {
5
5
  typesFilter: Set<FilterOption>;
6
6
  localesFilter: Set<FilterOption>;
7
7
  }): {
8
- documents: {
8
+ documents: ({
9
+ versions: ((({
10
+ status: "unclassified";
11
+ } | {
12
+ status: "published";
13
+ } | {
14
+ status: "release";
15
+ release_id: string;
16
+ } | {
17
+ status: "archived";
18
+ }) & {
19
+ tags: string[];
20
+ author: {
21
+ first_name?: string | undefined;
22
+ last_name?: string | undefined;
23
+ email?: string | undefined;
24
+ uploadedAvatar?: string | undefined;
25
+ };
26
+ version_id: string;
27
+ last_modified_date: Date;
28
+ custom_type_label: string;
29
+ preview_image?: string | undefined;
30
+ uid?: string | undefined;
31
+ preview_summary?: string | undefined;
32
+ }) | (({
33
+ status: "unclassified";
34
+ } | {
35
+ status: "published";
36
+ } | {
37
+ status: "release";
38
+ release_id: string;
39
+ } | {
40
+ status: "archived";
41
+ }) & {
42
+ tags: string[];
43
+ version_id: string;
44
+ last_modified_date: Date;
45
+ summary?: string | undefined;
46
+ preview_image?: string | undefined;
47
+ uid?: string | undefined;
48
+ custom_type_id?: string | undefined;
49
+ author_ids?: string[] | undefined;
50
+ }))[];
9
51
  id: string;
10
52
  title: string;
11
53
  language: {
54
+ isMaster?: boolean | undefined;
12
55
  id: string;
13
- name: string;
14
- is_master?: boolean | undefined;
56
+ label: string;
15
57
  };
16
58
  custom_type_id: string;
17
59
  group_lang_id: string;
18
- versions: (({
60
+ } | {
61
+ versions: ((({
19
62
  status: "unclassified";
20
63
  } | {
21
64
  status: "published";
@@ -33,48 +76,34 @@ export declare function useDocuments(params: {
33
76
  uploadedAvatar?: string | undefined;
34
77
  };
35
78
  version_id: string;
36
- custom_type_label: string;
37
79
  last_modified_date: Date;
80
+ custom_type_label: string;
81
+ preview_image?: string | undefined;
82
+ uid?: string | undefined;
38
83
  preview_summary?: string | undefined;
84
+ }) | (({
85
+ status: "unclassified";
86
+ } | {
87
+ status: "published";
88
+ } | {
89
+ status: "release";
90
+ release_id: string;
91
+ } | {
92
+ status: "archived";
93
+ }) & {
94
+ tags: string[];
95
+ version_id: string;
96
+ last_modified_date: Date;
97
+ summary?: string | undefined;
39
98
  preview_image?: string | undefined;
40
99
  uid?: string | undefined;
41
- })[];
42
- }[];
43
- response: {
44
- results: {
45
- versions: (({
46
- status: "unclassified";
47
- } | {
48
- status: "published";
49
- } | {
50
- status: "release";
51
- release_id: string;
52
- } | {
53
- status: "archived";
54
- }) & {
55
- tags: string[];
56
- author: {
57
- first_name?: string | undefined;
58
- last_name?: string | undefined;
59
- email?: string | undefined;
60
- uploadedAvatar?: string | undefined;
61
- };
62
- version_id: string;
63
- custom_type_label: string;
64
- last_modified_date: Date;
65
- preview_summary?: string | undefined;
66
- preview_image?: string | undefined;
67
- uid?: string | undefined;
68
- })[];
69
- id: string;
70
- title: string;
71
- language: {
72
- id: string;
73
- name: string;
74
- is_master?: boolean | undefined;
75
- };
76
- custom_type_id: string;
77
- group_lang_id: string;
78
- }[];
79
- };
100
+ custom_type_id?: string | undefined;
101
+ author_ids?: string[] | undefined;
102
+ }))[];
103
+ id: string;
104
+ title: string;
105
+ custom_type_id: string;
106
+ group_lang_id: string;
107
+ locale_id?: string | undefined;
108
+ })[];
80
109
  };
@@ -2,22 +2,23 @@
2
2
  import { FilledLinkContent, type LinkContent } from "@prismicio/types-internal/lib/content";
3
3
  import type { Link } from "@prismicio/types-internal/lib/customtypes";
4
4
  import { type FieldSelectType } from "./LinkFieldActions";
5
+ type LinkFieldVariant = "normal" | "compact" | "condensedButtons";
5
6
  interface LinkFieldProps {
6
7
  id?: string;
7
8
  field: Link;
8
9
  content: LinkContent | undefined;
9
- condensedButtons?: boolean;
10
10
  onContentChange: (content: LinkContent | undefined) => void;
11
+ variant?: LinkFieldVariant;
11
12
  }
12
13
  export declare function LinkField(props: LinkFieldProps): JSX.Element;
13
14
  interface GetFieldIconArgs {
14
15
  selectType?: FieldSelectType;
15
16
  displayTextEnabled?: boolean;
16
17
  }
17
- export declare function getFieldIcon(args: GetFieldIconArgs): "description" | "image" | "link" | "notes" | "public";
18
+ export declare function getFieldIcon(args: GetFieldIconArgs): "image" | "description" | "link" | "notes" | "public";
18
19
  interface FilledLinkFieldProps {
19
20
  id?: string;
20
- condensedButtons?: boolean;
21
+ variant?: LinkFieldVariant;
21
22
  field: Link & {
22
23
  config?: {
23
24
  allowText?: false;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { type NestableContent } from "@prismicio/types-internal/lib/content";
3
+ import type { Link } from "@prismicio/types-internal/lib/customtypes";
4
+ interface LinkOrRepeatableLinkFieldProps {
5
+ content: NestableContent | undefined;
6
+ id: string;
7
+ field: Link;
8
+ onContentChange: (content: NestableContent | undefined) => void;
9
+ readOnly: boolean;
10
+ }
11
+ export declare function LinkOrRepeatableLinkField(props: LinkOrRepeatableLinkFieldProps): JSX.Element;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { RepeatableContent } from "@prismicio/types-internal/lib/content";
3
+ import { type Link } from "@prismicio/types-internal/lib/customtypes";
4
+ interface RepeatableLinkFieldProps {
5
+ id?: string;
6
+ field: Link;
7
+ content: RepeatableContent | undefined;
8
+ onContentChange: (content: RepeatableContent) => void;
9
+ }
10
+ export declare function RepeatableLinkField(props: RepeatableLinkFieldProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface RepeatableLinkFieldActionsProps {
3
+ onDelete: () => void;
4
+ onMoveUp: () => void;
5
+ onMoveDown: () => void;
6
+ isDeleteEnabled: boolean;
7
+ isMoveUpEnabled: boolean;
8
+ isMoveDownEnabled: boolean;
9
+ }
10
+ export declare function RepeatableLinkFieldActions(props: RepeatableLinkFieldActionsProps): JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export { RepeatableLinkField } from "./RepeatableLinkField";
@@ -0,0 +1,84 @@
1
+ import { type LinkContent, type RepeatableContent } from "@prismicio/types-internal/lib/content";
2
+ import { type Link } from "@prismicio/types-internal/lib/customtypes";
3
+ interface UseRepeatableLinkFieldProps {
4
+ field: Link;
5
+ content: RepeatableContent | undefined;
6
+ onContentChange: (content: RepeatableContent) => void;
7
+ }
8
+ export declare function useRepeatableLinkField(props: UseRepeatableLinkFieldProps): {
9
+ links: ({
10
+ key: string;
11
+ } & {
12
+ __TYPE__: "LinkContent";
13
+ value: ({
14
+ __TYPE__: "ImageLink";
15
+ } & ((({
16
+ kind: "image";
17
+ id: string;
18
+ url: string;
19
+ height: string;
20
+ width: string;
21
+ size: string;
22
+ name: string;
23
+ } & {
24
+ date?: string | null | undefined;
25
+ }) | {
26
+ kind: "image";
27
+ }) & {
28
+ text?: string | undefined;
29
+ })) | ({
30
+ __TYPE__: "FileLink";
31
+ } & ((({
32
+ kind: "file";
33
+ id: string;
34
+ url: string;
35
+ name: string;
36
+ size: string;
37
+ } & {
38
+ date?: string | null | undefined;
39
+ }) | {
40
+ kind: "file";
41
+ }) & {
42
+ text?: string | undefined;
43
+ })) | ({
44
+ __TYPE__: "DocumentLink";
45
+ } & (({
46
+ id: string;
47
+ } | {
48
+ kind: "document";
49
+ }) & {
50
+ text?: string | undefined;
51
+ })) | ({
52
+ __TYPE__: "ExternalLink";
53
+ } & ((({
54
+ url: string;
55
+ } & {
56
+ kind?: "web" | undefined;
57
+ target?: string | null | undefined;
58
+ preview?: {
59
+ title?: string | undefined;
60
+ } | null | undefined;
61
+ }) | {
62
+ kind: "web";
63
+ }) & {
64
+ text?: string | undefined;
65
+ })) | ({
66
+ __TYPE__: "MediaLink";
67
+ } & {
68
+ kind: "media";
69
+ } & {
70
+ text?: string | undefined;
71
+ }) | ({
72
+ __TYPE__: "AnyLink";
73
+ } & {
74
+ kind: "any";
75
+ } & {
76
+ text?: string | undefined;
77
+ });
78
+ })[];
79
+ updateLink: (linkContent: LinkContent | undefined, index: number) => void;
80
+ addNewLink: () => void;
81
+ deleteLink: (index: number) => void;
82
+ moveLink: (direction: "up" | "down", index: number) => void;
83
+ };
84
+ export {};
@@ -2,4 +2,5 @@ export { LinkDescriptionCard } from "./LinkDescriptionCard";
2
2
  export { FilledLinkField, LinkField } from "./LinkField";
3
3
  export { LinkFieldActions } from "./LinkFieldActions";
4
4
  export { LinkImageCard } from "./LinkImageCard";
5
+ export { RepeatableLinkField } from "./RepeatableLinkField";
5
6
  export { mapMediaToLinkContent } from "./useLinkField";
@@ -32,12 +32,13 @@ interface MapMediaToLinkContentArgs {
32
32
  }
33
33
  export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs): {
34
34
  __TYPE__: "LinkContent";
35
+ key: `${string}-${string}-${string}-${string}-${string}`;
35
36
  value: {
36
37
  __TYPE__: "ImageLink";
37
38
  id: string;
38
39
  name: string;
39
40
  url: string;
40
- kind: string;
41
+ kind: "image";
41
42
  size: string;
42
43
  height: string;
43
44
  width: string;
@@ -45,11 +46,12 @@ export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs):
45
46
  };
46
47
  } | {
47
48
  __TYPE__: "LinkContent";
49
+ key: `${string}-${string}-${string}-${string}-${string}`;
48
50
  value: {
49
51
  __TYPE__: "FileLink";
50
52
  id: string;
51
53
  name: string;
52
- kind: string;
54
+ kind: "file";
53
55
  url: string;
54
56
  size: string;
55
57
  date: string;
@@ -58,6 +60,7 @@ export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs):
58
60
  };
59
61
  } | {
60
62
  __TYPE__: "LinkContent";
63
+ key: `${string}-${string}-${string}-${string}-${string}`;
61
64
  value: {
62
65
  __TYPE__: "ImageLink";
63
66
  id: string;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
4
4
  converter: {
5
5
  fromPrismic(schema: Schema<any, any>): (list: {
6
- type: "em" | "embed" | "strong" | "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
6
+ type: "image" | "em" | "embed" | "strong" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
7
7
  content: {
8
8
  text: string;
9
9
  } & {
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  data: ({
12
12
  __TYPE__: "ImageLink";
13
13
  } & {
14
- kind: string;
14
+ kind: "image";
15
15
  id: string;
16
16
  url: string;
17
17
  height: string;
@@ -23,7 +23,7 @@ declare const _default: {
23
23
  }) | ({
24
24
  __TYPE__: "FileLink";
25
25
  } & {
26
- kind: string;
26
+ kind: "file";
27
27
  id: string;
28
28
  url: string;
29
29
  name: string;
@@ -64,7 +64,7 @@ declare const _default: {
64
64
  direction?: string | undefined;
65
65
  }) => ProsemirrorNode | undefined;
66
66
  toPrismic(node: ProsemirrorNode, nodeType: "list-item" | "o-list-item"): readonly ({
67
- type: "em" | "embed" | "strong" | "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
67
+ type: "image" | "em" | "embed" | "strong" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
68
68
  content: {
69
69
  text: string;
70
70
  } & {
@@ -72,7 +72,7 @@ declare const _default: {
72
72
  data: ({
73
73
  __TYPE__: "ImageLink";
74
74
  } & {
75
- kind: string;
75
+ kind: "image";
76
76
  id: string;
77
77
  url: string;
78
78
  height: string;
@@ -84,7 +84,7 @@ declare const _default: {
84
84
  }) | ({
85
85
  __TYPE__: "FileLink";
86
86
  } & {
87
- kind: string;
87
+ kind: "file";
88
88
  id: string;
89
89
  url: string;
90
90
  name: string;
@@ -4,7 +4,7 @@ import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
4
4
  import { type NodeViewProps } from "@tiptap/react";
5
5
  interface EmbedNode extends ProseMirrorNode {
6
6
  attrs: {
7
- content: EmbedContent | undefined;
7
+ content?: EmbedContent;
8
8
  };
9
9
  }
10
10
  export interface EmbedViewProps extends NodeViewProps {
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ImageBlockData } from "../../../../core/imageUtils";
3
- type LinkTo = ImageBlockData["linkTo"];
4
- interface ImageLinkControlProps {
5
- linkTo: LinkTo;
6
- onLinkToChange: (linkTo: LinkTo) => void;
7
- }
8
- export declare function ImageLinkControl(props: ImageLinkControlProps): JSX.Element;
9
- export {};
@@ -8,7 +8,7 @@ export interface ImageViewProps extends NodeViewProps {
8
8
  export declare function ImageView(props: ImageViewProps): JSX.Element;
9
9
  interface ImageNode extends ProseMirrorNode {
10
10
  attrs: {
11
- content: ImageBlockData | undefined;
11
+ content?: ImageBlockData;
12
12
  };
13
13
  }
14
14
  export declare const nodeWrapperClassName = "imageViewNodeWrapper";
@@ -13,7 +13,7 @@ interface useImageViewProps {
13
13
  }
14
14
  export declare function useImageView(props: useImageViewProps): {
15
15
  onMediaSelected: (media: MediaAssetOrExternalImage) => void;
16
- onCropperDialogClose: ({ croppedImages }: {
16
+ onCropperDialogClose: ({ croppedImages, }: {
17
17
  croppedImages: CroppedImages;
18
18
  }) => void;
19
19
  isUpdating: boolean;
@@ -31,7 +31,7 @@ export interface ImageLinkData {
31
31
  width: string;
32
32
  size: string;
33
33
  name: string;
34
- kind: string;
34
+ kind: "image";
35
35
  date?: string | null | undefined;
36
36
  }
37
37
  export interface FileLinkData {
@@ -39,7 +39,7 @@ export interface FileLinkData {
39
39
  id: string;
40
40
  url: string;
41
41
  name: string;
42
- kind: string;
42
+ kind: "file";
43
43
  size: string;
44
44
  date?: string | null | undefined;
45
45
  }
@@ -14,4 +14,4 @@ import { default as Paragraph } from "./Paragraph/Paragraph";
14
14
  export declare const MarkExtensions: (import("./Bold/BoldModel").BoldExtension | import("./Italic/ItalicModel").ItalicExtension | import("./Link/LinkModel").LinkExtension | import("./Label/LabelModel").LabelExtension)[];
15
15
  export type MarkExtensionName = typeof MarkExtensions[number]["name"];
16
16
  export declare function getAllExtensions(nodeTypes?: Set<RichTextNodeType>): WidgetExtension[];
17
- export { Bold, BulletList, CodeBlock, Embed, Heading, Image, Italic, Label, Link, OrderedList, Paragraph };
17
+ export { Bold, BulletList, CodeBlock, Embed, Heading, Image, Italic, Label, Link, OrderedList, Paragraph, };