/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ /** * Page-level chrome for the full-page document editor: the parts that frame a * form rather than render it. The embedded creation view renders none of this. * * Each component takes only the props it needs — deliberately not a * `FormRendererProps` pass-through, so what a region actually depends on stays * visible at its call site. */ import type { ReactNode, RefObject } from 'react'; import type { SlugifierFn, StructuralMutationReceipt, WorkflowStatus } from '@byline/core'; import { type DocumentActionsLocaleOption } from './document-actions.js'; import { type UseScheduledPublicationReturn } from './scheduled-publication-control.js'; import type { PublishedVersionInfo } from './form-renderer.js'; import type { StatusTransitions } from './status-transitions.js'; export interface FormHeadingRowProps { heading: ReactNode; /** Host-supplied controls rendered beside the heading (locale switcher, …). */ headerSlot?: ReactNode; } export declare const FormHeadingRow: ({ heading, headerSlot }: FormHeadingRowProps) => ReactNode; export interface FormStatusBarProps { /** Mutations blocked or a discard in flight. */ disabled: boolean; initialData?: any; workflowStatuses?: WorkflowStatus[]; publishedVersion?: PublishedVersionInfo | null; scheduling: UseScheduledPublicationReturn; hasChanges: boolean; isUploading: boolean; isSubmitting: boolean; onCancel: () => void; /** Status transitions, already computed for the current workflow position. */ transitions: StatusTransitions; statusBusy: boolean; onStatusBusyChange: (busy: boolean) => void; onStatusChange?: (nextStatus: string) => Promise; onMutationError?: (error: unknown) => 'blocked' | 'committed' | null | void; /** Read synchronously at click time, not at render time. */ isBlocked: () => boolean; /** A guarded action was attempted while the form is dirty. */ onUnsavedChanges: () => void; onUnpublish?: () => Promise; onDelete?: () => Promise; onDuplicate?: () => Promise; onCopyToLocale?: (args: { targetLocale: string; overwrite: boolean; }) => Promise; onDeleteLocale?: (args: { targetLocale: string; }) => Promise; useAsTitle?: string; contentLocale: string; contentLocales?: ReadonlyArray; defaultLocale: string; } export declare const FormStatusBar: ({ disabled, initialData, workflowStatuses, publishedVersion, scheduling, hasChanges, isUploading, isSubmitting, onCancel, transitions, statusBusy, onStatusBusyChange, onStatusChange, onMutationError, isBlocked, onUnsavedChanges, onUnpublish, onDelete, onDuplicate, onCopyToLocale, onDeleteLocale, useAsTitle, contentLocale, contentLocales, defaultLocale, }: FormStatusBarProps) => ReactNode; export interface FormConcurrencyNoticesProps { /** Mutations blocked or a discard in flight. */ disabled: boolean; mutationIssue?: 'stale' | 'reload' | 'lock' | 'unavailable' | 'committed' | null; scheduledPublicationsNeedReconfirmation?: boolean; scheduledPublicationsHref?: string; /** * Focus target when a mutation issue appears. The ref belongs to the form * component, which restores focus after a save; this region only attaches it. */ warningRef: RefObject; discarding: boolean; reloadFailed: boolean; onDiscardRequested: () => void; scheduling: UseScheduledPublicationReturn; restoreWarnings?: string[]; } export declare const FormConcurrencyNotices: ({ disabled, mutationIssue, scheduledPublicationsNeedReconfirmation, scheduledPublicationsHref, warningRef, discarding, reloadFailed, onDiscardRequested, scheduling, restoreWarnings, }: FormConcurrencyNoticesProps) => ReactNode; export interface FormSidebarWidgetsProps { /** Mutations blocked or a discard in flight. */ disabled: boolean; mode: 'create' | 'edit'; initialData?: any; collectionPath?: string; defaultLocale: string; contentLocale: string; contentLocales?: ReadonlyArray; showPath: boolean; useAsPath?: string; lockPath?: boolean; pathSlugifier?: SlugifierFn; pathSourceLocked?: boolean; tree?: boolean; useAsTitle?: string; advertiseLocales?: boolean; observedRevision?: number; onMutationError?: (error: unknown) => 'blocked' | 'committed' | null | void; onTreeMutationCommitted?: (receipt: StructuralMutationReceipt) => void; } /** * The page-level widgets in the editor's sidebar: path, tree placement and * advertised locales. They are page concerns rather than schema fields, so they * reach `FormLayout` through its `sidebarSlot` and the embedded creation view * passes none of them. */ export declare const FormSidebarWidgets: ({ disabled, mode, initialData, collectionPath, defaultLocale, contentLocale, contentLocales, showPath, useAsPath, lockPath, pathSlugifier, pathSourceLocked, tree, useAsTitle, advertiseLocales, observedRevision, onMutationError, onTreeMutationCommitted, }: FormSidebarWidgetsProps) => ReactNode;