UNPKG

@studiocms/ui

Version:

The UI library for StudioCMS. Includes the layouts & components we use to build StudioCMS.

47 lines (46 loc) 2.26 kB
/** * Finds the owning accordion element for a given accordion item. Used for nested accordions. * @param accordionItem The accordion item element to find the owning accordion for. * @returns The owning accordion element or null if not found. */ declare const findOwningAccordion: (accordionItem: HTMLDivElement) => HTMLDivElement | null; /** * Gets the direct accordion items for a given accordion. Supports nested accordions. * @param accordion The accordion element to get direct items from. * @returns An array of direct accordion item elements that are direct children of the given accordion. */ declare const getDirectAccordionItems: (accordion: HTMLDivElement) => HTMLDivElement[]; /** * Updates the ARIA attributes for a given accordion item. * @param item The accordion item element to update ARIA attributes for. * @param isOpen Whether the accordion item is currently open or closed. */ declare const updateAccordionARIA: (item: HTMLDivElement, isOpen: boolean) => void; /** * Toggles the open state of a given accordion item. * @param accordionItem The accordion item element to toggle. * @param accordion The accordion element that contains the item. * @returns void */ declare const toggleAccordionItem: (accordionItem: HTMLDivElement, accordion: HTMLDivElement) => void; /** * Focuses the next or previous accordion item within a given accordion. * @param accordion The accordion element to focus an item within. * @param direction The direction to focus the item in (next or previous). * @param currentItem The currently focused accordion item. * @returns void */ declare const focusAccordionItem: (accordion: HTMLDivElement, direction: "next" | "prev", currentItem: HTMLDivElement) => void; /** * Initializes the ARIA states for all accordion items on page load. */ declare const initializeAccordionStates: () => void; declare let listenersAdded: boolean; /** * Toggles the open state of a given accordion item. * @param event The event that triggered the interaction (click or keydown). * @param isKeyboard Whether the interaction was triggered by a keyboard event. * @returns void */ declare const handleAccordionInteraction: (event: Event, isKeyboard?: boolean) => void; declare const loadAccordions: () => void;