@spartan-ng/cli 0.0.1-alpha.336 → 0.0.1-alpha.338

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 (164) hide show
  1. package/package.json +4 -4
  2. package/src/generators/base/generator.js +8 -3
  3. package/src/generators/base/generator.js.map +1 -1
  4. package/src/generators/base/lib/build-dependency-array.js +1 -0
  5. package/src/generators/base/lib/build-dependency-array.js.map +1 -1
  6. package/src/generators/base/versions.d.ts +2 -1
  7. package/src/generators/base/versions.js +3 -2
  8. package/src/generators/base/versions.js.map +1 -1
  9. package/src/generators/theme/libs/add-theme-to-application-styles.js.map +1 -1
  10. package/src/generators/ui/generator.js +9 -2
  11. package/src/generators/ui/generator.js.map +1 -1
  12. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.directive.ts.template +3 -8
  13. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.directive.ts.template +7 -11
  14. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-item.directive.ts.template +9 -9
  15. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-trigger.directive.ts.template +3 -8
  16. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion.directive.ts.template +4 -9
  17. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-cancel-button.directive.ts.template +3 -8
  18. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-content.component.ts.template +3 -8
  19. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-description.directive.ts.template +3 -8
  20. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-footer.component.ts.template +3 -7
  21. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-header.component.ts.template +3 -7
  22. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-overlay.directive.ts.template +3 -7
  23. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-title.directive.ts.template +3 -7
  24. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog.component.ts.template +1 -2
  25. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-description.directive.ts.template +3 -11
  26. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-title.directive.ts.template +3 -11
  27. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert.directive.ts.template +3 -11
  28. package/src/generators/ui/libs/ui-aspect-ratio-helm/files/lib/helm-aspect-ratio.directive.ts.template +3 -8
  29. package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.spec.ts.template +10 -6
  30. package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.ts.template +5 -11
  31. package/src/generators/ui/libs/ui-avatar-helm/files/lib/image/hlm-avatar-image.directive.ts.template +3 -11
  32. package/src/generators/ui/libs/ui-badge-helm/files/lib/hlm-badge.directive.ts.template +5 -14
  33. package/src/generators/ui/libs/ui-button-helm/files/.DS_Store.template +0 -0
  34. package/src/generators/ui/libs/ui-button-helm/files/lib/hlm-button.directive.ts.template +11 -11
  35. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-content.directive.ts.template +3 -11
  36. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-description.directive.ts.template +3 -11
  37. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-footer.directive.ts.template +4 -16
  38. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-header.directive.ts.template +4 -16
  39. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-title.directive.ts.template +3 -11
  40. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card.directive.ts.template +3 -11
  41. package/src/generators/ui/libs/ui-carousel-helm/files/index.ts.template +26 -0
  42. package/src/generators/ui/libs/ui-carousel-helm/files/lib/hlm-carousel-content.component.ts.template +25 -0
  43. package/src/generators/ui/libs/ui-carousel-helm/files/lib/hlm-carousel-item.component.ts.template +26 -0
  44. package/src/generators/ui/libs/ui-carousel-helm/files/lib/hlm-carousel-next.component.ts.template +62 -0
  45. package/src/generators/ui/libs/ui-carousel-helm/files/lib/hlm-carousel-previous.component.ts.template +62 -0
  46. package/src/generators/ui/libs/ui-carousel-helm/files/lib/hlm-carousel.component.ts.template +93 -0
  47. package/src/generators/ui/libs/ui-carousel-helm/generator.d.ts +3 -0
  48. package/src/generators/ui/libs/ui-carousel-helm/generator.js +12 -0
  49. package/src/generators/ui/libs/ui-carousel-helm/generator.js.map +1 -0
  50. package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox-checkicon.component.ts.template +11 -20
  51. package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox.component.ts.template +50 -46
  52. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-dialog-close-button.directive.ts.template +3 -11
  53. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-dialog.directive.ts.template +8 -14
  54. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-empty.directive.ts.template +3 -11
  55. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-group.directive.ts.template +7 -13
  56. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-input-wrapper.component.ts.template +5 -14
  57. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-input.directive.ts.template +7 -12
  58. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-item-icon.directive.ts.template +3 -10
  59. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-item.directive.ts.template +7 -12
  60. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-list.directive.ts.template +3 -11
  61. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-shortcut.component.ts.template +5 -11
  62. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command.directive.ts.template +7 -13
  63. package/src/generators/ui/libs/ui-dialog-helm/files/.DS_Store.template +0 -0
  64. package/src/generators/ui/libs/ui-dialog-helm/files/index.ts.template +1 -0
  65. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-close.directive.ts.template +7 -13
  66. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.component.ts.template +24 -17
  67. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-description.directive.ts.template +3 -11
  68. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-footer.component.ts.template +5 -11
  69. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-header.component.ts.template +5 -11
  70. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-overlay.directive.ts.template +9 -13
  71. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-title.directive.ts.template +3 -11
  72. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog.component.ts.template +1 -2
  73. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog.service.ts.template +35 -0
  74. package/src/generators/ui/libs/ui-hover-card-helm/files/lib/hlm-hover-card-content.component.ts.template +3 -10
  75. package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.spec.ts.template +3 -3
  76. package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.ts.template +4 -4
  77. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input-error.directive.ts.template +3 -11
  78. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input.directive.ts.template +5 -10
  79. package/src/generators/ui/libs/ui-label-helm/files/lib/hlm-label.directive.ts.template +4 -10
  80. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar-item.directive.ts.template +7 -13
  81. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar.component.ts.template +5 -11
  82. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-check.component.ts.template +12 -14
  83. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-checkbox.directive.ts.template +8 -21
  84. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-icon.directive.ts.template +3 -10
  85. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.component.ts.template +12 -14
  86. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.directive.ts.template +8 -21
  87. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-sub-indicator.component.ts.template +6 -14
  88. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item.directive.ts.template +5 -15
  89. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-label.component.ts.template +5 -11
  90. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-separator.component.ts.template +3 -11
  91. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-shortcut.component.ts.template +5 -11
  92. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu.component.ts.template +4 -12
  93. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-sub-menu.component.ts.template +7 -13
  94. package/src/generators/ui/libs/ui-pagination-helm/files/index.ts.template +33 -0
  95. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-content.directive.ts.template +21 -0
  96. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-ellipsis.componet.ts.template +23 -0
  97. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-item.directive.ts.template +22 -0
  98. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-link.directive.ts.template +56 -0
  99. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-next.componet.ts.template +31 -0
  100. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-previous.componet.ts.template +31 -0
  101. package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination.directive.ts.template +25 -0
  102. package/src/generators/ui/libs/ui-pagination-helm/generator.d.ts +3 -0
  103. package/src/generators/ui/libs/ui-pagination-helm/generator.js +12 -0
  104. package/src/generators/ui/libs/ui-pagination-helm/generator.js.map +1 -0
  105. package/src/generators/ui/libs/ui-popover-helm/files/lib/hlm-popover-close.directive.ts.template +7 -13
  106. package/src/generators/ui/libs/ui-popover-helm/files/lib/hlm-popover-content.directive.ts.template +7 -13
  107. package/src/generators/ui/libs/ui-progress-helm/files/lib/hlm-progress-indicator.directive.ts.template +5 -11
  108. package/src/generators/ui/libs/ui-progress-helm/files/lib/hlm-progress.directive.ts.template +5 -11
  109. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio-group.directive.ts.template +3 -11
  110. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio-indicator.component.ts.template +3 -11
  111. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio.directive.ts.template +5 -11
  112. package/src/generators/ui/libs/ui-select-helm/files/index.ts.template +38 -0
  113. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-content.directive.ts.template +34 -0
  114. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-group.directive.ts.template +22 -0
  115. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-label.directive.ts.template +38 -0
  116. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-option.component.ts.template +54 -0
  117. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-scroll-down.component.ts.template +17 -0
  118. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-scroll-up.component.ts.template +17 -0
  119. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-trigger.component.ts.template +44 -0
  120. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-value.directive.ts.template +26 -0
  121. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select.directive.ts.template +21 -0
  122. package/src/generators/ui/libs/ui-select-helm/generator.d.ts +3 -0
  123. package/src/generators/ui/libs/ui-select-helm/generator.js +12 -0
  124. package/src/generators/ui/libs/ui-select-helm/generator.js.map +1 -0
  125. package/src/generators/ui/libs/ui-separator-helm/files/lib/hlm-separator.directive.ts.template +7 -13
  126. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-close.directive.ts.template +7 -13
  127. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-content.component.ts.template +6 -14
  128. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-description.directive.ts.template +3 -11
  129. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-footer.component.ts.template +5 -11
  130. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-header.component.ts.template +3 -11
  131. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-overlay.directive.ts.template +11 -17
  132. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-title.directive.ts.template +3 -11
  133. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet.component.ts.template +1 -2
  134. package/src/generators/ui/libs/ui-skeleton-helm/files/lib/hlm-skeleton.component.ts.template +3 -11
  135. package/src/generators/ui/libs/ui-spinner-helm/files/lib/hlm-spinner.component.ts.template +5 -11
  136. package/src/generators/ui/libs/ui-switch-helm/files/lib/hlm-switch-thumb.directive.ts.template +7 -13
  137. package/src/generators/ui/libs/ui-switch-helm/files/lib/hlm-switch.component.ts.template +19 -14
  138. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-caption.component.ts.template +10 -28
  139. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.component.ts.template +11 -27
  140. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-td.component.ts.template +8 -12
  141. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-th.component.ts.template +22 -23
  142. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-trow.component.ts.template +7 -24
  143. package/src/generators/ui/libs/ui-tabs-helm/files/index.ts.template +8 -1
  144. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-content.directive.ts.template +9 -21
  145. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-list.component.ts.template +5 -17
  146. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-trigger.directive.ts.template +9 -21
  147. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs.component.ts.template +17 -0
  148. package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle-group.directive.ts.template +7 -13
  149. package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle.directive.ts.template +5 -11
  150. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-blockquote.directive.ts.template +3 -11
  151. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-code.directive.ts.template +3 -11
  152. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h1.directive.ts.template +3 -11
  153. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h2.directive.ts.template +3 -11
  154. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h3.directive.ts.template +3 -11
  155. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h4.directive.ts.template +3 -11
  156. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-large.directive.ts.template +3 -11
  157. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-lead.directive.ts.template +3 -11
  158. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-muted.directive.ts.template +3 -11
  159. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-p.directive.ts.template +3 -11
  160. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-small.directive.ts.template +3 -11
  161. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-ul.directive.ts.template +3 -11
  162. package/src/generators/ui/supported-ui-libraries.json +115 -81
  163. package/src/utils/get-project-names.js.map +1 -1
  164. package/src/utils/version-utils.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import { Component } from '@angular/core';
