ngx-com 0.0.1 → 0.0.4

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 (82) hide show
  1. package/fesm2022/ngx-com-components-avatar.mjs +772 -0
  2. package/fesm2022/ngx-com-components-avatar.mjs.map +1 -0
  3. package/fesm2022/ngx-com-components-badge.mjs +138 -0
  4. package/fesm2022/ngx-com-components-badge.mjs.map +1 -0
  5. package/fesm2022/ngx-com-components-button.mjs +146 -0
  6. package/fesm2022/ngx-com-components-button.mjs.map +1 -0
  7. package/fesm2022/ngx-com-components-calendar.mjs +5046 -0
  8. package/fesm2022/ngx-com-components-calendar.mjs.map +1 -0
  9. package/fesm2022/ngx-com-components-card.mjs +590 -0
  10. package/fesm2022/ngx-com-components-card.mjs.map +1 -0
  11. package/fesm2022/ngx-com-components-checkbox.mjs +344 -0
  12. package/fesm2022/ngx-com-components-checkbox.mjs.map +1 -0
  13. package/fesm2022/ngx-com-components-collapsible.mjs +612 -0
  14. package/fesm2022/ngx-com-components-collapsible.mjs.map +1 -0
  15. package/fesm2022/ngx-com-components-confirm.mjs +562 -0
  16. package/fesm2022/ngx-com-components-confirm.mjs.map +1 -0
  17. package/fesm2022/ngx-com-components-dropdown-testing.mjs +255 -0
  18. package/fesm2022/ngx-com-components-dropdown-testing.mjs.map +1 -0
  19. package/fesm2022/ngx-com-components-dropdown.mjs +2692 -0
  20. package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -0
  21. package/fesm2022/ngx-com-components-empty-state.mjs +382 -0
  22. package/fesm2022/ngx-com-components-empty-state.mjs.map +1 -0
  23. package/fesm2022/ngx-com-components-form-field.mjs +924 -0
  24. package/fesm2022/ngx-com-components-form-field.mjs.map +1 -0
  25. package/fesm2022/ngx-com-components-icon.mjs +183 -0
  26. package/fesm2022/ngx-com-components-icon.mjs.map +1 -0
  27. package/fesm2022/ngx-com-components-item.mjs +578 -0
  28. package/fesm2022/ngx-com-components-item.mjs.map +1 -0
  29. package/fesm2022/ngx-com-components-menu.mjs +1200 -0
  30. package/fesm2022/ngx-com-components-menu.mjs.map +1 -0
  31. package/fesm2022/ngx-com-components-paginator.mjs +823 -0
  32. package/fesm2022/ngx-com-components-paginator.mjs.map +1 -0
  33. package/fesm2022/ngx-com-components-popover.mjs +901 -0
  34. package/fesm2022/ngx-com-components-popover.mjs.map +1 -0
  35. package/fesm2022/ngx-com-components-radio.mjs +621 -0
  36. package/fesm2022/ngx-com-components-radio.mjs.map +1 -0
  37. package/fesm2022/ngx-com-components-segmented-control.mjs +538 -0
  38. package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -0
  39. package/fesm2022/ngx-com-components-sort.mjs +368 -0
  40. package/fesm2022/ngx-com-components-sort.mjs.map +1 -0
  41. package/fesm2022/ngx-com-components-spinner.mjs +189 -0
  42. package/fesm2022/ngx-com-components-spinner.mjs.map +1 -0
  43. package/fesm2022/ngx-com-components-tabs.mjs +1522 -0
  44. package/fesm2022/ngx-com-components-tabs.mjs.map +1 -0
  45. package/fesm2022/ngx-com-components-tooltip.mjs +625 -0
  46. package/fesm2022/ngx-com-components-tooltip.mjs.map +1 -0
  47. package/fesm2022/ngx-com-components.mjs +17 -0
  48. package/fesm2022/ngx-com-components.mjs.map +1 -0
  49. package/fesm2022/ngx-com-tokens.mjs +12 -0
  50. package/fesm2022/ngx-com-tokens.mjs.map +1 -0
  51. package/fesm2022/ngx-com-utils.mjs +601 -0
  52. package/fesm2022/ngx-com-utils.mjs.map +1 -0
  53. package/fesm2022/ngx-com.mjs +9 -23
  54. package/fesm2022/ngx-com.mjs.map +1 -1
  55. package/package.json +105 -1
  56. package/types/ngx-com-components-avatar.d.ts +409 -0
  57. package/types/ngx-com-components-badge.d.ts +97 -0
  58. package/types/ngx-com-components-button.d.ts +69 -0
  59. package/types/ngx-com-components-calendar.d.ts +1665 -0
  60. package/types/ngx-com-components-card.d.ts +373 -0
  61. package/types/ngx-com-components-checkbox.d.ts +116 -0
  62. package/types/ngx-com-components-collapsible.d.ts +379 -0
  63. package/types/ngx-com-components-confirm.d.ts +160 -0
  64. package/types/ngx-com-components-dropdown-testing.d.ts +116 -0
  65. package/types/ngx-com-components-dropdown.d.ts +938 -0
  66. package/types/ngx-com-components-empty-state.d.ts +269 -0
  67. package/types/ngx-com-components-form-field.d.ts +531 -0
  68. package/types/ngx-com-components-icon.d.ts +94 -0
  69. package/types/ngx-com-components-item.d.ts +336 -0
  70. package/types/ngx-com-components-menu.d.ts +479 -0
  71. package/types/ngx-com-components-paginator.d.ts +265 -0
  72. package/types/ngx-com-components-popover.d.ts +309 -0
  73. package/types/ngx-com-components-radio.d.ts +258 -0
  74. package/types/ngx-com-components-segmented-control.d.ts +274 -0
  75. package/types/ngx-com-components-sort.d.ts +133 -0
  76. package/types/ngx-com-components-spinner.d.ts +120 -0
  77. package/types/ngx-com-components-tabs.d.ts +396 -0
  78. package/types/ngx-com-components-tooltip.d.ts +200 -0
  79. package/types/ngx-com-components.d.ts +12 -0
  80. package/types/ngx-com-tokens.d.ts +7 -0
  81. package/types/ngx-com-utils.d.ts +424 -0
  82. package/types/ngx-com.d.ts +10 -7
