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

class Button {
    constructor() {
        /**
         * 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 icon, displayed as graphical element within the component.
      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.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" }] : []));
        /**
         * When set to `true`, the component will
      automatically submit the nearest HTML form element on `press`.
      
      **Note:** This property is only applicable within the context of an HTML Form element.`
         */
        this.submits = input(false, ...(ngDevMode ? [{ debugName: "submits", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * 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`.
      
      - **ariaLabel**: Defines the accessible ARIA name of the component.
      Accepts any string value.
      
       - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or give focus to the button.
      
      - **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" }] : []));
        /**
         * Defines the accessible description of the component.
         */
        this.accessibleDescription = input(...(ngDevMode ? [undefined, { debugName: "accessibleDescription" }] : []));
        /**
         * Defines whether the button has special form-related functionality.
      
      **Note:** This property is only applicable within the context of an HTML Form element.
         */
        this.type = input("Button", ...(ngDevMode ? [{ debugName: "type" }] : []));
        /**
         * Describes the accessibility role of the button.
      
      **Note:** Use <code>ButtonAccessibleRole.Link</code> role only with a press handler, which performs a navigation. In all other scenarios the default button semantics are recommended.
         */
        this.accessibleRole = input("Button", ...(ngDevMode ? [{ debugName: "accessibleRole" }] : []));
        /**
         * Defines whether the button shows a loading indicator.
      
      **Note:** If set to `true`, a busy indicator component will be displayed on the related button.
         */
        this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Specifies the delay in milliseconds before the loading indicator appears within the associated button.
         */
        this.loadingDelay = input(1000, ...(ngDevMode ? [{ debugName: "loadingDelay" }] : [])); // 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();
        /**
         * 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.
         * - **badge**: Adds a badge to the button.
         *
         * @example
         * ```html
         * <ui5-button>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-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."
            },
            {
                "name": "badge",
                "description": "Adds a badge to the button.",
                "since": "2.7.0"
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'design',
            'disabled',
            'icon',
            'endIcon',
            'submits',
            'tooltip',
            'accessibleName',
            'accessibleNameRef',
            'accessibilityAttributes',
            'accessibleDescription',
            'type',
            'accessibleRole',
            'loading',
            'loadingDelay',
        ];
        // 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: Button, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Button, isStandalone: true, selector: "ui5-button, [ui5-button]", inputs: { design: { classPropertyName: "design", publicName: "design", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, submits: { classPropertyName: "submits", publicName: "submits", 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 }, accessibleDescription: { classPropertyName: "accessibleDescription", publicName: "accessibleDescription", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, accessibleRole: { classPropertyName: "accessibleRole", publicName: "accessibleRole", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, loadingDelay: { classPropertyName: "loadingDelay", publicName: "loadingDelay", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click" }, exportAs: ["ui5Button"], 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: Button, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-button, [ui5-button]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Button',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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