@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.
Files changed (53) hide show
  1. package/README.md +60 -0
  2. package/package.json +43 -0
  3. package/src/accordion.component.ts +97 -0
  4. package/src/activity-group.component.ts +61 -0
  5. package/src/alert.component.ts +75 -0
  6. package/src/autocomplete.component.ts +196 -0
  7. package/src/avatar.component.ts +59 -0
  8. package/src/backdrop.component.ts +51 -0
  9. package/src/badge.component.ts +67 -0
  10. package/src/breadcrumb.component.ts +77 -0
  11. package/src/button.component.ts +74 -0
  12. package/src/card.component.ts +72 -0
  13. package/src/carousel.component.ts +96 -0
  14. package/src/chat-input.component.ts +116 -0
  15. package/src/checkbox.component.ts +121 -0
  16. package/src/code-block.component.ts +67 -0
  17. package/src/collapsible.component.ts +72 -0
  18. package/src/date-picker.component.ts +159 -0
  19. package/src/dialog.component.ts +67 -0
  20. package/src/drawer.component.ts +67 -0
  21. package/src/fab.component.ts +70 -0
  22. package/src/file-upload.component.ts +77 -0
  23. package/src/index.ts +99 -0
  24. package/src/listbox.component.ts +121 -0
  25. package/src/menu.component.ts +99 -0
  26. package/src/message-bubble.component.ts +67 -0
  27. package/src/message-group.component.ts +77 -0
  28. package/src/message-part.component.ts +47 -0
  29. package/src/pagination.component.ts +67 -0
  30. package/src/popover.component.ts +77 -0
  31. package/src/profile-menu.component.ts +87 -0
  32. package/src/progress.component.ts +60 -0
  33. package/src/radio-group.component.ts +138 -0
  34. package/src/scrollbar.component.ts +59 -0
  35. package/src/search-bar.component.ts +127 -0
  36. package/src/select.component.ts +181 -0
  37. package/src/sidebar.component.ts +91 -0
  38. package/src/skeleton.component.ts +57 -0
  39. package/src/slider.component.ts +134 -0
  40. package/src/speed-dial.component.ts +100 -0
  41. package/src/spinner.component.ts +53 -0
  42. package/src/split-button.component.ts +97 -0
  43. package/src/stepper.component.ts +83 -0
  44. package/src/switch.component.ts +123 -0
  45. package/src/table.component.ts +219 -0
  46. package/src/tabs.component.ts +82 -0
  47. package/src/text-input.component.ts +158 -0
  48. package/src/text.component.ts +73 -0
  49. package/src/thinking.component.ts +57 -0
  50. package/src/toast.component.ts +72 -0
  51. package/src/toggle-group.component.ts +123 -0
  52. package/src/tooltip.component.ts +61 -0
  53. package/src/types.ts +334 -0
