@colletdev/angular 0.1.3
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 +60 -0
- package/package.json +43 -0
- package/src/accordion.component.ts +97 -0
- package/src/activity-group.component.ts +61 -0
- package/src/alert.component.ts +75 -0
- package/src/autocomplete.component.ts +196 -0
- package/src/avatar.component.ts +59 -0
- package/src/backdrop.component.ts +51 -0
- package/src/badge.component.ts +67 -0
- package/src/breadcrumb.component.ts +77 -0
- package/src/button.component.ts +74 -0
- package/src/card.component.ts +72 -0
- package/src/carousel.component.ts +96 -0
- package/src/chat-input.component.ts +116 -0
- package/src/checkbox.component.ts +121 -0
- package/src/code-block.component.ts +67 -0
- package/src/collapsible.component.ts +72 -0
- package/src/date-picker.component.ts +159 -0
- package/src/dialog.component.ts +67 -0
- package/src/drawer.component.ts +67 -0
- package/src/fab.component.ts +70 -0
- package/src/file-upload.component.ts +77 -0
- package/src/index.ts +99 -0
- package/src/listbox.component.ts +121 -0
- package/src/menu.component.ts +99 -0
- package/src/message-bubble.component.ts +67 -0
- package/src/message-group.component.ts +77 -0
- package/src/message-part.component.ts +47 -0
- package/src/pagination.component.ts +67 -0
- package/src/popover.component.ts +77 -0
- package/src/profile-menu.component.ts +87 -0
- package/src/progress.component.ts +60 -0
- package/src/radio-group.component.ts +138 -0
- package/src/scrollbar.component.ts +59 -0
- package/src/search-bar.component.ts +127 -0
- package/src/select.component.ts +181 -0
- package/src/sidebar.component.ts +91 -0
- package/src/skeleton.component.ts +57 -0
- package/src/slider.component.ts +134 -0
- package/src/speed-dial.component.ts +100 -0
- package/src/spinner.component.ts +53 -0
- package/src/split-button.component.ts +97 -0
- package/src/stepper.component.ts +83 -0
- package/src/switch.component.ts +123 -0
- package/src/table.component.ts +219 -0
- package/src/tabs.component.ts +82 -0
- package/src/text-input.component.ts +158 -0
- package/src/text.component.ts +73 -0
- package/src/thinking.component.ts +57 -0
- package/src/toast.component.ts +72 -0
- package/src/toggle-group.component.ts +123 -0
- package/src/tooltip.component.ts +61 -0
- package/src/types.ts +334 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-badge>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'cx-badge[collet]',
|
|
18
|
+
standalone: true,
|
|
19
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
template: `
|
|
22
|
+
<cx-badge
|
|
23
|
+
[attr.id]="id"
|
|
24
|
+
[attr.label]="label"
|
|
25
|
+
[attr.variant]="variant"
|
|
26
|
+
[attr.intent]="intent"
|
|
27
|
+
[attr.shape]="shape"
|
|
28
|
+
[attr.size]="size"
|
|
29
|
+
[attr.dot]="dot || null"
|
|
30
|
+
[attr.dismissible]="dismissible || null"
|
|
31
|
+
[attr.dismiss-label]="dismissLabel"
|
|
32
|
+
[attr.dynamic]="dynamic || null"
|
|
33
|
+
#el
|
|
34
|
+
><ng-content /></cx-badge>
|
|
35
|
+
`,
|
|
36
|
+
})
|
|
37
|
+
export class CxBadge implements AfterViewInit {
|
|
38
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
39
|
+
|
|
40
|
+
@Input() id?: string = undefined;
|
|
41
|
+
@Input() label?: string = undefined;
|
|
42
|
+
@Input() variant?: 'filled' | 'outline' | 'ghost' = undefined;
|
|
43
|
+
@Input() intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger' = undefined;
|
|
44
|
+
@Input() shape?: 'rounded' | 'pill' = undefined;
|
|
45
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
46
|
+
@Input() dot?: boolean = undefined;
|
|
47
|
+
@Input() dismissible?: boolean = undefined;
|
|
48
|
+
@Input() dismissLabel?: string = undefined;
|
|
49
|
+
@Input() dynamic?: boolean = undefined;
|
|
50
|
+
|
|
51
|
+
@Output() cxDismiss = new EventEmitter<CustomEvent>();
|
|
52
|
+
|
|
53
|
+
constructor(private c: ChangeDetectorRef) {
|
|
54
|
+
c.detach();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ngAfterViewInit(): void {
|
|
58
|
+
this.el.nativeElement.addEventListener('cx-dismiss', (e: Event) => {
|
|
59
|
+
this.cxDismiss.emit(e as CustomEvent);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-breadcrumb>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
OnChanges,
|
|
14
|
+
SimpleChanges,
|
|
15
|
+
AfterViewInit,
|
|
16
|
+
} from '@angular/core';
|
|
17
|
+
import type { BreadcrumbItem, NavigateDetail } from './types.js';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'cx-breadcrumb[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
template: `
|
|
25
|
+
<cx-breadcrumb
|
|
26
|
+
[attr.id]="id"
|
|
27
|
+
[items]="_serialize_items()"
|
|
28
|
+
[attr.separator]="separator"
|
|
29
|
+
[attr.size]="size"
|
|
30
|
+
[attr.nav-label]="navLabel"
|
|
31
|
+
[attr.disabled]="disabled || null"
|
|
32
|
+
#el
|
|
33
|
+
><ng-content /></cx-breadcrumb>
|
|
34
|
+
`,
|
|
35
|
+
})
|
|
36
|
+
export class CxBreadcrumb implements AfterViewInit, OnChanges {
|
|
37
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
38
|
+
|
|
39
|
+
@Input() id?: string = undefined;
|
|
40
|
+
@Input() items?: BreadcrumbItem[] | string = undefined;
|
|
41
|
+
@Input() separator?: string = undefined;
|
|
42
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
43
|
+
@Input() navLabel?: string = undefined;
|
|
44
|
+
@Input() disabled?: boolean = undefined;
|
|
45
|
+
|
|
46
|
+
@Output() cxNavigate = new EventEmitter<CustomEvent<NavigateDetail>>();
|
|
47
|
+
|
|
48
|
+
constructor(private c: ChangeDetectorRef) {
|
|
49
|
+
c.detach();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
ngAfterViewInit(): void {
|
|
53
|
+
this.el.nativeElement.addEventListener('cx-navigate', (e: Event) => {
|
|
54
|
+
this.cxNavigate.emit(e as CustomEvent);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
59
|
+
if (changes['items'] && this.el) {
|
|
60
|
+
const val = this.items;
|
|
61
|
+
if (val != null) {
|
|
62
|
+
this.el.nativeElement.setAttribute('items', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
63
|
+
} else {
|
|
64
|
+
this.el.nativeElement.removeAttribute('items');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_serialize_items(): string | null {
|
|
70
|
+
const val = this.items;
|
|
71
|
+
if (val == null) return null;
|
|
72
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-button>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
import type { ClickDetail } from './types.js';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'cx-button[collet]',
|
|
19
|
+
standalone: true,
|
|
20
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
template: `
|
|
23
|
+
<cx-button
|
|
24
|
+
[attr.label]="label"
|
|
25
|
+
[attr.variant]="variant"
|
|
26
|
+
[attr.intent]="intent"
|
|
27
|
+
[attr.shape]="shape"
|
|
28
|
+
[attr.size]="size"
|
|
29
|
+
[attr.disabled]="disabled || null"
|
|
30
|
+
[attr.icon-leading]="iconLeading"
|
|
31
|
+
[attr.icon-trailing]="iconTrailing"
|
|
32
|
+
[attr.icon-only]="iconOnly"
|
|
33
|
+
[attr.aria-label]="ariaLabel"
|
|
34
|
+
[attr.kind]="kind"
|
|
35
|
+
[attr.pressed]="pressed || null"
|
|
36
|
+
[attr.href]="href"
|
|
37
|
+
#el
|
|
38
|
+
><ng-content /></cx-button>
|
|
39
|
+
`,
|
|
40
|
+
})
|
|
41
|
+
export class CxButton implements AfterViewInit {
|
|
42
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
43
|
+
|
|
44
|
+
@Input() label?: string = undefined;
|
|
45
|
+
@Input() variant?: 'filled' | 'ghost' | 'outline' | 'underline' | 'side-indicator' = undefined;
|
|
46
|
+
@Input() intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger' = undefined;
|
|
47
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
48
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
49
|
+
@Input() disabled?: boolean = undefined;
|
|
50
|
+
@Input() iconLeading?: string = undefined;
|
|
51
|
+
@Input() iconTrailing?: string = undefined;
|
|
52
|
+
@Input() iconOnly?: string = undefined;
|
|
53
|
+
@Input() ariaLabel?: string = undefined;
|
|
54
|
+
@Input() kind?: 'button' | 'submit' | 'toggle' | 'link' = undefined;
|
|
55
|
+
@Input() pressed?: boolean = undefined;
|
|
56
|
+
@Input() href?: string = undefined;
|
|
57
|
+
|
|
58
|
+
@Output() cxClick = new EventEmitter<CustomEvent<ClickDetail>>();
|
|
59
|
+
|
|
60
|
+
constructor(private c: ChangeDetectorRef) {
|
|
61
|
+
c.detach();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ngAfterViewInit(): void {
|
|
65
|
+
this.el.nativeElement.addEventListener('cx-click', (e: Event) => {
|
|
66
|
+
this.cxClick.emit(e as CustomEvent);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-card>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
import type { ClickDetail, KeyboardDetail } from './types.js';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'cx-card[collet]',
|
|
19
|
+
standalone: true,
|
|
20
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
template: `
|
|
23
|
+
<cx-card
|
|
24
|
+
[attr.id]="id"
|
|
25
|
+
[attr.label]="label"
|
|
26
|
+
[attr.variant]="variant"
|
|
27
|
+
[attr.shape]="shape"
|
|
28
|
+
[attr.size]="size"
|
|
29
|
+
[attr.clickable]="clickable || null"
|
|
30
|
+
[attr.texture]="texture || null"
|
|
31
|
+
#el
|
|
32
|
+
><ng-content />
|
|
33
|
+
<ng-content select="[slot=header]" />
|
|
34
|
+
<ng-content select="[slot=footer]" /></cx-card>
|
|
35
|
+
`,
|
|
36
|
+
})
|
|
37
|
+
export class CxCard implements AfterViewInit {
|
|
38
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
39
|
+
|
|
40
|
+
@Input() id?: string = undefined;
|
|
41
|
+
@Input() label?: string = undefined;
|
|
42
|
+
@Input() variant?: 'elevated' | 'outlined' | 'filled' = undefined;
|
|
43
|
+
@Input() shape?: 'rounded' | 'sharp' | 'soft' = undefined;
|
|
44
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
45
|
+
@Input() clickable?: boolean = undefined;
|
|
46
|
+
@Input() texture?: boolean = undefined;
|
|
47
|
+
|
|
48
|
+
@Output() cxClick = new EventEmitter<CustomEvent<ClickDetail>>();
|
|
49
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
50
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
51
|
+
|
|
52
|
+
constructor(private c: ChangeDetectorRef) {
|
|
53
|
+
c.detach();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ngAfterViewInit(): void {
|
|
57
|
+
this.el.nativeElement.addEventListener('cx-click', (e: Event) => {
|
|
58
|
+
this.cxClick.emit(e as CustomEvent);
|
|
59
|
+
});
|
|
60
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
61
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
62
|
+
});
|
|
63
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
64
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-carousel>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
OnChanges,
|
|
14
|
+
SimpleChanges,
|
|
15
|
+
AfterViewInit,
|
|
16
|
+
} from '@angular/core';
|
|
17
|
+
import type { CarouselDetail, CarouselSlide } from './types.js';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'cx-carousel[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
template: `
|
|
25
|
+
<cx-carousel
|
|
26
|
+
[attr.id]="id"
|
|
27
|
+
[attr.label]="label"
|
|
28
|
+
[attr.variant]="variant"
|
|
29
|
+
[attr.shape]="shape"
|
|
30
|
+
[attr.size]="size"
|
|
31
|
+
[slides]="_serialize_slides()"
|
|
32
|
+
[attr.autoplay]="autoplay"
|
|
33
|
+
[attr.autoplay-interval]="autoplayInterval"
|
|
34
|
+
[attr.loop-mode]="loopMode || null"
|
|
35
|
+
[attr.motion-blur]="motionBlur || null"
|
|
36
|
+
[attr.custom-cursor]="customCursor || null"
|
|
37
|
+
[attr.indicator]="indicator"
|
|
38
|
+
#el
|
|
39
|
+
><ng-content /></cx-carousel>
|
|
40
|
+
`,
|
|
41
|
+
})
|
|
42
|
+
export class CxCarousel implements AfterViewInit, OnChanges {
|
|
43
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
44
|
+
|
|
45
|
+
@Input() id?: string = undefined;
|
|
46
|
+
@Input() label?: string = undefined;
|
|
47
|
+
@Input() variant?: 'editorial' | 'card' = undefined;
|
|
48
|
+
@Input() shape?: 'sharp' | 'rounded' = undefined;
|
|
49
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
50
|
+
@Input() slides?: CarouselSlide[] | string = undefined;
|
|
51
|
+
@Input() autoplay?: 'off' | 'on' = undefined;
|
|
52
|
+
@Input() autoplayInterval?: number = undefined;
|
|
53
|
+
@Input() loopMode?: boolean = undefined;
|
|
54
|
+
@Input() motionBlur?: boolean = undefined;
|
|
55
|
+
@Input() customCursor?: boolean = undefined;
|
|
56
|
+
@Input() indicator?: string = undefined;
|
|
57
|
+
|
|
58
|
+
@Output() cxChange = new EventEmitter<CustomEvent<CarouselDetail>>();
|
|
59
|
+
|
|
60
|
+
constructor(private c: ChangeDetectorRef) {
|
|
61
|
+
c.detach();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ngAfterViewInit(): void {
|
|
65
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
66
|
+
this.cxChange.emit(e as CustomEvent);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
71
|
+
if (changes['slides'] && this.el) {
|
|
72
|
+
const val = this.slides;
|
|
73
|
+
if (val != null) {
|
|
74
|
+
this.el.nativeElement.setAttribute('slides', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
75
|
+
} else {
|
|
76
|
+
this.el.nativeElement.removeAttribute('slides');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_serialize_slides(): string | null {
|
|
82
|
+
const val = this.slides;
|
|
83
|
+
if (val == null) return null;
|
|
84
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Advances to the next slide. */
|
|
88
|
+
next(): void { (this.el.nativeElement as any).next(); }
|
|
89
|
+
|
|
90
|
+
/** Returns to the previous slide. */
|
|
91
|
+
prev(): void { (this.el.nativeElement as any).prev(); }
|
|
92
|
+
|
|
93
|
+
/** Navigates to the slide at the given index. */
|
|
94
|
+
goTo(index: number): void { (this.el.nativeElement as any).goTo(index); }
|
|
95
|
+
|
|
96
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-chat-input>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
forwardRef,
|
|
15
|
+
} from '@angular/core';
|
|
16
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
|
+
import type { FocusDetail, KeyboardDetail } from './types.js';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'cx-chat-input[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
providers: [{
|
|
25
|
+
provide: NG_VALUE_ACCESSOR,
|
|
26
|
+
useExisting: forwardRef(() => CxChatInput),
|
|
27
|
+
multi: true,
|
|
28
|
+
}],
|
|
29
|
+
template: `
|
|
30
|
+
<cx-chat-input
|
|
31
|
+
[attr.id]="id"
|
|
32
|
+
[attr.shape]="shape"
|
|
33
|
+
[attr.size]="size"
|
|
34
|
+
[attr.placeholder]="placeholder"
|
|
35
|
+
[attr.value]="value"
|
|
36
|
+
[attr.disabled]="disabled || null"
|
|
37
|
+
[attr.max-rows]="maxRows"
|
|
38
|
+
[attr.show-action-button]="showActionButton || null"
|
|
39
|
+
[attr.action-label]="actionLabel"
|
|
40
|
+
[attr.submit-label]="submitLabel"
|
|
41
|
+
[attr.label]="label"
|
|
42
|
+
[attr.slotted]="slotted || null"
|
|
43
|
+
#el
|
|
44
|
+
><ng-content /></cx-chat-input>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class CxChatInput implements AfterViewInit, ControlValueAccessor {
|
|
48
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
49
|
+
|
|
50
|
+
@Input() id?: string = undefined;
|
|
51
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
52
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
53
|
+
@Input() placeholder?: string = undefined;
|
|
54
|
+
@Input() value?: string = undefined;
|
|
55
|
+
@Input() disabled?: boolean = undefined;
|
|
56
|
+
@Input() maxRows?: number = undefined;
|
|
57
|
+
@Input() showActionButton?: boolean = undefined;
|
|
58
|
+
@Input() actionLabel?: string = undefined;
|
|
59
|
+
@Input() submitLabel?: string = undefined;
|
|
60
|
+
@Input() label?: string = undefined;
|
|
61
|
+
@Input() slotted?: boolean = undefined;
|
|
62
|
+
|
|
63
|
+
@Output() cxFocus = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
64
|
+
@Output() cxBlur = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
65
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
66
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
67
|
+
|
|
68
|
+
constructor(private c: ChangeDetectorRef) {
|
|
69
|
+
c.detach();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ngAfterViewInit(): void {
|
|
73
|
+
this.el.nativeElement.addEventListener('cx-focus', (e: Event) => {
|
|
74
|
+
this.cxFocus.emit(e as CustomEvent);
|
|
75
|
+
});
|
|
76
|
+
this.el.nativeElement.addEventListener('cx-blur', (e: Event) => {
|
|
77
|
+
this.cxBlur.emit(e as CustomEvent);
|
|
78
|
+
});
|
|
79
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
80
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
81
|
+
});
|
|
82
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
83
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
84
|
+
});
|
|
85
|
+
// CVA: sync CE value changes back to Angular forms
|
|
86
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
87
|
+
this._onChange((e as CustomEvent).detail?.value);
|
|
88
|
+
});
|
|
89
|
+
this.el.nativeElement.addEventListener('focusout', () => {
|
|
90
|
+
this._onTouched();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/** Focuses the textarea. */
|
|
97
|
+
focus(): void { (this.el.nativeElement as any).focus(); }
|
|
98
|
+
|
|
99
|
+
// ── ControlValueAccessor ──
|
|
100
|
+
private _onChange: (value: any) => void = () => {};
|
|
101
|
+
private _onTouched: () => void = () => {};
|
|
102
|
+
|
|
103
|
+
writeValue(value: any): void {
|
|
104
|
+
if (this.el) (this.el.nativeElement as any).value = value ?? '';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
|
|
108
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
109
|
+
|
|
110
|
+
setDisabledState(isDisabled: boolean): void {
|
|
111
|
+
if (this.el) {
|
|
112
|
+
if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
|
|
113
|
+
else this.el.nativeElement.removeAttribute('disabled');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-checkbox>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
forwardRef,
|
|
15
|
+
} from '@angular/core';
|
|
16
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
|
+
import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'cx-checkbox[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
providers: [{
|
|
25
|
+
provide: NG_VALUE_ACCESSOR,
|
|
26
|
+
useExisting: forwardRef(() => CxCheckbox),
|
|
27
|
+
multi: true,
|
|
28
|
+
}],
|
|
29
|
+
template: `
|
|
30
|
+
<cx-checkbox
|
|
31
|
+
[attr.id]="id"
|
|
32
|
+
[attr.label]="label"
|
|
33
|
+
[attr.shape]="shape"
|
|
34
|
+
[attr.size]="size"
|
|
35
|
+
[attr.checked]="checked"
|
|
36
|
+
[attr.disabled]="disabled || null"
|
|
37
|
+
[attr.required]="required || null"
|
|
38
|
+
[attr.helper-text]="helperText"
|
|
39
|
+
[attr.error]="error"
|
|
40
|
+
[attr.unlabeled]="unlabeled || null"
|
|
41
|
+
#el
|
|
42
|
+
><ng-content /></cx-checkbox>
|
|
43
|
+
`,
|
|
44
|
+
})
|
|
45
|
+
export class CxCheckbox implements AfterViewInit, ControlValueAccessor {
|
|
46
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
47
|
+
|
|
48
|
+
@Input() id?: string = undefined;
|
|
49
|
+
@Input() label?: string = undefined;
|
|
50
|
+
@Input() shape?: 'sharp' | 'rounded' = undefined;
|
|
51
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
52
|
+
/** Three-state check. Accepts true/false as aliases for 'checked'/unchecked, and keeps 'indeterminate' for the third state. */
|
|
53
|
+
@Input() checked?: boolean | '' | 'checked' | 'indeterminate' = undefined;
|
|
54
|
+
@Input() disabled?: boolean = undefined;
|
|
55
|
+
@Input() required?: boolean = undefined;
|
|
56
|
+
@Input() helperText?: string = undefined;
|
|
57
|
+
@Input() error?: string = undefined;
|
|
58
|
+
@Input() unlabeled?: boolean = undefined;
|
|
59
|
+
|
|
60
|
+
@Output() cxInput = new EventEmitter<CustomEvent<CheckedDetail>>();
|
|
61
|
+
@Output() cxChange = new EventEmitter<CustomEvent<CheckedDetail>>();
|
|
62
|
+
@Output() cxFocus = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
63
|
+
@Output() cxBlur = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
64
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
65
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
66
|
+
|
|
67
|
+
constructor(private c: ChangeDetectorRef) {
|
|
68
|
+
c.detach();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ngAfterViewInit(): void {
|
|
72
|
+
this.el.nativeElement.addEventListener('cx-input', (e: Event) => {
|
|
73
|
+
this.cxInput.emit(e as CustomEvent);
|
|
74
|
+
});
|
|
75
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
76
|
+
this.cxChange.emit(e as CustomEvent);
|
|
77
|
+
});
|
|
78
|
+
this.el.nativeElement.addEventListener('cx-focus', (e: Event) => {
|
|
79
|
+
this.cxFocus.emit(e as CustomEvent);
|
|
80
|
+
});
|
|
81
|
+
this.el.nativeElement.addEventListener('cx-blur', (e: Event) => {
|
|
82
|
+
this.cxBlur.emit(e as CustomEvent);
|
|
83
|
+
});
|
|
84
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
85
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
86
|
+
});
|
|
87
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
88
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
89
|
+
});
|
|
90
|
+
// CVA: sync CE value changes back to Angular forms
|
|
91
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
92
|
+
this._onChange((e as CustomEvent).detail?.checked);
|
|
93
|
+
});
|
|
94
|
+
this.el.nativeElement.addEventListener('focusout', () => {
|
|
95
|
+
this._onTouched();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/** Focuses the checkbox input. */
|
|
102
|
+
focus(): void { (this.el.nativeElement as any).focus(); }
|
|
103
|
+
|
|
104
|
+
// ── ControlValueAccessor ──
|
|
105
|
+
private _onChange: (value: any) => void = () => {};
|
|
106
|
+
private _onTouched: () => void = () => {};
|
|
107
|
+
|
|
108
|
+
writeValue(value: any): void {
|
|
109
|
+
if (this.el) (this.el.nativeElement as any).checked = value ?? false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
|
|
113
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
114
|
+
|
|
115
|
+
setDisabledState(isDisabled: boolean): void {
|
|
116
|
+
if (this.el) {
|
|
117
|
+
if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
|
|
118
|
+
else this.el.nativeElement.removeAttribute('disabled');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-code-block>
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
ChangeDetectionStrategy,
|
|
7
|
+
ChangeDetectorRef,
|
|
8
|
+
ElementRef,
|
|
9
|
+
ViewChild,
|
|
10
|
+
Input,
|
|
11
|
+
Output,
|
|
12
|
+
EventEmitter,
|
|
13
|
+
AfterViewInit,
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'cx-code-block[collet]',
|
|
18
|
+
standalone: true,
|
|
19
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
template: `
|
|
22
|
+
<cx-code-block
|
|
23
|
+
[attr.id]="id"
|
|
24
|
+
[attr.content]="content"
|
|
25
|
+
[attr.variant]="variant"
|
|
26
|
+
[attr.shape]="shape"
|
|
27
|
+
[attr.size]="size"
|
|
28
|
+
[attr.language]="language"
|
|
29
|
+
[attr.filename]="filename"
|
|
30
|
+
[attr.line-numbers]="lineNumbers || null"
|
|
31
|
+
[attr.copy-button]="copyButton || null"
|
|
32
|
+
[attr.traffic-lights]="trafficLights || null"
|
|
33
|
+
[attr.slotted]="slotted || null"
|
|
34
|
+
#el
|
|
35
|
+
><ng-content /></cx-code-block>
|
|
36
|
+
`,
|
|
37
|
+
})
|
|
38
|
+
export class CxCodeBlock implements AfterViewInit {
|
|
39
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
40
|
+
|
|
41
|
+
@Input() id?: string = undefined;
|
|
42
|
+
@Input() content?: string = undefined;
|
|
43
|
+
@Input() variant?: string = undefined;
|
|
44
|
+
@Input() shape?: string = undefined;
|
|
45
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
46
|
+
@Input() language?: string = undefined;
|
|
47
|
+
@Input() filename?: string = undefined;
|
|
48
|
+
@Input() lineNumbers?: boolean = undefined;
|
|
49
|
+
@Input() copyButton?: boolean = undefined;
|
|
50
|
+
@Input() trafficLights?: boolean = undefined;
|
|
51
|
+
@Input() slotted?: boolean = undefined;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
constructor(private c: ChangeDetectorRef) {
|
|
56
|
+
c.detach();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngAfterViewInit(): void {
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
}
|