{"version":3,"file":"eui-components-eui-block-content.mjs","sources":["../../eui-block-content/eui-block-content.component.ts","../../eui-block-content/index.ts","../../eui-block-content/eui-components-eui-block-content.ts"],"sourcesContent":["import {\n    Component,\n    ElementRef,\n    Renderer2,\n    ChangeDetectionStrategy,\n    booleanAttribute,\n    inject,\n    input,\n    effect,\n    computed,\n} from '@angular/core';\n\n/**\n * @description\n * Component that wraps content and manages focus state when content is blocked.\n * Provides accessibility attributes and handles focus restoration when blocking/unblocking.\n *\n * @usageNotes\n * #### Basic blocked content\n * ```html\n * <eui-block-content [isBlocked]=\"isLoading\">\n *   <form>\n *     <input type=\"text\" />\n *     <button>Submit</button>\n *   </form>\n * </eui-block-content>\n * ```\n *\n * #### With custom ARIA attributes\n * ```html\n * <eui-block-content\n *   role=\"region\"\n *   ariaLabel=\"User profile section\"\n *   [isBlocked]=\"isSaving\">\n *   <div>Content that can be blocked</div>\n * </eui-block-content>\n * ```\n *\n * ```ts\n * isLoading = true;\n *\n * loadData(): void {\n *   this.isLoading = true;\n *   this.service.getData().subscribe(() => {\n *     this.isLoading = false;\n *   });\n * }\n * ```\n *\n * ### Accessibility\n * - Automatically blurs focused elements when content is blocked\n * - Restores focus to previously focused element when unblocked\n * - Uses ARIA role and label for screen reader context\n * - Prevents keyboard interaction with blocked content\n * - Focus management ensures users don't interact with disabled content\n *\n * ### Notes\n * - Use isBlocked to control blocking state (typically tied to loading/saving states)\n * - Default role is 'region', can be customized via role input\n * - Default ariaLabel is 'block content wrapper', should be customized for context\n * - Focus is automatically saved and restored during block/unblock transitions\n * - Blocked state applies visual styling (typically overlay or disabled appearance)\n * - Commonly used with loading indicators or during async operations\n * - Does not prevent programmatic changes, only user interaction\n */\n@Component({\n    selector: 'eui-block-content',\n    template: '<ng-content/>',\n    styleUrls: ['./eui-block-content.scss'],\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    host: {\n        '[class]': 'cssClasses()',\n        '[attr.role]': 'role()',\n        '[attr.aria-label]': 'ariaLabel()',\n    },\n})\nexport class EuiBlockContentComponent {\n    /**\n     * ARIA role for the content wrapper\n     * @default 'region'\n     */\n    role = input<string>('region');\n\n    /**\n     * ARIA label for the content wrapper\n     * @default 'block content wrapper'\n     */\n    ariaLabel = input<string>('block content wrapper');\n\n    /**\n     * Whether the content is currently blocked\n     * When true, focused elements within will be blurred and state saved\n     * @default false\n     */\n    isBlocked = input(false, { transform: booleanAttribute });\n\n    cssClasses = computed(() => [\n        'eui-block-content',\n        this.isBlocked() ? 'eui-block-content--blocked' : '',\n    ].join(' ').trim());\n\n    private lastActiveElement: HTMLElement | null = null;\n    private elRef = inject(ElementRef);\n    private renderer = inject(Renderer2);\n    private previousBlocked = false;\n\n    constructor() {\n        effect(() => {\n            const blocked = this.isBlocked();\n            const activeElement = this.getActiveElement();\n\n            if (blocked && !this.previousBlocked) {\n                this.deactivateElement(activeElement);\n            } else if (!blocked && this.previousBlocked) {\n                this.reactivateElement(this.lastActiveElement);\n            }\n\n            this.previousBlocked = blocked;\n        });\n    }\n\n    /**\n     * Removes focus from the currently focused element when blocking\n     * Stores the element reference for later restoration\n     *\n     * @param activeElement - The currently focused element\n     */\n    private deactivateElement(activeElement: HTMLElement | null): void {\n        if (activeElement) {\n            this.renderer.selectRootElement(activeElement, true).blur();\n            this.lastActiveElement = activeElement;\n        } else {\n            this.lastActiveElement = null;\n        }\n    }\n\n    /**\n     * Restores focus to the previously focused element when unblocking\n     *\n     * @param element - The element that was previously focused\n     */\n    private reactivateElement(element: HTMLElement | null): void {\n        if (element) {\n            this.renderer.selectRootElement(element, true).focus();\n        }\n    }\n\n    /**\n     * Finds the currently focused element within the block content\n     *\n     * @returns The currently focused HTMLElement or null if none found\n     */\n    private getActiveElement(): HTMLElement | null {\n        return this.elRef.nativeElement.querySelector(':focus');\n    }\n}\n","import { EuiBlockContentComponent } from './eui-block-content.component';\n\nexport * from './eui-block-content.component';\n\nexport const EUI_BLOCK_CONTENT = [\n    EuiBlockContentComponent,\n] as const;\n\n// export { EuiBlockContentComponent as EuiBlockContent } from './eui-block-content.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDG;MAYU,wBAAwB,CAAA;AA8BjC,IAAA,WAAA,GAAA;AA7BA;;;AAGG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,QAAQ,2EAAC;AAE9B;;;AAGG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAS,uBAAuB,gFAAC;AAElD;;;;AAIG;QACH,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAEzD,QAAA,IAAA,CAAA,UAAU,GAAG,QAAQ,CAAC,MAAM;YACxB,mBAAmB;YACnB,IAAI,CAAC,SAAS,EAAE,GAAG,4BAA4B,GAAG,EAAE;SACvD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,iFAAC;QAEX,IAAA,CAAA,iBAAiB,GAAuB,IAAI;AAC5C,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAC1B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;QAC5B,IAAA,CAAA,eAAe,GAAG,KAAK;QAG3B,MAAM,CAAC,MAAK;AACR,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE;AAChC,YAAA,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE;AAE7C,YAAA,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;AAClC,gBAAA,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC;YACzC;AAAO,iBAAA,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,EAAE;AACzC,gBAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CA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