@@ -0,0 +1,123 @@
1
+ // Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
2
+ // Angular wrapper for <cx-toggle-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 { ToggleDetail, ToggleItem } from './types.js';
20
+
21
+ @Component({
22
+ selector: 'cx-toggle-group[collet]',
23
+ standalone: true,
24
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+ providers: [{
27
+ provide: NG_VALUE_ACCESSOR,
28
+ useExisting: forwardRef(() => CxToggleGroup),
29
+ multi: true,
30
+ }],
31
+ template: `
32
+ <cx-toggle-group
33
+ [attr.id]="id"
34
+ [attr.label]="label"
35
+ [items]="_serialize_items()"
36
+ [attr.variant]="variant"
37
+ [attr.shape]="shape"
38
+ [attr.mode]="mode"
39
+ [attr.orientation]="orientation"
40
+ [attr.intent]="intent"
41
+ [attr.size]="size"
42
+ [attr.disabled]="disabled || null"
43
+ [attr.value]="value"
44
+ #el
45
+ ><ng-content /></cx-toggle-group>
46
+ `,
47
+ })
48
+ export class CxToggleGroup implements AfterViewInit, OnChanges, ControlValueAccessor {
49
+ @ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
50
+
51
+ @Input() id?: string = undefined;
52
+ @Input() label?: string = undefined;
53
+ @Input() items?: ToggleItem[] | string = undefined;
54
+ @Input() variant?: 'outline' | 'ghost' | 'filled' = undefined;
55
+ @Input() shape?: 'sharp' | 'rounded' | 'pill' = undefined;
56
+ @Input() mode?: 'single' | 'multiple' = undefined;
57
+ @Input() orientation?: 'horizontal' | 'vertical' = undefined;
58
+ @Input() intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger' = undefined;
59
+ @Input() size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = undefined;
60
+ @Input() disabled?: boolean = undefined;
61
+ /** Controlled pressed item IDs. Pass a single ID or an array. */
62
+ @Input() value?: string | string[] = undefined;
63
+
64
+ @Output() cxInput = new EventEmitter<CustomEvent>();
65
+ @Output() cxChange = new EventEmitter<CustomEvent<ToggleDetail>>();
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
+ // CVA: sync CE value changes back to Angular forms
79
+ this.el.nativeElement.addEventListener('cx-change', (e: Event) => {
80
+ this._onChange((e as CustomEvent).detail?.value);
81
+ });
82
+ this.el.nativeElement.addEventListener('focusout', () => {
83
+ this._onTouched();
84
+ });
85
+ }
86
+
87
+ ngOnChanges(changes: SimpleChanges): void {
88
+ if (changes['items'] && this.el) {
89
+ const val = this.items;
90
+ if (val != null) {
91
+ this.el.nativeElement.setAttribute('items', typeof val === 'object' ? JSON.stringify(val) : String(val));
92
+ } else {
93
+ this.el.nativeElement.removeAttribute('items');
94
+ }
95
+ }
96
+ }
97
+
98
+ _serialize_items(): string | null {
99
+ const val = this.items;
100
+ if (val == null) return null;
101
+ return typeof val === 'object' ? JSON.stringify(val) : String(val);
102
+ }
103
+
104
+
105
+
106
+ // ── ControlValueAccessor ──
107
+ private _onChange: (value: any) => void = () => {};
108
+ private _onTouched: () => void = () => {};
109
+
110
+ writeValue(value: any): void {
111
+ if (this.el) (this.el.nativeElement as any).value = value ?? '';
112
+ }
113
+
114
+ registerOnChange(fn: (value: any) => void): void { this._onChange = fn; }
115
+ registerOnTouched(fn: () => void): void { this._onTouched = fn; }
116
+
117
+ setDisabledState(isDisabled: boolean): void {
118
+ if (this.el) {
119
+ if (isDisabled) this.el.nativeElement.setAttribute('disabled', '');
120
+ else this.el.nativeElement.removeAttribute('disabled');
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,61 @@
1
+ // Auto-generated by scripts/generate-angular.mjs — DO NOT EDIT
2
+ // Angular wrapper for <cx-tooltip>
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-tooltip[collet]',
18
+ standalone: true,
19
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ template: `
22
+ <cx-tooltip
23
+ [attr.id]="id"
24
+ [attr.content]="content"
25
+ [attr.trigger-html]="triggerHtml"
26
+ [attr.position]="position"
27
+ [attr.arrow]="arrow || null"
28
+ [attr.open-delay]="openDelay"
29
+ [attr.close-delay]="closeDelay"
30
+ #el
31
+ ><ng-content />
32
+ <ng-content select="[slot=trigger]" /></cx-tooltip>
33
+ `,
34
+ })
35
+ export class CxTooltip implements AfterViewInit {
36
+ @ViewChild('el', { static: true }) el!: ElementRef<HTMLElement>;
37
+
38
+ @Input() id?: string = undefined;
39
+ /** Tooltip text shown on hover/focus. Also serves as the accessible name. */
40
+ @Input() content?: string = undefined;
41
+ @Input() triggerHtml?: string = undefined;
42
+ @Input() position?: 'top' | 'bottom' | 'left' | 'right' = undefined;
43
+ @Input() arrow?: boolean = undefined;
44
+ @Input() openDelay?: number = undefined;
45
+ @Input() closeDelay?: number = undefined;
46
+
47
+
48
+
49
+ constructor(private c: ChangeDetectorRef) {
50
+ c.detach();
51
+ }
52
+
53
+ ngAfterViewInit(): void {
54
+
55
+ }
56
+
57
+
58
+
59
+
60
+
61
+ }
package/src/types.ts ADDED
@@ -0,0 +1,334 @@
1
+ // Shared TypeScript interfaces for structured component props.
2
+ // These mirror the Rust config structs in crates/wasm-api/src/*.rs.
3
+ // Auto-generated by the framework wrapper generator — DO NOT EDIT.
4
+
5
+ // ─── Shared Option Types (Select, Listbox, Autocomplete) ───
6
+
7
+ export interface SelectOption {
8
+ value: string;
9
+ label: string;
10
+ icon?: string;
11
+ description?: string;
12
+ disabled?: boolean;
13
+ }
14
+
15
+ export interface OptionGroup {
16
+ label: string;
17
+ options: SelectOption[];
18
+ }
19
+
20
+ // ─── Tabs ───
21
+
22
+ export interface TabItem {
23
+ value: string;
24
+ label: string;
25
+ content?: string;
26
+ icon?: string;
27
+ disabled?: boolean;
28
+ }
29
+
30
+ // ─── Table ───
31
+
32
+ export interface TableColumn {
33
+ id: string;
34
+ header: string;
35
+ sortable?: boolean;
36
+ width?: string;
37
+ align?: 'left' | 'center' | 'right';
38
+ visible?: boolean;
39
+ pinned?: 'left' | 'right';
40
+ resizable?: boolean;
41
+ sr_only?: boolean;
42
+ min_width?: string;
43
+ max_width?: string;
44
+ }
45
+
46
+ export interface TableCell {
47
+ text?: string;
48
+ html?: string;
49
+ number?: number;
50
+ }
51
+
52
+ export interface TableRow {
53
+ id: string;
54
+ cells: TableCell[] | Record<string, string | TableCell>;
55
+ disabled?: boolean;
56
+ detail?: string;
57
+ expanded?: boolean;
58
+ }
59
+
60
+ export interface SortState {
61
+ column_id: string;
62
+ direction: 'asc' | 'desc' | 'ascending' | 'descending';
63
+ }
64
+
65
+ export interface PaginationConfig {
66
+ current_page: number;
67
+ page_size: number;
68
+ total_items: number;
69
+ page_size_options?: number[];
70
+ }
71
+
72
+ export interface FooterRow {
73
+ cells: Record<string, string | TableCell>;
74
+ }
75
+
76
+ export interface EmptyStateConfig {
77
+ title?: string;
78
+ icon?: string;
79
+ description?: string;
80
+ }
81
+
82
+ // ─── Accordion ───
83
+
84
+ export interface AccordionItem {
85
+ id: string;
86
+ trigger_label: string;
87
+ panel_content: string;
88
+ icon?: string;
89
+ description?: string;
90
+ disabled?: boolean;
91
+ }
92
+
93
+ // ─── Menu ───
94
+
95
+ export interface MenuRadioItem {
96
+ value: string;
97
+ label: string;
98
+ icon?: string;
99
+ disabled?: boolean;
100
+ }
101
+
102
+ export interface MenuEntry {
103
+ type: 'item' | 'checkbox' | 'radio-group' | 'separator' | 'label';
104
+ id?: string;
105
+ label?: string;
106
+ icon?: string;
107
+ shortcut?: string;
108
+ disabled?: boolean;
109
+ danger?: boolean;
110
+ intent?: string;
111
+ checked?: boolean;
112
+ value?: string;
113
+ items?: MenuRadioItem[];
114
+ }
115
+
116
+ // ─── Sidebar ───
117
+
118
+ export interface SidebarNavItem {
119
+ id: string;
120
+ label: string;
121
+ href?: string;
122
+ icon?: string;
123
+ badge?: string;
124
+ active?: boolean;
125
+ disabled?: boolean;
126
+ }
127
+
128
+ export interface SidebarGroup {
129
+ label?: string;
130
+ icon?: string;
131
+ items: SidebarNavItem[];
132
+ collapsible?: boolean;
133
+ expanded?: boolean;
134
+ }
135
+
136
+ // ─── Breadcrumb ───
137
+
138
+ export interface BreadcrumbItem {
139
+ label: string;
140
+ href?: string;
141
+ icon?: string;
142
+ current?: boolean;
143
+ ellipsis?: boolean;
144
+ }
145
+
146
+ // ─── Radio Group ───
147
+
148
+ export interface RadioOption {
149
+ value: string;
150
+ label: string;
151
+ description?: string;
152
+ disabled?: boolean;
153
+ icon?: string;
154
+ }
155
+
156
+ // ─── Toggle Group ───
157
+
158
+ export interface ToggleItem {
159
+ id: string;
160
+ label: string;
161
+ icon?: string;
162
+ icon_only?: boolean;
163
+ pressed?: boolean;
164
+ disabled?: boolean;
165
+ }
166
+
167
+ // ─── Split Button ───
168
+
169
+ export interface SplitMenuEntry {
170
+ type: 'item' | 'separator';
171
+ id?: string;
172
+ label?: string;
173
+ icon?: string;
174
+ shortcut?: string;
175
+ intent?: string;
176
+ disabled?: boolean;
177
+ }
178
+
179
+ // ─── Carousel ───
180
+
181
+ export interface CarouselSlide {
182
+ image_url?: string;
183
+ title: string;
184
+ badge?: string;
185
+ badge_color?: string;
186
+ subtitle?: string;
187
+ href?: string;
188
+ }
189
+
190
+ export interface CarouselDetail {
191
+ index: number;
192
+ total: number;
193
+ }
194
+
195
+ // ─── Speed Dial ───
196
+
197
+ export interface SpeedDialAction {
198
+ id: string;
199
+ icon: string;
200
+ label: string;
201
+ intent?: string;
202
+ disabled?: boolean;
203
+ handler?: string;
204
+ }
205
+
206
+ // ─── Message Group ───
207
+
208
+ export interface MessageGroupPart {
209
+ id?: string;
210
+ kind: 'text' | 'tool-call' | 'tool-result' | 'thinking' | 'code-block' | 'error';
211
+ connection?: 'standalone' | 'first' | 'middle' | 'last';
212
+ content?: string;
213
+ html_content?: string;
214
+ tool_name?: string;
215
+ tool_arguments?: string;
216
+ tool_status?: 'pending' | 'success' | 'error';
217
+ collapsible?: boolean;
218
+ thinking_label?: string;
219
+ language?: string;
220
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
221
+ }
222
+
223
+ // ─── Stepper ───
224
+
225
+ export interface StepperStep {
226
+ id: string;
227
+ label: string;
228
+ description?: string;
229
+ status?: 'pending' | 'active' | 'completed' | 'error' | 'loading';
230
+ disabled?: boolean;
231
+ optional?: boolean;
232
+ }
233
+
234
+ // ─── Event Detail Interfaces ───
235
+
236
+ export interface InputDetail {
237
+ value: string;
238
+ }
239
+
240
+ export interface SelectDetail {
241
+ value: string;
242
+ }
243
+
244
+ export interface CheckedDetail {
245
+ checked: boolean;
246
+ }
247
+
248
+ export interface SliderDetail {
249
+ value: number;
250
+ }
251
+
252
+ export interface ToggleDetail {
253
+ pressed: string[];
254
+ }
255
+
256
+ export interface AccordionDetail {
257
+ expanded: string[];
258
+ }
259
+
260
+ export interface CollapsibleDetail {
261
+ open: boolean;
262
+ }
263
+
264
+ export interface MenuActionDetail {
265
+ id: string;
266
+ label?: string;
267
+ }
268
+
269
+ export interface MenuChangeDetail {
270
+ id: string;
271
+ checked?: boolean;
272
+ value?: string;
273
+ }
274
+
275
+ export interface SortDetail {
276
+ column_id: string;
277
+ direction: 'asc' | 'desc' | 'none';
278
+ }
279
+
280
+ export interface TableSelectDetail {
281
+ selected: string[];
282
+ row_id?: string;
283
+ }
284
+
285
+ export interface TableExpandDetail {
286
+ row_id: string;
287
+ expanded: boolean;
288
+ }
289
+
290
+ export interface PageDetail {
291
+ page: number;
292
+ page_size?: number;
293
+ }
294
+
295
+ export interface NavigateDetail {
296
+ href: string;
297
+ label: string;
298
+ }
299
+
300
+ export interface ClickDetail {
301
+ x?: number;
302
+ y?: number;
303
+ }
304
+
305
+ export interface FileChangeDetail {
306
+ files: FileInfo[];
307
+ }
308
+
309
+ export interface FileInfo {
310
+ name: string;
311
+ size: number;
312
+ type: string;
313
+ }
314
+
315
+ export interface CloseDetail {
316
+ reason?: 'escape' | 'backdrop' | 'close-button';
317
+ }
318
+
319
+ export interface DismissDetail {
320
+ reason?: 'user' | 'timeout';
321
+ }
322
+
323
+ export interface FocusDetail {
324
+ relatedTarget: EventTarget | null;
325
+ }
326
+
327
+ export interface KeyboardDetail {
328
+ key: string;
329
+ code: string;
330
+ shiftKey: boolean;
331
+ ctrlKey: boolean;
332
+ altKey: boolean;
333
+ metaKey: boolean;
334
+ }