UNPKG

@visa/nova-angular

Version:

Visa Product Design System Nova Angular library

78 lines (77 loc) 3.65 kB
/** * Copyright (c) 2025 Visa, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **/ import { UUIDService } from '../_utilities/services/uuid.service'; import { AccordionHeadingDirective } from '../accordion-heading/accordion-heading.directive'; import { AccordionPanelDirective } from '../accordion-panel/accordion-panel.directive'; import { ButtonDirective } from '../button/button.directive'; import { AccordionDirective } from './accordion.directive'; import * as i0 from "@angular/core"; /** * AccordionService is an internal service used to create accordion behavior and is used within the accordion component. */ export declare class AccordionService { private uuidService; constructor(uuidService: UUIDService); /** @ignore */ accordion: AccordionDirective; /** @ignore */ items: { heading: AccordionHeadingDirective; button: ButtonDirective; panel: AccordionPanelDirective; }[]; /** @ignore */ headings: AccordionHeadingDirective[]; /** @ignore */ panels: AccordionPanelDirective[]; /** * The setUpAccordion method sets up the accordion by pairing accordion headings with their respective panels and having them reflect the same expanded state. * @param accordion Accordion to set up. * @returns void */ setUpAccordion(accordion: AccordionDirective): void; /** * The setUpPanel method configures a panel with index, expanded state, and assigns an id if not provided. * @param index Index of panel to set up. * @param expanded Expanded state of panel's associated accordion item. */ setUpPanel(index: number, expanded: boolean): void; /** * The setUpButton method configures a button with id, aria-controls, aria-expanded attributes, and the appropriate toggle icon. * @param buttonHeading Button to set up. * @param index Index of button to set up. * @param expanded Expanded state of button's associated accordion item. */ setUpButton(buttonHeading: ButtonDirective, index: number, expanded: boolean): void; /** * The toggleItem method reverses the current state of the accordion. If collapsed, it expands; if expanded, it collapses. If it was collapsed, the function will expand. If it was expanded, the function will collapse. * @param index Index of accordion item to toggle. */ toggleItem(index: number): void; /** * The expandItem method expands the accordion by showing panel content, setting the button’s aria-expanded to true, and changing the toggle icon to expandedIcon. * @param index Index of accordion item to expand. */ expandItem(index: number): void; /** * The collapseItem method collapses the accordion by hiding panel content, setting the button’s aria-expanded to false, and changing the toggle icon to collapsedIcon. * @param index Index of accordion item to collapse. */ collapseItem(index: number): void; static ɵfac: i0.ɵɵFactoryDeclaration<AccordionService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<AccordionService>; }