@prismicio/editor-fields 0.4.48 → 0.4.49-alpha.feat-onboarding-guide.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.
- package/dist/Selection.d.ts +1 -1
- package/dist/core/MediaLibrary/hooks/tagData.d.ts +1 -1
- package/dist/core/OnboardingGuide/OnboardingGuide.d.ts +53 -0
- package/dist/core/OnboardingGuide/components/OnboardingCard.d.ts +6 -0
- package/dist/core/OnboardingGuide/components/OnboardingGuideUI.d.ts +10 -0
- package/dist/core/OnboardingGuide/components/OnboardingProgressStepper.d.ts +7 -0
- package/dist/core/OnboardingGuide/components/OnboardingProvider.d.ts +26 -0
- package/dist/core/OnboardingGuide/components/OnboardingStepDialog.d.ts +12 -0
- package/dist/core/OnboardingGuide/components/OnboardingTutorial.d.ts +8 -0
- package/dist/core/OnboardingGuide/content.d.ts +4 -0
- package/dist/core/OnboardingGuide/index.d.ts +2 -0
- package/dist/core/OnboardingGuide/types.d.ts +45 -0
- package/dist/fields/FieldTextInput.d.ts +1 -1
- package/dist/fields/ImageField/Components/ImageAltControl.d.ts +1 -2
- package/dist/fields/ImageField/Components/ImageFieldCard.d.ts +2 -2
- package/dist/fields/ImageField/Components/NonEmptyCardContent.d.ts +4 -5
- package/dist/fields/ImageField/ImageField.d.ts +1 -2
- package/dist/fields/ImageField/useImageField.d.ts +2 -3
- package/dist/fields/RichTextField/coreExtensions/Placeholder.d.ts +2 -2
- package/dist/fields/RichTextField/extensions/Image/ImageView.d.ts +6 -4
- package/dist/fields/RichTextField/globalExtensions/TextDirection.d.ts +1 -1
- package/dist/index.cjs.js +62 -30
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +17985 -16966
- package/package.json +21 -20
- package/dist/fields/ImageField/imageFieldUtils.d.ts +0 -30
package/dist/Selection.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Selection {
|
|
|
9
9
|
*/
|
|
10
10
|
update: (requestedFrom: SelectionArea, newId: string) => void;
|
|
11
11
|
}
|
|
12
|
-
export type SelectionArea = "sliceTable" | "sliceFieldSet";
|
|
12
|
+
export type SelectionArea = "all" | "sliceTable" | "sliceFieldSet";
|
|
13
13
|
export declare function getSelectionDOMId(area: SelectionArea, id?: string): string | undefined;
|
|
14
14
|
export declare const SelectionContext: import("react").Context<Selection>;
|
|
15
15
|
interface UseSelectionArgs {
|
|
@@ -9,7 +9,7 @@ export declare function useTagSearch(): {
|
|
|
9
9
|
uploader_id?: string | undefined;
|
|
10
10
|
}[];
|
|
11
11
|
};
|
|
12
|
-
export declare const minTagNameLength =
|
|
12
|
+
export declare const minTagNameLength = 1;
|
|
13
13
|
export declare const maxTagNameLength = 20;
|
|
14
14
|
export declare const tagNameSchema: z.ZodString;
|
|
15
15
|
export declare const tagSchema: z.ZodObject<{
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { OnboardingCardVariant, OnboardingFramework, OnboardingState, OnboardingStepId, OnboardingTrackFn } from "./types";
|
|
3
|
+
interface OnboardingGuideProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the whole guide (including 'Get started' button) should be visible
|
|
6
|
+
*
|
|
7
|
+
* Example usage: we hide it on small screens in SM
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
isOnboardingVisible?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A/B test onboarding card visibility experiment variant
|
|
13
|
+
* @default "default"
|
|
14
|
+
*/
|
|
15
|
+
variant?: OnboardingCardVariant;
|
|
16
|
+
/**
|
|
17
|
+
* The framework the user is using
|
|
18
|
+
*
|
|
19
|
+
* Used to display a link to the appropriate tutorial
|
|
20
|
+
* @default "other"
|
|
21
|
+
*/
|
|
22
|
+
framework?: OnboardingFramework;
|
|
23
|
+
/**
|
|
24
|
+
* Function to track onboarding events
|
|
25
|
+
*
|
|
26
|
+
* - onboarding:step-completed,
|
|
27
|
+
* - onboarding:step-opened,
|
|
28
|
+
* - onboarding:guide-completed
|
|
29
|
+
* */
|
|
30
|
+
track: OnboardingTrackFn;
|
|
31
|
+
/**
|
|
32
|
+
* Fetches the current onboarding state
|
|
33
|
+
*
|
|
34
|
+
* @returns {OnboardingState}
|
|
35
|
+
*/
|
|
36
|
+
fetchState: () => Promise<OnboardingState>;
|
|
37
|
+
/**
|
|
38
|
+
* Updates the onboarding steps progress state
|
|
39
|
+
*
|
|
40
|
+
* @param {OnboardingStepId[]} stepId
|
|
41
|
+
*/
|
|
42
|
+
toggleStep: (stepId: OnboardingStepId) => Promise<OnboardingStepId[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates the onboarding guide state to completed
|
|
45
|
+
*
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
resolveGuide: () => Promise<{
|
|
49
|
+
isResolved: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface OnboardingGuideUIProps {
|
|
3
|
+
isOnboardingVisible: boolean;
|
|
4
|
+
isFadedOut: boolean;
|
|
5
|
+
resolveGuide: () => Promise<{
|
|
6
|
+
isResolved: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export declare function OnboardingGuideUI(props: OnboardingGuideUIProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { OnboardingCardVariant } from "../types";
|
|
3
|
+
interface OnboardingProgressStepperProps {
|
|
4
|
+
variant: OnboardingCardVariant;
|
|
5
|
+
}
|
|
6
|
+
export declare function OnboardingProgressStepper(props: OnboardingProgressStepperProps): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type OnboardingCardVariant, type OnboardingFramework, type OnboardingState, type OnboardingStep, type OnboardingStepId, type OnboardingTrackFn } from "../types";
|
|
3
|
+
interface OnboardingProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
variant: OnboardingCardVariant;
|
|
6
|
+
framework: OnboardingFramework;
|
|
7
|
+
onComplete?: () => void;
|
|
8
|
+
track: OnboardingTrackFn;
|
|
9
|
+
fetchState: () => Promise<OnboardingState>;
|
|
10
|
+
toggleStep: (stepId: OnboardingStepId) => Promise<OnboardingStepId[]>;
|
|
11
|
+
}
|
|
12
|
+
export declare function OnboardingProvider(props: OnboardingProviderProps): JSX.Element;
|
|
13
|
+
interface OnboardingContext {
|
|
14
|
+
steps: OnboardingStep[];
|
|
15
|
+
completedStepsCount: number;
|
|
16
|
+
variant: OnboardingCardVariant;
|
|
17
|
+
tutorialLink?: string;
|
|
18
|
+
isResolved?: boolean;
|
|
19
|
+
toggleStepComplete: (step: OnboardingStep) => void;
|
|
20
|
+
getStepIndex: (step: OnboardingStepId) => number;
|
|
21
|
+
isStepComplete: (step: OnboardingStep) => boolean;
|
|
22
|
+
track: OnboardingTrackFn;
|
|
23
|
+
}
|
|
24
|
+
declare const OnboardingContext: import("react").Context<OnboardingContext | undefined>;
|
|
25
|
+
export declare const useOnboardingContext: () => OnboardingContext;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { OnboardingStep } from "../types";
|
|
3
|
+
interface OnboardingStepDialogProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
step: OnboardingStep;
|
|
6
|
+
stepIndex: number;
|
|
7
|
+
isStepComplete: boolean;
|
|
8
|
+
onActionClick: () => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function OnboardingStepDialog(props: OnboardingStepDialogProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { OnboardingCardVariant } from "../types";
|
|
3
|
+
interface OnboardingTutorialProps {
|
|
4
|
+
href: string;
|
|
5
|
+
variant?: OnboardingCardVariant;
|
|
6
|
+
}
|
|
7
|
+
export declare function OnboardingTutorial(props: OnboardingTutorialProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
declare const onboardingStepStatusesSchema: z.ZodObject<{
|
|
4
|
+
createProject: z.ZodBoolean;
|
|
5
|
+
createPageType: z.ZodBoolean;
|
|
6
|
+
codePage: z.ZodBoolean;
|
|
7
|
+
createSlice: z.ZodBoolean;
|
|
8
|
+
reviewAndPush: z.ZodBoolean;
|
|
9
|
+
createContent: z.ZodBoolean;
|
|
10
|
+
renderPage: z.ZodBoolean;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
createProject: boolean;
|
|
13
|
+
createPageType: boolean;
|
|
14
|
+
codePage: boolean;
|
|
15
|
+
createSlice: boolean;
|
|
16
|
+
reviewAndPush: boolean;
|
|
17
|
+
createContent: boolean;
|
|
18
|
+
renderPage: boolean;
|
|
19
|
+
}, {
|
|
20
|
+
createProject: boolean;
|
|
21
|
+
createPageType: boolean;
|
|
22
|
+
codePage: boolean;
|
|
23
|
+
createSlice: boolean;
|
|
24
|
+
reviewAndPush: boolean;
|
|
25
|
+
createContent: boolean;
|
|
26
|
+
renderPage: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
|
|
29
|
+
export type OnboardingStepId = keyof OnboardingStepStatuses;
|
|
30
|
+
export interface OnboardingStep {
|
|
31
|
+
id: OnboardingStepId;
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
content?: JSX.Element;
|
|
35
|
+
videoUrl?: string;
|
|
36
|
+
defaultCompleted?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type OnboardingState = {
|
|
39
|
+
completedSteps: OnboardingStepId[];
|
|
40
|
+
isResolved: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type OnboardingCardVariant = "default" | "light" | "dark";
|
|
43
|
+
export type OnboardingFramework = "next" | "nuxt" | "sveltekit" | "other";
|
|
44
|
+
export type OnboardingTrackFn = (args: Record<string, string>) => void;
|
|
45
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type TextInputProps } from "@prismicio/editor-ui";
|
|
3
|
-
export declare const FieldTextInput: import("react").
|
|
3
|
+
export declare const FieldTextInput: (props: TextInputProps & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
4
4
|
export declare const fieldInputPadding: {
|
|
5
5
|
readonly input: {
|
|
6
6
|
readonly inline: 4;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface ImageAltControlProps {
|
|
3
|
-
id?: string;
|
|
4
3
|
readOnly?: boolean;
|
|
5
4
|
altText: string;
|
|
6
|
-
onValueChange: (value: string) => void;
|
|
7
5
|
selected?: boolean;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare function ImageAltControl(props: ImageAltControlProps): JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -3,9 +3,9 @@ import type { MediaAssetOrExternalImage } from "../../../core/MediaLibrary/hooks
|
|
|
3
3
|
interface ImageFieldCardProps {
|
|
4
4
|
isMediaDialogOpen: boolean;
|
|
5
5
|
selected?: boolean;
|
|
6
|
+
children: ReactNode;
|
|
6
7
|
onMediaDialogOpenChange: (open: boolean) => void;
|
|
7
8
|
onMediaSelected: (media: MediaAssetOrExternalImage) => void;
|
|
8
|
-
children: ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare
|
|
10
|
+
export declare const ImageFieldCard: (props: ImageFieldCardProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
11
11
|
export {};
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
import { type ImageContent, type ImageContentView } from "@prismicio/types-internal/lib/content";
|
|
3
3
|
import { type CropperImage, type ImageBlockData } from "../../../core/imageUtils";
|
|
4
4
|
import { type CroppedImages } from "../CropperDialog";
|
|
5
|
-
interface NonEmptyCardContentProps<
|
|
5
|
+
interface NonEmptyCardContentProps<Content extends ImageContent | ImageBlockData> {
|
|
6
6
|
allContentViews: readonly (ImageContentView | undefined)[];
|
|
7
|
-
content:
|
|
7
|
+
content: Content;
|
|
8
8
|
contentView: ImageContentView | undefined;
|
|
9
9
|
fieldLabel: string;
|
|
10
|
-
id: string;
|
|
11
10
|
imageLabel: string[];
|
|
12
11
|
initialImages: CropperImage[];
|
|
13
12
|
isUpdating: boolean;
|
|
@@ -15,7 +14,7 @@ interface NonEmptyCardContentProps<ContentType extends ImageContent | ImageBlock
|
|
|
15
14
|
readOnly: boolean;
|
|
16
15
|
thumbnailName: string;
|
|
17
16
|
onClear: () => void;
|
|
18
|
-
onContentChange: (content:
|
|
17
|
+
onContentChange: (content: Content | undefined) => void;
|
|
19
18
|
onCropperDialogClose: (result: {
|
|
20
19
|
croppedImages: CroppedImages;
|
|
21
20
|
option: number;
|
|
@@ -23,5 +22,5 @@ interface NonEmptyCardContentProps<ContentType extends ImageContent | ImageBlock
|
|
|
23
22
|
onPageChange?: (page: number) => void;
|
|
24
23
|
onMediaDialogOpenChange: (open: boolean) => void;
|
|
25
24
|
}
|
|
26
|
-
export declare function NonEmptyCardContent<
|
|
25
|
+
export declare function NonEmptyCardContent<Content extends ImageContent | ImageBlockData>(props: NonEmptyCardContentProps<Content>): JSX.Element;
|
|
27
26
|
export {};
|
|
@@ -4,8 +4,7 @@ import type { Image } from "@prismicio/types-internal/lib/customtypes";
|
|
|
4
4
|
export interface ImageFieldProps {
|
|
5
5
|
content: ImageContent | undefined;
|
|
6
6
|
field: Image;
|
|
7
|
-
id: string;
|
|
8
|
-
onContentChange: (content: ImageContent | undefined) => void;
|
|
9
7
|
readOnly: boolean;
|
|
8
|
+
onContentChange: (content: ImageContent | undefined) => void;
|
|
10
9
|
}
|
|
11
10
|
export declare function ImageField(props: ImageFieldProps): JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ImageContent } from "@prismicio/types-internal/lib/content";
|
|
2
2
|
import type { Image } from "@prismicio/types-internal/lib/customtypes";
|
|
3
|
-
import { type Thumbnail } from "../../core/imageUtils";
|
|
4
3
|
import type { MediaAssetOrExternalImage } from "../../core/MediaLibrary/hooks/mediaLibraryData";
|
|
5
4
|
import type { CroppedImages } from "./CropperDialog";
|
|
6
5
|
interface useImageFieldProps {
|
|
@@ -17,8 +16,8 @@ export declare function useImageField(props: useImageFieldProps): {
|
|
|
17
16
|
onMediaSelected: (media: MediaAssetOrExternalImage) => void;
|
|
18
17
|
isUpdating: boolean;
|
|
19
18
|
page: number;
|
|
20
|
-
thumbnail: Thumbnail | undefined;
|
|
21
|
-
allThumbnails: readonly Thumbnail[];
|
|
19
|
+
thumbnail: import("../../core/imageUtils").Thumbnail | undefined;
|
|
20
|
+
allThumbnails: readonly import("../../core/imageUtils").Thumbnail[];
|
|
22
21
|
allContentViews: readonly [{
|
|
23
22
|
origin: {
|
|
24
23
|
id: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ExtensionPlaceholder, type NodeExtension } from "../models";
|
|
2
|
-
interface
|
|
2
|
+
interface PlaceholderArgs {
|
|
3
3
|
placeholderByNodeType: Record<string, ExtensionPlaceholder>;
|
|
4
4
|
unfocusedPlaceholder: string | undefined;
|
|
5
5
|
nodeExtensions: readonly NodeExtension[];
|
|
6
6
|
}
|
|
7
|
-
declare const _default: (
|
|
7
|
+
declare const _default: (args: PlaceholderArgs) => import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any>;
|
|
8
8
|
export default _default;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
3
3
|
import { type NodeViewProps } from "@tiptap/react";
|
|
4
4
|
import { type ImageBlockData } from "../../../../core/imageUtils";
|
|
5
|
+
export interface ImageViewProps extends NodeViewProps {
|
|
6
|
+
node: ImageNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function ImageView(props: ImageViewProps): JSX.Element;
|
|
5
9
|
interface ImageNode extends ProseMirrorNode {
|
|
6
10
|
attrs: {
|
|
7
11
|
content: ImageBlockData | undefined;
|
|
8
12
|
};
|
|
9
13
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export declare function ImageView(props: ImageViewProps): JSX.Element;
|
|
14
|
+
export declare const nodeWrapperClassName = "imageViewNodeWrapper";
|
|
15
|
+
export declare function imageViewHeight(isEmpty: boolean): number;
|
|
14
16
|
export {};
|
|
@@ -5,7 +5,7 @@ export type Direction = "ltr" | "rtl";
|
|
|
5
5
|
export declare const leftToRight: Direction;
|
|
6
6
|
export declare const rightToLeft: Direction;
|
|
7
7
|
interface TextDirectionOptions {
|
|
8
|
-
supportedExtensionNames:
|
|
8
|
+
supportedExtensionNames: string[];
|
|
9
9
|
}
|
|
10
10
|
export declare const attrName = "dir";
|
|
11
11
|
declare module "@tiptap/core" {
|