1
+ import { Component, Input } from '@angular/core';
2
2
  import { ComponentFixture, TestBed } from '@angular/core/testing';
3
3
  import { BrnAvatarFallbackDirective, BrnAvatarImageDirective } from '@spartan-ng/ui-avatar-brain';
4
4
  import { HlmAvatarComponent } from './hlm-avatar.component';
@@ -7,13 +7,15 @@ import { HlmAvatarComponent } from './hlm-avatar.component';
7
7
  selector: 'hlm-mock',
8
8
  imports: [BrnAvatarImageDirective, BrnAvatarFallbackDirective, HlmAvatarComponent],
9
9
  template: `
10
- <hlm-avatar id="fallbackOnly">
10
+ <hlm-avatar [class]="class" id="fallbackOnly">
11
11
  <span brnAvatarFallback>fallback</span>
12
12
  </hlm-avatar>
13
13
  `,
14
14
  standalone: true,
15
15
  })
16
- class MockComponent {}
16
+ class MockComponent {
17
+ @Input() class = '';
18
+ }
17
19
 
18
20
  describe('HlmAvatarComponent', () => {
19
21
  let component: HlmAvatarComponent;
@@ -34,9 +36,11 @@ describe('HlmAvatarComponent', () => {
34
36
  });
35
37
 
36
38
  it('should add any user defined classes', () => {
37
- component.class = 'test-class';
38
- fixture.detectChanges();
39
- expect(fixture.nativeElement.className).toContain('test-class');
39
+ const mockFixture = TestBed.createComponent(MockComponent);
40
+ mockFixture.componentRef.setInput('class', 'test-class');
41
+ mockFixture.detectChanges();
42
+ const avatar = mockFixture.nativeElement.querySelector('hlm-avatar');
43
+ expect(avatar.className).toContain('test-class');
40
44
  });
41
45
 
42
46
  it('should change the size when the variant is changed', () => {
@@ -1,4 +1,4 @@
1
- import { ChangeDetectionStrategy, Component, computed, Input, signal, ViewEncapsulation } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, computed, input, Input, signal, ViewEncapsulation } from '@angular/core';
2
2
  import { BrnAvatarComponent } from '@spartan-ng/ui-avatar-brain';
3
3
  import { hlm } from '@spartan-ng/ui-core';
4
4
  import { cva, VariantProps } from 'class-variance-authority';
@@ -36,20 +36,14 @@ type AvatarVariants = VariantProps<typeof avatarVariants>;
36
36
  `,
37
37
  })
38
38
  export class HlmAvatarComponent extends BrnAvatarComponent {
39
- private readonly _userCls = signal<ClassValue>('');
40
-
41
- @Input()
42
- set class(userCls: ClassValue) {
43
- this._userCls.set(userCls);
44
- }
39
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
40
+ protected readonly _computedClass = computed(() =>
41
+ hlm(avatarVariants({ variant: this._variant() }), this.userClass()),
42
+ );
45
43
 
46
44
  private readonly _variant = signal<AvatarVariants['variant']>('medium');
47
45
  @Input()
48
46
  set variant(variant: AvatarVariants['variant']) {
49
47
  this._variant.set(variant);
50
48
  }
51
-
52
- protected readonly _computedClass = computed(() =>
53
- hlm(avatarVariants({ variant: this._variant() }), this._userCls()),
54
- );
55
49
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, inject, Input, signal } from '@angular/core';
1
+ import { computed, Directive, inject, input } from '@angular/core';
2
2
  import { BrnAvatarImageDirective } from '@spartan-ng/ui-avatar-brain';
3
3
  import { hlm } from '@spartan-ng/ui-core';
4
4
  import { ClassValue } from 'clsx';
@@ -15,14 +15,6 @@ import { ClassValue } from 'clsx';
15
15
  export class HlmAvatarImageDirective {
16
16
  canShow = inject(BrnAvatarImageDirective).canShow;
17
17
 
18
- private readonly _userCls = signal<ClassValue>('');
19
- @Input()
20
- set class(userCls: ClassValue) {
21
- this._userCls.set(userCls);
22
- }
23
-
24
- protected _computedClass = computed(() => this._generateClass());
25
- private _generateClass() {
26
- return hlm('aspect-square object-cover h-full w-full', this._userCls());
27
- }
18
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
19
+ protected _computedClass = computed(() => hlm('aspect-square object-cover h-full w-full', this.userClass()));
28
20
  }
@@ -1,4 +1,4 @@
1
- import { booleanAttribute, computed, Directive, Input, signal } from '@angular/core';
1
+ import { booleanAttribute, computed, Directive, Input, input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -53,11 +53,10 @@ type badgeVariants = VariantProps<typeof badgeVariants>;
53
53
  },
54
54
  })
55
55
  export class HlmBadgeDirective {
56
- private readonly _userCls = signal<ClassValue>('');
57
- @Input()
58
- set class(userCls: ClassValue) {
59
- this._userCls.set(userCls);
60
- }
56
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
57
+ protected _computedClass = computed(() =>
58
+ hlm(badgeVariants({ variant: this._variant(), size: this._size(), static: this._static() }), this.userClass()),
59
+ );
61
60
 
62
61
  private readonly _variant = signal<badgeVariants['variant']>('default');
63
62
  @Input()
@@ -76,12 +75,4 @@ export class HlmBadgeDirective {
76
75
  set size(size: badgeVariants['size']) {
77
76
  this._size.set(size);
78
77
  }
79
-
80
- protected _computedClass = computed(() => this._generateClass());
81
- private _generateClass() {
82
- return hlm(
83
- badgeVariants({ variant: this._variant(), size: this._size(), static: this._static() }),
84
- this._userCls(),
85
- );
86
- }
87
78
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input, Input, signal } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -28,7 +28,7 @@ export const buttonVariants = cva(
28
28
  },
29
29
  },
30
30
  );
31
- type ButtonVariants = VariantProps<typeof buttonVariants>;
31
+ export type ButtonVariants = VariantProps<typeof buttonVariants>;
32
32
 
33
33
  @Directive({
34
34
  selector: '[hlmBtn]',
@@ -38,10 +38,15 @@ type ButtonVariants = VariantProps<typeof buttonVariants>;
38
38
  },
39
39
  })
40
40
  export class HlmButtonDirective {
41
- private readonly _userCls = signal<ClassValue>('');
42
- @Input()
43
- set class(userCls: ClassValue) {
44
- this._userCls.set(userCls);
41
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
42
+ private readonly _settableClass = signal<ClassValue>('');
43
+
44
+ protected _computedClass = computed(() =>
45
+ hlm(buttonVariants({ variant: this._variant(), size: this._size() }), this._settableClass(), this.userClass()),
46
+ );
47
+
48
+ setClass(value: ClassValue) {
49
+ this._settableClass.set(value);
45
50
  }
46
51
 
47
52
  private readonly _variant = signal<ButtonVariants['variant']>('default');
@@ -55,9 +60,4 @@ export class HlmButtonDirective {
55
60
  set size(size: ButtonVariants['size']) {
56
61
  this._size.set(size);
57
62
  }
58
-
59
- protected _computedClass = computed(() => this._generateClass());
60
- private _generateClass() {
61
- return hlm(buttonVariants({ variant: this._variant(), size: this._size() }), this._userCls());
62
- }
63
63
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -17,14 +17,6 @@ export type CardContentVariants = VariantProps<typeof cardContentVariants>;
17
17
  },
18
18
  })
19
19
  export class HlmCardContentDirective {
20
- private readonly _userCls = signal<ClassValue>('');
21
- @Input()
22
- set class(userCls: ClassValue) {
23
- this._userCls.set(userCls);
24
- }
25
-
26
- protected _computedClass = computed(() => this._generateClass());
27
- private _generateClass() {
28
- return hlm(cardContentVariants(), this._userCls());
29
- }
20
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
21
+ protected _computedClass = computed(() => hlm(cardContentVariants(), this.userClass()));
30
22
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -17,14 +17,6 @@ export type CardDescriptionVariants = VariantProps<typeof cardDescriptionVariant
17
17
  },
18
18
  })
19
19
  export class HlmCardDescriptionDirective {
20
- private readonly _userCls = signal<ClassValue>('');
21
- @Input()
22
- set class(userCls: ClassValue) {
23
- this._userCls.set(userCls);
24
- }
25
-
26
- protected _computedClass = computed(() => this._generateClass());
27
- private _generateClass() {
28
- return hlm(cardDescriptionVariants(), this._userCls());
29
- }
20
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
21
+ protected _computedClass = computed(() => hlm(cardDescriptionVariants(), this.userClass()));
30
22
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -24,20 +24,8 @@ export type CardFooterVariants = VariantProps<typeof cardFooterVariants>;
24
24
  },
25
25
  })
26
26
  export class HlmCardFooterDirective {
27
- private readonly _userCls = signal<ClassValue>('');
28
- @Input()
29
- set class(userCls: ClassValue) {
30
- this._userCls.set(userCls);
31
- }
27
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
28
+ protected _computedClass = computed(() => hlm(cardFooterVariants({ direction: this.direction() }), this.userClass()));
32
29
 
33
- private readonly _direction = signal<CardFooterVariants['direction']>('row');
34
- @Input()
35
- set direction(direction: CardFooterVariants['direction']) {
36
- this._direction.set(direction);
37
- }
38
-
39
- protected _computedClass = computed(() => this._generateClass());
40
- private _generateClass() {
41
- return hlm(cardFooterVariants({ direction: this._direction() }), this._userCls());
42
- }
30
+ public readonly direction = input<CardFooterVariants['direction']>('row');
43
31
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -24,20 +24,8 @@ export type CardHeaderVariants = VariantProps<typeof cardHeaderVariants>;
24
24
  },
25
25
  })
26
26
  export class HlmCardHeaderDirective {
27
- private readonly _userCls = signal<ClassValue>('');
28
- @Input()
29
- set class(userCls: ClassValue) {
30
- this._userCls.set(userCls);
31
- }
27
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
28
+ protected _computedClass = computed(() => hlm(cardHeaderVariants({ direction: this.direction() }), this.userClass()));
32
29
 
33
- private readonly _direction = signal<CardHeaderVariants['direction']>('column');
34
- @Input()
35
- set direction(direction: CardHeaderVariants['direction']) {
36
- this._direction.set(direction);
37
- }
38
-
39
- protected _computedClass = computed(() => this._generateClass());
40
- private _generateClass() {
41
- return hlm(cardHeaderVariants({ direction: this._direction() }), this._userCls());
42
- }
30
+ public readonly direction = input<CardHeaderVariants['direction']>('column');
43
31
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -17,14 +17,6 @@ export type CardTitleVariants = VariantProps<typeof cardTitleVariants>;
17
17
  },
18
18
  })
19
19
  export class HlmCardTitleDirective {
20
- private readonly _userCls = signal<ClassValue>('');
21
- @Input()
22
- set class(userCls: ClassValue) {
23
- this._userCls.set(userCls);
24
- }
25
-
26
- protected _computedClass = computed(() => this._generateClass());
27
- private _generateClass() {
28
- return hlm(cardTitleVariants(), this._userCls());
29
- }
20
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
21
+ protected _computedClass = computed(() => hlm(cardTitleVariants(), this.userClass()));
30
22
  }
@@ -1,4 +1,4 @@
1
- import { computed, Directive, Input, signal } from '@angular/core';
1
+ import { computed, Directive, input } from '@angular/core';
2
2
  import { hlm } from '@spartan-ng/ui-core';
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
4
  import { ClassValue } from 'clsx';
@@ -20,14 +20,6 @@ export type CardVariants = VariantProps<typeof cardVariants>;
20
20
  },
21
21
  })
22
22
  export class HlmCardDirective {
23
- private readonly _userCls = signal<ClassValue>('');
24
- @Input()
25
- set class(userCls: ClassValue) {
26
- this._userCls.set(userCls);
27
- }
28
-
29
- protected _computedClass = computed(() => this._generateClass());
30
- private _generateClass() {
31
- return hlm(cardVariants(), this._userCls());
32
- }
23
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
24
+ protected _computedClass = computed(() => hlm(cardVariants(), this.userClass()));
33
25
  }
@@ -0,0 +1,26 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { HlmCarouselContentComponent } from './lib/hlm-carousel-content.component';
3
+ import { HlmCarouselItemComponent } from './lib/hlm-carousel-item.component';
4
+ import { HlmCarouselNextComponent } from './lib/hlm-carousel-next.component';
5
+ import { HlmCarouselPreviousComponent } from './lib/hlm-carousel-previous.component';
6
+ import { HlmCarouselComponent } from './lib/hlm-carousel.component';
7
+
8
+ export * from './lib/hlm-carousel-content.component';
9
+ export * from './lib/hlm-carousel-item.component';
10
+ export * from './lib/hlm-carousel-next.component';
11
+ export * from './lib/hlm-carousel-previous.component';
12
+ export * from './lib/hlm-carousel.component';
13
+
14
+ export const HlmCarouselImports = [
15
+ HlmCarouselComponent,
16
+ HlmCarouselContentComponent,
17
+ HlmCarouselItemComponent,
18
+ HlmCarouselPreviousComponent,
19
+ HlmCarouselNextComponent,
20
+ ] as const;
21
+
22
+ @NgModule({
23
+ imports: [...HlmCarouselImports],
24
+ exports: [...HlmCarouselImports],
25
+ })
26
+ export class HlmCarouselModule {}
@@ -0,0 +1,25 @@
1
+ import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { ClassValue } from 'clsx';
4
+ import { HlmCarouselComponent } from './hlm-carousel.component';
5
+
6
+ @Component({
7
+ selector: 'hlm-carousel-content',
8
+ standalone: true,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ encapsulation: ViewEncapsulation.None,
11
+ host: {
12
+ '[class]': '_computedClass()',
13
+ },
14
+ template: `
15
+ <ng-content />
16
+ `,
17
+ })
18
+ export class HlmCarouselContentComponent {
19
+ private orientation = inject(HlmCarouselComponent).orientation;
20
+
21
+ _userClass = input<ClassValue>('', { alias: 'class' });
22
+ protected _computedClass = computed(() =>
23
+ hlm('flex', this.orientation() === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', this._userClass()),
24
+ );
25
+ }
@@ -0,0 +1,26 @@
1
+ import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { ClassValue } from 'clsx';
4
+ import { HlmCarouselComponent } from './hlm-carousel.component';
5
+
6
+ @Component({
7
+ selector: 'hlm-carousel-item',
8
+ standalone: true,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ encapsulation: ViewEncapsulation.None,
11
+ host: {
12
+ '[class]': '_computedClass()',
13
+ role: 'group',
14
+ 'aria-roledescription': 'slide',
15
+ },
16
+ template: `
17
+ <ng-content />
18
+ `,
19
+ })
20
+ export class HlmCarouselItemComponent {
21
+ _userClass = input<ClassValue>('', { alias: 'class' });
22
+ private orientation = inject(HlmCarouselComponent).orientation;
23
+ protected _computedClass = computed(() =>
24
+ hlm('min-w-0 shrink-0 grow-0 basis-full', this.orientation() === 'horizontal' ? 'pl-4' : 'pt-4', this._userClass()),
25
+ );
26
+ }
@@ -0,0 +1,62 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ViewEncapsulation,
5
+ computed,
6
+ effect,
7
+ inject,
8
+ input,
9
+ untracked,
10
+ } from '@angular/core';
11
+ import { lucideArrowRight } from '@ng-icons/lucide';
12
+ import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
13
+ import { hlm } from '@spartan-ng/ui-core';
14
+ import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
15
+ import { ClassValue } from 'clsx';
16
+ import { HlmCarouselComponent } from './hlm-carousel.component';
17
+
18
+ @Component({
19
+ // eslint-disable-next-line @angular-eslint/component-selector
20
+ selector: 'button[hlm-carousel-next], button[hlmCarouselNext]',
21
+ standalone: true,
22
+ changeDetection: ChangeDetectionStrategy.OnPush,
23
+ encapsulation: ViewEncapsulation.None,
24
+ host: {
25
+ '[disabled]': 'isDisabled()',
26
+ '(click)': 'carousel.scrollNext()',
27
+ },
28
+ hostDirectives: [{ directive: HlmButtonDirective, inputs: ['variant', 'size'] }],
29
+ providers: [provideIcons({ lucideArrowRight })],
30
+ imports: [HlmIconComponent],
31
+ template: `
32
+ <hlm-icon size="sm" name="lucideArrowRight" />
33
+ <span class="sr-only">Next slide</span>
34
+ `,
35
+ })
36
+ export class HlmCarouselNextComponent {
37
+ protected carousel = inject(HlmCarouselComponent);
38
+ _userClass = input<ClassValue>('', { alias: 'class' });
39
+ protected _computedClass = computed(() =>
40
+ hlm(
41
+ 'absolute h-8 w-8 rounded-full',
42
+ this.carousel.orientation() === 'horizontal'
43
+ ? '-right-12 top-1/2 -translate-y-1/2'
44
+ : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
45
+ this._userClass(),
46
+ ),
47
+ );
48
+ protected isDisabled = () => !this.carousel.canScrollNext();
49
+
50
+ constructor() {
51
+ const button = inject(HlmButtonDirective);
52
+
53
+ button.variant = 'outline';
54
+ button.size = 'icon';
55
+
56
+ effect(() => {
57
+ const computedClass = this._computedClass();
58
+
59
+ untracked(() => button.setClass(computedClass));
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,62 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ViewEncapsulation,
5
+ computed,
6
+ effect,
7
+ inject,
8
+ input,
9
+ untracked,
10
+ } from '@angular/core';
11
+ import { lucideArrowLeft } from '@ng-icons/lucide';
12
+ import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
13
+ import { hlm } from '@spartan-ng/ui-core';
14
+ import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
15
+ import { ClassValue } from 'clsx';
16
+ import { HlmCarouselComponent } from './hlm-carousel.component';
17
+
18
+ @Component({
19
+ // eslint-disable-next-line @angular-eslint/component-selector
20
+ selector: 'button[hlm-carousel-previous], button[hlmCarouselPrevious]',
21
+ standalone: true,
22
+ changeDetection: ChangeDetectionStrategy.OnPush,
23
+ encapsulation: ViewEncapsulation.None,
24
+ host: {
25
+ '[disabled]': 'isDisabled()',
26
+ '(click)': 'carousel.scrollPrev()',
27
+ },
28
+ hostDirectives: [{ directive: HlmButtonDirective, inputs: ['variant', 'size'] }],
29
+ providers: [provideIcons({ lucideArrowLeft })],
30
+ imports: [HlmIconComponent],
31
+ template: `
32
+ <hlm-icon size="sm" name="lucideArrowLeft" />
33
+ <span class="sr-only">Previous slide</span>
34
+ `,
35
+ })
36
+ export class HlmCarouselPreviousComponent {
37
+ protected carousel = inject(HlmCarouselComponent);
38
+ _userClass = input<ClassValue>('', { alias: 'class' });
39
+ protected _computedClass = computed(() =>
40
+ hlm(
41
+ 'absolute h-8 w-8 rounded-full',
42
+ this.carousel.orientation() === 'horizontal'
43
+ ? '-left-12 top-1/2 -translate-y-1/2'
44
+ : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
45
+ this._userClass(),
46
+ ),
47
+ );
48
+ protected isDisabled = () => !this.carousel.canScrollPrev();
49
+
50
+ constructor() {
51
+ const button = inject(HlmButtonDirective);
52
+
53
+ button.variant = 'outline';
54
+ button.size = 'icon';
55
+
56
+ effect(() => {
57
+ const computedClass = this._computedClass();
58
+
59
+ untracked(() => button.setClass(computedClass));
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,93 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ HostListener,
5
+ InputSignal,
6
+ Signal,
7
+ ViewChild,
8
+ ViewEncapsulation,
9
+ computed,
10
+ input,
11
+ signal,
12
+ } from '@angular/core';
13
+ import { hlm } from '@spartan-ng/ui-core';
14
+ import { ClassValue } from 'clsx';
15
+ import { EmblaCarouselDirective, EmblaEventType, EmblaPluginType, type EmblaOptionsType } from 'embla-carousel-angular';
16
+
17
+ @Component({
18
+ selector: 'hlm-carousel',
19
+ standalone: true,
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ encapsulation: ViewEncapsulation.None,
22
+ host: {
23
+ '[class]': '_computedClass()',
24
+ role: 'region',
25
+ 'aria-roledescription': 'carousel',
26
+ },
27
+ imports: [EmblaCarouselDirective],
28
+ template: `
29
+ <div
30
+ emblaCarousel
31
+ class="overflow-hidden"
32
+ [plugins]="plugins()"
33
+ [options]="emblaOptions()"
34
+ [subscribeToEvents]="['init', 'select', 'reInit']"
35
+ (emblaChange)="onEmblaEvent($event)"
36
+ >
37
+ <ng-content select="hlm-carousel-content" />
38
+ </div>
39
+ <ng-content />
40
+ `,
41
+ })
42
+ export class HlmCarouselComponent {
43
+ @ViewChild(EmblaCarouselDirective) protected emblaCarousel?: EmblaCarouselDirective;
44
+
45
+ _userClass = input<ClassValue>('', { alias: 'class' });
46
+ protected _computedClass = computed(() => hlm('relative', this._userClass()));
47
+
48
+ orientation = input<'horizontal' | 'vertical'>('horizontal');
49
+ options: InputSignal<Omit<EmblaOptionsType, 'axis'> | undefined> = input();
50
+ plugins: InputSignal<EmblaPluginType[]> = input([] as EmblaPluginType[]);
51
+
52
+ protected emblaOptions: Signal<EmblaOptionsType> = computed(() => ({
53
+ ...this.options(),
54
+ axis: this.orientation() === 'horizontal' ? 'x' : 'y',
55
+ }));
56
+
57
+ private _canScrollPrev = signal(false);
58
+ canScrollPrev = this._canScrollPrev.asReadonly();
59
+ private _canScrollNext = signal(false);
60
+ canScrollNext = this._canScrollNext.asReadonly();
61
+
62
+ protected onEmblaEvent(event: EmblaEventType) {
63
+ const emblaApi = this.emblaCarousel?.emblaApi;
64
+
65
+ if (!emblaApi) {
66
+ return;
67
+ }
68
+
69
+ if (event === 'select' || event === 'init' || event === 'reInit') {
70
+ this._canScrollPrev.set(emblaApi.canScrollPrev());
71
+ this._canScrollNext.set(emblaApi.canScrollNext());
72
+ }
73
+ }
74
+
75
+ @HostListener('keydown', ['$event'])
76
+ protected onKeydown(event: KeyboardEvent) {
77
+ if (event.key === 'ArrowLeft') {
78
+ event.preventDefault();
79
+ this.emblaCarousel?.scrollPrev();
80
+ } else if (event.key === 'ArrowRight') {
81
+ event.preventDefault();
82
+ this.emblaCarousel?.scrollNext();
83
+ }
84
+ }
85
+
86
+ scrollPrev() {
87
+ this.emblaCarousel?.scrollPrev();
88
+ }
89
+
90
+ scrollNext() {
91
+ this.emblaCarousel?.scrollNext();
92
+ }
93
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { HlmBaseGeneratorSchema } from '../../../base/schema';
3
+ export declare function generator(tree: Tree, options: HlmBaseGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const generator_1 = require("../../../base/generator");
6
+ function generator(tree, options) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ return yield (0, generator_1.default)(tree, Object.assign(Object.assign({}, options), { primitiveName: 'carousel', internalName: 'ui-carousel-helm', publicName: 'ui-carousel-helm' }));
9
+ });
10
+ }
11
+ exports.generator = generator;
12
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/ui-carousel-helm/generator.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AAGvD,SAAsB,SAAS,CAAC,IAAU,EAAE,OAA+B;;QAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,kCAC9B,OAAO,KACV,aAAa,EAAE,UAAU,EACzB,YAAY,EAAE,kBAAkB,EAChC,UAAU,EAAE,kBAAkB,IAC7B,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}