{"version":3,"file":"eui-components-eui-list.mjs","sources":["../../eui-list/eui-list.component.ts","../../eui-list/eui-list-item/eui-list-item.component.ts","../../eui-list/eui-list-item/eui-list-item.component.html","../../eui-list/index.ts","../../eui-list/eui-components-eui-list.ts"],"sourcesContent":["import {\n    Component,\n    HostBinding,\n    ChangeDetectionStrategy,\n    AfterContentInit,\n    ContentChildren,\n    forwardRef,\n    QueryList,\n    HostListener,\n} from '@angular/core';\nimport { FocusKeyManager } from '@angular/cdk/a11y';\n\nimport { EuiListItemComponent } from './eui-list-item/eui-list-item.component';\n\n/**\n * @description\n * Component that provides a navigable list implementation with keyboard interaction support.\n * Works with Angular CDK's FocusKeyManager to enable keyboard navigation between list items.\n *\n * The component automatically manages focus between nested lists and supports rich content\n * navigation. It can contain multiple EuiListItemComponents as children.\n *\n * @usageNotes\n * ### Basic Usage\n * ```html\n * <ul euiList>\n *   <li euiListItem>First item</li>\n *   <li euiListItem>Second item</li>\n *   <li euiListItem>Third item</li>\n * </ul>\n * ```\n *\n * ### With Nested Lists\n * ```html\n * <ul euiList>\n *   <li euiListItem>\n *     Parent item\n *     <ul euiList>\n *       <li euiListItem>Child item</li>\n *     </ul>\n *   </li>\n * </ul>\n * ```\n *\n * ### Accessibility\n * - Uses semantic `list` role\n * - Keyboard navigation with Arrow keys\n * - Enter key activates items\n * - Focus management for nested lists\n *\n * ### Notes\n * - Can be used as attribute `[euiList]` or element `<eui-list>`\n * - Supports nested list structures\n * - Automatically manages tabindex for keyboard navigation\n */\n@Component({\n    selector: '[euiList], eui-list',\n    template: '<ng-content/>',\n    styleUrl: './eui-list.scss',\n    changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class EuiListComponent implements AfterContentInit {\n    /**\n     * CSS class binding that applies the 'eui-list' class to the host element.\n     * This class applies the basic styling for the list component.\n     *\n     * @returns {string} The CSS class to be applied to the host element\n     */\n    @HostBinding('class')\n    get cssClasses(): string {\n        return 'eui-list';\n    }\n\n    /**\n     * Binds the 'list' ARIA role to the host element for accessibility.\n     * This informs screen readers that this component functions as a list.\n     */\n    @HostBinding('attr.role') role = 'list';\n    /**\n     * Binds the tabIndex attribute to the host element.\n     * Controls whether the list can receive keyboard focus.\n     * Set to '0' for top-level lists and '-1' for nested lists.\n     */\n    @HostBinding('attr.tabindex') tabIndex: string;\n    /**\n     * Collection of all list item components that are children of this list.\n     * Includes items from nested lists due to the 'descendants: true' option.\n     */\n    @ContentChildren(forwardRef(() => EuiListItemComponent), { descendants: true }) items: QueryList<EuiListItemComponent>;\n    private focusKeyManager: FocusKeyManager<EuiListItemComponent>;\n\n    /**\n     * Handles keyboard events for navigating the list.\n     * Supports Enter key for selection and arrow keys for navigation.\n     *\n     * @param {KeyboardEvent} event - The keyboard event to handle\n     */\n    @HostListener('keydown', ['$event'])\n    onKeydown(event: KeyboardEvent): void {\n        switch (event.key) {\n            case 'Enter': {\n                if (this.focusKeyManager?.activeItem) {\n                    this.focusKeyManager.activeItem.click();\n                }\n                break;\n            }\n            case 'ArrowRight': {\n               if(this.focusKeyManager.activeItem?.euiArrowKeyNavigableDirective){\n                    this.checkRichContentFocusState();\n               }\n               break;\n            }\n            case 'ArrowLeft': {\n               if(this.focusKeyManager.activeItem?.euiArrowKeyNavigableDirective){\n                    this.checkRichContentFocusState();\n               }\n               break;\n            }\n            default: {\n                this.focusKeyManager.onKeydown(event);\n                break;\n            }\n        }\n    }\n\n    /**\n     * Initializes the component after content (list items) has been initialized.\n     * Sets up the FocusKeyManager for keyboard navigation and configures tabindex\n     * attributes based on nested list structure.\n     */\n    ngAfterContentInit(): void {\n        // instantiates FocusKeyManager with the query list of items enabling wrapping\n        this.focusKeyManager = new FocusKeyManager(this.items).withWrap();\n\n        // checks whether an item contains a sub-menu and if so it sets it's ul element tabindex to -1\n        this.items.forEach((item) => {\n            if (item.euiListComponent.length > 0) {\n                item.euiListComponent.forEach((list) => (list.tabIndex = '-1'));\n            } else {\n                this.tabIndex = '0';\n            }\n        });\n    }\n\n    /**\n     * Manages focus state of rich content navigation within list items.\n     * Handles the focus transition between list item elements and their navigable content.\n     * Called when right/left arrow keys are pressed on items with navigable content.\n     */\n    checkRichContentFocusState(): void {\n        // eslint-disable-next-line\n        !this.focusKeyManager.activeItem.euiArrowKeyNavigableDirective.isFocused ?\n            this.focusKeyManager.activeItem.euiArrowKeyNavigableDirective.elementRef.nativeElement.focus() :\n            this.focusKeyManager.activeItem.focus();\n    }\n}\n","import {\n    Component,\n    HostBinding,\n    ContentChildren,\n    forwardRef,\n    QueryList,\n    Input,\n    ElementRef,\n    booleanAttribute,\n    ContentChild,\n    inject,\n} from '@angular/core';\nimport { Highlightable, FocusableOption } from '@angular/cdk/a11y';\n\nimport { BaseStatesDirective } from '@eui/components/shared';\nimport { EuiListComponent } from '../eui-list.component';\nimport { EuiIconSvgComponent } from '@eui/components/eui-icon';\nimport { EuiLabelComponent } from '@eui/components/eui-label';\nimport { EuiTemplateDirective, EuiArrowKeyNavigableDirective } from '@eui/components/directives';\n\n/**\n * @description\n * Component that represents a single item within an EuiList.\n * Implements FocusableOption and Highlightable for keyboard navigation and accessibility.\n *\n * This component is designed to work with the EuiListComponent as part of a navigable list.\n * It supports various display states through the BaseStatesDirective, and can contain\n * nested list components, icons, labels, and custom templates.\n *\n * @usageNotes\n * ### Basic Usage\n * ```html\n * <ul euiList>\n *   <li euiListItem>Simple list item</li>\n *   <li euiListItem [isActive]=\"true\">Active item</li>\n *   <li euiListItem euiPrimary>Primary styled item</li>\n * </ul>\n * ```\n *\n * ### With Icon and Label\n * ```html\n * <li euiListItem>\n *   <eui-icon icon=\"eui-home\"></eui-icon>\n *   <label euiLabel>Home</label>\n * </li>\n * ```\n *\n * ### Accessibility\n * - Uses semantic `listitem` role\n * - Keyboard focusable with proper tabindex management\n * - Active state is visually and programmatically indicated\n * - Supports arrow key navigation for rich content\n *\n * ### Notes\n * - Can be used as attribute `[euiListItem]` or element `<eui-list-item>`\n * - Supports variant styling via BaseStatesDirective\n * - Active state managed by parent list's FocusKeyManager\n */\n@Component({\n    templateUrl: './eui-list-item.component.html',\n    selector: '[euiListItem], eui-list-item',\n    styleUrl: './eui-list-item.scss',\n    hostDirectives: [\n        {\n            directive: BaseStatesDirective,\n            inputs: [\n                'euiPrimary',\n                'euiSecondary',\n                'euiSuccess',\n                'euiInfo',\n                'euiWarning',\n                'euiDanger',\n                'euiVariant',\n            ],\n        },\n    ],\n})\nexport class EuiListItemComponent implements FocusableOption, Highlightable {\n    @HostBinding('class')\n    get cssClasses(): string {\n        return [\n            this.baseStatesDirective.getCssClasses('eui-list-item'),\n            this.isActive ? 'eui-list-item--active' : '',\n        ].join(' ').trim();\n    }\n\n    @HostBinding('attr.role') role = 'listitem';\n    @HostBinding('attr.data-e2e') @Input() e2eAttr = 'eui-list-item';\n    @HostBinding('attr.tabindex') tabindex = '-1';\n\n    @ContentChildren(forwardRef(() => EuiListComponent), { descendants: true }) euiListComponent: QueryList<EuiListComponent>;\n    @ContentChildren(forwardRef(() => EuiIconSvgComponent), { descendants: true }) euiIconSvgComponent: QueryList<EuiIconSvgComponent>;\n    @ContentChildren(forwardRef(() => EuiLabelComponent), { descendants: true }) euiLabelComponent: QueryList<EuiLabelComponent>;\n    @ContentChildren(forwardRef(() => EuiTemplateDirective), { descendants: true }) templates: QueryList<EuiTemplateDirective>;\n    @ContentChild(forwardRef(() => EuiArrowKeyNavigableDirective)) euiArrowKeyNavigableDirective: EuiArrowKeyNavigableDirective;\n\n    @Input({ transform: booleanAttribute }) isActive = false;\n    baseStatesDirective = inject(BaseStatesDirective);\n    private elementRef = inject(ElementRef);\n\n    /**\n     * Sets focus on the list item element.\n     * Used by the FocusKeyManager to handle keyboard navigation within the list.\n     */\n    public focus(): void {\n        this.elementRef.nativeElement.focus();\n    }\n\n    /**\n     * Programmatically triggers a click event on the list item element.\n     * Typically, invoked when the user presses Enter while the item is focused.\n     */\n    // TODO: make it protected\n    public click(): void {\n        this.elementRef.nativeElement.click();\n    }\n\n    /**\n     * Applies active styling to the list item.\n     * Called by the FocusKeyManager when this item becomes the active item in the list.\n     * Sets the isActive flag to true, which adds the 'eui-list-item--active' CSS class.\n     */\n    public setActiveStyles(): void {\n        this.isActive = true;\n    }\n\n    /**\n     * Removes active styling from the list item.\n     * Called by the FocusKeyManager when another item becomes the active item.\n     * Sets the isActive flag to false, removing the 'eui-list-item--active' CSS class.\n     */\n    public setInactiveStyles(): void {\n        this.isActive = false;\n    }\n}\n","<div class=\"eui-list-item__container\" [class.eui-list-item--has-submenu]=\"euiListComponent.length > 0\">\n    <div class=\"eui-list-item__content\">\n        @if (euiIconSvgComponent.length > 0) {\n            <div class=\"eui-list-item__content-icon\">\n                <ng-content select=\"eui-icon-svg, span[euiIconSvg]\"></ng-content>\n            </div>\n        }\n        @if (euiLabelComponent.length > 0) {\n            <div class=\"eui-list-item__content-text\">\n                <ng-content select=\"[eui-label], [euiLabel]\"></ng-content>\n            </div>\n        }\n        <ng-content></ng-content>\n    </div>\n\n    @if ((euiListComponent.length > 0) || (euiListComponent.length > 0)) {\n        <div class=\"eui-list-item__sub-list\">\n            <ng-content select=\"[eui-list], [euiList]\"></ng-content>\n        </div>\n    }\n</div>\n","import { EuiListItemComponent } from './eui-list-item/eui-list-item.component';\nimport { EuiListComponent } from './eui-list.component';\n\nexport * from './eui-list.component';\nexport * from './eui-list-item/eui-list-item.component';\n\nexport const EUI_LIST = [\n    EuiListComponent,\n    EuiListItemComponent,\n] as const;","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;MAOU,gBAAgB,CAAA;AAN7B,IAAA,WAAA,GAAA;AAkBI;;;AAGG;QACuB,IAAA,CAAA,IAAI,GAAG,MAAM;AA8E1C,IAAA;AA7FG;;;;;AAKG;AACH,IAAA,IACI,UAAU,GAAA;AACV,QAAA,OAAO,UAAU;IACrB;AAoBA;;;;;AAKG;AAEH,IAAA,SAAS,CAAC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