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

class ToolbarSelect {
    constructor() {
        /**
         * Defines the width of the select.
      
      **Note:** all CSS sizes are supported - 'percentage', 'px', 'rem', 'auto', etc.
         */
        this.width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : []));
        /**
         * Defines the value state of the component.
         */
        this.valueState = input("None", ...(ngDevMode ? [{ debugName: "valueState" }] : []));
        /**
         * Defines whether the component is in disabled state.
      
      **Note:** A disabled component is noninteractive.
         */
        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" }] : []));
        /**
         * Receives id(or many ids) of the elements that label the select.
         */
        this.accessibleNameRef = input(...(ngDevMode ? [undefined, { debugName: "accessibleNameRef" }] : []));
        /**
         * Defines the value of the component:
         */
        this.value = input("", ...(ngDevMode ? [{ debugName: "value" }] : []));
        /**
         * Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
      the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
         */
        this.overflowPriority = input("Default", ...(ngDevMode ? [{ debugName: "overflowPriority" }] : []));
        /**
         * Defines if the toolbar overflow popup should close upon intereaction with the item.
      It will close by default.
         */
        this.preventOverflowClosing = input(false, ...(ngDevMode ? [{ debugName: "preventOverflowClosing", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
        /**
         * Fired when the selected option changes.
         */
        this.ui5Change = output();
        /**
         * Fired after the component's dropdown menu opens.
         */
        this.ui5Open = output();
        /**
         * Fired after the component's dropdown menu closes.
         */
        this.ui5Close = 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 component options.
      
      **Note:** Only one selected option is allowed.
      If more than one option is defined as selected, the last one would be considered as the selected one.
      
      **Note:** Use the `ui5-toolbar-select-option` component to define the desired options.
         * - **label**: Defines the HTML element that will be displayed in the component input part,
      representing the selected option.
         *
         * @example
         * ```html
         * <ui5-toolbar-select>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-toolbar-select>
         * ```
         *
         * @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 component options.\n\n**Note:** Only one selected option is allowed.\nIf more than one option is defined as selected, the last one would be considered as the selected one.\n\n**Note:** Use the `ui5-toolbar-select-option` component to define the desired options."
            },
            {
                "name": "label",
                "description": "Defines the HTML element that will be displayed in the component input part,\nrepresenting the selected option.",
                "since": "2.15.0"
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'width',
            'valueState',
            'disabled',
            'accessibleName',
            'accessibleNameRef',
            'value',
            'overflowPriority',
            'preventOverflowClosing',
        ];
        // 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 = [
            'ui5Change',
            'ui5Open',
            'ui5Close',
        ];
        // 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: ToolbarSelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: ToolbarSelect, isStandalone: true, selector: "ui5-toolbar-select, [ui5-toolbar-select]", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, valueState: { classPropertyName: "valueState", publicName: "valueState", 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 }, accessibleNameRef: { classPropertyName: "accessibleNameRef", publicName: "accessibleNameRef", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, overflowPriority: { classPropertyName: "overflowPriority", publicName: "overflowPriority", isSignal: true, isRequired: false, transformFunction: null }, preventOverflowClosing: { classPropertyName: "preventOverflowClosing", publicName: "preventOverflowClosing", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Change: "ui5Change", ui5Open: "ui5Open", ui5Close: "ui5Close" }, exportAs: ["ui5ToolbarSelect"], 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: ToolbarSelect, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-toolbar-select, [ui5-toolbar-select]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5ToolbarSelect',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

export { ToolbarSelect };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-toolbar-select.mjs.map
