@spartan-ng/cli 0.0.1-alpha.360 → 0.0.1-alpha.362

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 (51) hide show
  1. package/package.json +1 -1
  2. package/src/generators/base/versions.d.ts +20 -20
  3. package/src/generators/base/versions.js +20 -20
  4. package/src/generators/theme/libs/supported-theme-generator-map.js +24 -0
  5. package/src/generators/theme/libs/supported-theme-generator-map.js.map +1 -1
  6. package/src/generators/ui/add-dependent-primitive.d.ts +1 -0
  7. package/src/generators/ui/add-dependent-primitive.js +36 -0
  8. package/src/generators/ui/add-dependent-primitive.js.map +1 -0
  9. package/src/generators/ui/generator.js +3 -49
  10. package/src/generators/ui/generator.js.map +1 -1
  11. package/src/generators/ui/libs/ui-accordion-helm/files/index.ts.template +3 -3
  12. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.component.ts.template +38 -0
  13. package/src/generators/ui/libs/ui-button-helm/files/.DS_Store.template +0 -0
  14. package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox.component.ts.template +29 -5
  15. package/src/generators/ui/libs/ui-dialog-helm/files/.DS_Store.template +0 -0
  16. package/src/generators/ui/libs/ui-form-field-helm/files/index.ts.template +14 -0
  17. package/src/generators/ui/libs/ui-form-field-helm/files/lib/form-field.spec.ts.template +135 -0
  18. package/src/generators/ui/libs/ui-form-field-helm/files/lib/hlm-error.directive.ts.template +10 -0
  19. package/src/generators/ui/libs/ui-form-field-helm/files/lib/hlm-form-field.component.ts.template +41 -0
  20. package/src/generators/ui/libs/ui-form-field-helm/files/lib/hlm-hint.directive.ts.template +10 -0
  21. package/src/generators/ui/libs/ui-form-field-helm/generator.d.ts +3 -0
  22. package/src/generators/ui/libs/ui-form-field-helm/generator.js +12 -0
  23. package/src/generators/ui/libs/ui-form-field-helm/generator.js.map +1 -0
  24. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input.directive.ts.template +46 -2
  25. package/src/generators/ui/libs/ui-pagination-helm/files/index.ts.template +6 -6
  26. package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-trigger.component.ts.template +6 -5
  27. package/src/generators/ui/libs/ui-slider-helm/files/index.ts.template +11 -0
  28. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-input.directive.ts.template +19 -0
  29. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-thumb.directive.ts.template +27 -0
  30. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-tick-mark.directive.ts.template +29 -0
  31. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-tick-marks.directive.ts.template +17 -0
  32. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-active-fill.directive.ts.template +26 -0
  33. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-active.directive.ts.template +20 -0
  34. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-inactive.directive.ts.template +20 -0
  35. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track.component.ts.template +55 -0
  36. package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider.component.ts.template +28 -0
  37. package/src/generators/ui/libs/ui-slider-helm/generator.d.ts +3 -0
  38. package/src/generators/ui/libs/ui-slider-helm/generator.js +12 -0
  39. package/src/generators/ui/libs/ui-slider-helm/generator.js.map +1 -0
  40. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-paginated-list.component.ts.template +2 -2
  41. package/src/generators/ui/primivite-deps.d.ts +3 -0
  42. package/src/generators/ui/primivite-deps.js +58 -0
  43. package/src/generators/ui/primivite-deps.js.map +1 -0
  44. package/src/generators/ui/primivites.d.ts +1 -0
  45. package/src/generators/ui/primivites.js +3 -0
  46. package/src/generators/ui/primivites.js.map +1 -0
  47. package/src/generators/ui/supported-ui-libraries.json +79 -60
  48. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.directive.ts.template +0 -25
  49. /package/src/generators/ui/libs/ui-pagination-helm/files/lib/{hlm-pagination-ellipsis.componet.ts.template → hlm-pagination-ellipsis.component.ts.template} +0 -0
  50. /package/src/generators/ui/libs/ui-pagination-helm/files/lib/{hlm-pagination-next.componet.ts.template → hlm-pagination-next.component.ts.template} +0 -0
  51. /package/src/generators/ui/libs/ui-pagination-helm/files/lib/{hlm-pagination-previous.componet.ts.template → hlm-pagination-previous.component.ts.template} +0 -0
