var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { MelodicComponent } from '@melodicdev/core';
import { dropdownItemTemplate } from './dropdown-item.template.js';
import { dropdownItemStyles } from './dropdown-item.styles.js';
/**
 * ml-dropdown-item - Individual menu item within a dropdown
 *
 * @example
 * ```html
 * <ml-dropdown-item value="edit" icon="pencil">Edit</ml-dropdown-item>
 * <ml-dropdown-item value="delete" icon="trash" destructive>Delete</ml-dropdown-item>
 * ```
 *
 * @slot default - The item label text
 * @fires ml:item-select - Internal event caught by parent dropdown
 */
let DropdownItemComponent = class DropdownItemComponent {
    constructor() {
        /** Selection value emitted on click */
        this.value = '';
        /** Left icon name (Phosphor) */
        this.icon = '';
        /** Right addon text (e.g. keyboard shortcut) */
        this.addon = '';
        /** Non-interactive state */
        this.disabled = false;
        /** Red/danger styling */
        this.destructive = false;
        /** Set by parent dropdown for keyboard navigation highlight */
        this.focused = false;
        this.handleClick = () => {
            if (this.disabled)
                return;
            this.elementRef.dispatchEvent(new CustomEvent('ml:item-select', {
                bubbles: true,
                composed: true,
                detail: { value: this.value }
            }));
        };
    }
};
DropdownItemComponent = __decorate([
    MelodicComponent({
        selector: 'ml-dropdown-item',
        template: dropdownItemTemplate,
        styles: dropdownItemStyles,
        attributes: ['value', 'icon', 'addon', 'disabled', 'destructive']
    })
], DropdownItemComponent);
export { DropdownItemComponent };
