@spartan-ng/cli 0.0.1-alpha.326 → 0.0.1-alpha.327

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/package.json +1 -1
  2. package/src/generators/ui/libs/ui-accordion-helm/files/index.ts.template +3 -3
  3. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.directive.ts.template +12 -67
  4. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.directive.ts.template +31 -0
  5. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-item.directive.ts.template +7 -6
  6. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-trigger.directive.ts.template +12 -23
  7. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion.directive.ts.template +10 -7
  8. package/src/generators/ui/libs/ui-alert-dialog-helm/files/index.ts.template +6 -6
  9. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-cancel-button.directive.ts.template +3 -6
  10. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/{hlm-alert-dialog-content.directive.ts.template → hlm-alert-dialog-content.component.ts.template} +19 -20
  11. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-description.directive.ts.template +5 -6
  12. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-footer.component.ts.template +6 -6
  13. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-header.component.ts.template +6 -6
  14. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-overlay.directive.ts.template +10 -16
  15. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-title.directive.ts.template +4 -6
  16. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog.component.ts.template +30 -0
  17. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-description.directive.ts.template +3 -3
  18. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-title.directive.ts.template +3 -3
  19. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert.directive.ts.template +3 -3
  20. package/src/generators/ui/libs/ui-aspect-ratio-helm/files/lib/helm-aspect-ratio.directive.ts.template +7 -9
  21. package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.ts.template +11 -14
  22. package/src/generators/ui/libs/ui-badge-helm/files/lib/hlm-badge.directive.ts.template +3 -3
  23. package/src/generators/ui/libs/ui-button-helm/files/lib/hlm-button.directive.ts.template +3 -3
  24. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-content.directive.ts.template +3 -3
  25. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-description.directive.ts.template +3 -3
  26. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-footer.directive.ts.template +3 -3
  27. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-header.directive.ts.template +3 -3
  28. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-title.directive.ts.template +3 -3
  29. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card.directive.ts.template +3 -3
  30. package/src/generators/ui/libs/ui-checkbox-helm/files/index.ts.template +14 -0
  31. package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox-checkicon.component.ts.template +37 -0
  32. package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox.directive.ts.template +30 -0
  33. package/src/generators/ui/libs/ui-checkbox-helm/generator.d.ts +3 -0
  34. package/src/generators/ui/libs/ui-checkbox-helm/generator.js +12 -0
  35. package/src/generators/ui/libs/ui-checkbox-helm/generator.js.map +1 -0
  36. package/src/generators/ui/libs/ui-dialog-helm/files/index.ts.template +6 -3
  37. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.component.ts.template +44 -0
  38. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-overlay.directive.ts.template +10 -16
  39. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog.component.ts.template +29 -0
  40. package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.ts.template +50 -5
  41. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input-error.directive.ts.template +3 -3
  42. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input.directive.ts.template +3 -3
  43. package/src/generators/ui/libs/ui-label-helm/files/lib/hlm-label.directive.ts.template +37 -8
  44. package/src/generators/ui/libs/ui-menu-helm/files/index.ts.template +18 -9
  45. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar-item.directive.ts.template +3 -1
  46. package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-menu-bar.directive.ts.template → hlm-menu-bar.component.ts.template} +7 -4
  47. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-group.component.ts.template +15 -0
  48. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-check.component.ts.template +1 -1
  49. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-checkbox.directive.ts.template +41 -0
  50. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.component.ts.template +1 -1
  51. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.directive.ts.template +41 -0
  52. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item.directive.ts.template +24 -7
  53. package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-menu.directive.ts.template → hlm-menu.component.ts.template} +11 -6
  54. package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-sub-menu.directive.ts.template → hlm-sub-menu.component.ts.template} +9 -4
  55. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-content.directive.ts.template +1 -1
  56. package/src/generators/ui/libs/ui-spinner-helm/files/lib/hlm-spinner.component.ts.template +3 -3
  57. package/src/generators/ui/libs/ui-table-helm/files/index.ts.template +3 -0
  58. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-caption.component.ts.template +73 -0
  59. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.component.ts.template +20 -2
  60. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.directive.ts.template +4 -3
  61. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-td.component.ts.template +23 -11
  62. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-th.component.ts.template +12 -2
  63. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-trow.component.ts.template +11 -1
  64. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-list.directive.ts.template +14 -11
  65. package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle.directive.ts.template +3 -3
  66. package/src/generators/ui/supported-ui-libraries.json +51 -34
  67. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.component.ts.template +0 -28
  68. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-close.directive.ts.template +0 -26
  69. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.directive.ts.template +0 -37
