platform-bible-react
    Preparing search index...

    Type Alias BookChapterControlProps

    type BookChapterControlProps = {
        align?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>["align"];
        className?: string;
        disableReferencesUpTo?: SerializedVerseRef;
        getActiveBookIds?: () => string[];
        getEndVerse?: (bookId: string, chapterNum: number) => number;
        handleSubmit: (scrRef: SerializedVerseRef) => void;
        id?: string;
        localizedBookNames?: Map<
            string,
            { localizedId: string; localizedName: string },
        >;
        localizedStrings?: LanguageStrings;
        modal?: boolean;
        onAddRecentSearch?: (scrRef: SerializedVerseRef) => void;
        onCloseAutoFocus?: ComponentPropsWithoutRef<
            typeof PopoverPrimitive.Content,
        >["onCloseAutoFocus"];
        onOpenChange?: (open: boolean) => void;
        recentSearches?: SerializedVerseRef[];
        scrRef: SerializedVerseRef;
        submitKeys?: readonly string[];
        triggerContent?: ReactNode;
        triggerVariant?: ButtonProps["variant"];
    }
    Index

    Properties

    align?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>["align"]

    Optional alignment for the popover relative to its trigger along the cross-axis. Forwarded to the underlying Radix Popover.Content. Defaults to "center". Use "start" when the control sits on the right edge of a constrained container (e.g. the second picker in a range dialog) to keep the popover anchored to the trigger's leading edge rather than spilling off-screen.

    className?: string

    Optional additional class name for styling

    disableReferencesUpTo?: SerializedVerseRef

    Optional lower bound. When provided, any reference that comes strictly before this one in canon order is disabled in the UI (books, chapters, and verses). Used to prevent selecting an "end" reference that precedes a "start" reference (e.g., in a range picker).

    getActiveBookIds?: () => string[]

    Callback to retrieve book IDs that are available in the current context

    getEndVerse?: (bookId: string, chapterNum: number) => number

    Optional callback returning the number of verses for a given book and chapter. When provided, the control enables verse selection: clicking a chapter transitions to a verse selection sub-screen, and typing a reference with a chapter:verse separator shows a verse grid. When omitted, the control selects verseNum: 1 after a chapter is chosen (current behavior).

    handleSubmit: (scrRef: SerializedVerseRef) => void

    Callback to handle the submission of a selected reference

    id?: string

    Optional ID for the popover content for accessibility

    localizedBookNames?: Map<string, { localizedId: string; localizedName: string }>

    Optional map of localized book IDs/short names and full names. The key is the standard book ID (e.g., "2CH"), the value contains a localized version of the ID and related book name (e.g. { localizedId: '2CR', localizedName: '2 Crónicas' })

    localizedStrings?: LanguageStrings

    Optional localized strings for the component

    modal?: boolean

    Optional flag forwarded to the underlying Radix Popover.Root. Defaults to false. Set to true when the control is opened from inside another focus-trapping primitive (a Radix Dialog or DropdownMenu) — the transient focus blip that happens when the picker transitions between book/chapter/verse views would otherwise collide with the outer scope's focus trap and dismiss the popover. Modal mode gives the popover its own FocusScope that pauses the outer scope while it's open, avoiding the collision.

    onAddRecentSearch?: (scrRef: SerializedVerseRef) => void

    Callback to add a new recent scripture reference

    onCloseAutoFocus?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>["onCloseAutoFocus"]

    Optional handler forwarded to the underlying Radix Popover.Content. Fires as the popover closes and decides where focus should land next — by default Radix returns focus to the trigger button. Call event.preventDefault() and focus a different element when the trigger isn't the right landing spot (e.g. the picker is nested inside a DropdownMenuItem and focus should return to the menu item so arrow-key navigation continues to work).

    onOpenChange?: (open: boolean) => void

    Optional callback fired whenever the control's popover open state changes. Useful when the parent needs to react to the picker opening or closing — e.g. dimming a sibling control while this one is active. Internal back-navigation within the popover (verses → chapters → books) does not toggle this: only true open/close transitions do.

    recentSearches?: SerializedVerseRef[]

    Array of recent scripture references for quick access

    scrRef: SerializedVerseRef

    The current scripture reference

    submitKeys?: readonly string[]

    Optional list of extra keys that submit the currently-matched reference from the search input (in addition to Enter, which always submits). When one of these keys is pressed while the typed input resolves to a valid top-match reference, that match is submitted and the key is consumed (not inserted into the input). Intended for flows where a "separator" keystroke implies completion — e.g. a range picker that uses space or - to confirm the start of a range and advance to the end.

    triggerContent?: ReactNode

    Optional override for the contents of the trigger button. When provided, this replaces the default current-reference label ("MAT 5:3") rendered inside the button — useful when the current reference is already shown elsewhere and the trigger only needs an icon (e.g. an inline "change reference" affordance). The Button itself is still the PopoverTrigger; only its inner content is swapped.

    triggerVariant?: ButtonProps["variant"]

    Optional Button variant applied to the trigger. Defaults to "outline" (the standard inline picker look); pass "ghost" when the control is embedded in a menu / list where a bordered button would feel out of place.