// #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 { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
import { Emit } from '../../../../events/Decorators/EmitDecorator';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { wheelPickerElementCosmopolitanStyle } from './Themes/WheelPickerElement.Cosmopolitan';
import { wheelPickerElementJoyStyle } from './Themes/WheelPickerElement.Joy';
import { wheelPickerElementMemphisStyle } from './Themes/WheelPickerElement.Memphis';
import { wheelPickerElementTemplate } from './WheelPickerElementTemplate';
// #endregion
/**
 * WheelPicker - A scrollable column of items for value selection.
 *
 * @description
 * The WheelPicker element renders a vertical scrollable list of items where
 * one item can be selected at a time. It supports generic items (not just numbers)
 * via the `IWheelPickerItem` interface with `value` and `label` properties.
 * Commonly used as a building block inside composite pickers such as DateTimeBox.
 *
 * @name WheelPicker
 * @element mosaik-wheel-picker
 * @category Primitives
 *
 * @csspart column - The scrollable column container.
 * @csspart item - An individual item in the wheel.
 *
 * @cssprop {String} --wheel-picker-background-color - The wheel picker background color CSS custom property.
 * @cssprop {String} --wheel-picker-border-color - The wheel picker border color CSS custom property.
 * @cssprop {String} --wheel-picker-border-radius - The wheel picker border radius CSS custom property.
 * @cssprop {String} --wheel-picker-border-style - The wheel picker border style CSS custom property.
 * @cssprop {String} --wheel-picker-border-width - The wheel picker border width CSS custom property.
 * @cssprop {String} --wheel-picker-font-family - The wheel picker font family CSS custom property.
 * @cssprop {String} --wheel-picker-font-letter-spacing - The wheel picker font letter spacing CSS custom property.
 * @cssprop {String} --wheel-picker-font-line-height - The wheel picker font line height CSS custom property.
 * @cssprop {String} --wheel-picker-font-size - The wheel picker font size CSS custom property.
 * @cssprop {String} --wheel-picker-font-text-decoration - The wheel picker font text decoration CSS custom property.
 * @cssprop {String} --wheel-picker-font-text-transform - The wheel picker font text transform CSS custom property.
 * @cssprop {String} --wheel-picker-font-weight - The wheel picker font weight CSS custom property.
 * @cssprop {String} --wheel-picker-foreground-color - The wheel picker foreground color CSS custom property.
 * @cssprop {String} --wheel-picker-gap - The wheel picker gap CSS custom property.
 * @cssprop {String} --wheel-picker-item-height - The wheel picker item height CSS custom property.
 * @cssprop {String} --wheel-picker-padding-bottom - The wheel picker padding bottom CSS custom property.
 * @cssprop {String} --wheel-picker-padding-left - The wheel picker padding left CSS custom property.
 * @cssprop {String} --wheel-picker-padding-right - The wheel picker padding right CSS custom property.
 * @cssprop {String} --wheel-picker-padding-top - The wheel picker padding top CSS custom property.
 * @cssprop {String} --wheel-picker-shadow - The wheel picker shadow CSS custom property.
 * @cssprop {String} --wheel-picker-shadow-blur - The wheel picker shadow blur CSS custom property.
 * @cssprop {String} --wheel-picker-shadow-color - The wheel picker shadow color CSS custom property.
 * @cssprop {String} --wheel-picker-shadow-offset-x - The wheel picker shadow offset x CSS custom property.
 * @cssprop {String} --wheel-picker-shadow-offset-y - The wheel picker shadow offset y CSS custom property.
 * @cssprop {String} --wheel-picker-shadow-spread - The wheel picker shadow spread CSS custom property.
 * @cssprop {String} --wheel-picker-transition-duration - The wheel picker transition duration CSS custom property.
 * @cssprop {String} --wheel-picker-transition-mode - The wheel picker transition mode CSS custom property.
 * @cssprop {String} --wheel-picker-transition-property - The wheel picker transition property CSS custom property.
 * @cssprop {String} --wheel-picker-translate - The wheel picker translate CSS custom property.
 *
 * @fires wheelPickerChange {WheelPickerChangeEvent} - Fired when the selected item changes.
 *
 * @example
 * Basic wheel picker with hour values:
 * ```html
 * <mosaik-wheel-picker id="hourPicker"></mosaik-wheel-picker>
 *
 * <script>
 *   const picker = document.getElementById('hourPicker');
 *   picker.items = Array.from({ length: 24 }, (_, i) => ({
 *     value: String(i),
 *     label: String(i).padStart(2, '0')
 *   }));
 *   picker.value = '12';
 *   picker.addEventListener('wheelPickerChange', (e) => {
 *     console.log('Selected:', e.detail.value);
 *   });
 * </script>
 * ```
 *
 * @public
 */
let WheelPickerElement = class WheelPickerElement extends Themeable(Variantable(Appearanceable(Disableable(CustomElement)))) {
    // #region Fields
    _wheelPickerChanged;
    _items;
    _value;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._items = new Array();
        this._value = null;
        this._wheelPickerChanged = new HTMLElementEventEmitter(this, 'wheelPickerChange', { cancelable: true });
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-wheel-picker';
    }
    /**
     * Gets or sets the `items` property.
     * The list of items to display in the wheel.
     *
     * @public
     */
    get items() {
        return this._items;
    }
    set items(value) {
        if (this._items !== value) {
            this._items = value;
            this.requestUpdate('items');
        }
    }
    /**
     * Gets or sets the `value` property.
     * The currently selected item value.
     *
     * @public
     */
    get value() {
        return this._value;
    }
    set value(value) {
        if (this._value !== value) {
            this._value = value;
            this.requestUpdate('value');
        }
    }
    /**
     * The `wheelPickerChange` event emitter.
     *
     * @public
     * @readonly
     * @eventProperty
     */
    get wheelPickerChange() {
        return this._wheelPickerChanged;
    }
    // #endregion
    // #region Methods
    /**
     * Handles click events on items via event delegation.
     *
     * @param event - The click event.
     * @public
     * @template
     */
    onItemClick(event) {
        if (this.disabled) {
            return;
        }
        const target = event.target;
        const value = target.dataset['value'];
        if (value === undefined) {
            return;
        }
        this._value = value;
        this.requestUpdate('value');
        this._wheelPickerChanged.emit({ value });
    }
};
__decorate([
    Property({ type: Array }),
    __metadata("design:type", Array),
    __metadata("design:paramtypes", [Array])
], WheelPickerElement.prototype, "items", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], WheelPickerElement.prototype, "value", null);
__decorate([
    Emit(),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [])
], WheelPickerElement.prototype, "wheelPickerChange", null);
WheelPickerElement = __decorate([
    Component({
        selector: 'mosaik-wheel-picker',
        template: wheelPickerElementTemplate,
        themes: {
            joy: wheelPickerElementJoyStyle,
            memphis: wheelPickerElementMemphisStyle,
            cosmopolitan: wheelPickerElementCosmopolitanStyle
        }
    }),
    __metadata("design:paramtypes", [])
], WheelPickerElement);
export { WheelPickerElement };
//# sourceMappingURL=WheelPickerElement.js.map