@@ -1,47 +1,56 @@
1
1
  import { NgModule } from '@angular/core';
2
2
 
3
3
  import { HlmMenuBarItemDirective } from './lib/hlm-menu-bar-item.directive';
4
- import { HlmMenuBarDirective } from './lib/hlm-menu-bar.directive';
4
+ import { HlmMenuBarComponent } from './lib/hlm-menu-bar.component';
5
+ import { HlmMenuGroupComponent } from './lib/hlm-menu-group.component';
5
6
  import { HlmMenuItemCheckComponent } from './lib/hlm-menu-item-check.component';
7
+ import { HlmMenuItemCheckboxDirective } from './lib/hlm-menu-item-checkbox.directive';
6
8
  import { HlmMenuItemIconDirective } from './lib/hlm-menu-item-icon.directive';
7
9
  import { HlmMenuItemRadioComponent } from './lib/hlm-menu-item-radio.component';
10
+ import { HlmMenuItemRadioDirective } from './lib/hlm-menu-item-radio.directive';
8
11
  import { HlmMenuItemSubIndicatorComponent } from './lib/hlm-menu-item-sub-indicator.component';
9
12
  import { HlmMenuItemDirective } from './lib/hlm-menu-item.directive';
10
13
  import { HlmMenuLabelComponent } from './lib/hlm-menu-label.component';
11
14
  import { HlmMenuSeparatorComponent } from './lib/hlm-menu-separator.component';
12
15
  import { HlmMenuShortcutComponent } from './lib/hlm-menu-shortcut.component';
13
- import { HlmMenuDirective } from './lib/hlm-menu.directive';
14
- import { HlmSubMenuDirective } from './lib/hlm-sub-menu.directive';
16
+ import { HlmMenuComponent } from './lib/hlm-menu.component';
17
+ import { HlmSubMenuComponent } from './lib/hlm-sub-menu.component';
15
18
 
16
19
  export * from './lib/hlm-menu-bar-item.directive';
17
- export * from './lib/hlm-menu-bar.directive';
20
+ export * from './lib/hlm-menu-bar.component';
21
+ export * from './lib/hlm-menu-group.component';
18
22
  export * from './lib/hlm-menu-item-check.component';
23
+ export * from './lib/hlm-menu-item-checkbox.directive';
19
24
  export * from './lib/hlm-menu-item-icon.directive';
20
25
  export * from './lib/hlm-menu-item-radio.component';
26
+ export * from './lib/hlm-menu-item-radio.directive';
21
27
  export * from './lib/hlm-menu-item-sub-indicator.component';
22
28
  export * from './lib/hlm-menu-item.directive';
23
29
  export * from './lib/hlm-menu-label.component';
24
30
  export * from './lib/hlm-menu-separator.component';
25
31
  export * from './lib/hlm-menu-shortcut.component';
26
- export * from './lib/hlm-menu.directive';
27
- export * from './lib/hlm-sub-menu.directive';
32
+ export * from './lib/hlm-menu.component';
33
+ export * from './lib/hlm-sub-menu.component';
28
34
 
