@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,138 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-radio-group>
|
|
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
|
+
forwardRef,
|
|
17
|
+
} from '@angular/core';
|
|
18
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
19
|
+
import type { FocusDetail, KeyboardDetail, RadioOption, SelectDetail } from './types.js';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'cx-radio-group[collet]',
|
|
23
|
+
standalone: true,
|
|
24
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
providers: [{
|
|
27
|
+
provide: NG_VALUE_ACCESSOR,
|
|
28
|
+
useExisting: forwardRef(() => CxRadioGroup),
|
|
29
|
+
multi: true,
|
|
30
|
+
}],
|
|
31
|
+
template: `
|
|
32
|
+
<cx-radio-group
|
|
33
|
+
[attr.name]="name"
|
|
34
|
+
[attr.legend]="legend"
|
|
35
|
+
[options]="_serialize_options()"
|
|
36
|
+
[attr.shape]="shape"
|
|
37
|
+
[attr.orientation]="orientation"
|
|
38
|
+
[attr.size]="size"
|
|
39
|
+
[attr.selected]="selected"
|
|
40
|
+
[attr.disabled]="disabled || null"
|
|
41
|
+
[attr.required]="required || null"
|
|
42
|
+
[attr.helper-text]="helperText"
|
|
43
|
+
[attr.error]="error"
|
|
44
|
+
#el
|
|
45
|
+
><ng-content /></cx-radio-group>
|
|
46
|
+
`,
|
|
47
|
+
})
|
|
48
|
+
export class CxRadioGroup implements AfterViewInit, OnChanges, ControlValueAccessor {
|
|
49
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
50
|
+
|
|
51
|
+
@Input() name?: string = undefined;
|
|
52
|
+
@Input() legend!: string;
|
|
53
|
+
@Input() options?: RadioOption[] | string = undefined;
|
|
54
|
+
@Input() shape?: 'round' | 'rounded' = undefined;
|
|
55
|
+
@Input() orientation?: 'vertical' | 'horizontal' = undefined;
|
|
56
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
57
|
+
@Input() selected?: string = undefined;
|
|
58
|
+
@Input() disabled?: boolean = undefined;
|
|
59
|
+
@Input() required?: boolean = undefined;
|
|
60
|
+
@Input() helperText?: string = undefined;
|
|
61
|
+
@Input() error?: string = undefined;
|
|
62
|
+
|
|
63
|
+
@Output() cxInput = new EventEmitter<CustomEvent>();
|
|
64
|
+
@Output() cxChange = new EventEmitter<CustomEvent<SelectDetail>>();
|
|
65
|
+
@Output() cxFocus = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
66
|
+
@Output() cxBlur = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
67
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
68
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
69
|
+
|
|
70
|
+
constructor(private c: ChangeDetectorRef) {
|
|
71
|
+
c.detach();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ngAfterViewInit(): void {
|
|
75
|
+
this.el.nativeElement.addEventListener('cx-input', (e: Event) => {
|
|
76
|
+
this.cxInput.emit(e as CustomEvent);
|
|
77
|
+
});
|
|
78
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
79
|
+
this.cxChange.emit(e as CustomEvent);
|
|
80
|
+
});
|
|
81
|
+
this.el.nativeElement.addEventListener('cx-focus', (e: Event) => {
|
|
82
|
+
this.cxFocus.emit(e as CustomEvent);
|
|
83
|
+
});
|
|
84
|
+
this.el.nativeElement.addEventListener('cx-blur', (e: Event) => {
|
|
85
|
+
this.cxBlur.emit(e as CustomEvent);
|
|
86
|
+
});
|
|
87
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
88
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
89
|
+
});
|
|
90
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
91
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
92
|
+
});
|
|
93
|
+
// CVA: sync CE value changes back to Angular forms
|
|
94
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
95
|
+
this._onChange((e as CustomEvent).detail?.value);
|
|
96
|
+
});
|
|
97
|
+
this.el.nativeElement.addEventListener('focusout', () => {
|
|
98
|
+
this._onTouched();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
103
|
+
if (changes['options'] && this.el) {
|
|
104
|
+
const val = this.options;
|
|
105
|
+
if (val != null) {
|
|
106
|
+
this.el.nativeElement.setAttribute('options', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
107
|
+
} else {
|
|
108
|
+
this.el.nativeElement.removeAttribute('options');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_serialize_options(): string | null {
|
|
114
|
+
const val = this.options;
|
|
115
|
+
if (val == null) return null;
|
|
116
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// ── ControlValueAccessor ──
|
|
122
|
+
private _onChange: (value: any) => void = () => {};
|
|
123
|
+
private _onTouched: () => void = () => {};
|
|
124
|
+
|
|
125
|
+
writeValue(value: any): void {
|
|
126
|
+
if (this.el) (this.el.nativeElement as any).value = value ?? '';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
|
|
130
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
131
|
+
|
|
132
|
+
setDisabledState(isDisabled: boolean): void {
|
|
133
|
+
if (this.el) {
|
|
134
|
+
if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
|
|
135
|
+
else this.el.nativeElement.removeAttribute('disabled');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-scrollbar>
|
|
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-scrollbar[collet]',
|
|
18
|
+
standalone: true,
|
|
19
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
template: `
|
|
22
|
+
<cx-scrollbar
|
|
23
|
+
[attr.id]="id"
|
|
24
|
+
[attr.shape]="shape"
|
|
25
|
+
[attr.track]="track"
|
|
26
|
+
[attr.axis]="axis"
|
|
27
|
+
[attr.size]="size"
|
|
28
|
+
[attr.height]="height"
|
|
29
|
+
[attr.label]="label"
|
|
30
|
+
#el
|
|
31
|
+
><ng-content /></cx-scrollbar>
|
|
32
|
+
`,
|
|
33
|
+
})
|
|
34
|
+
export class CxScrollbar implements AfterViewInit {
|
|
35
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
36
|
+
|
|
37
|
+
@Input() id?: string = undefined;
|
|
38
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
39
|
+
@Input() track?: 'with-track' | 'floating' = undefined;
|
|
40
|
+
@Input() axis?: 'vertical' | 'horizontal' | 'both' = undefined;
|
|
41
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
42
|
+
@Input() height?: string = undefined;
|
|
43
|
+
@Input() label?: string = undefined;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
constructor(private c: ChangeDetectorRef) {
|
|
48
|
+
c.detach();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ngAfterViewInit(): void {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-search-bar>
|
|
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-search-bar[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
providers: [{
|
|
25
|
+
provide: NG_VALUE_ACCESSOR,
|
|
26
|
+
useExisting: forwardRef(() => CxSearchBar),
|
|
27
|
+
multi: true,
|
|
28
|
+
}],
|
|
29
|
+
template: `
|
|
30
|
+
<cx-search-bar
|
|
31
|
+
[attr.id]="id"
|
|
32
|
+
[attr.placeholder]="placeholder"
|
|
33
|
+
[attr.label]="label"
|
|
34
|
+
[attr.variant]="variant"
|
|
35
|
+
[attr.shape]="shape"
|
|
36
|
+
[attr.size]="size"
|
|
37
|
+
[attr.name]="name"
|
|
38
|
+
[attr.value]="value"
|
|
39
|
+
[attr.debounce-ms]="debounceMs"
|
|
40
|
+
[attr.loading]="loading || null"
|
|
41
|
+
[attr.shortcut]="shortcut"
|
|
42
|
+
[attr.expandable]="expandable || null"
|
|
43
|
+
[attr.disabled]="disabled || null"
|
|
44
|
+
[attr.readonly]="readonly || null"
|
|
45
|
+
[attr.controls]="controls"
|
|
46
|
+
[attr.shimmer]="shimmer || null"
|
|
47
|
+
#el
|
|
48
|
+
><ng-content /></cx-search-bar>
|
|
49
|
+
`,
|
|
50
|
+
})
|
|
51
|
+
export class CxSearchBar implements AfterViewInit, ControlValueAccessor {
|
|
52
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
53
|
+
|
|
54
|
+
@Input() id?: string = undefined;
|
|
55
|
+
@Input() placeholder?: string = undefined;
|
|
56
|
+
@Input() label?: string = undefined;
|
|
57
|
+
@Input() variant?: 'outline' | 'filled' | 'ghost' = undefined;
|
|
58
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
59
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
60
|
+
@Input() name?: string = undefined;
|
|
61
|
+
@Input() value?: string = undefined;
|
|
62
|
+
@Input() debounceMs?: number = undefined;
|
|
63
|
+
@Input() loading?: boolean = undefined;
|
|
64
|
+
@Input() shortcut?: string = undefined;
|
|
65
|
+
@Input() expandable?: boolean = undefined;
|
|
66
|
+
@Input() disabled?: boolean = undefined;
|
|
67
|
+
@Input() readonly?: boolean = undefined;
|
|
68
|
+
@Input() controls?: string = undefined;
|
|
69
|
+
@Input() shimmer?: boolean = undefined;
|
|
70
|
+
|
|
71
|
+
@Output() cxFocus = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
72
|
+
@Output() cxBlur = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
73
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
74
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
75
|
+
|
|
76
|
+
constructor(private c: ChangeDetectorRef) {
|
|
77
|
+
c.detach();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ngAfterViewInit(): void {
|
|
81
|
+
this.el.nativeElement.addEventListener('cx-focus', (e: Event) => {
|
|
82
|
+
this.cxFocus.emit(e as CustomEvent);
|
|
83
|
+
});
|
|
84
|
+
this.el.nativeElement.addEventListener('cx-blur', (e: Event) => {
|
|
85
|
+
this.cxBlur.emit(e as CustomEvent);
|
|
86
|
+
});
|
|
87
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
88
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
89
|
+
});
|
|
90
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
91
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
92
|
+
});
|
|
93
|
+
// CVA: sync CE value changes back to Angular forms
|
|
94
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
95
|
+
this._onChange((e as CustomEvent).detail?.value);
|
|
96
|
+
});
|
|
97
|
+
this.el.nativeElement.addEventListener('focusout', () => {
|
|
98
|
+
this._onTouched();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/** Focuses the search input. */
|
|
105
|
+
focus(): void { (this.el.nativeElement as any).focus(); }
|
|
106
|
+
|
|
107
|
+
/** Clears the search input value. */
|
|
108
|
+
clear(): void { (this.el.nativeElement as any).clear(); }
|
|
109
|
+
|
|
110
|
+
// ── ControlValueAccessor ──
|
|
111
|
+
private _onChange: (value: any) => void = () => {};
|
|
112
|
+
private _onTouched: () => void = () => {};
|
|
113
|
+
|
|
114
|
+
writeValue(value: any): void {
|
|
115
|
+
if (this.el) (this.el.nativeElement as any).value = value ?? '';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
|
|
119
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
120
|
+
|
|
121
|
+
setDisabledState(isDisabled: boolean): void {
|
|
122
|
+
if (this.el) {
|
|
123
|
+
if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
|
|
124
|
+
else this.el.nativeElement.removeAttribute('disabled');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-select>
|
|
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
|
+
forwardRef,
|
|
17
|
+
} from '@angular/core';
|
|
18
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
19
|
+
import type { FocusDetail, InputDetail, KeyboardDetail, OptionGroup, SelectDetail, SelectOption } from './types.js';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'cx-select[collet]',
|
|
23
|
+
standalone: true,
|
|
24
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
providers: [{
|
|
27
|
+
provide: NG_VALUE_ACCESSOR,
|
|
28
|
+
useExisting: forwardRef(() => CxSelect),
|
|
29
|
+
multi: true,
|
|
30
|
+
}],
|
|
31
|
+
template: `
|
|
32
|
+
<cx-select
|
|
33
|
+
[attr.id]="id"
|
|
34
|
+
[attr.label]="label"
|
|
35
|
+
[attr.variant]="variant"
|
|
36
|
+
[attr.shape]="shape"
|
|
37
|
+
[attr.size]="size"
|
|
38
|
+
[attr.mode]="mode"
|
|
39
|
+
[selected]="_serialize_selected()"
|
|
40
|
+
[attr.placeholder]="placeholder"
|
|
41
|
+
[attr.helper-text]="helperText"
|
|
42
|
+
[attr.error]="error"
|
|
43
|
+
[attr.disabled]="disabled || null"
|
|
44
|
+
[attr.required]="required || null"
|
|
45
|
+
[attr.name]="name"
|
|
46
|
+
[items]="_serialize_items()"
|
|
47
|
+
[groups]="_serialize_groups()"
|
|
48
|
+
#el
|
|
49
|
+
><ng-content /></cx-select>
|
|
50
|
+
`,
|
|
51
|
+
})
|
|
52
|
+
export class CxSelect implements AfterViewInit, OnChanges, ControlValueAccessor {
|
|
53
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
54
|
+
|
|
55
|
+
@Input() id?: string = undefined;
|
|
56
|
+
@Input() label?: string = undefined;
|
|
57
|
+
@Input() variant?: 'outline' | 'filled' | 'ghost' = undefined;
|
|
58
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
59
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
60
|
+
@Input() mode?: 'single' | 'multiple' = undefined;
|
|
61
|
+
@Input() selected?: string[] | string = undefined;
|
|
62
|
+
@Input() placeholder?: string = undefined;
|
|
63
|
+
@Input() helperText?: string = undefined;
|
|
64
|
+
@Input() error?: string = undefined;
|
|
65
|
+
@Input() disabled?: boolean = undefined;
|
|
66
|
+
@Input() required?: boolean = undefined;
|
|
67
|
+
@Input() name?: string = undefined;
|
|
68
|
+
@Input() items?: SelectOption[] | string = undefined;
|
|
69
|
+
@Input() groups?: OptionGroup[] | string = undefined;
|
|
70
|
+
|
|
71
|
+
@Output() cxInput = new EventEmitter<CustomEvent<InputDetail>>();
|
|
72
|
+
@Output() cxChange = new EventEmitter<CustomEvent<SelectDetail>>();
|
|
73
|
+
@Output() cxFocus = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
74
|
+
@Output() cxBlur = new EventEmitter<CustomEvent<FocusDetail>>();
|
|
75
|
+
@Output() cxKeydown = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
76
|
+
@Output() cxKeyup = new EventEmitter<CustomEvent<KeyboardDetail>>();
|
|
77
|
+
|
|
78
|
+
constructor(private c: ChangeDetectorRef) {
|
|
79
|
+
c.detach();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ngAfterViewInit(): void {
|
|
83
|
+
this.el.nativeElement.addEventListener('cx-input', (e: Event) => {
|
|
84
|
+
this.cxInput.emit(e as CustomEvent);
|
|
85
|
+
});
|
|
86
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
87
|
+
this.cxChange.emit(e as CustomEvent);
|
|
88
|
+
});
|
|
89
|
+
this.el.nativeElement.addEventListener('cx-focus', (e: Event) => {
|
|
90
|
+
this.cxFocus.emit(e as CustomEvent);
|
|
91
|
+
});
|
|
92
|
+
this.el.nativeElement.addEventListener('cx-blur', (e: Event) => {
|
|
93
|
+
this.cxBlur.emit(e as CustomEvent);
|
|
94
|
+
});
|
|
95
|
+
this.el.nativeElement.addEventListener('cx-keydown', (e: Event) => {
|
|
96
|
+
this.cxKeydown.emit(e as CustomEvent);
|
|
97
|
+
});
|
|
98
|
+
this.el.nativeElement.addEventListener('cx-keyup', (e: Event) => {
|
|
99
|
+
this.cxKeyup.emit(e as CustomEvent);
|
|
100
|
+
});
|
|
101
|
+
// CVA: sync CE value changes back to Angular forms
|
|
102
|
+
this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
|
|
103
|
+
this._onChange((e as CustomEvent).detail?.value);
|
|
104
|
+
});
|
|
105
|
+
this.el.nativeElement.addEventListener('focusout', () => {
|
|
106
|
+
this._onTouched();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
111
|
+
if (changes['selected'] && this.el) {
|
|
112
|
+
const val = this.selected;
|
|
113
|
+
if (val != null) {
|
|
114
|
+
this.el.nativeElement.setAttribute('selected', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
115
|
+
} else {
|
|
116
|
+
this.el.nativeElement.removeAttribute('selected');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (changes['items'] && this.el) {
|
|
120
|
+
const val = this.items;
|
|
121
|
+
if (val != null) {
|
|
122
|
+
this.el.nativeElement.setAttribute('items', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
123
|
+
} else {
|
|
124
|
+
this.el.nativeElement.removeAttribute('items');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (changes['groups'] && this.el) {
|
|
128
|
+
const val = this.groups;
|
|
129
|
+
if (val != null) {
|
|
130
|
+
this.el.nativeElement.setAttribute('groups', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
131
|
+
} else {
|
|
132
|
+
this.el.nativeElement.removeAttribute('groups');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
_serialize_selected(): string | null {
|
|
138
|
+
const val = this.selected;
|
|
139
|
+
if (val == null) return null;
|
|
140
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_serialize_items(): string | null {
|
|
144
|
+
const val = this.items;
|
|
145
|
+
if (val == null) return null;
|
|
146
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_serialize_groups(): string | null {
|
|
150
|
+
const val = this.groups;
|
|
151
|
+
if (val == null) return null;
|
|
152
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Opens the dropdown. */
|
|
156
|
+
open(): void { (this.el.nativeElement as any).open(); }
|
|
157
|
+
|
|
158
|
+
/** Closes the dropdown. */
|
|
159
|
+
close(): void { (this.el.nativeElement as any).close(); }
|
|
160
|
+
|
|
161
|
+
/** Focuses the trigger button. */
|
|
162
|
+
focus(): void { (this.el.nativeElement as any).focus(); }
|
|
163
|
+
|
|
164
|
+
// ── ControlValueAccessor ──
|
|
165
|
+
private _onChange: (value: any) => void = () => {};
|
|
166
|
+
private _onTouched: () => void = () => {};
|
|
167
|
+
|
|
168
|
+
writeValue(value: any): void {
|
|
169
|
+
if (this.el) (this.el.nativeElement as any).value = value ?? '';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
|
|
173
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
174
|
+
|
|
175
|
+
setDisabledState(isDisabled: boolean): void {
|
|
176
|
+
if (this.el) {
|
|
177
|
+
if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
|
|
178
|
+
else this.el.nativeElement.removeAttribute('disabled');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-sidebar>
|
|
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 { CloseDetail, NavigateDetail, SidebarGroup } from './types.js';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'cx-sidebar[collet]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
template: `
|
|
25
|
+
<cx-sidebar
|
|
26
|
+
[attr.id]="id"
|
|
27
|
+
[attr.label]="label"
|
|
28
|
+
[groups]="_serialize_groups()"
|
|
29
|
+
[attr.separators-after]="separatorsAfter"
|
|
30
|
+
[attr.side]="side"
|
|
31
|
+
[attr.state]="state"
|
|
32
|
+
[attr.shape]="shape"
|
|
33
|
+
[attr.size]="size"
|
|
34
|
+
#el
|
|
35
|
+
><ng-content />
|
|
36
|
+
<ng-content select="[slot=header]" />
|
|
37
|
+
<ng-content select="[slot=footer]" /></cx-sidebar>
|
|
38
|
+
`,
|
|
39
|
+
})
|
|
40
|
+
export class CxSidebar implements AfterViewInit, OnChanges {
|
|
41
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
42
|
+
|
|
43
|
+
@Input() id?: string = undefined;
|
|
44
|
+
@Input() label?: string = undefined;
|
|
45
|
+
@Input() groups?: SidebarGroup[] | string = undefined;
|
|
46
|
+
@Input() separatorsAfter?: string = undefined;
|
|
47
|
+
@Input() side?: 'left' | 'right' = undefined;
|
|
48
|
+
@Input() state?: 'expanded' | 'narrow' | 'hidden' = undefined;
|
|
49
|
+
@Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
|
|
50
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
51
|
+
|
|
52
|
+
@Output() cxClose = new EventEmitter<CustomEvent<CloseDetail>>();
|
|
53
|
+
@Output() cxNavigate = new EventEmitter<CustomEvent<NavigateDetail>>();
|
|
54
|
+
|
|
55
|
+
constructor(private c: ChangeDetectorRef) {
|
|
56
|
+
c.detach();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngAfterViewInit(): void {
|
|
60
|
+
this.el.nativeElement.addEventListener('cx-close', (e: Event) => {
|
|
61
|
+
this.cxClose.emit(e as CustomEvent);
|
|
62
|
+
});
|
|
63
|
+
this.el.nativeElement.addEventListener('cx-navigate', (e: Event) => {
|
|
64
|
+
this.cxNavigate.emit(e as CustomEvent);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
69
|
+
if (changes['groups'] && this.el) {
|
|
70
|
+
const val = this.groups;
|
|
71
|
+
if (val != null) {
|
|
72
|
+
this.el.nativeElement.setAttribute('groups', typeof val === 'object' ? JSON.stringify(val) : String(val));
|
|
73
|
+
} else {
|
|
74
|
+
this.el.nativeElement.removeAttribute('groups');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_serialize_groups(): string | null {
|
|
80
|
+
const val = this.groups;
|
|
81
|
+
if (val == null) return null;
|
|
82
|
+
return typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Opens the mobile sidebar drawer. */
|
|
86
|
+
open(): void { (this.el.nativeElement as any).open(); }
|
|
87
|
+
|
|
88
|
+
/** Closes the mobile sidebar drawer. */
|
|
89
|
+
close(): void { (this.el.nativeElement as any).close(); }
|
|
90
|
+
|
|
91
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
|
|
2
|
+
// Angular wrapper for <cx-skeleton>
|
|
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-skeleton[collet]',
|
|
18
|
+
standalone: true,
|
|
19
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
template: `
|
|
22
|
+
<cx-skeleton
|
|
23
|
+
[attr.id]="id"
|
|
24
|
+
[attr.variant]="variant"
|
|
25
|
+
[attr.animation]="animation"
|
|
26
|
+
[attr.label]="label"
|
|
27
|
+
[attr.size]="size"
|
|
28
|
+
[attr.lines]="lines"
|
|
29
|
+
#el
|
|
30
|
+
><ng-content /></cx-skeleton>
|
|
31
|
+
`,
|
|
32
|
+
})
|
|
33
|
+
export class CxSkeleton implements AfterViewInit {
|
|
34
|
+
@ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
|
|
35
|
+
|
|
36
|
+
@Input() id?: string = undefined;
|
|
37
|
+
@Input() variant?: 'text' | 'circle' | 'rectangular' = undefined;
|
|
38
|
+
@Input() animation?: 'pulse' | 'wave' = undefined;
|
|
39
|
+
@Input() label?: string = undefined;
|
|
40
|
+
@Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
|
|
41
|
+
@Input() lines?: number = undefined;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
constructor(private c: ChangeDetectorRef) {
|
|
46
|
+
c.detach();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ngAfterViewInit(): void {
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
}
|