ngx-com 0.0.21 → 0.1.0
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 +137 -33
- package/fesm2022/ngx-com-components-alert.mjs +21 -11
- package/fesm2022/ngx-com-components-alert.mjs.map +1 -1
- package/fesm2022/ngx-com-components-avatar.mjs +9 -7
- package/fesm2022/ngx-com-components-avatar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-button.mjs +1 -1
- package/fesm2022/ngx-com-components-button.mjs.map +1 -1
- package/fesm2022/ngx-com-components-calendar.mjs +27 -3112
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-card.mjs +8 -8
- package/fesm2022/ngx-com-components-card.mjs.map +1 -1
- package/fesm2022/ngx-com-components-carousel.mjs +16 -4
- package/fesm2022/ngx-com-components-carousel.mjs.map +1 -1
- package/fesm2022/ngx-com-components-checkbox.mjs +1 -1
- package/fesm2022/ngx-com-components-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-com-components-code-block.mjs +9 -9
- package/fesm2022/ngx-com-components-code-block.mjs.map +1 -1
- package/fesm2022/ngx-com-components-collapsible.mjs +15 -13
- package/fesm2022/ngx-com-components-collapsible.mjs.map +1 -1
- package/fesm2022/ngx-com-components-confirm.mjs +4 -4
- package/fesm2022/ngx-com-components-confirm.mjs.map +1 -1
- package/fesm2022/ngx-com-components-datepicker.mjs +2334 -0
- package/fesm2022/ngx-com-components-datepicker.mjs.map +1 -0
- package/fesm2022/ngx-com-components-dialog.mjs +47 -45
- package/fesm2022/ngx-com-components-dialog.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dropdown.mjs +446 -340
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-empty-state.mjs +5 -3
- package/fesm2022/ngx-com-components-empty-state.mjs.map +1 -1
- package/fesm2022/ngx-com-components-form-field.mjs +11 -6
- package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
- package/fesm2022/ngx-com-components-icon-lucide.mjs +41 -0
- package/fesm2022/ngx-com-components-icon-lucide.mjs.map +1 -0
- package/fesm2022/ngx-com-components-icon.mjs +89 -61
- package/fesm2022/ngx-com-components-icon.mjs.map +1 -1
- package/fesm2022/ngx-com-components-item.mjs +14 -4
- package/fesm2022/ngx-com-components-item.mjs.map +1 -1
- package/fesm2022/ngx-com-components-menu.mjs +61 -69
- package/fesm2022/ngx-com-components-menu.mjs.map +1 -1
- package/fesm2022/ngx-com-components-native-control.mjs +170 -0
- package/fesm2022/ngx-com-components-native-control.mjs.map +1 -0
- package/fesm2022/ngx-com-components-paginator.mjs +11 -3
- package/fesm2022/ngx-com-components-paginator.mjs.map +1 -1
- package/fesm2022/ngx-com-components-popover.mjs +58 -33
- package/fesm2022/ngx-com-components-popover.mjs.map +1 -1
- package/fesm2022/ngx-com-components-radio.mjs +4 -4
- package/fesm2022/ngx-com-components-radio.mjs.map +1 -1
- package/fesm2022/ngx-com-components-segmented-control.mjs +6 -4
- package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -1
- package/fesm2022/ngx-com-components-sort.mjs +63 -57
- package/fesm2022/ngx-com-components-sort.mjs.map +1 -1
- package/fesm2022/ngx-com-components-spinner.mjs +6 -6
- package/fesm2022/ngx-com-components-spinner.mjs.map +1 -1
- package/fesm2022/ngx-com-components-switch.mjs +18 -9
- package/fesm2022/ngx-com-components-switch.mjs.map +1 -1
- package/fesm2022/ngx-com-components-table.mjs +23 -9
- package/fesm2022/ngx-com-components-table.mjs.map +1 -1
- package/fesm2022/ngx-com-components-tabs.mjs +81 -58
- package/fesm2022/ngx-com-components-tabs.mjs.map +1 -1
- package/fesm2022/ngx-com-components-timepicker.mjs +1048 -0
- package/fesm2022/ngx-com-components-timepicker.mjs.map +1 -0
- package/fesm2022/ngx-com-components-toast.mjs +18 -14
- package/fesm2022/ngx-com-components-toast.mjs.map +1 -1
- package/fesm2022/ngx-com-components-tooltip.mjs +5 -5
- package/fesm2022/ngx-com-components-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-com-components.mjs +0 -13
- package/fesm2022/ngx-com-components.mjs.map +1 -1
- package/fesm2022/ngx-com-tokens.mjs +0 -8
- package/fesm2022/ngx-com-tokens.mjs.map +1 -1
- package/fesm2022/ngx-com-utils.mjs +13 -1
- package/fesm2022/ngx-com-utils.mjs.map +1 -1
- package/fesm2022/ngx-com.mjs +1 -1
- package/fesm2022/ngx-com.mjs.map +1 -1
- package/package.json +51 -8
- package/styles/animations.css +38 -0
- package/styles/candy.css +121 -0
- package/styles/dark.css +159 -0
- package/styles/forest.css +117 -0
- package/styles/ocean.css +117 -0
- package/styles/themes.css +7 -0
- package/styles/tokens.css +277 -0
- package/styles/utilities.css +16 -0
- package/types/ngx-com-components-alert.d.ts +14 -4
- package/types/ngx-com-components-avatar.d.ts +2 -0
- package/types/ngx-com-components-calendar.d.ts +3 -747
- package/types/ngx-com-components-card.d.ts +2 -2
- package/types/ngx-com-components-carousel.d.ts +11 -1
- package/types/ngx-com-components-code-block.d.ts +4 -4
- package/types/ngx-com-components-collapsible.d.ts +10 -2
- package/types/ngx-com-components-confirm.d.ts +2 -2
- package/types/ngx-com-components-datepicker.d.ts +623 -0
- package/types/ngx-com-components-dialog.d.ts +5 -2
- package/types/ngx-com-components-dropdown.d.ts +22 -4
- package/types/ngx-com-components-empty-state.d.ts +2 -0
- package/types/ngx-com-components-form-field.d.ts +4 -1
- package/types/ngx-com-components-icon-lucide.d.ts +32 -0
- package/types/ngx-com-components-icon.d.ts +49 -35
- package/types/ngx-com-components-item.d.ts +12 -2
- package/types/ngx-com-components-menu.d.ts +38 -38
- package/types/ngx-com-components-native-control.d.ts +99 -0
- package/types/ngx-com-components-paginator.d.ts +2 -0
- package/types/ngx-com-components-popover.d.ts +19 -12
- package/types/ngx-com-components-segmented-control.d.ts +3 -1
- package/types/ngx-com-components-sort.d.ts +13 -10
- package/types/ngx-com-components-switch.d.ts +7 -2
- package/types/ngx-com-components-table.d.ts +16 -2
- package/types/ngx-com-components-tabs.d.ts +46 -34
- package/types/ngx-com-components-timepicker.d.ts +273 -0
- package/types/ngx-com-components-toast.d.ts +4 -2
- package/types/ngx-com-components-tooltip.d.ts +1 -1
- package/types/ngx-com-components.d.ts +6 -7
- package/types/ngx-com-tokens.d.ts +5 -3
- package/types/ngx-com-utils.d.ts +11 -1
- package/types/ngx-com.d.ts +1 -1
|
@@ -143,6 +143,8 @@ declare function generateDropdownId(prefix?: string): string;
|
|
|
143
143
|
/**
|
|
144
144
|
* Directive to mark a template as the custom option template.
|
|
145
145
|
*
|
|
146
|
+
* @tokens none
|
|
147
|
+
*
|
|
146
148
|
* @example
|
|
147
149
|
* ```html
|
|
148
150
|
* <com-dropdown [options]="users()">
|
|
@@ -172,6 +174,8 @@ declare class ComDropdownOptionTpl<T> {
|
|
|
172
174
|
/**
|
|
173
175
|
* Directive to mark a template as the custom selected value template.
|
|
174
176
|
*
|
|
177
|
+
* @tokens none
|
|
178
|
+
*
|
|
175
179
|
* @example
|
|
176
180
|
* ```html
|
|
177
181
|
* <com-dropdown [options]="users()">
|
|
@@ -203,6 +207,8 @@ declare class ComDropdownSelectedTpl<T> {
|
|
|
203
207
|
/**
|
|
204
208
|
* Directive to mark a template as the custom empty state template.
|
|
205
209
|
*
|
|
210
|
+
* @tokens none
|
|
211
|
+
*
|
|
206
212
|
* @example
|
|
207
213
|
* ```html
|
|
208
214
|
* <com-dropdown [options]="users()" [searchable]="true">
|
|
@@ -230,6 +236,8 @@ declare class ComDropdownEmptyTpl {
|
|
|
230
236
|
/**
|
|
231
237
|
* Directive to mark a template as the custom group header template.
|
|
232
238
|
*
|
|
239
|
+
* @tokens none
|
|
240
|
+
*
|
|
233
241
|
* @example
|
|
234
242
|
* ```html
|
|
235
243
|
* <com-dropdown [options]="users()" [groupBy]="groupByDepartment">
|
|
@@ -257,6 +265,8 @@ declare class ComDropdownGroupTpl {
|
|
|
257
265
|
/**
|
|
258
266
|
* Directive to mark a template as the custom tag template (multi-select mode).
|
|
259
267
|
*
|
|
268
|
+
* @tokens none
|
|
269
|
+
*
|
|
260
270
|
* @example
|
|
261
271
|
* ```html
|
|
262
272
|
* <com-dropdown [options]="users()" [multiple]="true">
|
|
@@ -322,7 +332,7 @@ type DropdownTriggerVariants = VariantProps<typeof dropdownTriggerVariants>;
|
|
|
322
332
|
/**
|
|
323
333
|
* CVA variants for the dropdown panel (overlay).
|
|
324
334
|
*
|
|
325
|
-
* @tokens `--color-popover`, `--color-popover-foreground`, `--color-border-subtle`, `--radius-overlay`
|
|
335
|
+
* @tokens `--color-popover`, `--color-popover-foreground`, `--color-border-subtle`, `--shadow-overlay`, `--radius-overlay`
|
|
326
336
|
*/
|
|
327
337
|
declare const dropdownPanelVariants: (props?: {
|
|
328
338
|
size?: DropdownSize;
|
|
@@ -456,6 +466,8 @@ declare class ComDropdown<T> implements ControlValueAccessor, FormFieldControl<T
|
|
|
456
466
|
private readonly triggerRef;
|
|
457
467
|
/** Reference to the panel template. */
|
|
458
468
|
private readonly panelTemplateRef;
|
|
469
|
+
/** Reference to the virtual scroll viewport (when enabled). */
|
|
470
|
+
private readonly virtualViewport;
|
|
459
471
|
/** Content query for custom option template. */
|
|
460
472
|
protected readonly optionTemplate: Signal<ComDropdownOptionTpl<T> | undefined>;
|
|
461
473
|
/** Content query for custom selected template. */
|
|
@@ -483,7 +495,7 @@ declare class ComDropdown<T> implements ControlValueAccessor, FormFieldControl<T
|
|
|
483
495
|
/** Search input placeholder. */
|
|
484
496
|
readonly searchPlaceholder: InputSignal<string>;
|
|
485
497
|
/** Disable the dropdown. */
|
|
486
|
-
readonly disabled:
|
|
498
|
+
readonly disabled: ModelSignal<boolean>;
|
|
487
499
|
/** Mark as required. */
|
|
488
500
|
readonly required: InputSignal<boolean>;
|
|
489
501
|
/** Show clear button. */
|
|
@@ -514,6 +526,8 @@ declare class ComDropdown<T> implements ControlValueAccessor, FormFieldControl<T
|
|
|
514
526
|
readonly searchDebounceMs: InputSignal<number>;
|
|
515
527
|
/** Virtual scroll threshold. */
|
|
516
528
|
readonly virtualScrollThreshold: InputSignal<number>;
|
|
529
|
+
/** Item size in pixels for virtual scrolling. */
|
|
530
|
+
readonly virtualScrollItemSize: InputSignal<number>;
|
|
517
531
|
/** Maximum number of tags to display in multi-select mode. Set to null for no limit. */
|
|
518
532
|
readonly maxVisibleTags: InputSignal<number | null>;
|
|
519
533
|
/** Custom error state matcher for determining when to show errors. */
|
|
@@ -642,6 +656,8 @@ declare class ComDropdown<T> implements ControlValueAccessor, FormFieldControl<T
|
|
|
642
656
|
protected selectOption(value: T): void;
|
|
643
657
|
protected removeValue(value: T): void;
|
|
644
658
|
protected trackByValue(item: T, _index: number): unknown;
|
|
659
|
+
/** Track function for virtual scroll options. */
|
|
660
|
+
protected trackByOption(_index: number, option: ComDropdownProcessedOption<T>): string;
|
|
645
661
|
protected getGlobalIndex(groupKey: string, localIndex: number): number;
|
|
646
662
|
private createOverlay;
|
|
647
663
|
private destroyOverlay;
|
|
@@ -657,12 +673,14 @@ declare class ComDropdown<T> implements ControlValueAccessor, FormFieldControl<T
|
|
|
657
673
|
private navigateOptions;
|
|
658
674
|
private navigateToFirst;
|
|
659
675
|
private navigateToLast;
|
|
676
|
+
/** Scrolls the active option into view, using virtual viewport or native scroll. */
|
|
677
|
+
private scrollActiveOptionIntoView;
|
|
660
678
|
private selectActiveOption;
|
|
661
679
|
private flattenGroupedOptions;
|
|
662
680
|
private typeAhead;
|
|
663
681
|
private announce;
|
|
664
682
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComDropdown<any>, never>;
|
|
665
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ComDropdown<any>, "com-dropdown", ["comDropdown"], { "options": { "alias": "options"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "filterWith": { "alias": "filterWith"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "searchDebounceMs": { "alias": "searchDebounceMs"; "required": false; "isSignal": true; }; "virtualScrollThreshold": { "alias": "virtualScrollThreshold"; "required": false; "isSignal": true; }; "maxVisibleTags": { "alias": "maxVisibleTags"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "sfErrors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "touched": "touchedChange"; "searchChange": "searchChange"; "opened": "opened"; "closed": "closed"; }, ["optionTemplate", "selectedTemplate", "emptyTemplate", "groupTemplate", "tagTemplate"], never, true, never>;
|
|
683
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComDropdown<any>, "com-dropdown", ["comDropdown"], { "options": { "alias": "options"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "filterWith": { "alias": "filterWith"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "searchDebounceMs": { "alias": "searchDebounceMs"; "required": false; "isSignal": true; }; "virtualScrollThreshold": { "alias": "virtualScrollThreshold"; "required": false; "isSignal": true; }; "virtualScrollItemSize": { "alias": "virtualScrollItemSize"; "required": false; "isSignal": true; }; "maxVisibleTags": { "alias": "maxVisibleTags"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "sfErrors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "disabled": "disabledChange"; "touched": "touchedChange"; "searchChange": "searchChange"; "opened": "opened"; "closed": "closed"; }, ["optionTemplate", "selectedTemplate", "emptyTemplate", "groupTemplate", "tagTemplate"], never, true, never>;
|
|
666
684
|
}
|
|
667
685
|
|
|
668
686
|
/**
|
|
@@ -715,7 +733,7 @@ declare class ComDropdownOption<T> {
|
|
|
715
733
|
protected readonly optionClasses: Signal<string>;
|
|
716
734
|
/** Template context for custom option templates. */
|
|
717
735
|
protected readonly templateContext: Signal<ComDropdownOptionContext<T>>;
|
|
718
|
-
protected onOptionClick(event:
|
|
736
|
+
protected onOptionClick(event: Event): void;
|
|
719
737
|
protected onMouseEnter(): void;
|
|
720
738
|
/** Scrolls this option into view. */
|
|
721
739
|
scrollIntoView(): void;
|
|
@@ -243,6 +243,8 @@ declare class ComEmptyStateDescription {
|
|
|
243
243
|
* Apply to a container element. Place buttons inside.
|
|
244
244
|
* Styling automatically adapts to the parent's `size` input.
|
|
245
245
|
*
|
|
246
|
+
* @tokens none
|
|
247
|
+
*
|
|
246
248
|
* @example Single action
|
|
247
249
|
* ```html
|
|
248
250
|
* <div comEmptyStateActions>
|
|
@@ -20,7 +20,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare abstract class FormFieldControl<
|
|
23
|
+
declare abstract class FormFieldControl<_T = unknown> {
|
|
24
24
|
/** The NgControl bound to this control (if any). */
|
|
25
25
|
abstract readonly ngControl: NgControl | null;
|
|
26
26
|
/** Whether the control is focused. */
|
|
@@ -47,6 +47,8 @@ declare abstract class FormFieldControl<T = unknown> {
|
|
|
47
47
|
* The form field automatically associates this label with the inner control
|
|
48
48
|
* and positions it appropriately based on appearance and float state.
|
|
49
49
|
*
|
|
50
|
+
* @tokens none
|
|
51
|
+
*
|
|
50
52
|
* @example
|
|
51
53
|
* ```html
|
|
52
54
|
* <com-form-field>
|
|
@@ -542,6 +544,7 @@ declare class ComFormField {
|
|
|
542
544
|
protected readonly subscriptClasses: Signal<string>;
|
|
543
545
|
constructor();
|
|
544
546
|
protected onContainerClick(event: MouseEvent): void;
|
|
547
|
+
protected onContainerActivate(): void;
|
|
545
548
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComFormField, never>;
|
|
546
549
|
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>;
|
|
547
550
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
import { LucideIconData, LucideIcons } from 'lucide-angular';
|
|
3
|
+
import { ComIconData } from 'ngx-com/components/icon';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts a single Lucide icon to the generic `ComIconData` format.
|
|
7
|
+
*
|
|
8
|
+
* Lucide's `LucideIconData` is `readonly [string, Record<string, string>][]`
|
|
9
|
+
* which is structurally identical to `ComIconData`. This function exists for
|
|
10
|
+
* type-level conversion and explicit intent.
|
|
11
|
+
*/
|
|
12
|
+
declare function fromLucideIcon(icon: LucideIconData): ComIconData;
|
|
13
|
+
/**
|
|
14
|
+
* Registers Lucide icons for use with `com-icon`.
|
|
15
|
+
*
|
|
16
|
+
* Drop-in replacement for `provideComIcons` that accepts Lucide icon imports directly.
|
|
17
|
+
*
|
|
18
|
+
* @example Root-level (app.config.ts)
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { provideComLucideIcons } from 'ngx-com/components/icon/lucide';
|
|
21
|
+
* import { ChevronRight, Star, Check } from 'lucide-angular';
|
|
22
|
+
*
|
|
23
|
+
* export const appConfig = {
|
|
24
|
+
* providers: [
|
|
25
|
+
* provideComLucideIcons({ ChevronRight, Star, Check })
|
|
26
|
+
* ]
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function provideComLucideIcons(icons: LucideIcons): Provider;
|
|
31
|
+
|
|
32
|
+
export { fromLucideIcon, provideComLucideIcons };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InputSignal, Signal, InjectionToken, Provider } from '@angular/core';
|
|
3
|
-
import { LucideIconData, LucideIcons } from 'lucide-angular';
|
|
4
3
|
import { VariantProps } from 'class-variance-authority';
|
|
5
4
|
|
|
5
|
+
/** A single SVG element: [tagName, attributes]. */
|
|
6
|
+
type ComIconNode = readonly [string, Readonly<Record<string, string | number>>];
|
|
7
|
+
/** Icon data: array of SVG child elements rendered inside the `<svg>` wrapper. */
|
|
8
|
+
type ComIconData = readonly ComIconNode[];
|
|
9
|
+
/** Map of PascalCase icon names to their SVG data. */
|
|
10
|
+
type ComIconMap = Record<string, ComIconData>;
|
|
11
|
+
|
|
6
12
|
type IconColor = 'current' | 'primary' | 'accent' | 'warn' | 'success' | 'muted' | 'disabled';
|
|
7
13
|
type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
8
14
|
declare const iconVariants: (props?: {
|
|
@@ -14,27 +20,30 @@ declare const ICON_SIZE_PX: Record<IconSize, number>;
|
|
|
14
20
|
type IconVariants = VariantProps<typeof iconVariants>;
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
|
-
* Icon component — renders
|
|
23
|
+
* Icon component — renders SVG icons with CVA-powered color and size variants.
|
|
18
24
|
*
|
|
19
25
|
* Icons inherit `currentColor` by default, making them automatically match
|
|
20
26
|
* surrounding text. Use the `color` input for semantic color variants that
|
|
21
27
|
* respond to theme changes.
|
|
22
28
|
*
|
|
29
|
+
* Icon data is vendor-agnostic — register icons via `provideComIcons` (raw SVG data)
|
|
30
|
+
* or `provideComLucideIcons` from `ngx-com/components/icon/lucide` (Lucide adapter).
|
|
31
|
+
*
|
|
23
32
|
* @tokens `--color-primary`, `--color-accent`, `--color-warn`, `--color-success`,
|
|
24
33
|
* `--color-muted-foreground`, `--color-disabled-foreground`,
|
|
25
34
|
* `--size-icon-xs`, `--size-icon-sm`, `--size-icon-md`,
|
|
26
35
|
* `--size-icon-lg`, `--size-icon-xl`, `--size-icon-2xl`
|
|
27
36
|
*
|
|
28
|
-
* @example Basic usage (requires icon registration via
|
|
37
|
+
* @example Basic usage (requires icon registration via provideComLucideIcons)
|
|
29
38
|
* ```html
|
|
30
39
|
* <com-icon name="star" />
|
|
31
40
|
* <com-icon name="check" color="success" size="sm" />
|
|
32
41
|
* <com-icon name="alert-triangle" color="warn" />
|
|
33
42
|
* ```
|
|
34
43
|
*
|
|
35
|
-
* @example Direct icon
|
|
44
|
+
* @example Direct icon data (no provider needed)
|
|
36
45
|
* ```html
|
|
37
|
-
* <com-icon [img]="
|
|
46
|
+
* <com-icon [img]="starIconData" color="accent" size="2xl" />
|
|
38
47
|
* ```
|
|
39
48
|
*
|
|
40
49
|
* @example Accessible icon (not decorative)
|
|
@@ -50,12 +59,15 @@ type IconVariants = VariantProps<typeof iconVariants>;
|
|
|
50
59
|
* ```
|
|
51
60
|
*/
|
|
52
61
|
declare class ComIcon {
|
|
62
|
+
private readonly doc;
|
|
63
|
+
private readonly rd;
|
|
64
|
+
private readonly elRef;
|
|
53
65
|
private readonly registry;
|
|
54
66
|
private readonly _registrar;
|
|
55
|
-
/** Icon name in kebab-case (e.g. 'chevron-right'). Requires
|
|
67
|
+
/** Icon name in kebab-case (e.g. 'chevron-right'). Requires icon registration. */
|
|
56
68
|
readonly name: InputSignal<string | undefined>;
|
|
57
|
-
/** Direct
|
|
58
|
-
readonly img: InputSignal<
|
|
69
|
+
/** Direct icon data (SVG element tuples). Takes precedence over `name`. */
|
|
70
|
+
readonly img: InputSignal<ComIconData | undefined>;
|
|
59
71
|
/** Semantic color variant. Defaults to 'current' (inherits from parent). */
|
|
60
72
|
readonly color: InputSignal<IconColor>;
|
|
61
73
|
/** Size variant. Defaults to 'lg' (24px). */
|
|
@@ -67,25 +79,30 @@ declare class ComIcon {
|
|
|
67
79
|
/** Applies aria-label and removes aria-hidden. Use for meaningful icons. */
|
|
68
80
|
readonly ariaLabel: InputSignal<string | undefined>;
|
|
69
81
|
/** Resolves icon data from either `img` (direct ref) or `name` (registry lookup). */
|
|
70
|
-
protected readonly resolvedIcon: Signal<
|
|
82
|
+
protected readonly resolvedIcon: Signal<ComIconData | undefined>;
|
|
71
83
|
protected readonly sizeInPx: Signal<number>;
|
|
84
|
+
protected readonly effectiveStrokeWidth: Signal<number>;
|
|
72
85
|
protected readonly hostClasses: Signal<string>;
|
|
86
|
+
constructor();
|
|
87
|
+
/** Builds and inserts the SVG element, or clears the host if no icon data is available. */
|
|
88
|
+
private renderSvg;
|
|
73
89
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComIcon, never>;
|
|
74
90
|
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>;
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
/**
|
|
78
|
-
* Singleton registry for
|
|
94
|
+
* Singleton registry for icons used by `com-icon`.
|
|
79
95
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
96
|
+
* Stores generic `ComIconData` (SVG element tuples) rather than any
|
|
97
|
+
* vendor-specific format. Use the Lucide adapter (`ngx-com/components/icon/lucide`)
|
|
98
|
+
* or register raw SVG data directly via `provideComIcons`.
|
|
82
99
|
*/
|
|
83
100
|
declare class ComIconRegistry {
|
|
84
101
|
private readonly icons;
|
|
85
102
|
/** Merges the given icons into the registry. */
|
|
86
|
-
register(icons:
|
|
103
|
+
register(icons: ComIconMap): void;
|
|
87
104
|
/** Returns the icon data for the given PascalCase name, or `null` if not registered. */
|
|
88
|
-
get(name: string):
|
|
105
|
+
get(name: string): ComIconData | null;
|
|
89
106
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComIconRegistry, never>;
|
|
90
107
|
static ɵprov: i0.ɵɵInjectableDeclaration<ComIconRegistry>;
|
|
91
108
|
}
|
|
@@ -99,42 +116,39 @@ declare class ComIconRegistry {
|
|
|
99
116
|
*/
|
|
100
117
|
declare const COM_ICON_REGISTRAR: InjectionToken<void[]>;
|
|
101
118
|
/**
|
|
102
|
-
* Provides
|
|
119
|
+
* Provides icons for use with `com-icon`.
|
|
120
|
+
*
|
|
121
|
+
* Accepts generic `ComIconData` (SVG element tuples). For Lucide icons,
|
|
122
|
+
* use `provideComLucideIcons` from `ngx-com/components/icon/lucide` instead.
|
|
103
123
|
*
|
|
104
124
|
* Works at **all** injector levels: app root, lazy route, and component.
|
|
105
125
|
* Icons are merged into the root-level `ComIconRegistry`, so multiple calls
|
|
106
126
|
* accumulate rather than shadow.
|
|
107
127
|
*
|
|
108
|
-
* @example Root-level
|
|
128
|
+
* @example Root-level with raw SVG data
|
|
109
129
|
* ```ts
|
|
110
130
|
* import { provideComIcons } from 'ngx-com/components/icon';
|
|
111
|
-
*
|
|
131
|
+
*
|
|
132
|
+
* const myIcons = {
|
|
133
|
+
* Star: [['polygon', { points: '12 2 15.09 6.26 ...' }]],
|
|
134
|
+
* };
|
|
112
135
|
*
|
|
113
136
|
* export const appConfig = {
|
|
114
|
-
* providers: [
|
|
115
|
-
* provideComIcons({ ChevronRight, Star, Check, AlertTriangle })
|
|
116
|
-
* ]
|
|
137
|
+
* providers: [provideComIcons(myIcons)]
|
|
117
138
|
* };
|
|
118
139
|
* ```
|
|
119
140
|
*
|
|
120
|
-
* @example
|
|
141
|
+
* @example With Lucide adapter (recommended)
|
|
121
142
|
* ```ts
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* path: '',
|
|
125
|
-
* providers: [provideComIcons({ Settings, User })],
|
|
126
|
-
* component: FeatureComponent,
|
|
127
|
-
* }];
|
|
128
|
-
* ```
|
|
143
|
+
* import { provideComLucideIcons } from 'ngx-com/components/icon/lucide';
|
|
144
|
+
* import { Star, Check } from 'lucide-angular';
|
|
129
145
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* providers: [provideComIcons({ Trash2, Edit })],
|
|
134
|
-
* })
|
|
146
|
+
* export const appConfig = {
|
|
147
|
+
* providers: [provideComLucideIcons({ Star, Check })]
|
|
148
|
+
* };
|
|
135
149
|
* ```
|
|
136
150
|
*/
|
|
137
|
-
declare function provideComIcons(icons:
|
|
151
|
+
declare function provideComIcons(icons: ComIconMap): Provider;
|
|
138
152
|
|
|
139
153
|
export { COM_ICON_REGISTRAR, ComIcon, ComIconRegistry, ICON_SIZE_PX, iconVariants, provideComIcons };
|
|
140
|
-
export type { IconColor, IconSize, IconVariants };
|
|
154
|
+
export type { ComIconData, ComIconMap, ComIconNode, IconColor, IconSize, IconVariants };
|
|
@@ -12,6 +12,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
12
12
|
* Use this for custom avatars (with images or initials), bare icons,
|
|
13
13
|
* custom images, or any other leading visual.
|
|
14
14
|
*
|
|
15
|
+
* @tokens none
|
|
16
|
+
*
|
|
15
17
|
* @example Custom avatar with image
|
|
16
18
|
* ```html
|
|
17
19
|
* <com-item title="Jane Doe" description="jane@example.com">
|
|
@@ -45,6 +47,8 @@ declare class ComItemLeading {
|
|
|
45
47
|
* rich projected content. Use this when the title needs formatting,
|
|
46
48
|
* links, or other custom markup.
|
|
47
49
|
*
|
|
50
|
+
* @tokens none
|
|
51
|
+
*
|
|
48
52
|
* @example Title with link
|
|
49
53
|
* ```html
|
|
50
54
|
* <com-item icon="link">
|
|
@@ -65,11 +69,13 @@ declare class ComItemTitle {
|
|
|
65
69
|
* Content appears on the same line as the title, immediately after it.
|
|
66
70
|
* Use this for badges, tags, status indicators, or other inline metadata.
|
|
67
71
|
*
|
|
72
|
+
* @tokens none
|
|
73
|
+
*
|
|
68
74
|
* @example Badge suffix
|
|
69
75
|
* ```html
|
|
70
76
|
* <com-item title="My BP datasource" description="View and manage configuration">
|
|
71
77
|
* <ng-template comItemSuffix>
|
|
72
|
-
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary
|
|
78
|
+
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary-border-subtle bg-primary-subtle px-2 py-0.5 text-xs font-medium text-primary">
|
|
73
79
|
* Bluetooth
|
|
74
80
|
* </span>
|
|
75
81
|
* </ng-template>
|
|
@@ -88,6 +94,8 @@ declare class ComItemSuffix {
|
|
|
88
94
|
* with rich projected content. Use this when the description needs
|
|
89
95
|
* formatting, code snippets, or other custom markup.
|
|
90
96
|
*
|
|
97
|
+
* @tokens none
|
|
98
|
+
*
|
|
91
99
|
* @example Description with code
|
|
92
100
|
* ```html
|
|
93
101
|
* <com-item title="API Key" icon="key">
|
|
@@ -110,6 +118,8 @@ declare class ComItemDescription {
|
|
|
110
118
|
* action buttons, navigation chevrons, toggles, timestamps, or
|
|
111
119
|
* any other trailing content.
|
|
112
120
|
*
|
|
121
|
+
* @tokens none
|
|
122
|
+
*
|
|
113
123
|
* @example Trailing chevron
|
|
114
124
|
* ```html
|
|
115
125
|
* <com-item title="Settings" icon="settings" [interactive]="true">
|
|
@@ -221,7 +231,7 @@ type ItemVariants = VariantProps<typeof itemVariants>;
|
|
|
221
231
|
* size="lg"
|
|
222
232
|
* >
|
|
223
233
|
* <ng-template comItemSuffix>
|
|
224
|
-
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary
|
|
234
|
+
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary-border-subtle bg-primary-subtle px-2 py-0.5 text-xs font-medium text-primary">
|
|
225
235
|
* <com-icon name="bluetooth" size="xs" /> Bluetooth
|
|
226
236
|
* </span>
|
|
227
237
|
* </ng-template>
|