@prismicio/editor-fields 0.3.0 → 0.4.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.
@@ -1,16 +1,16 @@
1
1
  import type { Document } from "@prismicio/types-internal/lib/content";
2
- import { type CustomType, type SharedSlice } from "@prismicio/types-internal/lib/customtypes";
2
+ import type { StaticCustomType } from "@prismicio/types-internal/lib/customtypes";
3
3
  import { type FC } from "react";
4
- import { DocumentEditorConfig } from "./DocumentEditorConfig";
5
- declare type SharedSlices = Readonly<Record<string, SharedSlice>>;
4
+ import { EditorConfig } from "./EditorConfig";
5
+ import type { Selection } from "./Selection";
6
6
  declare type DocumentEditorProps = Readonly<{
7
+ config: EditorConfig;
8
+ readOnly?: boolean;
9
+ customType: StaticCustomType;
10
+ sectionName: string;
11
+ selection?: Selection;
7
12
  content: Document;
8
- customType: CustomType;
9
13
  onContentChange: (content: Document) => void;
10
- readOnly?: boolean;
11
- sectionName: string | undefined;
12
- sharedSlices: SharedSlices;
13
- config?: DocumentEditorConfig;
14
14
  }>;
15
15
  export declare const DocumentEditor: FC<DocumentEditorProps>;
16
16
  export {};
@@ -0,0 +1,10 @@
1
+ export interface EditorConfig {
2
+ embeds: {
3
+ url: string;
4
+ };
5
+ unsplash: {
6
+ url: string;
7
+ };
8
+ }
9
+ export declare const EditorConfigContext: import("react").Context<EditorConfig | undefined>;
10
+ export declare function useEditorConfig(): EditorConfig;
@@ -1,9 +1,11 @@
1
1
  import { type Document } from "@prismicio/types-internal/lib/content";
2
2
  import type { StaticSection } from "@prismicio/types-internal/lib/customtypes";
3
3
  import { type FC } from "react";
4
+ import type { Selection } from "./Selection";
4
5
  declare type SectionEditorProps = Readonly<{
5
6
  id: string;
6
7
  readOnly: boolean;
8
+ selection?: Selection;
7
9
  section: StaticSection;
8
10
  content: Document;
9
11
  onContentChange: (content: Document) => void;
@@ -0,0 +1,5 @@
1
+ export interface Selection {
2
+ id: string;
3
+ key: string;
4
+ offset?: number;
5
+ }
@@ -0,0 +1,10 @@
1
+ import type { ColorContent } from "@prismicio/types-internal/lib/content";
2
+ import type { Color as ColorT } from "@prismicio/types-internal/lib/customtypes";
3
+ declare type Props = Readonly<{
4
+ id: string;
5
+ field: ColorT;
6
+ content?: ColorContent;
7
+ onContentChange: (content?: ColorContent) => void;
8
+ }>;
9
+ export declare const ColorField: ({ id, field, content, onContentChange }: Props) => JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export { ColorField } from "./ColorField";
@@ -1,11 +1,11 @@
1
1
  import type { DateContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Date as DateT } from "@prismicio/types-internal/lib/customtypes";
3
3
  declare type Props = Readonly<{
4
- content?: DateContent;
5
- field: DateT;
6
4
  id: string;
7
- onContentChange: (content?: DateContent) => void;
8
5
  readOnly: boolean;
6
+ field: DateT;
7
+ content?: DateContent;
8
+ onContentChange: (content?: DateContent) => void;
9
9
  }>;
10
- export declare const DateField: ({ content, field, id, onContentChange, readOnly }: Props) => JSX.Element;
10
+ export declare const DateField: ({ id, readOnly, field, content, onContentChange }: Props) => JSX.Element;
11
11
  export {};
@@ -0,0 +1,11 @@
1
+ import type { EmbedContent } from "@prismicio/types-internal/lib/content";
2
+ import type { Embed as EmbedT } from "@prismicio/types-internal/lib/customtypes";
3
+ declare type Props = Readonly<{
4
+ id: string;
5
+ readOnly: boolean;
6
+ field: EmbedT;
7
+ content?: EmbedContent;
8
+ onContentChange: (content?: EmbedContent) => void;
9
+ }>;
10
+ export declare const EmbedField: ({ id, readOnly, field, content, onContentChange }: Props) => JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export { EmbedField } from "./EmbedField";
@@ -0,0 +1,11 @@
1
+ import type { TimestampContent } from "@prismicio/types-internal/lib/content";
2
+ import type { Timestamp } from "@prismicio/types-internal/lib/customtypes";
3
+ declare type Props = Readonly<{
4
+ id: string;
5
+ readOnly: boolean;
6
+ field: Timestamp;
7
+ content?: TimestampContent;
8
+ onContentChange: (content?: TimestampContent) => void;
9
+ }>;
10
+ export declare const TimestampField: ({ id, readOnly, field, content, onContentChange }: Props) => JSX.Element;
11
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { DocumentEditor } from "./DocumentEditor";
2
- export type { DocumentEditorConfig } from "./DocumentEditorConfig";
2
+ export type { EditorConfig } from "./EditorConfig";
3
+ export type { Selection } from "./Selection";
3
4
  export { SharedSliceEditor } from "./slices/SharedSliceEditor";