@@ -0,0 +1,531 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Signal, InputSignal, InjectionToken, OnInit, InputSignalWithTransform } from '@angular/core';
3
+ import { NgControl, AbstractControl, FormGroupDirective, NgForm } from '@angular/forms';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ /**
7
+ * Contract that any control inside a form field must implement.
8
+ *
9
+ * This allows the form field to read state from any inner control
10
+ * (input, textarea, custom controls) without knowing implementation details.
11
+ *
12
+ * @example Implementing for a custom phone input
13
+ * ```ts
14
+ * @Directive({
15
+ * selector: 'com-phone-input',
16
+ * providers: [{ provide: FormFieldControl, useExisting: PhoneInputComponent }],
17
+ * })
18
+ * export class PhoneInputComponent extends FormFieldControl<string> {
19
+ * // ... implement all abstract members
20
+ * }
21
+ * ```
22
+ */
23
+ declare abstract class FormFieldControl<T = unknown> {
24
+ /** The NgControl bound to this control (if any). */
25
+ abstract readonly ngControl: NgControl | null;
26
+ /** Whether the control is focused. */
27
+ abstract readonly focused: Signal<boolean>;
28
+ /** Whether the label should float (focused or non-empty). */
29
+ abstract readonly shouldLabelFloat: Signal<boolean>;
30
+ /** Whether the control is required. */
31
+ abstract readonly required: Signal<boolean>;
32
+ /** Whether the control is disabled. */
33
+ abstract readonly disabled: Signal<boolean>;
34
+ /** Whether the control is in an error state. */
35
+ abstract readonly errorState: Signal<boolean>;
36
+ /** Unique ID for the control element. */
37
+ abstract readonly id: Signal<string>;
38
+ /** Called when the form field container is clicked. */
39
+ abstract onContainerClick(event: MouseEvent): void;
40
+ }
41
+
42
+ /**
43
+ * Directive to mark the label element inside a form field.
44
+ *
45
+ * The form field automatically associates this label with the inner control
46
+ * and positions it appropriately based on appearance and float state.
47
+ *
48
+ * @example
49
+ * ```html
50
+ * <com-form-field>
51
+ * <label comLabel>Email address</label>
52
+ * <input comInput formControlName="email" />
53
+ * </com-form-field>
54
+ * ```
55
+ */
56
+ declare class ComLabel {
57
+ readonly labelId: string;
58
+ private readonly _forId;
59
+ readonly forId: Signal<string | null>;
60
+ /** Sets the `for` attribute to link to the control. Called by form field. */
61
+ setForId(id: string): void;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComLabel, never>;
63
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComLabel, "[comLabel]", ["comLabel"], {}, {}, never, never, true, never>;
64
+ }
65
+
66
+ /** Alignment of hint text in the subscript area. */
67
+ type HintAlign = 'start' | 'end';
68
+ /**
69
+ * Directive for hint text displayed below the form field.
70
+ *
71
+ * The hint provides supplementary information to help users fill out the field.
72
+ * It is automatically added to the control's `aria-describedby`.
73
+ *
74
+ * @tokens `--color-muted-foreground`
75
+ *
76
+ * @example Basic hint
77
+ * ```html
78
+ * <com-form-field>
79
+ * <label comLabel>Password</label>
80
+ * <input comInput formControlName="password" />
81
+ * <span comHint>At least 8 characters</span>
82
+ * </com-form-field>
83
+ * ```
84
+ *
85
+ * @example Right-aligned hint (e.g., character count)
86
+ * ```html
87
+ * <com-form-field>
88
+ * <label comLabel>Bio</label>
89
+ * <textarea comInput formControlName="bio"></textarea>
90
+ * <span comHint>Keep it brief</span>
91
+ * <span comHint align="end">{{ bioLength }}/150</span>
92
+ * </com-form-field>
93
+ * ```
94
+ */
95
+ declare class ComHint {
96
+ readonly id: string;
97
+ readonly align: InputSignal<HintAlign>;
98
+ protected readonly hostClasses: Signal<string>;
99
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComHint, never>;
100
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComHint, "[comHint]", ["comHint"], { "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
101
+ }
102
+
103
+ /**
104
+ * Directive for error messages displayed below the form field.
105
+ *
106
+ * Errors replace hints when the control is in an error state.
107
+ * Uses `role="alert"` and `aria-live="polite"` for screen reader announcement.
108
+ *
109
+ * The optional `match` input allows showing errors only for specific validation errors.
110
+ *
111
+ * @tokens `--color-warn`
112
+ *
113
+ * @example Basic error
114
+ * ```html
115
+ * <com-form-field>
116
+ * <label comLabel>Email</label>
117
+ * <input comInput formControlName="email" />
118
+ * <span comError>Please enter a valid email</span>
119
+ * </com-form-field>
120
+ * ```
121
+ *
122
+ * @example Matching specific errors
123
+ * ```html
124
+ * <com-form-field>
125
+ * <label comLabel>Email</label>
126
+ * <input comInput formControlName="email" />
127
+ * <span comError match="required">Email is required.</span>
128
+ * <span comError match="email">Must be a valid email address.</span>
129
+ * </com-form-field>
130
+ * ```
131
+ */
132
+ declare class ComError {
133
+ readonly id: string;
134
+ /** Reference to the form control, set by the parent form field. */
135
+ private readonly _control;
136
+ /**
137
+ * Show this error only when a specific validation error key is present.
138
+ * If empty, the error is always shown when the control is in error state.
139
+ */
140
+ readonly match: InputSignal<string>;
141
+ protected readonly errorVariants: () => string;
142
+ /**
143
+ * Whether this error should be displayed based on the match condition.
144
+ * Used by the form field to filter which errors to show.
145
+ */
146
+ readonly shouldShow: Signal<boolean>;
147
+ /**
148
+ * Sets the form control reference.
149
+ * Called by the parent form field component.
150
+ */
151
+ setControl(control: AbstractControl | null): void;
152
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComError, never>;
153
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComError, "[comError]", ["comError"], { "match": { "alias": "match"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
154
+ }
155
+
156
+ /**
157
+ * Directive to mark content as the prefix slot in a form field.
158
+ *
159
+ * Prefix content appears before the input (e.g., currency symbol, icon).
160
+ *
161
+ * @tokens `--color-muted-foreground`
162
+ *
163
+ * @example Currency prefix
164
+ * ```html
165
+ * <com-form-field>
166
+ * <label comLabel>Amount</label>
167
+ * <span comPrefix>$</span>
168
+ * <input comInput type="number" formControlName="amount" />
169
+ * </com-form-field>
170
+ * ```
171
+ *
172
+ * @example Icon prefix
173
+ * ```html
174
+ * <com-form-field>
175
+ * <label comLabel>Search</label>
176
+ * <svg comPrefix class="size-4">...</svg>
177
+ * <input comInput formControlName="query" />
178
+ * </com-form-field>
179
+ * ```
180
+ */
181
+ declare class ComPrefix {
182
+ protected readonly prefixVariants: () => string;
183
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComPrefix, never>;
184
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComPrefix, "[comPrefix]", ["comPrefix"], {}, {}, never, never, true, never>;
185
+ }
186
+
187
+ /**
188
+ * Directive to mark content as the suffix slot in a form field.
189
+ *
190
+ * Suffix content appears after the input (e.g., unit, clear button, visibility toggle).
191
+ *
192
+ * @tokens `--color-muted-foreground`
193
+ *
194
+ * @example Unit suffix
195
+ * ```html
196
+ * <com-form-field>
197
+ * <label comLabel>Weight</label>
198
+ * <input comInput type="number" formControlName="weight" />
199
+ * <span comSuffix>kg</span>
200
+ * </com-form-field>
201
+ * ```
202
+ *
203
+ * @example Clear button suffix
204
+ * ```html
205
+ * <com-form-field>
206
+ * <label comLabel>Search</label>
207
+ * <input comInput formControlName="query" />
208
+ * <button comSuffix type="button" (click)="clearSearch()">
209
+ * <svg class="size-4">...</svg>
210
+ * </button>
211
+ * </com-form-field>
212
+ * ```
213
+ *
214
+ * @example Password visibility toggle
215
+ * ```html
216
+ * <com-form-field>
217
+ * <label comLabel>Password</label>
218
+ * <input comInput [type]="showPassword ? 'text' : 'password'" formControlName="password" />
219
+ * <button comSuffix type="button" (click)="showPassword = !showPassword">
220
+ * <svg class="size-4">...</svg>
221
+ * </button>
222
+ * </com-form-field>
223
+ * ```
224
+ */
225
+ declare class ComSuffix {
226
+ protected readonly suffixVariants: () => string;
227
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComSuffix, never>;
228
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComSuffix, "[comSuffix]", ["comSuffix"], {}, {}, never, never, true, never>;
229
+ }
230
+
231
+ /**
232
+ * Strategy for determining when to display errors in a form field.
233
+ *
234
+ * The default behavior shows errors when the control is invalid AND
235
+ * either touched OR the parent form has been submitted.
236
+ *
237
+ * @example Override globally with eager error display
238
+ * ```ts
239
+ * @Injectable()
240
+ * export class EagerErrorStateMatcher extends ErrorStateMatcher {
241
+ * override isErrorState(control: AbstractControl | null): boolean {
242
+ * return !!(control?.invalid && control.dirty);
243
+ * }
244
+ * }
245
+ *
246
+ * // In app config
247
+ * providers: [{ provide: ErrorStateMatcher, useClass: EagerErrorStateMatcher }]
248
+ * ```
249
+ *
250
+ * @example Per-field override
251
+ * ```html
252
+ * <com-form-field>
253
+ * <input comInput [errorStateMatcher]="eagerMatcher" />
254
+ * </com-form-field>
255
+ * ```
256
+ */
257
+ declare class ErrorStateMatcher {
258
+ isErrorState(control: AbstractControl | null, form: FormGroupDirective | NgForm | null): boolean;
259
+ static ɵfac: i0.ɵɵFactoryDeclaration<ErrorStateMatcher, never>;
260
+ static ɵprov: i0.ɵɵInjectableDeclaration<ErrorStateMatcher>;
261
+ }
262
+
263
+ type FormFieldAppearance = 'fill' | 'outline';
264
+ type FormFieldColor = 'primary' | 'accent' | 'warn';
265
+ type FormFieldFloatLabel = 'auto' | 'always';
266
+ type FormFieldSubscriptSizing = 'fixed' | 'dynamic';
267
+ /**
268
+ * CVA variants for the form field wrapper.
269
+ *
270
+ * @tokens `--color-foreground`
271
+ */
272
+ declare const formFieldVariants: (props?: {
273
+ disabled?: boolean | null | undefined;
274
+ }) => string;
275
+ type FormFieldVariants = VariantProps<typeof formFieldVariants>;
276
+ /**
277
+ * CVA variants for the input container (the bordered/filled area).
278
+ *
279
+ * @tokens `--color-input-border`, `--color-input-background`, `--color-primary`,
280
+ * `--color-accent`, `--color-warn`, `--color-ring`, `--color-muted`,
281
+ * `--color-disabled`, `--radius-input`
282
+ */
283
+ declare const formFieldContainerVariants: (props?: {
284
+ appearance?: FormFieldAppearance | null | undefined;
285
+ color?: FormFieldColor | null | undefined;
286
+ focused?: boolean | null | undefined;
287
+ error?: boolean | null | undefined;
288
+ disabled?: boolean | null | undefined;
289
+ }) => string;
290
+ type FormFieldContainerVariants = VariantProps<typeof formFieldContainerVariants>;
291
+ /**
292
+ * CVA variants for the floating label.
293
+ *
294
+ * @tokens `--color-muted-foreground`, `--color-primary`, `--color-accent`,
295
+ * `--color-warn`, `--color-background`
296
+ */
297
+ declare const formFieldLabelVariants: (props?: {
298
+ appearance?: FormFieldAppearance | null | undefined;
299
+ floating?: boolean | null | undefined;
300
+ color?: FormFieldColor | null | undefined;
301
+ error?: boolean | null | undefined;
302
+ focused?: boolean | null | undefined;
303
+ disabled?: boolean | null | undefined;
304
+ }) => string;
305
+ type FormFieldLabelVariants = VariantProps<typeof formFieldLabelVariants>;
306
+ /**
307
+ * CVA variants for the subscript area (hints/errors).
308
+ *
309
+ * @tokens (inherits from children)
310
+ */
311
+ declare const formFieldSubscriptVariants: (props?: {
312
+ sizing?: FormFieldSubscriptSizing | null | undefined;
313
+ }) => string;
314
+ type FormFieldSubscriptVariants = VariantProps<typeof formFieldSubscriptVariants>;
315
+ /**
316
+ * CVA variants for hint text.
317
+ *
318
+ * @tokens `--color-muted-foreground`
319
+ */
320
+ declare const hintVariants: () => string;
321
+ /**
322
+ * CVA variants for error messages.
323
+ *
324
+ * @tokens `--color-warn`
325
+ */
326
+ declare const errorVariants: () => string;
327
+ /**
328
+ * CVA variants for prefix slot.
329
+ *
330
+ * @tokens `--color-muted-foreground`
331
+ */
332
+ declare const prefixVariants: () => string;
333
+ /**
334
+ * CVA variants for suffix slot.
335
+ *
336
+ * @tokens `--color-muted-foreground`
337
+ */
338
+ declare const suffixVariants: () => string;
339
+
340
+ /**
341
+ * Global configuration defaults for form fields.
342
+ *
343
+ * @example Set defaults in app config
344
+ * ```ts
345
+ * providers: [
346
+ * {
347
+ * provide: FORM_FIELD_DEFAULTS,
348
+ * useValue: {
349
+ * appearance: 'fill',
350
+ * floatLabel: 'always',
351
+ * color: 'primary',
352
+ * }
353
+ * }
354
+ * ]
355
+ * ```
356
+ */
357
+ interface FormFieldDefaults {
358
+ appearance?: FormFieldAppearance;
359
+ color?: FormFieldColor;
360
+ floatLabel?: FormFieldFloatLabel;
361
+ hideRequiredMarker?: boolean;
362
+ subscriptSizing?: FormFieldSubscriptSizing;
363
+ }
364
+ declare const FORM_FIELD_DEFAULTS: InjectionToken<FormFieldDefaults>;
365
+
366
+ /**
367
+ * Directive applied to native `<input>` and `<textarea>` elements to bridge
368
+ * them to the form field wrapper. Implements the `FormFieldControl` contract.
369
+ *
370
+ * This directive does NOT implement `ControlValueAccessor` - it relies on
371
+ * Angular's built-in value accessors (`DefaultValueAccessor`, `NumberValueAccessor`, etc.)
372
+ * that are already applied to native elements with `formControlName` or `ngModel`.
373
+ *
374
+ * Instead, this directive reports state (focused, empty, disabled, error) to the
375
+ * parent form field for proper visual presentation.
376
+ *
377
+ * @tokens (styling is controlled by the parent form field)
378
+ *
379
+ * @example Basic usage
380
+ * ```html
381
+ * <com-form-field>
382
+ * <label comLabel>Email</label>
383
+ * <input comInput formControlName="email" placeholder="you@example.com" />
384
+ * </com-form-field>
385
+ * ```
386
+ *
387
+ * @example Textarea
388
+ * ```html
389
+ * <com-form-field>
390
+ * <label comLabel>Description</label>
391
+ * <textarea comInput formControlName="description"></textarea>
392
+ * </com-form-field>
393
+ * ```
394
+ *
395
+ * @example Custom error state matcher
396
+ * ```html
397
+ * <com-form-field>
398
+ * <label comLabel>Code</label>
399
+ * <input comInput formControlName="code" [errorStateMatcher]="eagerMatcher" />
400
+ * </com-form-field>
401
+ * ```
402
+ */
403
+ declare class ComInput implements FormFieldControl<string>, OnInit {
404
+ private readonly elementRef;
405
+ private readonly destroyRef;
406
+ private readonly autofillMonitor;
407
+ private readonly defaultErrorStateMatcher;
408
+ private readonly parentForm;
409
+ private readonly parentFormGroup;
410
+ /** NgControl bound to this input (if using reactive forms). */
411
+ readonly ngControl: NgControl | null;
412
+ readonly inputId: InputSignal<string | undefined>;
413
+ readonly inputDisabled: InputSignalWithTransform<boolean, unknown>;
414
+ readonly inputRequired: InputSignalWithTransform<boolean, unknown>;
415
+ readonly userAriaDescribedBy: InputSignal<string>;
416
+ readonly errorStateMatcher: InputSignal<ErrorStateMatcher | undefined>;
417
+ private readonly _focused;
418
+ private readonly _autofilled;
419
+ private readonly _empty;
420
+ private readonly _uniqueId;
421
+ private readonly _appearance;
422
+ readonly focused: Signal<boolean>;
423
+ readonly id: Signal<string>;
424
+ readonly shouldLabelFloat: Signal<boolean>;
425
+ readonly disabled: Signal<boolean>;
426
+ readonly required: Signal<boolean>;
427
+ readonly errorState: Signal<boolean>;
428
+ /** Combined aria-describedby including user-provided and form-field-generated IDs. */
429
+ private readonly _describedByIds;
430
+ readonly ariaDescribedBy: Signal<string>;
431
+ /** Computed host classes including appearance-based padding. */
432
+ protected readonly hostClasses: Signal<string>;
433
+ ngOnInit(): void;
434
+ protected onFocus(): void;
435
+ protected onBlur(): void;
436
+ protected onInput(): void;
437
+ private updateEmpty;
438
+ onContainerClick(event: MouseEvent): void;
439
+ /**
440
+ * Sets the describedBy IDs from the form field.
441
+ * Called by the parent form field component.
442
+ */
443
+ setDescribedByIds(ids: string): void;
444
+ /**
445
+ * Sets the appearance for styling.
446
+ * Called by the parent form field component.
447
+ */
448
+ setAppearance(appearance: FormFieldAppearance): void;
449
+ /** Focus the native element. */
450
+ focus(): void;
451
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComInput, never>;
452
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ComInput, "input[comInput], textarea[comInput]", ["comInput"], { "inputId": { "alias": "id"; "required": false; "isSignal": true; }; "inputDisabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "inputRequired": { "alias": "required"; "required": false; "isSignal": true; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
453
+ }
454
+
455
+ /**
456
+ * Form field wrapper providing visual structure for form inputs.
457
+ *
458
+ * Provides floating labels, borders (outline/fill appearance), hints, errors,
459
+ * and prefix/suffix slots. Automatically wires ARIA attributes for accessibility.
460
+ *
461
+ * The form field reads state from its inner `FormFieldControl` child (typically
462
+ * a `ComInput` directive) and renders UI accordingly.
463
+ *
464
+ * @tokens `--color-foreground`, `--color-input-border`, `--color-input-background`,
465
+ * `--color-primary`, `--color-accent`, `--color-warn`, `--color-ring`,
466
+ * `--color-muted`, `--color-muted-foreground`, `--color-disabled`,
467
+ * `--color-disabled-foreground`, `--color-background`, `--radius-input`
468
+ *
469
+ * @example Basic outline field
470
+ * ```html
471
+ * <com-form-field>
472
+ * <label comLabel>Email</label>
473
+ * <input comInput formControlName="email" />
474
+ * <span comHint>We'll never share your email.</span>
475
+ * <span comError match="required">Email is required.</span>
476
+ * </com-form-field>
477
+ * ```
478
+ *
479
+ * @example Fill appearance
480
+ * ```html
481
+ * <com-form-field appearance="fill">
482
+ * <label comLabel>Username</label>
483
+ * <input comInput formControlName="username" />
484
+ * </com-form-field>
485
+ * ```
486
+ *
487
+ * @example With prefix and suffix
488
+ * ```html
489
+ * <com-form-field>
490
+ * <label comLabel>Amount</label>
491
+ * <span comPrefix>$</span>
492
+ * <input comInput type="number" formControlName="amount" />
493
+ * <span comSuffix>.00</span>
494
+ * </com-form-field>
495
+ * ```
496
+ */
497
+ declare class ComFormField {
498
+ private readonly defaults;
499
+ readonly control: Signal<FormFieldControl | undefined>;
500
+ readonly inputDirective: Signal<ComInput | undefined>;
501
+ readonly labelChild: Signal<ComLabel | undefined>;
502
+ readonly hintChildren: Signal<readonly ComHint[]>;
503
+ readonly errorChildren: Signal<readonly ComError[]>;
504
+ readonly prefixChild: Signal<ComPrefix | undefined>;
505
+ readonly suffixChild: Signal<ComSuffix | undefined>;
506
+ readonly appearance: InputSignal<FormFieldAppearance>;
507
+ readonly color: InputSignal<FormFieldColor>;
508
+ readonly floatLabel: InputSignal<FormFieldFloatLabel>;
509
+ readonly hideRequiredMarker: InputSignalWithTransform<boolean, unknown>;
510
+ readonly subscriptSizing: InputSignal<FormFieldSubscriptSizing>;
511
+ readonly userClass: InputSignal<string>;
512
+ readonly shouldLabelFloat: Signal<boolean>;
513
+ readonly isFocused: Signal<boolean>;
514
+ readonly isDisabled: Signal<boolean>;
515
+ readonly hasError: Signal<boolean>;
516
+ readonly hasPrefix: Signal<boolean>;
517
+ readonly hasSuffix: Signal<boolean>;
518
+ readonly showRequiredMarker: Signal<boolean>;
519
+ readonly showErrors: Signal<boolean>;
520
+ protected readonly hostClasses: Signal<string>;
521
+ protected readonly containerClasses: Signal<string>;
522
+ protected readonly labelClasses: Signal<string>;
523
+ protected readonly subscriptClasses: Signal<string>;
524
+ constructor();
525
+ protected onContainerClick(event: MouseEvent): void;
526
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComFormField, never>;
527
+ static ɵcmp: i0.ɵɵComponentDeclaration<ComFormField, "com-form-field", ["comFormField"], { "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "floatLabel": { "alias": "floatLabel"; "required": false; "isSignal": true; }; "hideRequiredMarker": { "alias": "hideRequiredMarker"; "required": false; "isSignal": true; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, ["control", "inputDirective", "labelChild", "hintChildren", "errorChildren", "prefixChild", "suffixChild"], ["[comPrefix]", "[comLabel]", "*", "[comSuffix]", "[comError]", "[comHint]:not([align='end'])", "[comHint][align='end']"], true, never>;
528
+ }
529
+
530
+ export { ComError, ComFormField, ComHint, ComInput, ComLabel, ComPrefix, ComSuffix, ErrorStateMatcher, FORM_FIELD_DEFAULTS, FormFieldControl, errorVariants, formFieldContainerVariants, formFieldLabelVariants, formFieldSubscriptVariants, formFieldVariants, hintVariants, prefixVariants, suffixVariants };
531
+ export type { FormFieldAppearance, FormFieldColor, FormFieldContainerVariants, FormFieldDefaults, FormFieldFloatLabel, FormFieldLabelVariants, FormFieldSubscriptSizing, FormFieldSubscriptVariants, FormFieldVariants, HintAlign };
@@ -0,0 +1,94 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InputSignal, Signal, Provider } from '@angular/core';
3
+ import { LucideIconData, LucideIcons } from 'lucide-angular';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ type IconColor = 'current' | 'primary' | 'accent' | 'warn' | 'success' | 'muted' | 'disabled';
7
+ type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
8
+ declare const iconVariants: (props?: {
9
+ color?: IconColor;
10
+ size?: IconSize;
11
+ }) => string;
12
+ /** Pixel values matching the CSS tokens — passed to Lucide's numeric [size] prop */
13
+ declare const ICON_SIZE_PX: Record<IconSize, number>;
14
+ type IconVariants = VariantProps<typeof iconVariants>;
15
+
16
+ /**
17
+ * Icon component — renders Lucide icons with CVA-powered color and size variants.
18
+ *
19
+ * Icons inherit `currentColor` by default, making them automatically match
20
+ * surrounding text. Use the `color` input for semantic color variants that
21
+ * respond to theme changes.
22
+ *
23
+ * @tokens `--color-primary`, `--color-accent`, `--color-warn`, `--color-success`,
24
+ * `--color-muted-foreground`, `--color-disabled-foreground`,
25
+ * `--size-icon-xs`, `--size-icon-sm`, `--size-icon-md`,
26
+ * `--size-icon-lg`, `--size-icon-xl`, `--size-icon-2xl`
27
+ *
28
+ * @example Basic usage (requires icon registration via provideComIcons)
29
+ * ```html
30
+ * <com-icon name="star" />
31
+ * <com-icon name="check" color="success" size="sm" />
32
+ * <com-icon name="alert-triangle" color="warn" />
33
+ * ```
34
+ *
35
+ * @example Direct icon reference (no provider needed)
36
+ * ```html
37
+ * <com-icon [img]="StarIcon" color="accent" size="2xl" />
38
+ * ```
39
+ *
40
+ * @example Accessible icon (not decorative)
41
+ * ```html
42
+ * <com-icon name="check" color="success" ariaLabel="Task completed" />
43
+ * ```
44
+ *
45
+ * @example Inline with text (inherits parent color)
46
+ * ```html
47
+ * <span class="text-primary">
48
+ * <com-icon name="star" size="sm" /> Favorite
49
+ * </span>
50
+ * ```
51
+ */
52
+ declare class ComIcon {
53
+ /** Icon name in kebab-case (e.g. 'chevron-right'). Requires provideComIcons registration. */
54
+ readonly name: InputSignal<string | undefined>;
55
+ /** Direct Lucide icon reference. Takes precedence over `name`. */
56
+ readonly img: InputSignal<LucideIconData | undefined>;
57
+ /** Semantic color variant. Defaults to 'current' (inherits from parent). */
58
+ readonly color: InputSignal<IconColor>;
59
+ /** Size variant. Defaults to 'lg' (24px). */
60
+ readonly size: InputSignal<IconSize>;
61
+ /** Stroke width. Defaults to 2. */
62
+ readonly strokeWidth: InputSignal<number>;
63
+ /** When true, stroke width doesn't scale with icon size. */
64
+ readonly absoluteStrokeWidth: InputSignal<boolean>;
65
+ /** Applies aria-label and removes aria-hidden. Use for meaningful icons. */
66
+ readonly ariaLabel: InputSignal<string | undefined>;
67
+ protected readonly sizeInPx: Signal<number>;
68
+ protected readonly hostClasses: Signal<string>;
69
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComIcon, never>;
70
+ static ɵcmp: i0.ɵɵComponentDeclaration<ComIcon, "com-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "img": { "alias": "img"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "absoluteStrokeWidth": { "alias": "absoluteStrokeWidth"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
71
+ }
72
+
73
+ /**
74
+ * Provides Lucide icons for use with `com-icon`.
75
+ *
76
+ * Register icons in your application config to use them by name:
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * // app.config.ts
81
+ * import { provideComIcons } from 'ngx-com/components/icon';
82
+ * import { ChevronRight, Star, Check, AlertTriangle } from 'lucide-angular';
83
+ *
84
+ * export const appConfig = {
85
+ * providers: [
86
+ * provideComIcons({ ChevronRight, Star, Check, AlertTriangle })
87
+ * ]
88
+ * };
89
+ * ```
90
+ */
91
+ declare function provideComIcons(icons: LucideIcons): Provider;
92
+
93
+ export { ComIcon, ICON_SIZE_PX, iconVariants, provideComIcons };
94
+ export type { IconColor, IconSize, IconVariants };