import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideCheck } from '@ng-icons/lucide';
import { BrnSelectItem } from '@spartan-ng/brain/select';
import { classes } from '@spartan-ng/styles/utils';
@Component({
selector: 'hlm-select-item',
imports: [NgIcon],
providers: [provideIcons({ lucideCheck })],
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnSelectItem, inputs: ['id', 'disabled', 'value'] }],
host: { 'data-slot': 'select-item' },
template: `
@if (_active()) {
}
`,
})
export class HlmSelectItem {
private readonly _brnSelectItem = inject(BrnSelectItem);
protected readonly _active = this._brnSelectItem.active;
constructor() {
classes(
() =>
'data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground gap-1.5 rounded-md py-1 ps-1.5 pe-8 text-sm *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0',
);
}
}