29
35
  export const HlmMenuItemImports = [
30
36
  HlmMenuItemDirective,
31
37
  HlmMenuItemIconDirective,
38
+ HlmMenuGroupComponent,
32
39
  HlmMenuItemSubIndicatorComponent,
33
40
  HlmMenuItemRadioComponent,
34
41
  HlmMenuItemCheckComponent,
35
42
  HlmMenuShortcutComponent,
43
+ HlmMenuItemCheckboxDirective,
44
+ HlmMenuItemRadioDirective,
36
45
  ];
37
46
  export const HlmMenuStructureImports = [HlmMenuLabelComponent, HlmMenuSeparatorComponent] as const;
38
47
  export const HlmMenuImports = [
39
48
  ...HlmMenuItemImports,
40
49
  ...HlmMenuStructureImports,
41
- HlmMenuDirective,
42
- HlmSubMenuDirective,
50
+ HlmMenuComponent,
51
+ HlmSubMenuComponent,
43
52
  ] as const;
44
- export const HlmMenuBarImports = [...HlmMenuImports, HlmMenuBarDirective, HlmMenuBarItemDirective] as const;
53
+ export const HlmMenuBarImports = [...HlmMenuImports, HlmMenuBarComponent, HlmMenuBarItemDirective] as const;
45
54
 
