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

class ColorPaletteItem {
    constructor() {
        /**
         * Defines the colour of the component.
      
      **Note:** The value should be a valid CSS color.
         */
        this.value = input("", ...(ngDevMode ? [{ debugName: "value" }] : []));
        /**
         * Defines if the component is selected.
      
      **Note:** Only one item must be selected per <code>ui5-color-palette</code>.
      If more than one item is defined as selected, the last one would be considered as the selected one.
         */
        this.selected = input(false, ...(ngDevMode ? [{ debugName: "selected", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'value',
            'selected',
        ];
        // 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;
                        }
                    });
                });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: ColorPaletteItem, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: ColorPaletteItem, isStandalone: true, selector: "ui5-color-palette-item, [ui5-color-palette-item]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["ui5ColorPaletteItem"], 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: ColorPaletteItem, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-color-palette-item, [ui5-color-palette-item]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5ColorPaletteItem',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

export { ColorPaletteItem };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-color-palette-item.mjs.map