@@ -0,0 +1,135 @@
1
+ import { Component } from '@angular/core';
2
+ import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
3
+ import { render, screen } from '@testing-library/angular';
4
+ import userEvent from '@testing-library/user-event';
5
+
6
+ import { HlmInputDirective } from '@spartan-ng/ui-input-helm';
7
+
8
+ import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@spartan-ng/ui-forms-brain';
9
+ import { HlmErrorDirective } from './hlm-error.directive';
10
+ import { HlmFormFieldComponent } from './hlm-form-field.component';
11
+ import { HlmHintDirective } from './hlm-hint.directive';
12
+
13
+ const DIRECTIVES = [HlmFormFieldComponent, HlmErrorDirective, HlmHintDirective, HlmInputDirective];
14
+
15
+ @Component({
16
+ standalone: true,
17
+ selector: 'single-form-field-example',
18
+ imports: [ReactiveFormsModule, ...DIRECTIVES],
19
+ template: `
20
+ <hlm-form-field>
21
+ <input
22
+ data-testid="hlm-input"
23
+ aria-label="Your Name"
24
+ [formControl]="name"
25
+ class="w-80"
26
+ hlmInput
27
+ type="text"
28
+ placeholder="Your Name"
29
+ />
30
+ <hlm-error data-testid="hlm-error">Your name is required</hlm-error>
31
+ <hlm-hint data-testid="hlm-hint">This is your public display name.</hlm-hint>
32
+ </hlm-form-field>
33
+ `,
34
+ })
35
+ class SingleFormFieldMock {
36
+ name = new FormControl('', Validators.required);
37
+ }
38
+
39
+ @Component({
40
+ standalone: true,
41
+ selector: 'single-form-field-dirty-example',
42
+ imports: [ReactiveFormsModule, ...DIRECTIVES],
43
+ template: `
44
+ <hlm-form-field>
45
+ <input
46
+ data-testid="hlm-input"
47
+ aria-label="Your Name"
48
+ [formControl]="name"
49
+ class="w-80"
50
+ hlmInput
51
+ type="text"
52
+ placeholder="Your Name"
53
+ />
54
+ <hlm-error data-testid="hlm-error">Your name is required</hlm-error>
55
+ <hlm-hint data-testid="hlm-hint">This is your public display name.</hlm-hint>
56
+ </hlm-form-field>
57
+ `,
58
+ providers: [{ provide: ErrorStateMatcher, useClass: ShowOnDirtyErrorStateMatcher }],
59
+ })
60
+ class SingleFormFieldDirtyMock {
61
+ name = new FormControl('', Validators.required);
62
+ }
63
+
64
+
65
+ describe('Hlm Form Field Component', () => {
66
+ const TEXT_HINT = 'This is your public display name.';
67
+ const TEXT_ERROR = 'Your name is required';
68
+
69
+ const setupFormField = async () => {
70
+ const { fixture } = await render(SingleFormFieldMock);
71
+ return {
72
+ user: userEvent.setup(),
73
+ fixture,
74
+ hint: screen.getByTestId('hlm-hint'),
75
+ error: () => screen.queryByTestId('hlm-error'),
76
+ trigger: screen.getByTestId('hlm-input'),
77
+ };
78
+ };
79
+
80
+ const setupFormFieldWithErrorStateDirty = async () => {
81
+ const { fixture } = await render(SingleFormFieldDirtyMock);
82
+ return {
83
+ user: userEvent.setup(),
84
+ fixture,
85
+ hint: screen.getByTestId('hlm-hint'),
86
+ error: () => screen.queryByTestId('hlm-error'),
87
+ trigger: screen.getByTestId('hlm-input'),
88
+ };
89
+ };
90
+
91
+ describe('SingleFormField', () => {
92
+ it('should show the hint if the errorState is false', async () => {
93
+ const { hint } = await setupFormField();
94
+
95
+ expect(hint.textContent).toBe(TEXT_HINT);
96
+ });
97
+
98
+ it('should show the error if the errorState is true', async () => {
99
+ const { user, error, trigger } = await setupFormField();
100
+
101
+ expect(error()).toBeNull();
102
+
103
+ await user.click(trigger);
104
+
105
+ await user.click(document.body);
106
+
107
+ expect(screen.queryByTestId('hlm-hint')).toBeNull();
108
+ expect(error()?.textContent?.trim()).toBe(TEXT_ERROR);
109
+ });
110
+ });
111
+
112
+ describe('SingleFormFieldDirty', () => {
113
+ it('should not display the error if the input does not have the dirty state due to the ErrorStateMatcher', async () => {
114
+ const { error, user, trigger } = await setupFormFieldWithErrorStateDirty();
115
+
116
+ await user.click(trigger);
117
+
118
+ await user.click(document.body);
119
+
120
+ expect(error()).toBeNull();
121
+ });
122
+
123
+ it('should display the error if the input has the dirty state due to the ErrorStateMatcher', async () => {
124
+ const { error, user, trigger } = await setupFormFieldWithErrorStateDirty();
125
+
126
+ await user.click(trigger);
127
+ await user.type(trigger, 'a');
128
+ await user.clear(trigger);
129
+
130
+ await user.click(document.body);
131
+
132
+ expect(error()?.textContent?.trim()).toBe(TEXT_ERROR);
133
+ });
134
+ });
135
+ });
@@ -0,0 +1,10 @@
1
+ import { Directive } from "@angular/core";
2
+
3
+ @Directive({
4
+ standalone: true,
5
+ selector: 'hlm-error',
6
+ host: {
7
+ class: 'block text-destructive text-sm font-medium'
8
+ }
9
+ })
10
+ export class HlmErrorDirective {}
@@ -0,0 +1,41 @@
1
+ import { Component, type Signal, computed, contentChild, contentChildren, effect } from '@angular/core';
2
+
3
+ import { BrnFormFieldControl } from '@spartan-ng/ui-form-field-brain';
4
+ import { HlmErrorDirective } from './hlm-error.directive';
5
+
6
+ @Component({
7
+ selector: 'hlm-form-field',
8
+ template: `
9
+ <ng-content></ng-content>
10
+
11
+ @switch (hasDisplayedMessage()) {
12
+ @case ('error') {
13
+ <ng-content select="hlm-error"></ng-content>
14
+ }
15
+ @default {
16
+ <ng-content select="hlm-hint"></ng-content>
17
+ }
18
+ }
19
+ `,
20
+ standalone: true,
21
+ host: {
22
+ class: 'space-y-2 block',
23
+ },
24
+ })
25
+ export class HlmFormFieldComponent {
26
+ control = contentChild(BrnFormFieldControl);
27
+
28
+ errorChildren = contentChildren(HlmErrorDirective);
29
+
30
+ hasDisplayedMessage: Signal<'error' | 'hint'> = computed(() => {
31
+ return this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint';
32
+ });
33
+
34
+ constructor() {
35
+ effect(() => {
36
+ if(!this.control()) {
37
+ throw new Error('hlm-form-field must contain a BrnFormFieldControl.');
38
+ }
39
+ })
40
+ }
41
+ }
@@ -0,0 +1,10 @@
1
+ import { Directive } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: 'hlm-hint',
5
+ standalone: true,
6
+ host: {
7
+ class: 'block text-sm text-muted-foreground',
8
+ },
9
+ })
10
+ export class HlmHintDirective {}
@@ -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: 'formfield', internalName: 'ui-form-field-helm', publicName: 'ui-formfield-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-form-field-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,WAAW,EAC1B,YAAY,EAAE,oBAAoB,EAClC,UAAU,EAAE,mBAAmB,IAC9B,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}
@@ -1,5 +1,9 @@
1
- import { Directive, Input, computed, input, signal } from '@angular/core';
1
+ import { Directive, type DoCheck, Injector, Input, computed, effect, inject, input, signal } from '@angular/core';
2
+ import { FormGroupDirective, NgControl, NgForm } from '@angular/forms';
2
3
  import { hlm } from '@spartan-ng/ui-core';
