// #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 { 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 { segmentItemElementTemplate } from './SegmentItemElementTemplate';
import { segmentItemElementJoyStyle } from './Themes/SegmentItemElement.Joy';
import { segmentItemElementRetroStyle } from './Themes/SegmentItemElement.Retro';
import { segmentItemElementCosmopolitanStyle } from './Themes/SegmentItemElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Segment Item - A button within a segment control that represents an option or view.
 *
 * @element mosaik-segment-item
 *
 * @description
 * Segment Items are individual buttons within a Segment control. They represent options or views that users can select
 * by clicking. When a Segment Item is selected, others in the same Segment control are automatically deselected.
 *
 * Segment Items are typically used inside a `mosaik-segment` to provide a set of mutually exclusive choices or
 * navigation options within the content area.
 *
 * @category Layout
 *
 * @example
 * ```html
 * <mosaik-segment>
 *   <mosaik-segment-item>Option 1</mosaik-segment-item>
 *   <mosaik-segment-item>Option 2</mosaik-segment-item>
 *   <mosaik-segment-item>Option 3</mosaik-segment-item>
 * </mosaik-segment>
 * ```
 *
 * @public
 */
let SegmentItemElement = class SegmentItemElement extends Themeable(Orientable(Checkable(Labelable(ButtonBaseElement)))) {
    // #region Fields
    _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,
            retro: segmentItemElementRetroStyle,
            cosmopolitan: segmentItemElementCosmopolitanStyle
        },
        imports: [
            StackElement,
            IconElement,
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], SegmentItemElement);
export { SegmentItemElement };
//# sourceMappingURL=SegmentItemElement.js.map