@sonny-ui/core 0.1.0-alpha.16 → 0.1.0-alpha.18
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/README.md +109 -55
- package/fesm2022/sonny-ui-core.mjs +617 -178
- package/fesm2022/sonny-ui-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/accordion/accordion.directives.ts +0 -4
- package/src/lib/alert/alert.directives.ts +0 -3
- package/src/lib/avatar/avatar.component.ts +0 -1
- package/src/lib/avatar-group/avatar-group.component.spec.ts +74 -0
- package/src/lib/avatar-group/avatar-group.component.ts +88 -0
- package/src/lib/avatar-group/index.ts +1 -0
- package/src/lib/badge/badge.directive.ts +0 -1
- package/src/lib/breadcrumb/breadcrumb.directives.ts +0 -6
- package/src/lib/button/button.directive.ts +0 -1
- package/src/lib/button-group/button-group.directive.ts +0 -1
- package/src/lib/calendar/calendar.component.ts +0 -1
- package/src/lib/card/card.directives.ts +0 -6
- package/src/lib/carousel/carousel.directives.ts +0 -5
- package/src/lib/chat-bubble/chat-bubble.directives.ts +0 -6
- package/src/lib/checkbox/checkbox.directive.ts +0 -1
- package/src/lib/color-picker/color-picker.component.ts +5 -5
- package/src/lib/combobox/combobox.component.ts +1 -3
- package/src/lib/command-palette/command-palette.component.ts +0 -1
- package/src/lib/data-table/data-table.component.ts +0 -1
- package/src/lib/data-table/data-table.directives.ts +0 -4
- package/src/lib/date-picker/date-picker.component.ts +5 -5
- package/src/lib/date-range-picker/date-range-picker.component.ts +5 -5
- package/src/lib/diff/diff.component.ts +0 -1
- package/src/lib/divider/divider.component.ts +0 -1
- package/src/lib/dock/dock.directives.ts +0 -2
- package/src/lib/drawer/drawer.directives.ts +0 -3
- package/src/lib/dropdown/dropdown.directives.ts +3 -10
- package/src/lib/fab/fab.directives.ts +0 -3
- package/src/lib/fieldset/fieldset.directives.ts +0 -3
- package/src/lib/file-input/file-input.component.ts +0 -1
- package/src/lib/indicator/indicator.directives.ts +0 -2
- package/src/lib/input/input.directive.ts +0 -1
- package/src/lib/input/label.directive.ts +0 -1
- package/src/lib/kbd/kbd.directive.ts +0 -1
- package/src/lib/link/link.directive.ts +0 -1
- package/src/lib/list/list.directives.ts +0 -5
- package/src/lib/loader/loader.component.ts +0 -1
- package/src/lib/modal/dialog.directives.ts +0 -6
- package/src/lib/navbar/navbar.directives.ts +0 -4
- package/src/lib/number-input/index.ts +2 -0
- package/src/lib/number-input/number-input.component.spec.ts +151 -0
- package/src/lib/number-input/number-input.component.ts +152 -0
- package/src/lib/number-input/number-input.variants.ts +17 -0
- package/src/lib/otp-input/otp-input.component.ts +0 -1
- package/src/lib/pagination/pagination.component.ts +0 -1
- package/src/lib/popover/index.ts +6 -0
- package/src/lib/popover/popover.directives.spec.ts +147 -0
- package/src/lib/popover/popover.directives.ts +151 -0
- package/src/lib/progress/progress.component.ts +0 -1
- package/src/lib/radial-progress/radial-progress.component.ts +0 -1
- package/src/lib/radio/radio.directive.ts +0 -1
- package/src/lib/rating/rating.component.ts +0 -1
- package/src/lib/select/select.component.ts +1 -3
- package/src/lib/sheet/sheet.directives.ts +0 -5
- package/src/lib/skeleton/skeleton.directive.ts +0 -1
- package/src/lib/slider/slider.component.ts +0 -1
- package/src/lib/stat/stat.directives.ts +0 -5
- package/src/lib/status/status.directive.ts +0 -1
- package/src/lib/steps/steps.directives.ts +0 -2
- package/src/lib/switch/switch.component.ts +0 -1
- package/src/lib/table/table.directives.ts +0 -8
- package/src/lib/tabs/tabs.directives.ts +0 -4
- package/src/lib/tag-input/index.ts +2 -0
- package/src/lib/tag-input/tag-input.component.spec.ts +190 -0
- package/src/lib/tag-input/tag-input.component.ts +172 -0
- package/src/lib/tag-input/tag-input.variants.ts +31 -0
- package/src/lib/textarea/textarea.directive.ts +0 -1
- package/src/lib/timeline/timeline.directives.ts +0 -5
- package/src/lib/toast/toaster.component.ts +0 -1
- package/src/lib/toggle/toggle.directive.ts +0 -1
- package/src/lib/tooltip/tooltip.directive.ts +0 -1
- package/src/lib/validator/validator.directives.ts +0 -2
- package/types/sonny-ui-core.d.ts +147 -2
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ export const SNY_ACCORDION_ITEM = new InjectionToken<SnyAccordionItemDirective>(
|
|
|
6
6
|
|
|
7
7
|
@Directive({
|
|
8
8
|
selector: '[snyAccordion]',
|
|
9
|
-
standalone: true,
|
|
10
9
|
exportAs: 'snyAccordion',
|
|
11
10
|
providers: [{ provide: SNY_ACCORDION, useExisting: SnyAccordionDirective }],
|
|
12
11
|
host: {
|
|
@@ -81,7 +80,6 @@ export class SnyAccordionDirective {
|
|
|
81
80
|
|
|
82
81
|
@Directive({
|
|
83
82
|
selector: '[snyAccordionItem]',
|
|
84
|
-
standalone: true,
|
|
85
83
|
exportAs: 'snyAccordionItem',
|
|
86
84
|
providers: [{ provide: SNY_ACCORDION_ITEM, useExisting: SnyAccordionItemDirective }],
|
|
87
85
|
host: { '[class]': 'computedClass()' },
|
|
@@ -104,7 +102,6 @@ export class SnyAccordionItemDirective {
|
|
|
104
102
|
|
|
105
103
|
@Directive({
|
|
106
104
|
selector: '[snyAccordionTrigger]',
|
|
107
|
-
standalone: true,
|
|
108
105
|
host: {
|
|
109
106
|
'[class]': 'computedClass()',
|
|
110
107
|
'[attr.aria-expanded]': 'item.isOpen()',
|
|
@@ -127,7 +124,6 @@ export class SnyAccordionTriggerDirective {
|
|
|
127
124
|
|
|
128
125
|
@Directive({
|
|
129
126
|
selector: '[snyAccordionContent]',
|
|
130
|
-
standalone: true,
|
|
131
127
|
host: {
|
|
132
128
|
'[class]': 'computedClass()',
|
|
133
129
|
role: 'region',
|
|
@@ -5,7 +5,6 @@ import { alertVariants, type AlertVariant } from './alert.variants';
|
|
|
5
5
|
@Directive({
|
|
6
6
|
selector: '[snyAlert]',
|
|
7
7
|
exportAs: 'snyAlert',
|
|
8
|
-
standalone: true,
|
|
9
8
|
host: {
|
|
10
9
|
'[class]': 'computedClass()',
|
|
11
10
|
'[attr.role]': 'role()',
|
|
@@ -41,7 +40,6 @@ export class SnyAlertDirective {
|
|
|
41
40
|
|
|
42
41
|
@Directive({
|
|
43
42
|
selector: '[snyAlertTitle]',
|
|
44
|
-
standalone: true,
|
|
45
43
|
host: {
|
|
46
44
|
'[class]': 'computedClass()',
|
|
47
45
|
},
|
|
@@ -56,7 +54,6 @@ export class SnyAlertTitleDirective {
|
|
|
56
54
|
|
|
57
55
|
@Directive({
|
|
58
56
|
selector: '[snyAlertDescription]',
|
|
59
|
-
standalone: true,
|
|
60
57
|
host: {
|
|
61
58
|
'[class]': 'computedClass()',
|
|
62
59
|
},
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, signal } from '@angular/core';
|
|
2
|
+
import { TestBed, type ComponentFixture } from '@angular/core/testing';
|
|
3
|
+
import { SnyAvatarGroupComponent, type AvatarGroupItem } from './avatar-group.component';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [SnyAvatarGroupComponent],
|
|
8
|
+
template: `<sny-avatar-group [items]="items()" [max]="max()" [size]="size()" />`,
|
|
9
|
+
})
|
|
10
|
+
class TestHost {
|
|
11
|
+
items = signal<AvatarGroupItem[]>([
|
|
12
|
+
{ src: 'a.jpg', alt: 'Alice' },
|
|
13
|
+
{ src: 'b.jpg', alt: 'Bob' },
|
|
14
|
+
{ src: 'c.jpg', alt: 'Carol' },
|
|
15
|
+
{ src: 'd.jpg', alt: 'David' },
|
|
16
|
+
{ src: 'e.jpg', alt: 'Eve' },
|
|
17
|
+
]);
|
|
18
|
+
max = signal(3);
|
|
19
|
+
size = signal<'sm' | 'md' | 'lg'>('md');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('SnyAvatarGroupComponent', () => {
|
|
23
|
+
let fixture: ComponentFixture<TestHost>;
|
|
24
|
+
let el: HTMLElement;
|
|
25
|
+
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
await TestBed.configureTestingModule({ imports: [TestHost] }).compileComponents();
|
|
28
|
+
fixture = TestBed.createComponent(TestHost);
|
|
29
|
+
fixture.detectChanges();
|
|
30
|
+
el = fixture.nativeElement;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should render max avatars', () => {
|
|
34
|
+
const imgs = el.querySelectorAll('img');
|
|
35
|
+
expect(imgs.length).toBe(3);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should show overflow counter', () => {
|
|
39
|
+
const counter = el.querySelector('[title="2 more"]');
|
|
40
|
+
expect(counter).not.toBeNull();
|
|
41
|
+
expect(counter?.textContent).toContain('+2');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should not show counter when no overflow', () => {
|
|
45
|
+
fixture.componentInstance.max.set(5);
|
|
46
|
+
fixture.detectChanges();
|
|
47
|
+
const counter = el.querySelector('[title]');
|
|
48
|
+
expect(counter).toBeNull();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should render all when max >= items', () => {
|
|
52
|
+
fixture.componentInstance.max.set(10);
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
const imgs = el.querySelectorAll('img');
|
|
55
|
+
expect(imgs.length).toBe(5);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should render fallback initials when no src', () => {
|
|
59
|
+
fixture.componentInstance.items.set([
|
|
60
|
+
{ fallback: 'AB' },
|
|
61
|
+
{ fallback: 'CD' },
|
|
62
|
+
]);
|
|
63
|
+
fixture.componentInstance.max.set(2);
|
|
64
|
+
fixture.detectChanges();
|
|
65
|
+
const fallbacks = el.querySelectorAll('.bg-muted');
|
|
66
|
+
expect(fallbacks.length).toBe(2);
|
|
67
|
+
expect(fallbacks[0].textContent).toContain('AB');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should have aria-label on group', () => {
|
|
71
|
+
const group = el.querySelector('[role="group"]');
|
|
72
|
+
expect(group?.getAttribute('aria-label')).toBe('Group of 5 users');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
input,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { cn } from '../core/utils/cn';
|
|
8
|
+
|
|
9
|
+
export interface AvatarGroupItem {
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
fallback?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const sizeMap = {
|
|
16
|
+
sm: { avatar: 'h-7 w-7 text-xs', counter: 'h-7 w-7 text-[10px]' },
|
|
17
|
+
md: { avatar: 'h-9 w-9 text-sm', counter: 'h-9 w-9 text-xs' },
|
|
18
|
+
lg: { avatar: 'h-11 w-11 text-base', counter: 'h-11 w-11 text-sm' },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const spacingMap = {
|
|
22
|
+
tight: '-space-x-3',
|
|
23
|
+
normal: '-space-x-2',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type AvatarGroupSize = 'sm' | 'md' | 'lg';
|
|
27
|
+
export type AvatarGroupSpacing = 'tight' | 'normal';
|
|
28
|
+
|
|
29
|
+
@Component({
|
|
30
|
+
selector: 'sny-avatar-group',
|
|
31
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
32
|
+
template: `
|
|
33
|
+
<div [class]="containerClass()" role="group" [attr.aria-label]="'Group of ' + items().length + ' users'">
|
|
34
|
+
@for (item of visibleItems(); track $index) {
|
|
35
|
+
@if (item.src) {
|
|
36
|
+
<img
|
|
37
|
+
[src]="item.src"
|
|
38
|
+
[alt]="item.alt ?? ''"
|
|
39
|
+
[class]="avatarClass()"
|
|
40
|
+
/>
|
|
41
|
+
} @else {
|
|
42
|
+
<div [class]="fallbackClass()">
|
|
43
|
+
{{ item.fallback ?? '?' }}
|
|
44
|
+
</div>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
@if (overflowCount() > 0) {
|
|
48
|
+
<div [class]="counterClass()" [title]="overflowCount() + ' more'">
|
|
49
|
+
+{{ overflowCount() }}
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
})
|
|
55
|
+
export class SnyAvatarGroupComponent {
|
|
56
|
+
readonly items = input.required<AvatarGroupItem[]>();
|
|
57
|
+
readonly max = input(3);
|
|
58
|
+
readonly size = input<AvatarGroupSize>('md');
|
|
59
|
+
readonly spacing = input<AvatarGroupSpacing>('normal');
|
|
60
|
+
|
|
61
|
+
readonly visibleItems = computed(() => this.items().slice(0, this.max()));
|
|
62
|
+
readonly overflowCount = computed(() => Math.max(0, this.items().length - this.max()));
|
|
63
|
+
|
|
64
|
+
readonly containerClass = computed(() =>
|
|
65
|
+
cn('flex items-center', spacingMap[this.spacing()])
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
readonly avatarClass = computed(() =>
|
|
69
|
+
cn(
|
|
70
|
+
'inline-block rounded-full object-cover ring-2 ring-background',
|
|
71
|
+
sizeMap[this.size()].avatar
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
readonly fallbackClass = computed(() =>
|
|
76
|
+
cn(
|
|
77
|
+
'inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground font-medium ring-2 ring-background',
|
|
78
|
+
sizeMap[this.size()].avatar
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
readonly counterClass = computed(() =>
|
|
83
|
+
cn(
|
|
84
|
+
'inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground font-semibold ring-2 ring-background',
|
|
85
|
+
sizeMap[this.size()].counter
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SnyAvatarGroupComponent, type AvatarGroupItem, type AvatarGroupSize, type AvatarGroupSpacing } from './avatar-group.component';
|
|
@@ -3,7 +3,6 @@ import { cn } from '../core/utils/cn';
|
|
|
3
3
|
|
|
4
4
|
@Directive({
|
|
5
5
|
selector: 'nav[snyBreadcrumb]',
|
|
6
|
-
standalone: true,
|
|
7
6
|
host: {
|
|
8
7
|
'[class]': 'computedClass()',
|
|
9
8
|
'aria-label': 'Breadcrumb',
|
|
@@ -16,7 +15,6 @@ export class SnyBreadcrumbDirective {
|
|
|
16
15
|
|
|
17
16
|
@Directive({
|
|
18
17
|
selector: 'ol[snyBreadcrumbList]',
|
|
19
|
-
standalone: true,
|
|
20
18
|
host: { '[class]': 'computedClass()' },
|
|
21
19
|
})
|
|
22
20
|
export class SnyBreadcrumbListDirective {
|
|
@@ -28,7 +26,6 @@ export class SnyBreadcrumbListDirective {
|
|
|
28
26
|
|
|
29
27
|
@Directive({
|
|
30
28
|
selector: 'li[snyBreadcrumbItem]',
|
|
31
|
-
standalone: true,
|
|
32
29
|
host: { '[class]': 'computedClass()' },
|
|
33
30
|
})
|
|
34
31
|
export class SnyBreadcrumbItemDirective {
|
|
@@ -40,7 +37,6 @@ export class SnyBreadcrumbItemDirective {
|
|
|
40
37
|
|
|
41
38
|
@Directive({
|
|
42
39
|
selector: '[snyBreadcrumbLink]',
|
|
43
|
-
standalone: true,
|
|
44
40
|
host: { '[class]': 'computedClass()' },
|
|
45
41
|
})
|
|
46
42
|
export class SnyBreadcrumbLinkDirective {
|
|
@@ -52,7 +48,6 @@ export class SnyBreadcrumbLinkDirective {
|
|
|
52
48
|
|
|
53
49
|
@Directive({
|
|
54
50
|
selector: '[snyBreadcrumbSeparator]',
|
|
55
|
-
standalone: true,
|
|
56
51
|
host: {
|
|
57
52
|
role: 'presentation',
|
|
58
53
|
'[aria-hidden]': 'true',
|
|
@@ -68,7 +63,6 @@ export class SnyBreadcrumbSeparatorDirective {
|
|
|
68
63
|
|
|
69
64
|
@Directive({
|
|
70
65
|
selector: '[snyBreadcrumbPage]',
|
|
71
|
-
standalone: true,
|
|
72
66
|
host: {
|
|
73
67
|
role: 'link',
|
|
74
68
|
'aria-disabled': 'true',
|
|
@@ -4,7 +4,6 @@ import { cardVariants, type CardVariant, type CardPadding } from './card.variant
|
|
|
4
4
|
|
|
5
5
|
@Directive({
|
|
6
6
|
selector: '[snyCard]',
|
|
7
|
-
standalone: true,
|
|
8
7
|
host: { '[class]': 'computedClass()' },
|
|
9
8
|
})
|
|
10
9
|
export class SnyCardDirective {
|
|
@@ -19,7 +18,6 @@ export class SnyCardDirective {
|
|
|
19
18
|
|
|
20
19
|
@Directive({
|
|
21
20
|
selector: '[snyCardHeader]',
|
|
22
|
-
standalone: true,
|
|
23
21
|
host: { '[class]': 'computedClass()' },
|
|
24
22
|
})
|
|
25
23
|
export class SnyCardHeaderDirective {
|
|
@@ -31,7 +29,6 @@ export class SnyCardHeaderDirective {
|
|
|
31
29
|
|
|
32
30
|
@Directive({
|
|
33
31
|
selector: '[snyCardTitle]',
|
|
34
|
-
standalone: true,
|
|
35
32
|
host: { '[class]': 'computedClass()' },
|
|
36
33
|
})
|
|
37
34
|
export class SnyCardTitleDirective {
|
|
@@ -43,7 +40,6 @@ export class SnyCardTitleDirective {
|
|
|
43
40
|
|
|
44
41
|
@Directive({
|
|
45
42
|
selector: '[snyCardDescription]',
|
|
46
|
-
standalone: true,
|
|
47
43
|
host: { '[class]': 'computedClass()' },
|
|
48
44
|
})
|
|
49
45
|
export class SnyCardDescriptionDirective {
|
|
@@ -55,7 +51,6 @@ export class SnyCardDescriptionDirective {
|
|
|
55
51
|
|
|
56
52
|
@Directive({
|
|
57
53
|
selector: '[snyCardContent]',
|
|
58
|
-
standalone: true,
|
|
59
54
|
host: { '[class]': 'computedClass()' },
|
|
60
55
|
})
|
|
61
56
|
export class SnyCardContentDirective {
|
|
@@ -67,7 +62,6 @@ export class SnyCardContentDirective {
|
|
|
67
62
|
|
|
68
63
|
@Directive({
|
|
69
64
|
selector: '[snyCardFooter]',
|
|
70
|
-
standalone: true,
|
|
71
65
|
host: { '[class]': 'computedClass()' },
|
|
72
66
|
})
|
|
73
67
|
export class SnyCardFooterDirective {
|
|
@@ -7,7 +7,6 @@ export const SNY_CAROUSEL = new InjectionToken<SnyCarouselDirective>('SnyCarouse
|
|
|
7
7
|
|
|
8
8
|
@Directive({
|
|
9
9
|
selector: '[snyCarouselItem]',
|
|
10
|
-
standalone: true,
|
|
11
10
|
host: {
|
|
12
11
|
'role': 'group',
|
|
13
12
|
'[attr.aria-roledescription]': '"slide"',
|
|
@@ -23,7 +22,6 @@ export class SnyCarouselItemDirective {
|
|
|
23
22
|
|
|
24
23
|
@Directive({
|
|
25
24
|
selector: '[snyCarouselContent]',
|
|
26
|
-
standalone: true,
|
|
27
25
|
host: {
|
|
28
26
|
'[class]': 'computedClass()',
|
|
29
27
|
'[style.transform]': 'transformStyle()',
|
|
@@ -44,7 +42,6 @@ export class SnyCarouselContentDirective {
|
|
|
44
42
|
|
|
45
43
|
@Directive({
|
|
46
44
|
selector: '[snyCarousel]',
|
|
47
|
-
standalone: true,
|
|
48
45
|
exportAs: 'snyCarousel',
|
|
49
46
|
providers: [{ provide: SNY_CAROUSEL, useExisting: SnyCarouselDirective }],
|
|
50
47
|
host: {
|
|
@@ -131,7 +128,6 @@ export class SnyCarouselDirective implements OnDestroy {
|
|
|
131
128
|
|
|
132
129
|
@Directive({
|
|
133
130
|
selector: '[snyCarouselPrev]',
|
|
134
|
-
standalone: true,
|
|
135
131
|
host: {
|
|
136
132
|
'(click)': 'carousel.prev()',
|
|
137
133
|
'[attr.aria-label]': '"Previous slide"',
|
|
@@ -148,7 +144,6 @@ export class SnyCarouselPrevDirective {
|
|
|
148
144
|
|
|
149
145
|
@Directive({
|
|
150
146
|
selector: '[snyCarouselNext]',
|
|
151
|
-
standalone: true,
|
|
152
147
|
host: {
|
|
153
148
|
'(click)': 'carousel.next()',
|
|
154
149
|
'[attr.aria-label]': '"Next slide"',
|
|
@@ -8,7 +8,6 @@ export const SNY_CHAT_BUBBLE = new InjectionToken<SnyChatBubbleDirective>('SnyCh
|
|
|
8
8
|
|
|
9
9
|
@Directive({
|
|
10
10
|
selector: '[snyChatBubble]',
|
|
11
|
-
standalone: true,
|
|
12
11
|
providers: [{ provide: SNY_CHAT_BUBBLE, useExisting: SnyChatBubbleDirective }],
|
|
13
12
|
host: {
|
|
14
13
|
'role': 'article',
|
|
@@ -30,7 +29,6 @@ export class SnyChatBubbleDirective {
|
|
|
30
29
|
|
|
31
30
|
@Directive({
|
|
32
31
|
selector: '[snyChatBubbleAvatar]',
|
|
33
|
-
standalone: true,
|
|
34
32
|
host: { '[class]': 'computedClass()' },
|
|
35
33
|
})
|
|
36
34
|
export class SnyChatBubbleAvatarDirective {
|
|
@@ -42,7 +40,6 @@ export class SnyChatBubbleAvatarDirective {
|
|
|
42
40
|
|
|
43
41
|
@Directive({
|
|
44
42
|
selector: '[snyChatBubbleHeader]',
|
|
45
|
-
standalone: true,
|
|
46
43
|
host: { '[class]': 'computedClass()' },
|
|
47
44
|
})
|
|
48
45
|
export class SnyChatBubbleHeaderDirective {
|
|
@@ -54,7 +51,6 @@ export class SnyChatBubbleHeaderDirective {
|
|
|
54
51
|
|
|
55
52
|
@Directive({
|
|
56
53
|
selector: '[snyChatBubbleContent]',
|
|
57
|
-
standalone: true,
|
|
58
54
|
host: { '[class]': 'computedClass()' },
|
|
59
55
|
})
|
|
60
56
|
export class SnyChatBubbleContentDirective {
|
|
@@ -74,7 +70,6 @@ export class SnyChatBubbleContentDirective {
|
|
|
74
70
|
|
|
75
71
|
@Directive({
|
|
76
72
|
selector: '[snyChatBubbleFooter]',
|
|
77
|
-
standalone: true,
|
|
78
73
|
host: { '[class]': 'computedClass()' },
|
|
79
74
|
})
|
|
80
75
|
export class SnyChatBubbleFooterDirective {
|
|
@@ -86,7 +81,6 @@ export class SnyChatBubbleFooterDirective {
|
|
|
86
81
|
|
|
87
82
|
@Directive({
|
|
88
83
|
selector: '[snyChatBubbleBody]',
|
|
89
|
-
standalone: true,
|
|
90
84
|
host: { '[class]': 'computedClass()' },
|
|
91
85
|
})
|
|
92
86
|
export class SnyChatBubbleBodyDirective {
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
effect,
|
|
6
6
|
ElementRef,
|
|
7
7
|
forwardRef,
|
|
8
|
-
HostListener,
|
|
9
8
|
inject,
|
|
10
9
|
input,
|
|
11
10
|
model,
|
|
@@ -30,9 +29,12 @@ import { colorPickerTriggerVariants, type ColorPickerSize } from './color-picker
|
|
|
30
29
|
|
|
31
30
|
@Component({
|
|
32
31
|
selector: 'sny-color-picker',
|
|
33
|
-
standalone: true,
|
|
34
32
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
-
host: {
|
|
33
|
+
host: {
|
|
34
|
+
class: 'relative inline-block',
|
|
35
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
36
|
+
'(keydown.escape)': 'onEscape()',
|
|
37
|
+
},
|
|
36
38
|
providers: [
|
|
37
39
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyColorPickerComponent), multi: true },
|
|
38
40
|
],
|
|
@@ -518,14 +520,12 @@ export class SnyColorPickerComponent implements ControlValueAccessor, OnDestroy
|
|
|
518
520
|
}
|
|
519
521
|
}
|
|
520
522
|
|
|
521
|
-
@HostListener('document:click', ['$event'])
|
|
522
523
|
onDocumentClick(event: MouseEvent): void {
|
|
523
524
|
if (!this.elRef.nativeElement.contains(event.target)) {
|
|
524
525
|
this.close();
|
|
525
526
|
}
|
|
526
527
|
}
|
|
527
528
|
|
|
528
|
-
@HostListener('keydown.escape')
|
|
529
529
|
onEscape(): void {
|
|
530
530
|
this.close();
|
|
531
531
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
computed,
|
|
5
5
|
ElementRef,
|
|
6
6
|
forwardRef,
|
|
7
|
-
HostListener,
|
|
8
7
|
inject,
|
|
9
8
|
input,
|
|
10
9
|
model,
|
|
@@ -23,10 +22,10 @@ export interface ComboboxOption {
|
|
|
23
22
|
|
|
24
23
|
@Component({
|
|
25
24
|
selector: 'sny-combobox',
|
|
26
|
-
standalone: true,
|
|
27
25
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
26
|
host: {
|
|
29
27
|
class: 'relative inline-block w-full',
|
|
28
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
30
29
|
},
|
|
31
30
|
providers: [
|
|
32
31
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyComboboxComponent), multi: true },
|
|
@@ -257,7 +256,6 @@ export class SnyComboboxComponent implements ControlValueAccessor, OnDestroy {
|
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
258
|
|
|
260
|
-
@HostListener('document:click', ['$event'])
|
|
261
259
|
onDocumentClick(event: MouseEvent): void {
|
|
262
260
|
if (!this.elRef.nativeElement.contains(event.target)) {
|
|
263
261
|
this.close();
|
|
@@ -2,7 +2,6 @@ import { Directive, TemplateRef, inject, input } from '@angular/core';
|
|
|
2
2
|
|
|
3
3
|
@Directive({
|
|
4
4
|
selector: '[snyCell]',
|
|
5
|
-
standalone: true,
|
|
6
5
|
})
|
|
7
6
|
export class SnyCellDefDirective {
|
|
8
7
|
readonly snyCell = input.required<string>();
|
|
@@ -11,7 +10,6 @@ export class SnyCellDefDirective {
|
|
|
11
10
|
|
|
12
11
|
@Directive({
|
|
13
12
|
selector: '[snyHeaderCell]',
|
|
14
|
-
standalone: true,
|
|
15
13
|
})
|
|
16
14
|
export class SnyHeaderCellDefDirective {
|
|
17
15
|
readonly snyHeaderCell = input.required<string>();
|
|
@@ -20,7 +18,6 @@ export class SnyHeaderCellDefDirective {
|
|
|
20
18
|
|
|
21
19
|
@Directive({
|
|
22
20
|
selector: '[snyBulkActions]',
|
|
23
|
-
standalone: true,
|
|
24
21
|
})
|
|
25
22
|
export class SnyBulkActionsDefDirective {
|
|
26
23
|
readonly template = inject(TemplateRef);
|
|
@@ -28,7 +25,6 @@ export class SnyBulkActionsDefDirective {
|
|
|
28
25
|
|
|
29
26
|
@Directive({
|
|
30
27
|
selector: '[snyRowExpand]',
|
|
31
|
-
standalone: true,
|
|
32
28
|
})
|
|
33
29
|
export class SnyRowExpandDefDirective {
|
|
34
30
|
readonly template = inject(TemplateRef);
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
computed,
|
|
5
5
|
ElementRef,
|
|
6
6
|
forwardRef,
|
|
7
|
-
HostListener,
|
|
8
7
|
inject,
|
|
9
8
|
input,
|
|
10
9
|
model,
|
|
@@ -19,10 +18,13 @@ import { datePickerTriggerVariants, type DatePickerSize } from './date-picker.va
|
|
|
19
18
|
|
|
20
19
|
@Component({
|
|
21
20
|
selector: 'sny-date-picker',
|
|
22
|
-
standalone: true,
|
|
23
21
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
22
|
imports: [SnyCalendarComponent],
|
|
25
|
-
host: {
|
|
23
|
+
host: {
|
|
24
|
+
class: 'relative inline-block w-full',
|
|
25
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
26
|
+
'(keydown.escape)': 'onEscape()',
|
|
27
|
+
},
|
|
26
28
|
providers: [
|
|
27
29
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyDatePickerComponent), multi: true },
|
|
28
30
|
],
|
|
@@ -206,14 +208,12 @@ export class SnyDatePickerComponent implements ControlValueAccessor, OnDestroy {
|
|
|
206
208
|
this.removeGlobalListeners();
|
|
207
209
|
}
|
|
208
210
|
|
|
209
|
-
@HostListener('document:click', ['$event'])
|
|
210
211
|
onDocumentClick(event: MouseEvent): void {
|
|
211
212
|
if (!this.elRef.nativeElement.contains(event.target)) {
|
|
212
213
|
this.close();
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
@HostListener('keydown.escape')
|
|
217
217
|
onEscape(): void {
|
|
218
218
|
this.close();
|
|
219
219
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
computed,
|
|
5
5
|
ElementRef,
|
|
6
6
|
forwardRef,
|
|
7
|
-
HostListener,
|
|
8
7
|
inject,
|
|
9
8
|
input,
|
|
10
9
|
model,
|
|
@@ -20,10 +19,13 @@ import { datePickerTriggerVariants, type DatePickerSize } from '../date-picker/d
|
|
|
20
19
|
|
|
21
20
|
@Component({
|
|
22
21
|
selector: 'sny-date-range-picker',
|
|
23
|
-
standalone: true,
|
|
24
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
23
|
imports: [SnyCalendarComponent],
|
|
26
|
-
host: {
|
|
24
|
+
host: {
|
|
25
|
+
class: 'relative inline-block w-full',
|
|
26
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
27
|
+
'(keydown.escape)': 'onEscape()',
|
|
28
|
+
},
|
|
27
29
|
providers: [
|
|
28
30
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyDateRangePickerComponent), multi: true },
|
|
29
31
|
],
|
|
@@ -326,14 +328,12 @@ export class SnyDateRangePickerComponent implements ControlValueAccessor, OnDest
|
|
|
326
328
|
this.removeGlobalListeners();
|
|
327
329
|
}
|
|
328
330
|
|
|
329
|
-
@HostListener('document:click', ['$event'])
|
|
330
331
|
onDocumentClick(event: MouseEvent): void {
|
|
331
332
|
if (!this.elRef.nativeElement.contains(event.target)) {
|
|
332
333
|
this.close();
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
|
|
336
|
-
@HostListener('keydown.escape')
|
|
337
337
|
onEscape(): void {
|
|
338
338
|
this.close();
|
|
339
339
|
}
|