UNPKG

@payfit/unity-components

Version:

36 lines (35 loc) 1.47 kB
import { RefObject } from 'react'; export type InlineFieldGroupMode = 'read' | 'edit'; export interface InlineFieldGroupContextValue { /** Current mode: read or edit */ mode: InlineFieldGroupMode; /** Switch to edit mode */ enterEditMode: () => void; /** Exit edit mode (cancel or save) */ exitEditMode: () => void; /** Unique ID for the field group (for aria attributes) */ groupId: string; /** ID for the header title (for aria-labelledby) */ headerId: string; /** ID for the edit view container (for aria-controls) */ editViewId: string; /** Whether the component is in a loading state */ isLoading?: boolean; /** Ref to the edit button for focus management */ editButtonRef?: RefObject<HTMLButtonElement>; /** Ref to the edit view container for focus management */ editViewRef?: RefObject<HTMLFieldSetElement>; /** Custom label for the edit button */ editLabel?: string; /** Custom label for the save button */ saveLabel?: string; /** Custom label for the cancel button */ cancelLabel?: string; /** Callback fired when edit button is clicked */ onEditPress?: () => void; /** Callback fired when save button is clicked */ onSavePress?: () => void; /** Callback fired when cancel button is clicked */ onCancelPress?: () => void; } export declare const InlineFieldGroupContext: import('react').Context<InlineFieldGroupContextValue | undefined>;