UNPKG

@payfit/unity-components

Version:

22 lines (21 loc) 914 B
import { RefObject } from 'react'; export type InlineFieldMode = 'read' | 'edit'; export interface InlineFieldContextValue { /** Current mode: read or edit */ mode: InlineFieldMode; /** Switch to edit mode */ enterEditMode: () => void; /** Exit edit mode (cancel or save) */ exitEditMode: () => void; /** Unique ID for the field (for aria attributes) */ fieldId: string; /** Whether the field is currently loading (saving) */ isLoading?: boolean; /** Ref to the edit view container for focus management */ editViewRef: RefObject<HTMLDivElement>; /** The ID for the edit view container (for aria-controls) */ editViewId: string; triggerRef: RefObject<HTMLButtonElement>; } export declare const InlineFieldContext: import('react').Context<InlineFieldContextValue | undefined>; export declare function useInlineField(): InlineFieldContextValue | undefined;