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

class ToolbarButton {
    constructor() {
        /**
         * Defines if the action is disabled.
      
      **Note:** a disabled action 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 action design.
         */
        this.design = input("Default", ...(ngDevMode ? [{ debugName: "design" }] : []));
        /**
         * Defines the `icon` source URI.
      
      **Note:** SAP-icons font provides numerous buil-in icons. To find all the available icons, see the
      [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
        /**
         * Defines the icon, displayed as graphical element within the component after the button text.
      
      **Note:** It is highly recommended to use `endIcon` property only together with `icon` and/or `text` properties.
      Usage of `endIcon` only should be avoided.
      
      The SAP-icons font provides numerous options.
      
      Example:
      See all the available icons within the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.endIcon = input(...(ngDevMode ? [undefined, { debugName: "endIcon" }] : []));
        /**
         * Defines the tooltip of the component.
      
      **Note:** A tooltip attribute should be provided for icon-only buttons, in order to represent their exact meaning/function.
         */
        this.tooltip = input(...(ngDevMode ? [undefined, { debugName: "tooltip" }] : []));
        /**
         * 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 component.
         */
        this.accessibleNameRef = input(...(ngDevMode ? [undefined, { debugName: "accessibleNameRef" }] : []));
        /**
         * Defines the additional accessibility attributes that will be applied to the component.
      
      The following fields are supported:
      
      - **expanded**: Indicates whether the button, or another grouping element it controls, is currently expanded or collapsed.
      Accepts the following string values: `true` or `false`
      
      - **hasPopup**: Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by the button.
      Accepts the following string values: `dialog`, `grid`, `listbox`, `menu` or `tree`.
      
      - **controls**: Identifies the element (or elements) whose contents or presence are controlled by the button element.
      Accepts a lowercase string value.
         */
        this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : []));
        /**
         * Button text
         */
        this.text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : []));
        /**
         * Defines whether the button text should only be displayed in the overflow popover.
      
      When set to `true`, the button appears as icon-only in the main toolbar,
      but shows both icon and text when moved to the overflow popover.
      
      **Note:** This property only takes effect when the `text` property is also set.
         */
        this.showOverflowText = input(false, ...(ngDevMode ? [{ debugName: "showOverflowText", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the width of the button.
      
      **Note:** all CSS sizes are supported - 'percentage', 'px', 'rem', 'auto', etc.
         */
        this.width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : []));
        /**
         * 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 component is activated either with a
      mouse/tap or by using the Enter or Space key.
      
      **Note:** The event will not be fired if the `disabled`
      property is set to `true`.
         */
        this.ui5Click = output();
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'disabled',
            'design',
            'icon',
            'endIcon',
            'tooltip',
            'accessibleName',
            'accessibleNameRef',
            'accessibilityAttributes',
            'text',
            'showOverflowText',
            'width',
            '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 = [
            'ui5Click',
        ];
        // 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: ToolbarButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: ToolbarButton, isStandalone: true, selector: "ui5-toolbar-button, [ui5-toolbar-button]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, design: { classPropertyName: "design", publicName: "design", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, endIcon: { classPropertyName: "endIcon", publicName: "endIcon", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", 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 }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, showOverflowText: { classPropertyName: "showOverflowText", publicName: "showOverflowText", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", 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: { ui5Click: "ui5Click" }, exportAs: ["ui5ToolbarButton"], 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: ToolbarButton, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-toolbar-button, [ui5-toolbar-button]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5ToolbarButton',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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