import * as i0 from '@angular/core';
import { input, booleanAttribute, computed, model, output, contentChild, TemplateRef, ChangeDetectionStrategy, Component } from '@angular/core';
import { Avatar } from '@masterteam/components/avatar';
import { NgTemplateOutlet } from '@angular/common';

class RadioCards {
    circle = input(false, { ...(ngDevMode ? { debugName: "circle" } : {}), transform: booleanAttribute });
    color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : []));
    size = input('medium', ...(ngDevMode ? [{ debugName: "size" }] : []));
    avatarSize = computed(() => {
        switch (this.size()) {
            case 'small':
                return 'normal';
            case 'medium':
                return 'large';
            case 'large':
                return 'xlarge';
            default:
                return 'normal';
        }
    }, ...(ngDevMode ? [{ debugName: "avatarSize" }] : []));
    options = model.required(...(ngDevMode ? [{ debugName: "options" }] : []));
    activeId = model(...(ngDevMode ? [undefined, { debugName: "activeId" }] : []));
    selectionChange = output();
    itemTemplate = input(null, ...(ngDevMode ? [{ debugName: "itemTemplate" }] : []));
    itemTemplateContent = contentChild('option', { ...(ngDevMode ? { debugName: "itemTemplateContent" } : {}), read: TemplateRef });
    textSizeClass = computed(() => {
        switch (this.size()) {
            case 'small':
                return 'text-xs';
            case 'large':
                return 'text-2xl';
            default:
                return 'text-base';
        }
    }, ...(ngDevMode ? [{ debugName: "textSizeClass" }] : []));
    classes = computed(() => { }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
    activeColorClasses = computed(() => {
        return [
            'bg-primary-50',
            'dark:bg-primary-800',
            'border-primary-400',
            'ring-primary-200',
        ];
    }, ...(ngDevMode ? [{ debugName: "activeColorClasses" }] : []));
    selectItem(item) {
        if (this.activeId() !== item.id) {
            this.activeId.set(item.id);
            this.selectionChange.emit(item);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: RadioCards, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: RadioCards, isStandalone: true, selector: "mt-radio-cards", inputs: { circle: { classPropertyName: "circle", publicName: "circle", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { options: "optionsChange", activeId: "activeIdChange", selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplateContent", first: true, predicate: ["option"], descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<div>\r\n  <div class=\"flex flex-wrap gap-3\">\r\n    @for (item of options(); track item.id) {\r\n      @let active = item.id === activeId();\r\n      <div\r\n        (click)=\"selectItem(item)\"\r\n        class=\"flex items-center space-x-4 p-4 rounded-lg cursor-pointer border-2 border-dashed transition-all ease-in-out duration-300\"\r\n        [class]=\"\r\n          active\r\n            ? 'bg-primary-50 dark:bg-primary-800 border-primary-400 ring-primary-200'\r\n            : 'border-gray-300 hover:border-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-600 dark:hover:text-gray-100'\r\n        \"\r\n      >\r\n        <ng-container\r\n          *ngTemplateOutlet=\"\r\n            itemTemplate() || itemTemplateContent() || defaultTemplate;\r\n            context: {\r\n              $implicit: item,\r\n              active: active,\r\n              size: size(),\r\n            }\r\n          \"\r\n        >\r\n        </ng-container>\r\n      </div>\r\n    }\r\n  </div>\r\n</div>\r\n\r\n<ng-template #defaultTemplate let-template let-active=\"active\" let-size=\"size\">\r\n  @if (template.icon) {\r\n    <mt-avatar\r\n      [shape]=\"circle() ? 'circle' : 'square'\"\r\n      [size]=\"avatarSize()\"\r\n      [icon]=\"template.icon\"\r\n    ></mt-avatar>\r\n  }\r\n  @if (template.name) {\r\n    <span\r\n      [class]=\"[\r\n        'font-semibold',\r\n        textSizeClass(),\r\n        'dark:text-gray-100',\r\n        'text-gray-600',\r\n      ]\"\r\n    >\r\n      {{ template.name }}\r\n    </span>\r\n  }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: RadioCards, decorators: [{
            type: Component,
            args: [{ selector: 'mt-radio-cards', standalone: true, imports: [NgTemplateOutlet, Avatar], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\r\n  <div class=\"flex flex-wrap gap-3\">\r\n    @for (item of options(); track item.id) {\r\n      @let active = item.id === activeId();\r\n      <div\r\n        (click)=\"selectItem(item)\"\r\n        class=\"flex items-center space-x-4 p-4 rounded-lg cursor-pointer border-2 border-dashed transition-all ease-in-out duration-300\"\r\n        [class]=\"\r\n          active\r\n            ? 'bg-primary-50 dark:bg-primary-800 border-primary-400 ring-primary-200'\r\n            : 'border-gray-300 hover:border-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-600 dark:hover:text-gray-100'\r\n        \"\r\n      >\r\n        <ng-container\r\n          *ngTemplateOutlet=\"\r\n            itemTemplate() || itemTemplateContent() || defaultTemplate;\r\n            context: {\r\n              $implicit: item,\r\n              active: active,\r\n              size: size(),\r\n            }\r\n          \"\r\n        >\r\n        </ng-container>\r\n      </div>\r\n    }\r\n  </div>\r\n</div>\r\n\r\n<ng-template #defaultTemplate let-template let-active=\"active\" let-size=\"size\">\r\n  @if (template.icon) {\r\n    <mt-avatar\r\n      [shape]=\"circle() ? 'circle' : 'square'\"\r\n      [size]=\"avatarSize()\"\r\n      [icon]=\"template.icon\"\r\n    ></mt-avatar>\r\n  }\r\n  @if (template.name) {\r\n    <span\r\n      [class]=\"[\r\n        'font-semibold',\r\n        textSizeClass(),\r\n        'dark:text-gray-100',\r\n        'text-gray-600',\r\n      ]\"\r\n    >\r\n      {{ template.name }}\r\n    </span>\r\n  }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"] }]
        }], propDecorators: { circle: [{ type: i0.Input, args: [{ isSignal: true, alias: "circle", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }, { type: i0.Output, args: ["optionsChange"] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }, { type: i0.Output, args: ["activeIdChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], itemTemplateContent: [{ type: i0.ContentChild, args: ['option', { ...{ read: TemplateRef }, isSignal: true }] }] } });

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

export { RadioCards };
//# sourceMappingURL=masterteam-components-radio-cards.mjs.map
