import { Directive, input } from '@angular/core'; import { classes } from '@spartan-ng/styles/utils'; import { HlmCardConfig, injectHlmCardConfig } from './hlm-card.token'; @Directive({ selector: '[hlmCard],hlm-card', host: { 'data-slot': 'card', '[attr.data-size]': 'size()', }, }) export class HlmCard { private readonly _defaultConfig = injectHlmCardConfig(); public readonly size = input(this._defaultConfig.size); constructor() { classes( () => 'ring-foreground/10 bg-card text-card-foreground gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col', ); } }