46
55
  @NgModule({
47
56
  imports: [...HlmMenuItemImports],
@@ -1,5 +1,6 @@
1
- import { Directive, Input, computed, signal } from '@angular/core';
1
+ import { computed, Directive, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuItemDirective } from '@spartan-ng/ui-menu-brain';
3
4
  import { ClassValue } from 'clsx';
4
5
 
5
6
  @Directive({
@@ -8,6 +9,7 @@ import { ClassValue } from 'clsx';
8
9
  host: {
9
10
  '[class]': '_computedClass()',
10
11
  },
12
+ hostDirectives: [BrnMenuItemDirective],
11
13
  })
12
14
  export class HlmMenuBarItemDirective {
13
15
  private readonly _userCls = signal<ClassValue>('');
@@ -1,15 +1,18 @@
1
- import { Directive, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuBarDirective } from '@spartan-ng/ui-menu-brain';
3
4
  import { ClassValue } from 'clsx';
4
5
 
5
- @Directive({
6
- selector: '[hlm][brnMenuBar]',
6
+ @Component({
7
+ selector: 'hlm-menu-bar',
7
8
  standalone: true,
8
9
  host: {
9
10
  '[class]': '_computedClass()',
10
11
  },
12
+ hostDirectives: [BrnMenuBarDirective],
13
+ template: '<ng-content/>',
11
14
  })
12
- export class HlmMenuBarDirective {
15
+ export class HlmMenuBarComponent {
13
16
  private readonly _userCls = signal<ClassValue>('');
14
17
  @Input()
15
18
  set class(userCls: ClassValue) {
@@ -0,0 +1,15 @@
1
+ import { Component } from '@angular/core';
2
+ import { BrnMenuGroupDirective } from '@spartan-ng/ui-menu-brain';
3
+
4
+ @Component({
5
+ selector: 'hlm-menu-group',
6
+ standalone: true,
7
+ host: {
8
+ class: 'block',
9
+ },
10
+ hostDirectives: [BrnMenuGroupDirective],
11
+ template: `
12
+ <ng-content />
13
+ `,
14
+ })
15
+ export class HlmMenuGroupComponent {}
@@ -1,4 +1,4 @@
1
- import { Component, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { radixCheck } from '@ng-icons/radix-icons';
3
3
  import { hlm } from '@spartan-ng/ui-core';
4
4
  import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
@@ -0,0 +1,41 @@
1
+ import { booleanAttribute, computed, Directive, Input, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuItemCheckboxDirective } from '@spartan-ng/ui-menu-brain';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ @Directive({
7
+ selector: '[hlmMenuItemCheckbox]',
8
+ standalone: true,
9
+ host: {
10
+ '[class]': '_computedClass()',
11
+ },
12
+ hostDirectives: [
13
+ {
14
+ directive: BrnMenuItemCheckboxDirective,
15
+ inputs: ['disabled: disabled', 'checked: checked'],
16
+ outputs: ['triggered: triggered'],
17
+ },
18
+ ],
19
+ })
20
+ export class HlmMenuItemCheckboxDirective {
21
+ private readonly _inset = signal<ClassValue>(false);
22
+
23
+ private readonly _userCls = signal<ClassValue>('');
24
+ @Input()
25
+ set class(userCls: ClassValue) {
26
+ this._userCls.set(userCls);
27
+ }
28
+ @Input({ transform: booleanAttribute })
29
+ set inset(value: boolean) {
30
+ this._inset.set(value);
31
+ }
32
+
33
+ protected _computedClass = computed(() => this._generateClass());
34
+ private _generateClass() {
35
+ return hlm(
36
+ 'group w-full relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground disabled:pointer-events-none disabled:opacity-50',
37
+ this._inset() && 'pl-10',
38
+ this._userCls(),
39
+ );
40
+ }
41
+ }
@@ -1,4 +1,4 @@
1
- import { Component, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { radixDotFilled } from '@ng-icons/radix-icons';
3
3
  import { hlm } from '@spartan-ng/ui-core';
4
4
  import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
@@ -0,0 +1,41 @@
1
+ import { booleanAttribute, computed, Directive, Input, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuItemRadioDirective } from '@spartan-ng/ui-menu-brain';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ @Directive({
7
+ selector: '[hlmMenuItemRadio]',
8
+ standalone: true,
9
+ host: {
10
+ '[class]': '_computedClass()',
11
+ },
12
+ hostDirectives: [
13
+ {
14
+ directive: BrnMenuItemRadioDirective,
15
+ inputs: ['disabled: disabled', 'checked: checked'],
16
+ outputs: ['triggered: triggered'],
17
+ },
18
+ ],
19
+ })
20
+ export class HlmMenuItemRadioDirective {
21
+ private readonly _inset = signal<ClassValue>(false);
22
+
23
+ private readonly _userCls = signal<ClassValue>('');
24
+ @Input()
25
+ set class(userCls: ClassValue) {
26
+ this._userCls.set(userCls);
27
+ }
28
+ @Input({ transform: booleanAttribute })
29
+ set inset(value: boolean) {
30
+ this._inset.set(value);
31
+ }
32
+
33
+ protected _computedClass = computed(() => this._generateClass());
34
+ private _generateClass() {
35
+ return hlm(
36
+ 'group w-full relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground disabled:pointer-events-none disabled:opacity-50',
37
+ this._inset() && 'pl-10',
38
+ this._userCls(),
39
+ );
40
+ }
41
+ }
@@ -1,33 +1,50 @@
1
1
  import { booleanAttribute, computed, Directive, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuItemDirective } from '@spartan-ng/ui-menu-brain';
4
+ import { cva, VariantProps } from 'class-variance-authority';
3
5
  import { ClassValue } from 'clsx';
4
6
 
7
+ export const hlmMenuItemVariants = cva(
8
+ 'group w-full relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground disabled:pointer-events-none disabled:opacity-50',
9
+ {
10
+ variants: { inset: { true: 'pl-10', false: '' } },
11
+ defaultVariants: { inset: false },
12
+ },
13
+ );
14
+ export type HlmMenuItemVariants = VariantProps<typeof hlmMenuItemVariants>;
15
+
5
16
  @Directive({
6
- selector: '[hlm][brnMenuItem], [hlm][brnMenuItemRadio], [hlm][brnMenuItemCheckbox]',
17
+ selector: '[hlmMenuItem]',
7
18
  standalone: true,
8
19
  host: {
9
20
  '[class]': '_computedClass()',
10
21
  },
22
+ hostDirectives: [
23
+ {
24
+ directive: BrnMenuItemDirective,
25
+ inputs: ['disabled: disabled'],
26
+ outputs: ['triggered: triggered'],
27
+ },
28
+ ],
11
29
  })
12
30
  export class HlmMenuItemDirective {
13
- private readonly _inset = signal<ClassValue>(false);
31
+ private readonly _inset = signal<boolean>(false);
14
32
 
15
33
  private readonly _userCls = signal<ClassValue>('');
34
+
16
35
  @Input()
17
36
  set class(userCls: ClassValue) {
18
37
  this._userCls.set(userCls);
19
38
  }
39
+
20
40
  @Input({ transform: booleanAttribute })
21
41
  set inset(value: boolean) {
22
42
  this._inset.set(value);
23
43
  }
24
44
 
25
45
  protected _computedClass = computed(() => this._generateClass());
46
+
26
47
  private _generateClass() {
27
- return hlm(
28
- 'group w-full relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground disabled:pointer-events-none disabled:opacity-50',
29
- this._inset() && 'pl-10',
30
- this._userCls(),
31
- );
48
+ return hlm(hlmMenuItemVariants({ inset: this._inset() }), this._userCls());
32
49
  }
33
50
  }
@@ -1,9 +1,10 @@
1
- import { Directive, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
- import { VariantProps, cva } from 'class-variance-authority';
3
+ import { BrnMenuDirective } from '@spartan-ng/ui-menu-brain';
4
+ import { cva, VariantProps } from 'class-variance-authority';
4
5
  import { ClassValue } from 'clsx';
5
6
 
6
- const menuVariants = cva(
7
+ export const menuVariants = cva(
7
8
  'border-border min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
8
9
  {
9
10
  variants: {
@@ -19,14 +20,18 @@ const menuVariants = cva(
19
20
  );
20
21
  type MenuVariants = VariantProps<typeof menuVariants>;
21
22
 
22
- @Directive({
23
- selector: '[hlm][brnMenu]',
23
+ @Component({
24
+ selector: 'hlm-menu',
24
25
  standalone: true,
25
26
  host: {
26
27
  '[class]': '_computedClass()',
27
28
  },
29
+ hostDirectives: [BrnMenuDirective],
30
+ template: `
31
+ <ng-content />
32
+ `,
28
33
  })
29
- export class HlmMenuDirective {
34
+ export class HlmMenuComponent {
30
35
  private readonly _userCls = signal<ClassValue>('');
31
36
  @Input()
32
37
  set class(userCls: ClassValue) {
@@ -1,15 +1,20 @@
1
- import { Directive, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnMenuDirective } from '@spartan-ng/ui-menu-brain';
3
4
  import { ClassValue } from 'clsx';
4
5
 
5
- @Directive({
6
- selector: '[hlm][brnSubMenu]',
6
+ @Component({
7
+ selector: 'hlm-sub-menu',
7
8
  standalone: true,
8
9
  host: {
9
10
  '[class]': '_computedClass()',
10
11
  },
12
+ hostDirectives: [BrnMenuDirective],
13
+ template: `
14
+ <ng-content />
15
+ `,
11
16
  })
12
- export class HlmSubMenuDirective {
17
+ export class HlmSubMenuComponent {
13
18
  private readonly _userCls = signal<ClassValue>('');
14
19
  @Input()
15
20
  set class(userCls: ClassValue) {
@@ -3,7 +3,7 @@ import { hlm, injectExposedSideProvider, injectExposesStateProvider } from '@spa
3
3
  import { cva } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
5
5
 
6
- const sheetVariants = cva(
6
+ export const sheetVariants = cva(
7
7
  'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
8
8
  {
9
9
  variants: {
@@ -1,9 +1,9 @@
1
- import { Component, Input, computed, signal } from '@angular/core';
1
+ import { Component, computed, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
- import { VariantProps, cva } from 'class-variance-authority';
3
+ import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
5
5
 
6
- const spinnerVariants = cva('inline-block', {
6
+ export const spinnerVariants = cva('inline-block', {
7
7
  variants: {
8
8
  variant: {
9
9
  default: 'animate-spin [&>svg]:text-foreground/30 [&>svg]:fill-accent',
@@ -1,11 +1,13 @@
1
1
  import { NgModule } from '@angular/core';
2
2
 
3
+ import { HlmCaptionComponent } from './lib/hlm-caption.component';
3
4
  import { HlmTableComponent } from './lib/hlm-table.component';
4
5
  import { HlmTableDirective } from './lib/hlm-table.directive';
5
6
  import { HlmTdComponent } from './lib/hlm-td.component';
6
7
  import { HlmThComponent } from './lib/hlm-th.component';
7
8
  import { HlmTrowComponent } from './lib/hlm-trow.component';
8
9
 
10
+ export { HlmCaptionComponent } from './lib/hlm-caption.component';
9
11
  export { HlmTableComponent } from './lib/hlm-table.component';
10
12
  export { HlmTableDirective } from './lib/hlm-table.directive';
11
13
  export { HlmTdComponent } from './lib/hlm-td.component';
@@ -15,6 +17,7 @@ export { HlmTrowComponent } from './lib/hlm-trow.component';
15
17
  export const HlmTableImports = [
16
18
  HlmTableComponent,
17
19
  HlmTableDirective,
20
+ HlmCaptionComponent,
18
21
  HlmThComponent,
19
22
  HlmTdComponent,
20
23
  HlmTrowComponent,
@@ -0,0 +1,73 @@
1
+ import {
2
+ booleanAttribute,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ effect,
7
+ inject,
8
+ Input,
9
+ signal,
10
+ ViewEncapsulation,
11
+ } from '@angular/core';
12
+ import { hlm } from '@spartan-ng/ui-core';
13
+ import { ClassValue } from 'clsx';
14
+ import { HlmTableComponent } from '../index';
15
+
16
+ let captionIdSequence = 0;
17
+
18
+ @Component({
19
+ selector: 'hlm-caption',
20
+ standalone: true,
21
+ host: {
22
+ '[class]': '_computedClass()',
23
+ '[id]': '_id()',
24
+ },
25
+ template: `
26
+ <ng-content />
27
+ `,
28
+ changeDetection: ChangeDetectionStrategy.OnPush,
29
+ encapsulation: ViewEncapsulation.None,
30
+ })
31
+ export class HlmCaptionComponent {
32
+ private readonly _table = inject(HlmTableComponent, { optional: true });
33
+
34
+ private readonly _hidden = signal(false);
35
+ private readonly _userCls = signal<ClassValue>('');
36
+ protected readonly _computedClass = computed(() =>
37
+ hlm(
38
+ 'text-center block mt-4 text-sm text-muted-foreground',
39
+ this._hidden() ? 'sr-only' : 'order-last',
40
+ this._userCls(),
41
+ ),
42
+ );
43
+ protected readonly _id = signal<string | null | undefined>(`${captionIdSequence++}`);
44
+
45
+ @Input({ transform: booleanAttribute })
46
+ public truncate = false;
47
+
48
+ @Input()
49
+ set class(inputs: ClassValue) {
50
+ this._userCls.set(inputs);
51
+ }
52
+
53
+ @Input()
54
+ set id(value: string | null | undefined) {
55
+ this._id.set(value);
56
+ }
57
+
58
+ @Input({ transform: booleanAttribute })
59
+ set hidden(value: boolean) {
60
+ this._hidden.set(value);
61
+ }
62
+
63
+ constructor() {
64
+ effect(
65
+ () => {
66
+ const id = this._id();
67
+ if (!this._table) return;
68
+ this._table.labeledBy = id;
69
+ },
70
+ { allowSignalWrites: true },
71
+ );
72
+ }
73
+ }
@@ -1,4 +1,12 @@
1
- import { booleanAttribute, Component, computed, Input, signal } from '@angular/core';
1
+ import {
2
+ booleanAttribute,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ Input,
7
+ signal,
8
+ ViewEncapsulation,
9
+ } from '@angular/core';
2
10
  import { hlm } from '@spartan-ng/ui-core';
3
11
  import { ClassValue } from 'clsx';
4
12
 
@@ -8,10 +16,13 @@ import { ClassValue } from 'clsx';
8
16
  host: {
9
17
  '[class]': '_computedClass()',
10
18
  role: 'table',
19
+ '[attr.aria-labelledby]': '_labeledBy()',
11
20
  },
12
21
  template: `
13
22
  <ng-content />
14
23
  `,
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ encapsulation: ViewEncapsulation.None,
15
26
  })
16
27
  export class HlmTableComponent {
17
28
  @Input({ transform: booleanAttribute })
@@ -23,8 +34,15 @@ export class HlmTableComponent {
23
34
  this._userCls.set(inputs);
24
35
  }
25
36
 
37
+ protected readonly _labeledBy = signal<string | null | undefined>(undefined);
38
+ // eslint-disable-next-line @angular-eslint/no-input-rename
39
+ @Input({ alias: 'aria-labelledby' })
40
+ set labeledBy(value: string | null | undefined) {
41
+ this._labeledBy.set(value);
42
+ }
43
+
26
44
  protected _computedClass = computed(() => this._generateClass());
27
45
  private _generateClass() {
28
- return hlm('flex flex-col [&_hlm-trow:last-child]:border-0', this._userCls());
46
+ return hlm('flex flex-col text-sm [&_hlm-trow:last-child]:border-0', this._userCls());
29
47
  }
30
48
  }
@@ -7,11 +7,12 @@ export class HlmTableDirective {
7
7
 
8
8
  constructor() {
9
9
  this._tableClassesSettable?.setTableClasses({
10
- table: 'flex flex-col [&_cdk-row:last-child]:border-0',
10
+ table: 'flex flex-col text-sm [&_cdk-row:last-child]:border-0',
11
11
  headerRow:
12
- 'flex min-w-[100%] w-fit border-b border-border [&.cdk-table-sticky]:bg-background [&.cdk-table-sticky]:hover:bg-muted',
12
+ 'flex min-w-[100%] w-fit border-b border-border [&.cdk-table-sticky]:bg-background ' +
13
+ '[&.cdk-table-sticky>*]:z-[101] [&.cdk-table-sticky]:before:z-0 [&.cdk-table-sticky]:before:block [&.cdk-table-sticky]:hover:before:bg-muted/50 [&.cdk-table-sticky]:before:absolute [&.cdk-table-sticky]:before:inset-0',
13
14
  bodyRow:
14
- 'flex min-w-[100%] w-fit border-b border-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
15
+ 'flex min-w-[100%] w-fit border-b border-border transition-[background-color] hover:bg-muted/50 [&:has([role=checkbox][aria-checked=true])]:bg-muted',
15
16
  });
16
17
  }
17
18
  }
@@ -1,12 +1,20 @@
1
- import { NgIf, NgTemplateOutlet } from '@angular/common';
2
- import { Component, Input, booleanAttribute, computed, signal } from '@angular/core';
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import {
3
+ booleanAttribute,
4
+ ChangeDetectionStrategy,
5
+ Component,
6
+ computed,
7
+ Input,
8
+ signal,
9
+ ViewEncapsulation,
10
+ } from '@angular/core';
3
11
  import { hlm } from '@spartan-ng/ui-core';
4
12
  import { ClassValue } from 'clsx';
5
13
 
6
14
  @Component({
7
15
  selector: 'hlm-td',
8
16
  standalone: true,
9
- imports: [NgTemplateOutlet, NgIf],
17
+ imports: [NgTemplateOutlet],
10
18
  host: {
11
19
  '[class]': '_computedClass()',
12
20
  },
@@ -14,24 +22,28 @@ import { ClassValue } from 'clsx';
14
22
  <ng-template #content>
15
23
  <ng-content />
16
24
  </ng-template>
17
- <span *ngIf="truncate" class="flex-1 truncate">
25
+ @if (truncate) {
26
+ <span class="flex-1 truncate">
27
+ <ng-container [ngTemplateOutlet]="content" />
28
+ </span>
29
+ } @else {
18
30
  <ng-container [ngTemplateOutlet]="content" />
19
- </span>
20
- <ng-container *ngIf="!truncate" [ngTemplateOutlet]="content" />
31
+ }
21
32
  `,
33
+ changeDetection: ChangeDetectionStrategy.OnPush,
34
+ encapsulation: ViewEncapsulation.None,
22
35
  })
23
36
  export class HlmTdComponent {
24
37
  @Input({ transform: booleanAttribute })
25
38
  public truncate = false;
26
39
 
27
40
  private readonly _userCls = signal<ClassValue>('');
41
+ protected readonly _computedClass = computed(() =>
42
+ hlm('flex flex-none p-4 items-center [&:has([role=checkbox])]:pr-0', this._userCls()),
43
+ );
44
+
28
45
  @Input()
29
46
  set class(inputs: ClassValue) {
30
47
  this._userCls.set(inputs);
31
48
  }
32
-
33
- protected _computedClass = computed(() => this._generateClass());
34
- private _generateClass() {
35
- return hlm('flex flex-none p-2 items-center [&:has([role=checkbox])]:pr-0', this._userCls());
36
- }
37
49
  }
@@ -1,5 +1,13 @@
1
1
  import { NgIf, NgTemplateOutlet } from '@angular/common';
2
- import { Component, Input, booleanAttribute, computed, signal } from '@angular/core';
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ Input,
6
+ ViewEncapsulation,
7
+ booleanAttribute,
8
+ computed,
9
+ signal,
10
+ } from '@angular/core';
3
11
  import { hlm } from '@spartan-ng/ui-core';
4
12
  import { ClassValue } from 'clsx';
5
13
 
@@ -19,6 +27,8 @@ import { ClassValue } from 'clsx';
19
27
  </span>
20
28
  <ng-container *ngIf="!truncate" [ngTemplateOutlet]="content" />
21
29
  `,
30
+ changeDetection: ChangeDetectionStrategy.OnPush,
31
+ encapsulation: ViewEncapsulation.None,
22
32
  })
23
33
  export class HlmThComponent {
24
34
  @Input({ transform: booleanAttribute })
@@ -33,7 +43,7 @@ export class HlmThComponent {
33
43
  protected _computedClass = computed(() => this._generateClass());
34
44
  private _generateClass() {
35
45
  return hlm(
36
- 'flex flex-none h-12 px-2 text-sm items-center font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
46
+ 'flex flex-none h-12 px-4 text-sm items-center font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
37
47
  this._userCls(),
38
48
  );
39
49
  }
@@ -1,4 +1,12 @@
1
- import { booleanAttribute, Component, computed, Input, signal } from '@angular/core';
1
+ import {
2
+ booleanAttribute,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ Input,
7
+ signal,
8
+ ViewEncapsulation,
9
+ } from '@angular/core';
2
10
  import { hlm } from '@spartan-ng/ui-core';
3
11
  import { ClassValue } from 'clsx';
4
12
 
@@ -12,6 +20,8 @@ import { ClassValue } from 'clsx';
12
20
  template: `
13
21
  <ng-content />
14
22
  `,
23
+ changeDetection: ChangeDetectionStrategy.OnPush,
24
+ encapsulation: ViewEncapsulation.None,
15
25
  })
16
26
  export class HlmTrowComponent {
17
27
  @Input({ transform: booleanAttribute })