4
+ import { BrnFormFieldControl } from '@spartan-ng/ui-form-field-brain';
5
+ import { ErrorStateMatcher, ErrorStateTracker } from '@spartan-ng/ui-forms-brain';
6
+
3
7
  import { type VariantProps, cva } from 'class-variance-authority';
4
8
  import type { ClassValue } from 'clsx';
5
9
 
@@ -31,8 +35,14 @@ type InputVariants = VariantProps<typeof inputVariants>;
31
35
  host: {
32
36
  '[class]': '_computedClass()',
33
37
  },
38
+ providers: [
39
+ {
40
+ provide: BrnFormFieldControl,
41
+ useExisting: HlmInputDirective,
42
+ },
43
+ ],
34
44
  })
35
- export class HlmInputDirective {
45
+ export class HlmInputDirective implements BrnFormFieldControl, DoCheck {
36
46
  private readonly _size = signal<InputVariants['size']>('default');
37
47
  @Input()
38
48
  set size(value: InputVariants['size']) {
@@ -49,4 +59,38 @@ export class HlmInputDirective {
49
59
  protected _computedClass = computed(() =>
50
60
  hlm(inputVariants({ size: this._size(), error: this._error() }), this.userClass()),
51
61
  );
62
+
63
+ private injector = inject(Injector)
64
+
65
+ ngControl: NgControl | null = this.injector.get(NgControl, null);
66
+
67
+ errorStateTracker: ErrorStateTracker;
68
+
69
+ private defaultErrorStateMatcher = inject(ErrorStateMatcher);
70
+ private parentForm = inject(NgForm, { optional: true });
71
+ private parentFormGroup = inject(FormGroupDirective, { optional: true });
72
+
73
+ errorState = computed(() => this.errorStateTracker.errorState());
74
+
75
+ constructor() {
76
+ this.errorStateTracker = new ErrorStateTracker(
77
+ this.defaultErrorStateMatcher,
78
+ this.ngControl,
79
+ this.parentFormGroup,
80
+ this.parentForm,
81
+ );
82
+
83
+ effect(
84
+ () => {
85
+ if (this.ngControl) {
86
+ this.error = this.errorStateTracker.errorState();
87
+ }
88
+ },
89
+ { allowSignalWrites: true },
90
+ );
91
+ }
92
+
93
+ ngDoCheck() {
94
+ this.errorStateTracker.updateErrorState();
95
+ }
52
96
  }
@@ -1,19 +1,19 @@
1
1
  import { NgModule } from '@angular/core';
2
2
 
3
3
  import { HlmPaginationContentDirective } from './lib/hlm-pagination-content.directive';
4
- import { HlmPaginationEllipsisComponent } from './lib/hlm-pagination-ellipsis.componet';
4
+ import { HlmPaginationEllipsisComponent } from './lib/hlm-pagination-ellipsis.component';
5
5
  import { HlmPaginationItemDirective } from './lib/hlm-pagination-item.directive';
6
6
  import { HlmPaginationLinkDirective } from './lib/hlm-pagination-link.directive';
7
- import { HlmPaginationNextComponent } from './lib/hlm-pagination-next.componet';
8
- import { HlmPaginationPreviousComponent } from './lib/hlm-pagination-previous.componet';
7
+ import { HlmPaginationNextComponent } from './lib/hlm-pagination-next.component';
8
+ import { HlmPaginationPreviousComponent } from './lib/hlm-pagination-previous.component';
9
9
  import { HlmPaginationDirective } from './lib/hlm-pagination.directive';
10
10
 
11
11
  export * from './lib/hlm-pagination-content.directive';
12
- export * from './lib/hlm-pagination-ellipsis.componet';
12
+ export * from './lib/hlm-pagination-ellipsis.component';
13
13
  export * from './lib/hlm-pagination-item.directive';
14
14
  export * from './lib/hlm-pagination-link.directive';
15
- export * from './lib/hlm-pagination-next.componet';
16
- export * from './lib/hlm-pagination-previous.componet';
15
+ export * from './lib/hlm-pagination-next.component';
16
+ export * from './lib/hlm-pagination-previous.component';
17
17
  export * from './lib/hlm-pagination.directive';
18
18
 
19
19
  export const HlmPaginationImports = [
@@ -1,9 +1,9 @@
1
- import { Component, ContentChild, type ElementRef, ViewChild, computed, input } from '@angular/core';
1
+ import { Component, ContentChild, type ElementRef, ViewChild, computed, inject, input } from '@angular/core';
2
2
  import { provideIcons } from '@ng-icons/core';
3
3
  import { lucideChevronDown } from '@ng-icons/lucide';
4
4
  import { hlm } from '@spartan-ng/ui-core';
5
5
  import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
6
- import { BrnSelectTriggerDirective } from '@spartan-ng/ui-select-brain';
6
+ import { BrnSelectComponent, BrnSelectTriggerDirective } from '@spartan-ng/ui-select-brain';
7
7
  import { type VariantProps, cva } from 'class-variance-authority';
8
8
  import type { ClassValue } from 'clsx';
9
9
 
@@ -40,7 +40,7 @@ type SelectTriggerVariants = VariantProps<typeof selectTriggerVariants>;
40
40
  @if (icon) {
41
41
  <ng-content select="hlm-icon" />
42
42
  } @else {
43
- <hlm-icon class="flex-none w-4 h-4 ml-2" name="lucideChevronDown" />
43
+ <hlm-icon class="ml-2 h-4 w-4 flex-none" name="lucideChevronDown" />
44
44
  }
45
45
  </button>
46
46
  `,
@@ -52,11 +52,12 @@ export class HlmSelectTriggerComponent {
52
52
  @ContentChild(HlmIconComponent, { static: false })
53
53
  protected icon!: HlmIconComponent;
54
54
 
55
+ protected readonly brnSelect = inject(BrnSelectComponent, { optional: true });
56
+
55
57
  public readonly _size = input<SelectTriggerVariants['size']>('default');
56
- public readonly _error = input<SelectTriggerVariants['error']>('auto');
57
58
  public readonly userClass = input<ClassValue>('', { alias: 'class' });
58
59
 
59
60
  protected _computedClass = computed(() =>
60
- hlm(selectTriggerVariants({ size: this._size(), error: this._error() }), this.userClass()),
61
+ hlm(selectTriggerVariants({ size: this._size(), error: this.brnSelect?.errorState() }), this.userClass()),
61
62
  );
62
63
  }
@@ -0,0 +1,11 @@
1
+ import { HlmSliderInputDirective } from './lib/hlm-slider-input.directive';
2
+ import { HlmSliderThumbDirective } from './lib/hlm-slider-thumb.directive';
3
+ import { HlmSliderTrackComponent } from './lib/hlm-slider-track.component';
4
+ import { HlmSliderComponent } from './lib/hlm-slider.component';
5
+
6
+ export const HlmSliderImports = [
7
+ HlmSliderComponent,
8
+ HlmSliderTrackComponent,
9
+ HlmSliderInputDirective,
10
+ HlmSliderThumbDirective,
11
+ ] as const;
@@ -0,0 +1,19 @@
1
+ import { Directive, computed, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BrnSliderInputDirective } from '@spartan-ng/ui-slider-brain';
4
+ import type { ClassValue } from 'clsx';
5
+
6
+ @Directive({
7
+ selector: 'input[hlmSliderInput], input[brnSliderInput]',
8
+ standalone: true,
9
+ hostDirectives: [BrnSliderInputDirective],
10
+ host: {
11
+ '[class]': '_computedClass()',
12
+ },
13
+ })
14
+ export class HlmSliderInputDirective {
15
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
16
+ protected _computedClass = computed(() =>
17
+ hlm('w-full h-5 -top-1.5 left-0 opacity-0 absolute cursor-pointer transition-all', this.userClass()),
18
+ );
19
+ }
@@ -0,0 +1,27 @@
1
+ import { Directive, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BRN_SLIDER, BrnSliderThumbDirective } from '@spartan-ng/ui-slider-brain';
4
+ import type { ClassValue } from 'clsx';
5
+
6
+ @Directive({
7
+ selector: 'hlm-slider-thumb, brn-slider-thumb [hlm]',
8
+ standalone: true,
9
+ host: {
10
+ '[class]': '_computedClass()',
11
+ '[attr.dir]': '_direction()',
12
+ },
13
+ hostDirectives: [BrnSliderThumbDirective],
14
+ })
15
+ export class HlmSliderThumbDirective {
16
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
17
+ protected _computedClass = computed(() =>
18
+ hlm(
19
+ '-translate-y-1/2 h-5 w-5 absolute rounded-full top-1/2 ltr:left-0 rtl:right-0 bg-secondary border-2 border-black cursor-pointer pointer-events-none transition-all',
20
+ this._brnSlider.brnSliderTrack()?.brnSliderInput()?.isFocused() ? 'ring-2 ring-gray-400' : '',
21
+ this.userClass(),
22
+ ),
23
+ );
24
+ protected _direction = computed(() => this._brnSlider.direction());
25
+
26
+ private readonly _brnSlider = inject(BRN_SLIDER);
27
+ }
@@ -0,0 +1,29 @@
1
+ import { Directive, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BRN_SLIDER, BrnSliderTickMarkDirective } from '@spartan-ng/ui-slider-brain';
4
+ import type { ClassValue } from 'clsx';
5
+
6
+ @Directive({
7
+ selector: '[hlmSliderTickMark]',
8
+ standalone: true,
9
+ host: {
10
+ '[class]': '_computedClass()',
11
+ '[attr.dir]': '_direction()',
12
+ },
13
+ hostDirectives: [{ directive: BrnSliderTickMarkDirective, inputs: ['data'] }],
14
+ })
15
+ export class HlmSliderTickMarkDirective {
16
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
17
+ public readonly active = input<boolean>();
18
+
19
+ protected _computedClass = computed(() =>
20
+ hlm(
21
+ 'absolute w-1 h-1 top-0.5 rounded-full rtl:right-0',
22
+ this.active() ? 'bg-secondary' : 'bg-primary',
23
+ this.userClass(),
24
+ ),
25
+ );
26
+ protected _direction = computed(() => this._brnSlider.direction());
27
+
28
+ private readonly _brnSlider = inject(BRN_SLIDER);
29
+ }
@@ -0,0 +1,17 @@
1
+ import { Directive, computed, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import type { ClassValue } from 'clsx';
4
+
5
+ @Directive({
6
+ selector: '[hlmSliderTickMarks]',
7
+ standalone: true,
8
+ host: {
9
+ '[class]': '_computedClass()',
10
+ },
11
+ })
12
+ export class HlmSliderTickMarksDirective {
13
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
14
+ protected _computedClass = computed(() =>
15
+ hlm('h-full w-full relative -top-4 cursor-pointer pointer-events-none transition-all', this.userClass()),
16
+ );
17
+ }
@@ -0,0 +1,26 @@
1
+ import { Directive, computed, inject, input } from "@angular/core";
2
+ import { hlm } from "@spartan-ng/ui-core";
3
+ import { BRN_SLIDER, BrnSliderTrackActiveFillDirective } from "@spartan-ng/ui-slider-brain";
4
+ import type { ClassValue } from "clsx";
5
+
6
+ @Directive({
7
+ selector: '[hlmSliderTrackActiveFill]',
8
+ standalone: true,
9
+ hostDirectives: [BrnSliderTrackActiveFillDirective],
10
+ host: {
11
+ '[class]': '_computedClass()',
12
+ '[attr.dir]': '_direction()',
13
+ },
14
+ })
15
+ export class HlmSliderTrackActiveFillDirective {
16
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
17
+ protected _computedClass = computed(() =>
18
+ hlm(
19
+ 'h-full w-full absolute top-0 pointer-events-none bg-primary ltr:origin-left rtl:origin-right transition-all scale-x-0',
20
+ this.userClass(),
21
+ ),
22
+ );
23
+ protected _direction = computed(() => this._brnSlider.direction());
24
+
25
+ private readonly _brnSlider = inject(BRN_SLIDER);
26
+ }
@@ -0,0 +1,20 @@
1
+ import { Directive, computed, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import type { ClassValue } from 'clsx';
4
+
5
+ @Directive({
6
+ selector: '[hlmSliderTrackActive]',
7
+ standalone: true,
8
+ host: {
9
+ '[class]': '_computedClass()',
10
+ },
11
+ })
12
+ export class HlmSliderTrackActiveDirective {
13
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
14
+ protected _computedClass = computed(() =>
15
+ hlm(
16
+ 'h-full w-full relative -top-2 pointer-events-none overflow-hidden rounded-full transition-all',
17
+ this.userClass(),
18
+ ),
19
+ );
20
+ }
@@ -0,0 +1,20 @@
1
+ import { Directive, computed, input } from "@angular/core";
2
+ import { hlm } from "@spartan-ng/ui-core";
3
+ import type { ClassValue } from "clsx";
4
+
5
+ @Directive({
6
+ selector: '[hlmSliderTrackInactive]',
7
+ standalone: true,
8
+ host: {
9
+ '[class]': '_computedClass()',
10
+ },
11
+ })
12
+ export class HlmSliderTrackInactiveDirective {
13
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
14
+ protected _computedClass = computed(() =>
15
+ hlm(
16
+ 'w-full h-full bg-secondary rounded-full transition-all',
17
+ this.userClass(),
18
+ ),
19
+ );
20
+ }
@@ -0,0 +1,55 @@
1
+ import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BRN_SLIDER, BRN_SLIDER_TRACK, BrnSliderTrackDirective } from '@spartan-ng/ui-slider-brain';
4
+ import type { ClassValue } from 'clsx';
5
+ import { HlmSliderTickMarkDirective } from './hlm-slider-tick-mark.directive';
6
+ import { HlmSliderTickMarksDirective } from './hlm-slider-tick-marks.directive';
7
+ import { HlmSliderTrackActiveFillDirective } from './hlm-slider-track-active-fill.directive';
8
+ import { HlmSliderTrackActiveDirective } from './hlm-slider-track-active.directive';
9
+ import { HlmSliderTrackInactiveDirective } from './hlm-slider-track-inactive.directive';
10
+
11
+ @Component({
12
+ selector: 'hlm-slider-track, brn-slider-track [hlm]',
13
+ standalone: true,
14
+ changeDetection: ChangeDetectionStrategy.OnPush,
15
+ template: `
16
+ <ng-content></ng-content>
17
+ <div class="flex w-full flex-wrap">
18
+ <div hlmSliderTrackInactive></div>
19
+ <div hlmSliderTrackActive>
20
+ <div hlmSliderTrackActiveFill></div>
21
+ </div>
22
+ @if (_brnSlider.showTickMarks()) {
23
+ <div hlmSliderTickMarks>
24
+ @for (tickMark of _brnSliderTrack.tickMarks(); track $index) {
25
+ <div
26
+ hlmSliderTickMark
27
+ [data]="{ tickMarkIndex: $index, totalTickMarks: _brnSliderTrack.tickMarks().length }"
28
+ [active]="tickMark"
29
+ ></div>
30
+ }
31
+ </div>
32
+ }
33
+ </div>
34
+ `,
35
+ host: {
36
+ '[class]': '_computedClass()',
37
+ },
38
+ hostDirectives: [BrnSliderTrackDirective],
39
+ imports: [
40
+ HlmSliderTrackInactiveDirective,
41
+ HlmSliderTrackActiveDirective,
42
+ HlmSliderTrackActiveFillDirective,
43
+ HlmSliderTickMarksDirective,
44
+ HlmSliderTickMarkDirective,
45
+ ],
46
+ })
47
+ export class HlmSliderTrackComponent {
48
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
49
+ protected _computedClass = computed(() =>
50
+ hlm('flex w-full h-2 px-3 self-center relative transition-all', this.userClass()),
51
+ );
52
+
53
+ protected readonly _brnSlider = inject(BRN_SLIDER);
54
+ protected readonly _brnSliderTrack = inject(BRN_SLIDER_TRACK, { host: true });
55
+ }
@@ -0,0 +1,28 @@
1
+ import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { BRN_SLIDER, BrnSliderDirective } from '@spartan-ng/ui-slider-brain';
4
+ import type { ClassValue } from 'clsx';
5
+
6
+ @Component({
7
+ selector: 'hlm-slider, brn-slider [hlm]',
8
+ standalone: true,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ hostDirectives: [
11
+ {
12
+ directive: BrnSliderDirective,
13
+ inputs: ['brnSliderDisabled: disabled', 'min', 'max', 'step', 'dir', 'label', 'ariaLabel', 'showTickMarks'],
14
+ },
15
+ ],
16
+ template: '<ng-content/>',
17
+ host: {
18
+ '[class]': '_computedClass()',
19
+ },
20
+ })
21
+ export class HlmSliderComponent {
22
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
23
+ protected _computedClass = computed(() =>
24
+ hlm('w-full h-5 flex relative', this._brnSlider.disabled() ? 'opacity-40' : '', this.userClass()),
25
+ );
26
+
27
+ private readonly _brnSlider = inject(BRN_SLIDER, { host: true });
28
+ }
@@ -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: 'slider', internalName: 'ui-slider-helm', publicName: 'ui-slider-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-slider-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,QAAQ,EACvB,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,gBAAgB,IAC3B,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}
@@ -1,11 +1,11 @@
1
1
  import { CdkObserveContent } from '@angular/cdk/observers';
2
- import { Component, ContentChildren, ElementRef, QueryList, ViewChild, computed, input } from '@angular/core';
2
+ import { Component, ContentChildren, type ElementRef, type QueryList, ViewChild, computed, input } from '@angular/core';
3
3
  import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
4
4
  import { buttonVariants } from '@spartan-ng/ui-button-helm';
5
5
  import { hlm } from '@spartan-ng/ui-core';
6
6
  import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
7
7
  import { BrnTabsPaginatedListDirective, BrnTabsTriggerDirective } from '@spartan-ng/ui-tabs-brain';
8
- import { ClassValue } from 'clsx';
8
+ import type { ClassValue } from 'clsx';
9
9
  import { listVariants } from './hlm-tabs-list.component';
10
10
 
11
11
  @Component({
@@ -0,0 +1,3 @@
1
+ import type { Primitive } from './primivites';
2
+ export declare const primitiveDependencies: Record<Primitive, Primitive[]>;
3
+ export declare const getDependentPrimitives: (primitives: Primitive[]) => Primitive[];