@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.
- package/package.json +1 -1
- package/src/generators/ui/libs/ui-accordion-helm/files/index.ts.template +3 -3
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.directive.ts.template +12 -67
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.directive.ts.template +31 -0
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-item.directive.ts.template +7 -6
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-trigger.directive.ts.template +12 -23
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion.directive.ts.template +10 -7
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/index.ts.template +6 -6
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-cancel-button.directive.ts.template +3 -6
- 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
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-description.directive.ts.template +5 -6
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-footer.component.ts.template +6 -6
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-header.component.ts.template +6 -6
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-overlay.directive.ts.template +10 -16
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-title.directive.ts.template +4 -6
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog.component.ts.template +30 -0
- package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-description.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-title.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-aspect-ratio-helm/files/lib/helm-aspect-ratio.directive.ts.template +7 -9
- package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.ts.template +11 -14
- package/src/generators/ui/libs/ui-badge-helm/files/lib/hlm-badge.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-button-helm/files/lib/hlm-button.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-content.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-description.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-footer.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-header.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-title.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-checkbox-helm/files/index.ts.template +14 -0
- package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox-checkicon.component.ts.template +37 -0
- package/src/generators/ui/libs/ui-checkbox-helm/files/lib/hlm-checkbox.directive.ts.template +30 -0
- package/src/generators/ui/libs/ui-checkbox-helm/generator.d.ts +3 -0
- package/src/generators/ui/libs/ui-checkbox-helm/generator.js +12 -0
- package/src/generators/ui/libs/ui-checkbox-helm/generator.js.map +1 -0
- package/src/generators/ui/libs/ui-dialog-helm/files/index.ts.template +6 -3
- package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.component.ts.template +44 -0
- package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-overlay.directive.ts.template +10 -16
- package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog.component.ts.template +29 -0
- package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.ts.template +50 -5
- package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input-error.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input.directive.ts.template +3 -3
- package/src/generators/ui/libs/ui-label-helm/files/lib/hlm-label.directive.ts.template +37 -8
- package/src/generators/ui/libs/ui-menu-helm/files/index.ts.template +18 -9
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar-item.directive.ts.template +3 -1
- package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-menu-bar.directive.ts.template → hlm-menu-bar.component.ts.template} +7 -4
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-group.component.ts.template +15 -0
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-check.component.ts.template +1 -1
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-checkbox.directive.ts.template +41 -0
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.component.ts.template +1 -1
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.directive.ts.template +41 -0
- package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item.directive.ts.template +24 -7
- package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-menu.directive.ts.template → hlm-menu.component.ts.template} +11 -6
- package/src/generators/ui/libs/ui-menu-helm/files/lib/{hlm-sub-menu.directive.ts.template → hlm-sub-menu.component.ts.template} +9 -4
- package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-content.directive.ts.template +1 -1
- package/src/generators/ui/libs/ui-spinner-helm/files/lib/hlm-spinner.component.ts.template +3 -3
- package/src/generators/ui/libs/ui-table-helm/files/index.ts.template +3 -0
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-caption.component.ts.template +73 -0
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.component.ts.template +20 -2
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.directive.ts.template +4 -3
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-td.component.ts.template +23 -11
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-th.component.ts.template +12 -2
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-trow.component.ts.template +11 -1
- package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-list.directive.ts.template +14 -11
- package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle.directive.ts.template +3 -3
- package/src/generators/ui/supported-ui-libraries.json +51 -34
- package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.component.ts.template +0 -28
- package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-close.directive.ts.template +0 -26
- package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.directive.ts.template +0 -37
|
@@ -23,26 +23,24 @@ export class HlmAspectRatioDirective implements AfterViewInit {
|
|
|
23
23
|
private readonly _ratio = signal(1);
|
|
24
24
|
private readonly _el: HTMLElement = inject(ElementRef).nativeElement;
|
|
25
25
|
|
|
26
|
+
protected readonly _computedPaddingBottom = computed(() => {
|
|
27
|
+
return `${100 / this._ratio()}%`;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
private readonly _userCls = signal<ClassValue>('');
|
|
31
|
+
protected readonly _computedClass = computed(() => hlm(`relative w-full`, this._userCls()));
|
|
32
|
+
|
|
26
33
|
@Input()
|
|
27
34
|
set hlmAspectRatio(value: NumberInput) {
|
|
28
35
|
const coerced = coerceNumberProperty(parseDividedString(value));
|
|
29
36
|
this._ratio.set(coerced <= 0 ? 1 : coerced);
|
|
30
37
|
}
|
|
31
|
-
protected _computedPaddingBottom = computed(() => {
|
|
32
|
-
return `${100 / this._ratio()}%`;
|
|
33
|
-
});
|
|
34
38
|
|
|
35
|
-
private readonly _userCls = signal<ClassValue>('');
|
|
36
39
|
@Input()
|
|
37
40
|
set class(userCls: ClassValue) {
|
|
38
41
|
this._userCls.set(userCls);
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
protected _computedClass = computed(() => this._generateClass());
|
|
42
|
-
private _generateClass() {
|
|
43
|
-
return hlm(`relative w-full`, this._userCls());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
44
|
ngAfterViewInit() {
|
|
47
45
|
// support delayed addition of image to dom
|
|
48
46
|
const child = this._el.firstElementChild;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { NgIf } from '@angular/common';
|
|
2
1
|
import { ChangeDetectionStrategy, Component, computed, Input, signal, ViewEncapsulation } from '@angular/core';
|
|
3
2
|
import { BrnAvatarComponent } from '@spartan-ng/ui-avatar-brain';
|
|
4
3
|
import { hlm } from '@spartan-ng/ui-core';
|
|
5
4
|
import { cva, VariantProps } from 'class-variance-authority';
|
|
6
5
|
import { ClassValue } from 'clsx';
|
|
7
6
|
|
|
8
|
-
const avatarVariants = cva('relative flex shrink-0 overflow-hidden rounded-full', {
|
|
7
|
+
export const avatarVariants = cva('relative flex shrink-0 overflow-hidden rounded-full', {
|
|
9
8
|
variants: {
|
|
10
9
|
variant: {
|
|
11
10
|
small: 'h-6 w-6 text-xs',
|
|
@@ -24,22 +23,21 @@ type AvatarVariants = VariantProps<typeof avatarVariants>;
|
|
|
24
23
|
selector: 'hlm-avatar',
|
|
25
24
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
25
|
encapsulation: ViewEncapsulation.None,
|
|
27
|
-
imports: [NgIf],
|
|
28
26
|
standalone: true,
|
|
27
|
+
host: {
|
|
28
|
+
'[class]': '_computedClass()',
|
|
29
|
+
},
|
|
29
30
|
template: `
|
|
30
|
-
|
|
31
|
+
@if (image?.canShow()) {
|
|
31
32
|
<ng-content select="[hlmAvatarImage],[brnAvatarImage]" />
|
|
32
|
-
|
|
33
|
-
<ng-template #fallback>
|
|
33
|
+
} @else {
|
|
34
34
|
<ng-content select="[hlmAvatarFallback],[brnAvatarFallback]" />
|
|
35
|
-
|
|
35
|
+
}
|
|
36
36
|
`,
|
|
37
|
-
host: {
|
|
38
|
-
'[class]': '_computedClass()',
|
|
39
|
-
},
|
|
40
37
|
})
|
|
41
38
|
export class HlmAvatarComponent extends BrnAvatarComponent {
|
|
42
39
|
private readonly _userCls = signal<ClassValue>('');
|
|
40
|
+
|
|
43
41
|
@Input()
|
|
44
42
|
set class(userCls: ClassValue) {
|
|
45
43
|
this._userCls.set(userCls);
|
|
@@ -51,8 +49,7 @@ export class HlmAvatarComponent extends BrnAvatarComponent {
|
|
|
51
49
|
this._variant.set(variant);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
protected _computedClass = computed(() =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
52
|
+
protected readonly _computedClass = computed(() =>
|
|
53
|
+
hlm(avatarVariants({ variant: this._variant() }), this._userCls()),
|
|
54
|
+
);
|
|
58
55
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { booleanAttribute, computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const badgeVariants = cva(
|
|
6
|
+
export const badgeVariants = cva(
|
|
7
7
|
'inline-flex items-center border rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const buttonVariants = cva(
|
|
6
|
+
export const buttonVariants = cva(
|
|
7
7
|
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-content.directive.ts.template
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardContentVariants = cva('p-6 pt-0', {
|
|
6
|
+
export const cardContentVariants = cva('p-6 pt-0', {
|
|
7
7
|
variants: {},
|
|
8
8
|
defaultVariants: {},
|
|
9
9
|
});
|
package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-description.directive.ts.template
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardDescriptionVariants = cva('text-sm text-muted-foreground', {
|
|
6
|
+
export const cardDescriptionVariants = cva('text-sm text-muted-foreground', {
|
|
7
7
|
variants: {},
|
|
8
8
|
defaultVariants: {},
|
|
9
9
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardFooterVariants = cva('flex p-6 pt-0', {
|
|
6
|
+
export const cardFooterVariants = cva('flex p-6 pt-0', {
|
|
7
7
|
variants: {
|
|
8
8
|
direction: {
|
|
9
9
|
row: 'flex-row items-center space-x-1.5',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardHeaderVariants = cva('flex p-6', {
|
|
6
|
+
export const cardHeaderVariants = cva('flex p-6', {
|
|
7
7
|
variants: {
|
|
8
8
|
direction: {
|
|
9
9
|
row: 'flex-row items-center space-x-1.5',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardTitleVariants = cva('text-lg font-semibold leading-none tracking-tight', {
|
|
6
|
+
export const cardTitleVariants = cva('text-lg font-semibold leading-none tracking-tight', {
|
|
7
7
|
variants: {},
|
|
8
8
|
defaultVariants: {},
|
|
9
9
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const cardVariants = cva(
|
|
6
|
+
export const cardVariants = cva(
|
|
7
7
|
'rounded-lg border border-border bg-card focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-card-foreground shadow-sm',
|
|
8
8
|
{
|
|
9
9
|
variants: {},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { HlmCheckboxCheckIconComponent } from './lib/hlm-checkbox-checkicon.component';
|
|
4
|
+
import { HlmCheckboxDirective } from './lib/hlm-checkbox.directive';
|
|
5
|
+
|
|
6
|
+
export * from './lib/hlm-checkbox-checkicon.component';
|
|
7
|
+
export * from './lib/hlm-checkbox.directive';
|
|
8
|
+
|
|
9
|
+
export const HlmCheckboxImports = [HlmCheckboxDirective, HlmCheckboxCheckIconComponent] as const;
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [...HlmCheckboxImports],
|
|
12
|
+
exports: [...HlmCheckboxImports],
|
|
13
|
+
})
|
|
14
|
+
export class HlmCheckboxModule {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, computed, inject, Input, signal } from '@angular/core';
|
|
2
|
+
import { radixCheck } from '@ng-icons/radix-icons';
|
|
3
|
+
import { BrnCheckboxComponent } from '@spartan-ng/ui-checkbox-brain';
|
|
4
|
+
import { hlm } from '@spartan-ng/ui-core';
|
|
5
|
+
import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'hlm-checkbox-checkicon',
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [HlmIconComponent],
|
|
12
|
+
providers: [provideIcons({ radixCheck })],
|
|
13
|
+
host: {
|
|
14
|
+
'[class]': '_computedClass()',
|
|
15
|
+
},
|
|
16
|
+
template: `
|
|
17
|
+
<hlm-icon size="sm" name="radixCheck" />
|
|
18
|
+
`,
|
|
19
|
+
})
|
|
20
|
+
export class HlmCheckboxCheckIconComponent {
|
|
21
|
+
private _brnCheckbox = inject(BrnCheckboxComponent);
|
|
22
|
+
protected _checked = this._brnCheckbox?.isChecked;
|
|
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(
|
|
32
|
+
'h-4 w-4 leading-none group-data-[state=unchecked]:opacity-0',
|
|
33
|
+
this._checked() === 'indeterminate' ? 'opacity-50' : '',
|
|
34
|
+
this._userCls(),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { computed, Directive, inject, Input, signal } from '@angular/core';
|
|
2
|
+
import { BrnCheckboxComponent } from '@spartan-ng/ui-checkbox-brain';
|
|
3
|
+
import { hlm } from '@spartan-ng/ui-core';
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
|
|
6
|
+
@Directive({
|
|
7
|
+
selector: 'brn-checkbox[hlm],[hlmCheckbox]',
|
|
8
|
+
standalone: true,
|
|
9
|
+
host: {
|
|
10
|
+
'[class]': '_computedClass()',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class HlmCheckboxDirective {
|
|
14
|
+
private readonly _brnCheckbox = inject(BrnCheckboxComponent);
|
|
15
|
+
private readonly _userCls = signal<ClassValue>('');
|
|
16
|
+
@Input()
|
|
17
|
+
set class(userCls: ClassValue) {
|
|
18
|
+
this._userCls.set(userCls);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected _computedClass = computed(() => this._generateClass());
|
|
22
|
+
private _generateClass() {
|
|
23
|
+
return hlm(
|
|
24
|
+
'group inline-flex border border-foreground shrink-0 cursor-pointer items-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring' +
|
|
25
|
+
' focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[state=checked]:text-background data-[state=unchecked]:bg-foreground data-[state=checked]:bg-primary data-[state=unchecked]:bg-background',
|
|
26
|
+
this._brnCheckbox.disabled ? 'cursor-not-allowed opacity-50' : '',
|
|
27
|
+
this._userCls(),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -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: 'checkbox', internalName: 'ui-checkbox-helm', publicName: 'ui-checkbox-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-checkbox-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"}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
import { HlmDialogCloseDirective } from './lib/hlm-dialog-close.directive';
|
|
4
|
-
import {
|
|
4
|
+
import { HlmDialogContentComponent } from './lib/hlm-dialog-content.component';
|
|
5
5
|
import { HlmDialogDescriptionDirective } from './lib/hlm-dialog-description.directive';
|
|
6
6
|
import { HlmDialogFooterComponent } from './lib/hlm-dialog-footer.component';
|
|
7
7
|
import { HlmDialogHeaderComponent } from './lib/hlm-dialog-header.component';
|
|
8
8
|
import { HlmDialogOverlayDirective } from './lib/hlm-dialog-overlay.directive';
|
|
9
9
|
import { HlmDialogTitleDirective } from './lib/hlm-dialog-title.directive';
|
|
10
|
+
import { HlmDialogComponent } from './lib/hlm-dialog.component';
|
|
10
11
|
|
|
11
12
|
export * from './lib/hlm-dialog-close.directive';
|
|
12
|
-
export * from './lib/hlm-dialog-content.
|
|
13
|
+
export * from './lib/hlm-dialog-content.component';
|
|
13
14
|
export * from './lib/hlm-dialog-description.directive';
|
|
14
15
|
export * from './lib/hlm-dialog-footer.component';
|
|
15
16
|
export * from './lib/hlm-dialog-header.component';
|
|
16
17
|
export * from './lib/hlm-dialog-overlay.directive';
|
|
17
18
|
export * from './lib/hlm-dialog-title.directive';
|
|
19
|
+
export * from './lib/hlm-dialog.component';
|
|
18
20
|
|
|
19
21
|
export const HlmDialogImports = [
|
|
22
|
+
HlmDialogComponent,
|
|
20
23
|
HlmDialogCloseDirective,
|
|
21
|
-
|
|
24
|
+
HlmDialogContentComponent,
|
|
22
25
|
HlmDialogDescriptionDirective,
|
|
23
26
|
HlmDialogFooterComponent,
|
|
24
27
|
HlmDialogHeaderComponent,
|
package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.component.ts.template
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, Input, signal, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { radixCross1 } from '@ng-icons/radix-icons';
|
|
3
|
+
import { hlm, injectExposesStateProvider } from '@spartan-ng/ui-core';
|
|
4
|
+
import { BrnDialogCloseDirective } from '@spartan-ng/ui-dialog-brain';
|
|
5
|
+
import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
import { HlmDialogCloseDirective } from './hlm-dialog-close.directive';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'hlm-dialog-content',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [BrnDialogCloseDirective, HlmDialogCloseDirective, HlmIconComponent],
|
|
13
|
+
providers: [provideIcons({ radixCross1 })],
|
|
14
|
+
host: {
|
|
15
|
+
'[class]': '_computedClass()',
|
|
16
|
+
'[attr.data-state]': 'state()',
|
|
17
|
+
},
|
|
18
|
+
template: `
|
|
19
|
+
<ng-content />
|
|
20
|
+
<button brnDialogClose hlm>
|
|
21
|
+
<span class="sr-only">Close</span>
|
|
22
|
+
<hlm-icon class="flex h-4 w-4" size="100%" name="radixCross1" />
|
|
23
|
+
</button>
|
|
24
|
+
`,
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
encapsulation: ViewEncapsulation.None,
|
|
27
|
+
})
|
|
28
|
+
export class HlmDialogContentComponent {
|
|
29
|
+
private readonly _statusProvider = injectExposesStateProvider({ host: true });
|
|
30
|
+
public readonly state = this._statusProvider.state ?? signal('closed').asReadonly();
|
|
31
|
+
|
|
32
|
+
private readonly _userCls = signal<ClassValue>('');
|
|
33
|
+
protected readonly _computedClass = computed(() =>
|
|
34
|
+
hlm(
|
|
35
|
+
'border-border grid w-full max-w-lg relative gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-top-[2%] data-[state=open]:slide-in-from-top-[2%] sm:rounded-lg md:w-full',
|
|
36
|
+
this._userCls(),
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
@Input()
|
|
41
|
+
set class(userCls: ClassValue) {
|
|
42
|
+
this._userCls.set(userCls);
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-overlay.directive.ts.template
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import { Directive,
|
|
1
|
+
import { computed, Directive, effect, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm, injectCustomClassSettable } from '@spartan-ng/ui-core';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
@Directive({
|
|
6
6
|
selector: '[hlmDialogOverlay],brn-dialog-overlay[hlm]',
|
|
7
7
|
standalone: true,
|
|
8
|
-
host: {
|
|
9
|
-
'[class]': '_computedClass()',
|
|
10
|
-
},
|
|
11
8
|
})
|
|
12
9
|
export class HlmDialogOverlayDirective {
|
|
13
|
-
private _classSettable = injectCustomClassSettable({ optional: true, host: true });
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
this._classSettable?.setClassToCustomElement(this._computedClass());
|
|
17
|
-
}
|
|
10
|
+
private readonly _classSettable = injectCustomClassSettable({ optional: true, host: true });
|
|
18
11
|
|
|
19
12
|
private readonly _userCls = signal<ClassValue>('');
|
|
13
|
+
protected readonly _computedClass = computed(() =>
|
|
14
|
+
hlm(
|
|
15
|
+
'bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
16
|
+
this._userCls(),
|
|
17
|
+
),
|
|
18
|
+
);
|
|
20
19
|
@Input()
|
|
21
20
|
set class(userCls: ClassValue) {
|
|
22
21
|
this._userCls.set(userCls);
|
|
23
|
-
this._classSettable?.setClassToCustomElement(this._computedClass());
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return hlm(
|
|
29
|
-
'bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
30
|
-
this._userCls(),
|
|
31
|
-
);
|
|
24
|
+
constructor() {
|
|
25
|
+
effect(() => this._classSettable?.setClassToCustomElement(this._computedClass()));
|
|
32
26
|
}
|
|
33
27
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, forwardRef, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { BrnDialogComponent, BrnDialogOverlayComponent, provideBrnDialog } from '@spartan-ng/ui-dialog-brain';
|
|
3
|
+
import { HlmDialogOverlayDirective } from './hlm-dialog-overlay.directive';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'hlm-dialog',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [BrnDialogComponent, BrnDialogOverlayComponent, HlmDialogOverlayDirective],
|
|
9
|
+
providers: [
|
|
10
|
+
provideBrnDialog(),
|
|
11
|
+
{
|
|
12
|
+
provide: BrnDialogComponent,
|
|
13
|
+
useExisting: forwardRef(() => HlmDialogComponent),
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
template: `
|
|
17
|
+
<brn-dialog-overlay hlm />
|
|
18
|
+
<ng-content />
|
|
19
|
+
`,
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
encapsulation: ViewEncapsulation.None,
|
|
22
|
+
exportAs: 'hlmDialog',
|
|
23
|
+
})
|
|
24
|
+
export class HlmDialogComponent extends BrnDialogComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
this.closeDelay = 100;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
inject,
|
|
8
|
+
Input,
|
|
9
|
+
OnDestroy,
|
|
10
|
+
PLATFORM_ID,
|
|
11
|
+
signal,
|
|
12
|
+
ViewEncapsulation,
|
|
13
|
+
} from '@angular/core';
|
|
2
14
|
import { IconName, NgIconComponent } from '@ng-icons/core';
|
|
3
15
|
import { hlm } from '@spartan-ng/ui-core';
|
|
4
16
|
import { cva } from 'class-variance-authority';
|
|
@@ -8,7 +20,7 @@ const DEFINED_SIZES = ['xs', 'sm', 'base', 'lg', 'xl', 'none'] as const;
|
|
|
8
20
|
|
|
9
21
|
type DefinedSizes = (typeof DEFINED_SIZES)[number];
|
|
10
22
|
|
|
11
|
-
const iconVariants = cva('inline-flex', {
|
|
23
|
+
export const iconVariants = cva('inline-flex', {
|
|
12
24
|
variants: {
|
|
13
25
|
variant: {
|
|
14
26
|
xs: 'h-3 w-3',
|
|
@@ -30,6 +42,8 @@ const isDefinedSize = (size: IconSize): size is DefinedSizes => {
|
|
|
30
42
|
return DEFINED_SIZES.includes(size as DefinedSizes);
|
|
31
43
|
};
|
|
32
44
|
|
|
45
|
+
const TAILWIND_H_W_PATTERN = /\b(h-\d+|w-\d+)\b/g;
|
|
46
|
+
|
|
33
47
|
@Component({
|
|
34
48
|
selector: 'hlm-icon',
|
|
35
49
|
standalone: true,
|
|
@@ -49,7 +63,14 @@ const isDefinedSize = (size: IconSize): size is DefinedSizes => {
|
|
|
49
63
|
'[class]': '_computedClass()',
|
|
50
64
|
},
|
|
51
65
|
})
|
|
52
|
-
export class HlmIconComponent {
|
|
66
|
+
export class HlmIconComponent implements OnDestroy {
|
|
67
|
+
private readonly _host = inject(ElementRef);
|
|
68
|
+
private readonly _platformId = inject(PLATFORM_ID);
|
|
69
|
+
|
|
70
|
+
private _mutObs?: MutationObserver;
|
|
71
|
+
|
|
72
|
+
private readonly _hostClasses = signal<string>('');
|
|
73
|
+
|
|
53
74
|
protected readonly _name = signal<IconName | string>('');
|
|
54
75
|
protected readonly _size = signal<IconSize>('base');
|
|
55
76
|
protected readonly _color = signal<string | undefined>(undefined);
|
|
@@ -61,10 +82,34 @@ export class HlmIconComponent {
|
|
|
61
82
|
protected readonly _computedClass = computed(() => {
|
|
62
83
|
const size: IconSize = this._size();
|
|
63
84
|
const variant = isDefinedSize(size) ? size : 'none';
|
|
64
|
-
|
|
85
|
+
const hostClasses =
|
|
86
|
+
variant === 'none' ? this._hostClasses().replace(TAILWIND_H_W_PATTERN, '') : this._hostClasses();
|
|
87
|
+
|
|
88
|
+
return hlm(iconVariants({ variant }), this.userCls(), hostClasses);
|
|
65
89
|
});
|
|
66
90
|
|
|
67
|
-
|
|
91
|
+
constructor() {
|
|
92
|
+
if (isPlatformBrowser(this._platformId)) {
|
|
93
|
+
this._mutObs = new MutationObserver((mutations: MutationRecord[]) => {
|
|
94
|
+
mutations.forEach((mutation: MutationRecord) => {
|
|
95
|
+
if (mutation.attributeName !== 'class') return;
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
97
|
+
// @ts-expect-error
|
|
98
|
+
this._hostClasses.set(mutation.target?.['className'] ?? '');
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
this._mutObs.observe(this._host.nativeElement, {
|
|
102
|
+
attributes: true,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
ngOnDestroy() {
|
|
108
|
+
this._mutObs?.disconnect();
|
|
109
|
+
this._mutObs = undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@Input()
|
|
68
113
|
set name(value: IconName | string) {
|
|
69
114
|
this._name.set(value);
|
|
70
115
|
}
|
package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input-error.directive.ts.template
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const inputErrorVariants = cva('text-destructive text-sm font-medium', {
|
|
6
|
+
export const inputErrorVariants = cva('text-destructive text-sm font-medium', {
|
|
7
7
|
variants: {},
|
|
8
8
|
defaultVariants: {},
|
|
9
9
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Directive, Input,
|
|
1
|
+
import { computed, Directive, Input, signal } from '@angular/core';
|
|
2
2
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
3
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
|
-
const inputVariants = cva(
|
|
6
|
+
export const inputVariants = cva(
|
|
7
7
|
'flex rounded-md border font-normal border-input bg-transparent text-sm ring-offset-background file:border-0 file:text-foreground file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import { computed, Directive, ElementRef, inject, Input, OnInit, PLATFORM_ID, signal } from '@angular/core';
|
|
2
3
|
import { hlm } from '@spartan-ng/ui-core';
|
|
3
|
-
import {
|
|
4
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
5
|
import { ClassValue } from 'clsx';
|
|
5
6
|
|
|
6
|
-
const labelVariants = cva(
|
|
7
|
+
export const labelVariants = cva(
|
|
7
8
|
'text-sm font-medium leading-none [&:has([hlmInput]:disabled)]:cursor-not-allowed [&:has([hlmInput]:disabled)]:opacity-70',
|
|
8
9
|
{
|
|
9
10
|
variants: {
|
|
@@ -14,6 +15,11 @@ const labelVariants = cva(
|
|
|
14
15
|
auto: '[&:has([hlmInput].ng-invalid.ng-touched)]:text-destructive',
|
|
15
16
|
true: 'text-destructive',
|
|
16
17
|
},
|
|
18
|
+
disabled: {
|
|
19
|
+
auto: '[&:has([hlmInput]:disabled)]:opacity-70',
|
|
20
|
+
true: 'opacity-70',
|
|
21
|
+
false: '',
|
|
22
|
+
},
|
|
17
23
|
},
|
|
18
24
|
defaultVariants: {
|
|
19
25
|
variant: 'default',
|
|
@@ -30,7 +36,28 @@ export type LabelVariants = VariantProps<typeof labelVariants>;
|
|
|
30
36
|
'[class]': '_computedClass()',
|
|
31
37
|
},
|
|
32
38
|
})
|
|
33
|
-
export class HlmLabelDirective {
|
|
39
|
+
export class HlmLabelDirective implements OnInit {
|
|
40
|
+
private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
41
|
+
private readonly _element = inject(ElementRef).nativeElement;
|
|
42
|
+
private _changes?: MutationObserver;
|
|
43
|
+
private readonly _dataDisabled = signal<boolean | 'auto'>('auto');
|
|
44
|
+
|
|
45
|
+
ngOnInit(): void {
|
|
46
|
+
if (!this._isBrowser) return;
|
|
47
|
+
this._changes = new MutationObserver((mutations: MutationRecord[]) => {
|
|
48
|
+
mutations.forEach((mutation: MutationRecord) => {
|
|
49
|
+
if (mutation.attributeName !== 'data-disabled') return;
|
|
50
|
+
// eslint-disable-next-line
|
|
51
|
+
const state = (mutation.target as any).attributes.getNamedItem(mutation.attributeName)?.value === 'true';
|
|
52
|
+
this._dataDisabled.set(state ?? 'auto');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
this._changes?.observe(this._element, {
|
|
56
|
+
attributes: true,
|
|
57
|
+
childList: true,
|
|
58
|
+
characterData: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
34
61
|
private readonly _variant = signal<LabelVariants['variant']>('default');
|
|
35
62
|
@Input()
|
|
36
63
|
set variant(value: LabelVariants['variant']) {
|
|
@@ -49,8 +76,10 @@ export class HlmLabelDirective {
|
|
|
49
76
|
this._userCls.set(userCls);
|
|
50
77
|
}
|
|
51
78
|
|
|
52
|
-
protected _computedClass = computed(() =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
protected readonly _computedClass = computed(() =>
|
|
80
|
+
hlm(
|
|
81
|
+
labelVariants({ variant: this._variant(), error: this._error(), disabled: this._dataDisabled() }),
|
|
82
|
+
this._userCls(),
|
|
83
|
+
),
|
|
84
|
+
);
|
|
56
85
|
}
|