import * as i0 from '@angular/core';
import { input, booleanAttribute, output, inject, ElementRef, Injector, runInInjectionContext, effect, ChangeDetectionStrategy, Component } from '@angular/core';
import '@ui5/webcomponents/dist/SplitButton.js';

class SplitButton {
    constructor() {
        /**
         * Defines the icon to be displayed as graphical element within the component.
      The SAP-icons font provides numerous options.
      
      Example:
      
      See all available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
        /**
         * Defines whether the arrow button should have the active state styles or not.
         */
        this.activeArrowButton = input(false, ...(ngDevMode ? [{ debugName: "activeArrowButton", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the component design.
         */
        this.design = input("Default", ...(ngDevMode ? [{ debugName: "design" }] : []));
        /**
         * Defines whether the component is disabled.
      A disabled component can't be pressed or
      focused, and it is not in the tab chain.
         */
        this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the accessible ARIA name of the component.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Defines the additional accessibility attributes that will be applied to the component.
      The `accessibilityAttributes` property accepts an object with the following optional fields:
      
      - **root**: Attributes that will be applied to the main (text) button.
        - **hasPopup**: Indicates the presence and type of popup triggered by the button.
          Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
        - **roleDescription**: Provides a human-readable description for the role of the button.
          Accepts any string value.
        - **title**: Specifies a tooltip or description for screen readers.
          Accepts any string value.
          - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or give focus to the button.
      
      - **arrowButton**: Attributes applied specifically to the arrow (split) button.
        - **hasPopup**: Indicates the presence and type of popup triggered by the arrow button.
          Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
        - **expanded**: Indicates whether the popup triggered by the arrow button is currently expanded.
          Accepts boolean values: `true` or `false`.
         */
        this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : [])); // className is now passed
        /**
         * Fired when the user clicks on the default action.
         */
        this.ui5Click = output();
        /**
         * Fired when the user clicks on the arrow action.
         */
        this.ui5ArrowClick = output();
        /**
         * Available slots for content projection in this component.
         *
         * Slots allow you to insert custom content into predefined areas of the web component.
         * Use the `slot` attribute on child elements to target specific slots.
         *
         * - **(default)**: Defines the text of the component.
      
      **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
         *
         * @example
         * ```html
         * <ui5-split-button>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-split-button>
         * ```
         *
         * @readonly
         * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
         */
        this.slots = [
            {
                "name": "default",
                "description": "Defines the text of the component.\n\n**Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design."
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'icon',
            'activeArrowButton',
            'design',
            'disabled',
            'accessibleName',
            'accessibilityAttributes',
        ];
        // Synchronize inputs (properties)
        for (const inputName of inputsToSync) {
            // Find the corresponding camelCase signal property on the Angular component
            const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
            // Use the Injector to run the effect in the correct context
            if (this[signalName] && typeof this[signalName] === 'function') {
                runInInjectionContext(this.injector, () => {
                    effect(() => {
                        // Read the signal value
                        const value = this[signalName]();
                        if (wcElement) {
                            // Write the value to the Web Component's property
                            wcElement[inputName] = value;
                        }
                    });
                });
            }
        }
        const outputsToSync = [
            'ui5Click',
            'ui5ArrowClick',
        ];
        // Synchronize outputs (events)
        for (const outputName of outputsToSync) {
            // Map Angular output name to UI5 web component event name
            const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
            // Ensure the output property exists and has an emit function before adding listener
            if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
                // Cast the listener to the correct type to satisfy TypeScript
                wcElement.addEventListener(eventName, (e) => {
                    this[outputName].emit(e);
                });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SplitButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: SplitButton, isStandalone: true, selector: "ui5-split-button, [ui5-split-button]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, activeArrowButton: { classPropertyName: "activeArrowButton", publicName: "activeArrowButton", isSignal: true, isRequired: false, transformFunction: null }, design: { classPropertyName: "design", publicName: "design", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", isSignal: true, isRequired: false, transformFunction: null }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click", ui5ArrowClick: "ui5ArrowClick" }, exportAs: ["ui5SplitButton"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SplitButton, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-split-button, [ui5-split-button]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5SplitButton',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { SplitButton };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-split-button.mjs.map
