@keystatic/core

Search for an npm package

@keystatic/core

module "@keystatic/core" {
export function config<Collections extends {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
}, Singletons extends {
[key: string]: Singleton<Record<string, ComponentSchema>>;
}>(config: Config<Collections, Singletons>): Config<Collections, Singletons>
export function collection<Schema extends Record<string, ComponentSchema>, SlugField extends {
[K in keyof Schema]: Schema[K] extends SlugFormField<any, any, any, any> ? K : never;
}[keyof Schema]>(collection: Collection<Schema, SlugField & string>): Collection<Schema, SlugField & string>
export function singleton<Schema extends Record<string, ComponentSchema>>(collection: Singleton<Schema>): Singleton<Schema>
export const BlockWrapper: (props: BlockWrapperProps) => import("react").Element = ...
Unexported symbols referenced here
type BlockWrapperProps = {
attributes?: import("slate-react").RenderElementProps["attributes"];
children: import("react").ReactNode;
draggable?: boolean;
}
Referenced by
  • BlockWrapper
export const NotEditable: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>> = ...
export const ToolbarSeparator: () => import("react").Element = ...
export type CloudConfig<Collections extends {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
} = {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
}, Singletons extends {
[key: string]: Singleton<Record<string, ComponentSchema>>;
} = {
[key: string]: Singleton<Record<string, ComponentSchema>>;
}> = {
storage: CloudStorageConfig;
cloud: {
project: string;
};
collections?: Collections;
singletons?: Singletons;
} & CommonConfig<Collections, Singletons>
Unexported symbols referenced here
type CloudStorageConfig = {
kind: "cloud";
} & CommonRemoteStorageConfig
Referenced by
type CommonConfig<Collections, Singletons> = {
locale?: Locale;
cloud?: {
project: string;
};
ui?: UserInterface<Collections, Singletons>;
}
Referenced by
type CommonRemoteStorageConfig = {
pathPrefix?: string;
branchPrefix?: string;
}
Referenced by
type Locale = keyof typeof locales
Referenced by
type UserInterface<Collections, Singletons> = {
brand?: {
mark?: BrandMark;
name: string;
};
navigation?: Navigation<(keyof Collections & string) | (keyof Singletons & string) | typeof NAVIGATION_DIVIDER_KEY>;
}
Referenced by
const locales: {
'ar-AE': string;
'bg-BG': string;
'cs-CZ': string;
'da-DK': string;
'de-DE': string;
'el-GR': string;
'en-US': string;
'es-ES': string;
'et-EE': string;
'fi-FI': string;
'fr-FR': string;
'he-IL': string;
'hr-HR': string;
'hu-HU': string;
'it-IT': string;
'ja-JP': string;
'ko-KR': string;
'lt-LT': string;
'lv-LV': string;
'nb-NO': string;
'nl-NL': string;
'pl-PL': string;
'pt-BR': string;
'pt-PT': string;
'ro-RO': string;
'ru-RU': string;
'sk-SK': string;
'sl-SI': string;
'sr-SP': string;
'sv-SE': string;
'tr-TR': string;
'uk-UA': string;
'zh-CN': string;
'zh-TW': string;
} = ...
Referenced by
type BrandMark = (props: {
colorScheme: Exclude<import("@keystar/ui").ColorScheme, "auto">;
}) => import("react").ReactElement
Referenced by
type Navigation<K> = K[] | {
[key: string]: K[];
}
Referenced by
const NAVIGATION_DIVIDER_KEY: "---" = ...
Referenced by
export type Collection<Schema extends Record<string, ComponentSchema>, SlugField extends string> = {
label: string;
path?: `${string}/${Glob}` | `${string}/${Glob}/${string}`;
entryLayout?: EntryLayout;
format?: Format;
previewUrl?: string;
slugField: SlugField;
schema: Schema;
}
Referenced by
export type Config<Collections extends {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
} = {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
}, Singletons extends {
[key: string]: Singleton<Record<string, ComponentSchema>>;
} = {
[key: string]: Singleton<Record<string, ComponentSchema>>;
}> = {
storage: LocalStorageConfig | GitHubStorageConfig | CloudStorageConfig;
collections?: Collections;
singletons?: Singletons;
} & ({} extends Collections ? {} : {
collections: Collections;
}) & ({} extends Singletons ? {} : {
singletons: Singletons;
}) & CommonConfig<Collections, Singletons>
Referenced by
Unexported symbols referenced here
type LocalStorageConfig = {
kind: "local";
}
Referenced by
type GitHubStorageConfig = {
kind: "github";
repo: RepoConfig;
} & CommonRemoteStorageConfig
Referenced by
type RepoConfig = `${string}/${string}` | {
owner: string;
name: string;
}
Referenced by
export type DataFormat = "json" | "yaml"
Referenced by
export type EntryLayout = "content" | "form"
Referenced by
export type Format = DataFormat | {
data?: DataFormat;
contentField?: string;
}
Referenced by
export type GitHubConfig<Collections extends {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
} = {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
}, Singletons extends {
[key: string]: Singleton<Record<string, ComponentSchema>>;
} = {
[key: string]: Singleton<Record<string, ComponentSchema>>;
}> = {
storage: GitHubStorageConfig;
collections?: Collections;
singletons?: Singletons;
} & CommonConfig<Collections, Singletons>
export type Glob = "*" | "**"
Referenced by
export type LocalConfig<Collections extends {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
} = {
[key: string]: Collection<Record<string, ComponentSchema>, string>;
}, Singletons extends {
[key: string]: Singleton<Record<string, ComponentSchema>>;
} = {
[key: string]: Singleton<Record<string, ComponentSchema>>;
}> = {
storage: LocalStorageConfig;
collections?: Collections;
singletons?: Singletons;
} & CommonConfig<Collections, Singletons>
export type Singleton<Schema extends Record<string, ComponentSchema>> = {
label: string;
path?: string;
entryLayout?: EntryLayout;
format?: Format;
previewUrl?: string;
schema: Schema;
}
Referenced by
export function component<Schema extends {
[Key in any]: ComponentSchema;
}>(options: {

The preview component shown in the editor

preview: (props: PreviewProps<ObjectField<Schema>> & {
onRemove(): void;
}) => import("react").ReactElement | null;

The schema for the props that the preview component, toolbar and rendered component will receive

schema: Schema;

The label to show in the insert menu and chrome around the block if chromeless is false

label: string;

An icon to show in the toolbar for this component block. Component blocks with toolbarIcon are shown in the toolbar directly instead of the insert menu

toolbarIcon?: import("react").ReactElement;
} & ({
chromeless: true;
toolbar?: null | ((props: {
onRemove(): void;
}) => import("react").ReactElement);
} | {
chromeless?: false;
toolbar?: (props: {
onShowEditMode(): void;
onRemove(): void;
}) => import("react").ReactElement;
})): ComponentBlock<Schema>
export type FormFieldInputProps<Value> = {
value: Value;
onChange(value: Value): void;
autoFocus: boolean;

This will be true when validate has returned false and the user has attempted to close the form or when the form is open and they attempt to save the item

forceValidation: boolean;
}
Referenced by
export type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
[key: string]: JsonValue;
}
Referenced by
export type FormFieldStoredValue = JsonValueWithoutNull | undefined
Referenced by
Unexported symbols referenced here
type JsonValueWithoutNull = JsonValue & {}
Referenced by
export type BasicFormField<ParsedValue extends {} | null, ValidatedValue extends ParsedValue = ParsedValue, ReaderValue = ValidatedValue> = {
kind: "form";
formKind?: undefined;
Input(props: FormFieldInputProps<ParsedValue>): import("react").ReactElement | null;
defaultValue(): ParsedValue;
parse(value: FormFieldStoredValue): ParsedValue;

If undefined is returned, the field will generally not be written, except in array fields where it will be stored as null

serialize(value: ParsedValue): { };
validate(value: ParsedValue): ValidatedValue;
reader: {
parse(value: FormFieldStoredValue): ReaderValue;
};
}
Referenced by
export type SlugFormField<ParsedValue extends {} | null, ValidatedValue extends ParsedValue, ReaderValue, ReaderValueAsSlugField> = {
kind: "form";
formKind: "slug";
Input(props: FormFieldInputProps<ParsedValue>): import("react").ReactElement | null;
defaultValue(): ParsedValue;
parse(value: FormFieldStoredValue, extra: {
slug: string;
} | undefined): ParsedValue;
serialize(value: ParsedValue): { };
serializeWithSlug(value: ParsedValue): {
slug: string;
};
validate(value: ParsedValue, extra: {
slugField: {
slugs: Set<string>;
glob: Glob;
};
} | undefined): ValidatedValue;
reader: {
parse(value: FormFieldStoredValue): ReaderValue;
parseWithSlug(value: FormFieldStoredValue, extra: {
slug: string;
glob: Glob;
}): ReaderValueAsSlugField;
};
}
Referenced by
export type AssetFormField<ParsedValue extends {} | null, ValidatedValue extends ParsedValue, ReaderValue> = {
kind: "form";
formKind: "asset";
Input(props: FormFieldInputProps<ParsedValue>): import("react").ReactElement | null;
directory?: string;
defaultValue(): ParsedValue;
filename(value: FormFieldStoredValue, extra: {
suggestedFilenamePrefix: string | undefined;
slug: string | undefined;
}): string | undefined;
parse(value: FormFieldStoredValue, extra: {
asset: Uint8Array | undefined;
slug: string | undefined;
}): ParsedValue;
serialize(value: ParsedValue, extra: {
suggestedFilenamePrefix: string | undefined;
slug: string | undefined;
}): {
asset: {
content: Uint8Array;
filename: string;
} | undefined;
};
validate(value: ParsedValue): ValidatedValue;
reader: {
parse(value: FormFieldStoredValue): ReaderValue;
};
}
Referenced by
export type ContentFormField<ParsedValue extends {} | null, ValidatedValue extends ParsedValue, ReaderValue> = {
kind: "form";
formKind: "content";
contentExtension: string;
directories?: string[];
Input(props: FormFieldInputProps<ParsedValue>): import("react").ReactElement | null;
defaultValue(): ParsedValue;
parse(value: FormFieldStoredValue, args: {
content: Uint8Array | undefined;
other: ReadonlyMap<string, Uint8Array>;
external: ReadonlyMap<string, ReadonlyMap<string, Uint8Array>>;
slug: string | undefined;
}): ParsedValue;
serialize(value: ParsedValue, extra: {
slug: string | undefined;
}): {
content: Uint8Array | undefined;
other: ReadonlyMap<string, Uint8Array>;
external: ReadonlyMap<string, ReadonlyMap<string, Uint8Array>>;
};
validate(value: ParsedValue): ValidatedValue;
reader: {
parse(value: FormFieldStoredValue, extra: {
content: Uint8Array | undefined;
}): ReaderValue;
};
}
Referenced by
export type FormField<ParsedValue extends {} | null, ValidatedValue extends ParsedValue, ReaderValue> = BasicFormField<ParsedValue, ValidatedValue, ReaderValue> | SlugFormField<ParsedValue, ValidatedValue, ReaderValue, any> | AssetFormField<ParsedValue, ValidatedValue, ReaderValue> | ContentFormField<ParsedValue, ValidatedValue, ReaderValue>
Referenced by
export type DocumentNode = DocumentElement | DocumentText
Referenced by
export type DocumentElement = {
children: DocumentNode[];
[key: string]: unknown;
}
Referenced by
export type DocumentText = {
text: string;
[key: string]: unknown;
}
Referenced by
export type ChildField = {
kind: "child";
options: ({
kind: "block";
formatting?: BlockFormattingConfig;
dividers?: "inherit";
links?: "inherit";
images?: "inherit";
tables?: "inherit";
componentBlocks?: "inherit";
} & BlockEditingOptions) | {
kind: "inline";
placeholder: string;
formatting?: {
inlineMarks?: InlineMarksConfig;
softBreaks?: "inherit";
};
links?: "inherit";
};
}
Referenced by
Unexported symbols referenced here
type BlockFormattingConfig = {
alignment?: "inherit";
blockTypes?: "inherit";
headingLevels?: "inherit" | (1 | 2 | 3 | 4 | 5 | 6)[];
inlineMarks?: InlineMarksConfig;
listTypes?: "inherit";
softBreaks?: "inherit";
componentBlocks?: "inherit";
}
Referenced by
type BlockEditingOptions = {
editIn?: "preview";
placeholder: string;
} | {
editIn: "modal";
label: string;
} | {
editIn: "both";
label: string;
placeholder: string;
}
Referenced by
type InlineMarksConfig = "inherit" | {
bold?: "inherit";
code?: "inherit";
italic?: "inherit";
strikethrough?: "inherit";
underline?: "inherit";
keyboard?: "inherit";
subscript?: "inherit";
superscript?: "inherit";
}
Referenced by
export type ArrayField<ElementField extends ComponentSchema> = {
kind: "array";
element: ElementField;
label: string;
description?: string;
itemLabel(props: unknown): string;
asChildTag?: string;
slugField?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
Input(props: unknown): import("react").ReactElement | null;
}
Referenced by
export type ObjectFieldOptions = {
label?: string;
description?: string;
}
Referenced by
export interface ObjectField<Fields extends Record<string, ComponentSchema> = Record<string, ComponentSchema>> extends ObjectFieldOptions {
kind: "object";
fields: Fields;
Input(props: unknown): import("react").ReactElement | null;
}
Referenced by
export type ConditionalField<DiscriminantField extends BasicFormField<string | boolean>, ConditionalValues extends {
[Key in `${ReturnType<DiscriminantField["defaultValue"]>}`]: ComponentSchema;
}> = {
kind: "conditional";
discriminant: DiscriminantField;
values: ConditionalValues;
Input(props: unknown): import("react").ReactElement | null;
}
Referenced by
export type ComponentSchema = ChildField | FormField<any, any, any> | ObjectField | ConditionalField<BasicFormField<any, any, any>, {
[key: string]: ComponentSchema;
}> | ArrayFieldInComponentSchema
Referenced by
Unexported symbols referenced here
type ArrayFieldInComponentSchema = {
kind: "array";
element: ComponentSchema;
label: string;
description?: string;
itemLabel(props: unknown): string;
asChildTag?: string;
slugField?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
Input(props: unknown): import("react").ReactElement | null;
}
Referenced by
export * as fields from {
export function array<ElementField extends ComponentSchema>(element: ElementField, opts?: {
label?: string;
description?: string;
itemLabel?: (props: GenericPreviewProps<ElementField, unknown>) => string;
asChildTag?: string;
slugField?: ElementField extends {
kind: "object";
} ? {
[K in keyof ElementField["fields"]]: ElementField["fields"][K] extends SlugFormField<any, any, any, any> ? K : never;
}[keyof ElementField["fields"]] : never;
validation?: {
length?: {
min?: number;
max?: number;
};
};
}): ArrayField<ElementField>
export function checkbox({ label, defaultValue, description, }: {
label: string;
defaultValue?: boolean;
description?: string;
}): BasicFormField<boolean>
export function child(options: ({
kind: "block";
formatting?: BlockFormattingConfig | "inherit";
dividers?: "inherit";
links?: "inherit";
images?: "inherit";
tables?: "inherit";
componentBlocks?: "inherit";
} & BlockEditingOptions) | {
kind: "inline";
placeholder: string;
formatting?: "inherit" | {
inlineMarks?: InlineMarksConfig;
softBreaks?: "inherit";
};
links?: "inherit";
}): ChildField
export function conditional<DiscriminantField extends BasicFormField<string> | BasicFormField<boolean>, ConditionalValues extends {
[Key in `${ReturnType<DiscriminantField["defaultValue"]>}`]: ComponentSchema;
}>(discriminant: DiscriminantField, values: ConditionalValues): ConditionalField<DiscriminantField, ConditionalValues>
export function date<IsRequired extends boolean | undefined>({ label, defaultValue, validation, description, }: {
label: string;
defaultValue?: string | {
kind: "today";
};
validation?: {
isRequired?: IsRequired;
min?: string;
max?: string;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<string | null, string | (IsRequired extends true ? never : null)>
Unexported symbols referenced here
type RequiredValidation<IsRequired extends boolean | undefined> = IsRequired extends true ? {
validation: {
isRequired: true;
};
} : unknown
Referenced by
export function datetime<IsRequired extends boolean | undefined>({ label, defaultValue, validation, description, }: {
label: string;
defaultValue?: string | {
kind: "now";
};
validation?: {
isRequired?: IsRequired;
min?: string;
max?: string;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<string | null, string | (IsRequired extends true ? never : null)>
export function document({ label, componentBlocks, description, ...documentFeaturesConfig }: {
label: string;
componentBlocks?: Record<string, ComponentBlock>;
description?: string;
} & DocumentFeaturesConfig): ContentFormField<DocumentElement[], DocumentElement[], DocumentElement[]>
Unexported symbols referenced here
type DocumentFeaturesConfig = {
formatting?: true | FormattingConfig;
links?: true;
dividers?: true;
images?: true | {
directory?: string;
publicPath?: string;
schema?: { };
};
layouts?: readonly (readonly [number, ...number[]])[];
tables?: true;
}
Referenced by
type FormattingConfig = {
inlineMarks?: true | {
bold?: true;
italic?: true;
underline?: true;
strikethrough?: true;
code?: true;
superscript?: true;
subscript?: true;
keyboard?: true;
};
listTypes?: true | {
ordered?: true;
unordered?: true;
};
alignment?: true | {
center?: true;
end?: true;
};
headingLevels?: HeadingLevels | {
levels: HeadingLevels;
schema?: Record<string, ComponentSchema>;
};
blockTypes?: true | {
blockquote?: true;
code?: true | {
schema?: Record<string, ComponentSchema>;
};
};
softBreaks?: true;
}
Referenced by
type BasicStringFormField = BasicFormField<string> | SlugFormField<string, string, string, null>
Referenced by
type HeadingLevels = true | readonly (1 | 2 | 3 | 4 | 5 | 6)[]
Referenced by
export function emptyDocument(): ContentFormField<null, null, null>
export function empty(): BasicFormField<null>
export function image<IsRequired extends boolean | undefined>({ label, directory, validation, description, publicPath, }: {
label: string;
directory?: string;
validation?: {
isRequired?: IsRequired;
};
description?: string;
publicPath?: string;
} & RequiredValidation<IsRequired>): AssetFormField<{
data: Uint8Array;
extension: string;
filename: string;
} | null, {
data: Uint8Array;
extension: string;
filename: string;
} | (IsRequired extends true ? never : null), string | (IsRequired extends true ? never : null)>
export function file<IsRequired extends boolean | undefined>({ label, directory, validation, description, publicPath, }: {
label: string;
directory?: string;
validation?: {
isRequired?: IsRequired;
};
description?: string;
publicPath?: string;
} & RequiredValidation<IsRequired>): AssetFormField<{
data: Uint8Array;
extension: string;
filename: string;
} | null, {
data: Uint8Array;
extension: string;
filename: string;
} | (IsRequired extends true ? never : null), string | (IsRequired extends true ? never : null)>
export function integer<IsRequired extends boolean | undefined>({ label, defaultValue, validation, description, }: {
label: string;
defaultValue?: number;
validation?: {
isRequired?: IsRequired;
min: number;
max: number;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<number | null, number | (IsRequired extends true ? never : null)>
export function multiselect<Option extends {
label: string;
value: string;
}>({ label, options, defaultValue, description, }: {
label: string;
options: readonly Option[];
defaultValue?: readonly Option["value"][];
description?: string;
}): BasicFormField<readonly Option["value"][]> & {
options: readonly Option[];
}
export function object<Fields extends Record<string, ComponentSchema>>(fields: Fields, opts?: ObjectFieldOptions): ObjectField<Fields>
export function pathReference<IsRequired extends boolean | undefined>({ label, pattern, validation, description, }: {
label: string;
pattern?: string;
validation?: {
isRequired?: IsRequired;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<string | null, string | (IsRequired extends true ? never : null)>
export function relationship<IsRequired extends boolean | undefined>({ label, collection, validation, description, }: {
label: string;
collection: string;
validation?: {
isRequired?: IsRequired;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<string | null, string | (IsRequired extends true ? never : null)>
export function select<Option extends {
label: string;
value: string;
}>({ label, options, defaultValue, description, }: {
label: string;
options: readonly Option[];
defaultValue: Option["value"];
description?: string;
}): BasicFormField<Option["value"]> & {
options: readonly Option[];
}
export function slug(args: {
name: {
label: string;
defaultValue?: string;
description?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
};
slug?: {
label?: string;
generate?: (name: string) => string;
description?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
};
}): SlugFormField<{
name: string;
slug: string;
}, {
name: string;
slug: string;
}, {
name: string;
slug: string;
}, string>
export function text({ label, defaultValue, validation: { length: { max, min } }, description, multiline, }: {
label: string;
defaultValue?: string | (() => string);
description?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
multiline?: boolean;
}): SlugFormField<string, string, string, null>
export function url<IsRequired extends boolean | undefined>({ label, defaultValue, validation, description, }: {
label: string;
defaultValue?: string;
validation?: {
isRequired?: IsRequired;
};
description?: string;
} & RequiredValidation<IsRequired>): BasicFormField<string | null, string | (IsRequired extends true ? never : null)>
export function blocks<Schemas extends Record<string, ComponentSchema>>(blocks: {
[K in keyof Schemas]: {
label: string;
itemLabel?: (props: GenericPreviewProps<Schemas[K], unknown>) => string;
schema: Schemas[K];
};
}, opts: {
label: string;
description?: string;
validation?: {
length?: {
min?: number;
max?: number;
};
};
}): ArrayField<ConditionalField<BasicFormField<keyof Schemas & string>, Schemas>>
export function cloudImage({ label, description, validation, }: {
label: string;
description?: string;
validation?: {
isRequired?: boolean;
};
}): ObjectField<typeof cloudImageSchema>
Unexported symbols referenced here
const cloudImageSchema: {
src: SlugFormField<string, string, string, null>;
alt: SlugFormField<string, string, string, null>;
height: BasicFormField<number | null, number | null>;
width: BasicFormField<number | null, number | null>;
} = ...
Referenced by
}
export type ComponentBlock<Fields extends Record<string, ComponentSchema> = Record<string, ComponentSchema>> = {
preview: (props: any) => import("react").ReactElement | null;
schema: Fields;
label: string;
toolbarIcon?: import("react").ReactElement;
} & ({
chromeless: true;
toolbar?: (props: {
props: Record<string, any>;
onRemove(): void;
}) => import("react").ReactElement;
} | {
chromeless?: false;
toolbar?: (props: {
props: Record<string, any>;
onShowEditMode(): void;
onRemove(): void;
isValid: boolean;
}) => import("react").ReactElement;
})
Referenced by
export type GenericPreviewProps<Schema extends ComponentSchema, ChildFieldElement> = Schema extends ChildField ? ChildFieldPreviewProps<Schema, ChildFieldElement> : Schema extends FormField<any, any, any> ? FormFieldPreviewProps<Schema> : Schema extends ObjectField<any> ? ObjectFieldPreviewProps<Schema, ChildFieldElement> : Schema extends ConditionalField<any, any> ? ConditionalFieldPreviewProps<Schema, ChildFieldElement> : Schema extends ArrayField<any> ? ArrayFieldPreviewProps<Schema, ChildFieldElement> : never
Referenced by
Unexported symbols referenced here
type ChildFieldPreviewProps<Schema extends ChildField, ChildFieldElement> = {
readonly element: ChildFieldElement;
readonly schema: Schema;
}
Referenced by
type FormFieldPreviewProps<Schema extends FormField<any, any, any>> = {
readonly value: ReturnType<Schema["defaultValue"]>;
onChange(value: ReturnType<Schema["defaultValue"]>): void;
readonly schema: Schema;
}
Referenced by
type ObjectFieldPreviewProps<Schema extends ObjectField<any>, ChildFieldElement> = {
readonly fields: {
readonly [Key in keyof Schema["fields"]]: GenericPreviewProps<Schema["fields"][Key], ChildFieldElement>;
};
onChange(value: {
readonly [Key in keyof Schema["fields"]]?: InitialOrUpdateValueFromComponentPropField<Schema["fields"][Key]>;
}): void;
readonly schema: Schema;
}
Referenced by
type ConditionalFieldPreviewProps<Schema extends ConditionalField<BasicFormField<string | boolean>, any>, ChildFieldElement> = {
readonly [Key in keyof Schema["values"]]: {
readonly discriminant: DiscriminantStringToDiscriminantValue<Schema["discriminant"], Key>;
onChange<Discriminant extends ReturnType<Schema["discriminant"]["defaultValue"]>>(discriminant: Discriminant, value?: InitialOrUpdateValueFromComponentPropField<Schema["values"][`${Discriminant}`]>): void;
readonly value: GenericPreviewProps<Schema["values"][Key], ChildFieldElement>;
readonly schema: Schema;
};
}[keyof Schema["values"]]
Referenced by
type ArrayFieldPreviewProps<Schema extends ArrayField<ComponentSchema>, ChildFieldElement> = {
readonly elements: readonly (GenericPreviewProps<Schema["element"], ChildFieldElement> & {
readonly key: string;
})[];
readonly onChange: (value: readonly {
key: string | undefined;
value?: InitialOrUpdateValueFromComponentPropField<Schema["element"]>;
}[]) => void;
readonly schema: Schema;
}
Referenced by
export type PreviewProps<Schema extends ComponentSchema> = GenericPreviewProps<Schema, import("react").ReactNode>
Referenced by
export type InitialOrUpdateValueFromComponentPropField<Schema extends ComponentSchema> = Schema extends ChildField ? undefined : Schema extends FormField<infer ParsedValue, any, any> ? ParsedValue | undefined : Schema extends ObjectField<infer Value> ? {
readonly [Key in keyof Value]?: InitialOrUpdateValueFromComponentPropField<Value[Key]>;
} : Schema extends ConditionalField<infer DiscriminantField, infer Values> ? {
readonly [Key in keyof Values]