// #region Imports
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { RendererServiceLocator } from '../../../../Dom/Renderer';
import { Checkable } from '../../../Behaviors/Checkable';
import { Labelable } from '../../../Behaviors/Labelable';
import { Orientable } from '../../../Behaviors/Orientable';
import { Themeable } from '../../../Behaviors/Themeable';
import { addInheritanceConsumerController } from '../../../Controllers/InheritanceConsumerController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { IconPosition } from '../../../Types/IconPosition';
import { Size } from '../../../Types/Size';
import { ButtonBaseElement } from '../../Buttons/Abstracts/ButtonBaseElement';
import { StackElement } from '../../Layouts/Stack/StackElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { SEGMENT_INHERITANCE_CONTEXT } from './SegmentInheritanceContext';
import { segmentItemElementTemplate } from './SegmentItemElementTemplate';
import { segmentItemElementCosmopolitanStyle } from './Themes/SegmentItemElement.Cosmopolitan';
import { segmentItemElementJoyStyle } from './Themes/SegmentItemElement.Joy';
import { segmentItemElementMemphisStyle } from './Themes/SegmentItemElement.Memphis';
// #endregion
/**
 * Segment Item - An individual selectable button within a Segment control.
 *
 * @description
 * The Segment Item component represents a single option within a Segment control. It can display
 * a label, an icon, or both, and supports checked/unchecked states managed by the parent segment.
 * Each segment item functions as a toggle button that automatically deselects other items in the
 * same segment when selected. The component supports both horizontal and vertical orientations,
 * icon positioning, and inherits appearance and variant from the parent segment.
 *
 * @name Segment Item
 * @element mosaik-segment-item
 * @category Selectors
 *
 * @slot icon - The icon displayed within the segment item
 * @slot label - The text label displayed within the segment item
 *
 * @csspart button - The main button element container
 * @csspart innerStack - The inner layout stack for icon and label
 * @csspart icon - The icon display area
 * @csspart label - The text label display area
 *
 * @cssprop {String} --segment-item-background-color - The background fill color
 * @cssprop {String} --segment-item-font-family - The font family for segment item text
 * @cssprop {String} --segment-item-font-size - The font size for segment item text
 * @cssprop {String} --segment-item-font-line-height - The line height for segment item text
 * @cssprop {String} --segment-item-font-weight - The font weight for segment item text
 * @cssprop {String} --segment-item-font-letter-spacing - The letter spacing for segment item text
 * @cssprop {String} --segment-item-font-text-decoration - The text decoration style
 * @cssprop {String} --segment-item-font-text-transform - The text transformation style
 *
 * @dependency {StackElement} - Layout container for organizing content
 * @dependency {IconElement} - Icon display component
 * @dependency {TextElement} - Text rendering component for labels
 *
 * @fires checked {CheckedEvent} - Fired when the segment item is checked
 * @fires unchecked {UncheckedEvent} - Fired when the segment item is unchecked
 * @fires connected {ConnectedEvent} - Fired when connected to the DOM
 * @fires changed {PropertyChangedEvent} - Fired when properties change
 *
 * @example
 * Basic segment item with label:
 * ```html
 * <mosaik-segment-item label="Daily"></mosaik-segment-item>
 * ```
 *
 * @example
 * Segment item with icon and label:
 * ```html
 * <mosaik-segment-item label="List View" icon="list-icon" icon-position="before"></mosaik-segment-item>
 * ```
 *
 * @example
 * Icon-only segment item:
 * ```html
 * <mosaik-segment-item icon="grid-icon" aria-label="Grid view"></mosaik-segment-item>
 * ```
 *
 * @example
 * Checked segment item:
 * ```html
 * <mosaik-segment-item label="Active" checked></mosaik-segment-item>
 * ```
 *
 * @public
 */
let SegmentItemElement = class SegmentItemElement extends Themeable(Orientable(Checkable(Labelable(ButtonBaseElement)))) {
    // #region Fields
    _inheritance = addInheritanceConsumerController(this, {
        context: SEGMENT_INHERITANCE_CONTEXT
    });
    _icon;
    _iconPosition;
    _iconSize;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._icon = '';
        this._iconPosition = IconPosition.Before;
        this._iconSize = null;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-segment-item';
    }
    /**
     * Gets or sets the `icon` property.
     *
     * @public
     */
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            this.requestUpdate('icon');
        }
    }
    /**
     * Gets or sets the `iconPosition` property.
     *
     * @public
     */
    get iconPosition() {
        return this._iconPosition;
    }
    set iconPosition(value) {
        if (this._iconPosition !== value) {
            this._iconPosition = value;
            this.requestUpdate('iconPosition');
        }
    }
    /**
     * Gets or sets the `iconSize` property.
     *
     * @public
     */
    get iconSize() {
        return this._iconSize;
    }
    set iconSize(value) {
        if (this._iconSize !== value) {
            this._iconSize = value;
            this.requestUpdate('iconSize');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onIconPropertyChanged(prev, next) {
        if (next === '') {
            RendererServiceLocator.current.removeAttribute(this, 'has-icon');
        }
        else {
            RendererServiceLocator.current.setAttribute(this, 'has-icon');
        }
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], SegmentItemElement.prototype, "icon", null);
__decorate([
    Attribute({ type: IconPosition }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], SegmentItemElement.prototype, "iconPosition", null);
__decorate([
    Attribute({ type: Size }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], SegmentItemElement.prototype, "iconSize", null);
__decorate([
    Watch('icon'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], SegmentItemElement.prototype, "onIconPropertyChanged", null);
SegmentItemElement = __decorate([
    Component({
        selector: 'mosaik-segment-item',
        template: segmentItemElementTemplate,
        themes: {
            joy: segmentItemElementJoyStyle,
            memphis: segmentItemElementMemphisStyle,
            cosmopolitan: segmentItemElementCosmopolitanStyle
        },
        imports: [
            StackElement,
            IconElement,
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], SegmentItemElement);
export { SegmentItemElement };
//# sourceMappingURL=SegmentItemElement.js.map