@cocoar/ui-components 0.1.0-beta.75 → 0.1.0-beta.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/ui-components",
3
- "version": "0.1.0-beta.75",
3
+ "version": "0.1.0-beta.80",
4
4
  "description": "Angular UI components for the Cocoar Design System",
5
5
  "author": "Cocoar",
6
6
  "license": "Apache-2.0",
@@ -4,6 +4,7 @@ import { ControlValueAccessor } from '@angular/forms';
4
4
  import { SafeHtml } from '@angular/platform-browser';
5
5
  import { OverlayScrollbars } from 'overlayscrollbars';
6
6
  import { Observable } from 'rxjs';
7
+ import { HttpClient } from '@angular/common/http';
7
8
  import { Temporal } from '@js-temporal/polyfill';
8
9
 
9
10
  declare function coarProvideValueAccessor(type: () => Type<ControlValueAccessor>): Provider;
@@ -80,77 +81,15 @@ declare class CoarTextInputComponent extends CoarControlValueAccessor<string> {
80
81
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarTextInputComponent, "coar-text-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "prefix": { "alias": "prefix"; "required": false; "isSignal": true; }; "suffix": { "alias": "suffix"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "valueChange": "valueChange"; "blurred": "blurred"; "focused": "focused"; "clear": "clear"; }, never, ["[prefix]", "[suffix]", "[suffixAction]"], true, never>;
81
82
  }
82
83
 
83
- /**
84
- * Built-in icon registry.
85
- *
86
- * ⚠️ DO NOT EDIT THIS FILE MANUALLY
87
- *
88
- * This file is auto-generated from /assets/icons/*.svg files.
89
- * To add new icons:
90
- * 1. Add SVG files to /assets/icons/
91
- * 2. Run: npm run build:icons
92
- * 3. Commit the generated file
93
- *
94
- * Icons are inlined as strings for maximum portability.
95
- *
96
- * Generated: 2026-01-03T10:25:22.816Z
97
- * Source: C:\git\cocoar\cocoar-ui\assets\icons
98
- */
99
- declare const CORE_ICONS: {
100
- 'add-list': string;
101
- 'add-user': string;
102
- add: string;
103
- 'arrow-right': string;
104
- back: string;
105
- bin: string;
106
- calendar: string;
107
- 'caret-right': string;
108
- chat: string;
109
- check: string;
110
- 'chevron-down': string;
111
- 'chevron-left': string;
112
- 'chevron-right': string;
113
- 'chevrons-left': string;
114
- 'chevrons-right': string;
115
- clipboard: string;
116
- close: string;
117
- comments: string;
118
- copy: string;
119
- customers: string;
120
- employee: string;
121
- 'eye-closed': string;
122
- 'eye-off': string;
123
- 'eye-open': string;
124
- eye: string;
125
- 'important-1': string;
126
- important: string;
127
- key: string;
128
- list: string;
129
- load: string;
130
- lock: string;
131
- minus: string;
132
- padlock: string;
133
- plus: string;
134
- question: string;
135
- settings: string;
136
- 'square-rounded-dashed': string;
137
- trash: string;
138
- user: string;
139
- users: string;
140
- x: string;
141
- };
142
- type CoreIconName = keyof typeof CORE_ICONS | (string & {});
143
-
144
84
  type CoarIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'auto';
145
85
  /**
146
86
  * COAR Icon Component
147
87
  *
148
- * Hybrid icon system supporting built-in icons and customer-uploaded SVGs.
88
+ * Icon component supporting DI-provided icon registries.
149
89
  *
150
90
  * Usage:
151
91
  * ```html
152
92
  * <coar-icon name="settings" size="md"></coar-icon>
153
- * <coar-icon name="customer:invoicePaid" size="lg"></coar-icon>
154
93
  * ```
155
94
  *
156
95
  * Size tokens:
@@ -164,11 +103,19 @@ type CoarIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'auto';
164
103
  declare class CoarIconComponent {
165
104
  private readonly iconService;
166
105
  private readonly sanitizer;
106
+ private iconLoadVersion;
167
107
  /**
168
108
  * Icon identifier.
169
- * Examples: "settings", "user", "customer:invoicePaid"
109
+ * Examples: "settings", "user"
110
+ */
111
+ name: _angular_core.InputSignal<string | undefined>;
112
+ /**
113
+ * Optional icon source key.
114
+ *
115
+ * - If omitted, the default source is used.
116
+ * - If multiple sources are registered, this can be used to target a specific one.
170
117
  */
171
- name: _angular_core.InputSignal<CoreIconName | undefined>;
118
+ source: _angular_core.InputSignal<string | undefined>;
172
119
  /**
173
120
  * Icon size. Defaults to 'md' (20px).
174
121
  * Can be a preset token (xs, sm, md, lg, xl, auto) or a custom CSS value (e.g., '42px', '3rem').
@@ -199,11 +146,6 @@ declare class CoarIconComponent {
199
146
  * Optional text label to display next to the icon.
200
147
  */
201
148
  label: _angular_core.InputSignal<string | number | undefined>;
202
- /**
203
- * Optional fallback icon to show if the requested icon fails to load.
204
- * If not specified and the icon fails, nothing will be rendered.
205
- */
206
- fallback?: string;
207
149
  /**
208
150
  * Signal holding the sanitized SVG HTML ready for rendering.
209
151
  */
@@ -222,15 +164,13 @@ declare class CoarIconComponent {
222
164
  protected getRotateTransitionValue(): string | null;
223
165
  constructor();
224
166
  /**
225
- * Load an icon from the service and sanitize it.
226
- */
227
- private loadIcon;
228
- /**
229
- * Load fallback icon if available.
167
+ * Resolve an icon name to an SVG string.
168
+ *
169
+ * This is kept as a single observable chain so callers can cancel it.
230
170
  */
231
- private loadFallback;
171
+ private resolveIcon$;
232
172
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarIconComponent, never>;
233
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarIconComponent, "coar-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "rotate": { "alias": "rotate"; "required": false; "isSignal": true; }; "rotateTransition": { "alias": "rotateTransition"; "required": false; "isSignal": true; }; "spin": { "alias": "spin"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; }; }, {}, never, ["*"], true, never>;
173
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarIconComponent, "coar-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "source": { "alias": "source"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "rotate": { "alias": "rotate"; "required": false; "isSignal": true; }; "rotateTransition": { "alias": "rotateTransition"; "required": false; "isSignal": true; }; "spin": { "alias": "spin"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
234
174
  }
235
175
 
236
176
  /** Configuration for number formatting */
@@ -1055,52 +995,86 @@ declare class CoarTagSelectComponent<T = string> extends CoarSelectBase<T[]> {
1055
995
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarTagSelectComponent<any>, "coar-tag-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "allowCreate": { "alias": "allowCreate"; "required": false; "isSignal": true; }; "maxTags": { "alias": "maxTags"; "required": false; "isSignal": true; }; "createPrefix": { "alias": "createPrefix"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "valueChange": "valueChange"; "tagCreated": "tagCreated"; }, never, never, true, never>;
1056
996
  }
1057
997
 
1058
- /**
1059
- * Service for loading and caching icons from both built-in registry and customer uploads.
1060
- *
1061
- * Built-in icons are stored in memory and returned immediately.
1062
- * Customer icons are fetched from the API and cached after first request.
1063
- */
998
+ type CoarIconRegisteredSource = Readonly<{
999
+ key: string;
1000
+ isDefault: boolean;
1001
+ canProvideIconKeys: boolean;
1002
+ }>;
1064
1003
  declare class CoarIconService {
1065
- private readonly http;
1066
- private customerIconCache;
1004
+ private readonly builtInSource;
1005
+ private readonly sourceEntries;
1006
+ private readonly defaultSourceOverrides;
1007
+ private readonly sourceByKey;
1067
1008
  /**
1068
- * Get an icon by name. Handles both built-in and customer icons.
1009
+ * Get an icon by name from a specific icon source.
1069
1010
  *
1070
- * @param name - Icon identifier (e.g., "settings" or "customer:invoicePaid")
1071
- * @returns Observable of SVG string, or null if not found
1011
+ * - If `sourceKey` is omitted, the default source is used.
1012
+ * - If no source is configured, this throws to make misconfiguration obvious.
1072
1013
  */
1073
- getIcon(name: string): Observable<string | null>;
1014
+ getIcon(name: string, sourceKey?: string): Observable<string | null>;
1074
1015
  /**
1075
- * Parse icon name into source type and key.
1016
+ * List all registered icon sources.
1076
1017
  *
1077
- * Examples:
1078
- * - "settings" -> { source: "builtin", key: "settings" }
1079
- * - "customer:invoicePaid" -> { source: "customer", key: "invoicePaid" }
1080
- */
1081
- private parseIconName;
1082
- /**
1083
- * Get a built-in icon from the in-memory registry.
1084
- */
1085
- private getBuiltInIcon;
1086
- /**
1087
- * Get a customer icon from the API, with caching.
1088
- * Uses shareReplay(1) to ensure only one network request per icon.
1018
+ * This is useful for UIs that allow users to browse icons grouped by source.
1089
1019
  */
1090
- private getCustomerIcon;
1020
+ getRegisteredSources(): ReadonlyArray<CoarIconRegisteredSource>;
1091
1021
  /**
1092
- * Clear the customer icon cache.
1093
- * Useful when icons are updated on the server.
1022
+ * Get the available icon keys from a specific source.
1023
+ *
1024
+ * Throws if the source does not support listing keys.
1094
1025
  */
1026
+ getAvailableIconKeys(sourceKey?: string): Observable<readonly string[]>;
1095
1027
  clearCache(): void;
1096
- /**
1097
- * Clear a specific icon from the cache.
1098
- */
1099
1028
  clearIconCache(name: string): void;
1029
+ private getSourceOrThrow;
1030
+ private getSourceEntryOrThrow;
1031
+ private getDefaultSourceKeyOrThrow;
1100
1032
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarIconService, never>;
1101
1033
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CoarIconService>;
1102
1034
  }
1103
1035
 
1036
+ interface CoarIconSource {
1037
+ getIcon(name: string): Observable<string | null>;
1038
+ getAvailableIconKeys?(): Observable<readonly string[]>;
1039
+ clearCache?(): void;
1040
+ clearIconCache?(name: string): void;
1041
+ }
1042
+ type CoarIconSourceEntry = Readonly<{
1043
+ key: string;
1044
+ source: CoarIconSource;
1045
+ }>;
1046
+ declare const COAR_ICON_SOURCE_ENTRY: InjectionToken<Readonly<{
1047
+ key: string;
1048
+ source: CoarIconSource;
1049
+ }>>;
1050
+ declare const COAR_DEFAULT_ICON_SOURCE_KEY: InjectionToken<string>;
1051
+ type ProvideCoarIconSourceOptions = Readonly<{
1052
+ key: string;
1053
+ source: CoarIconSource;
1054
+ }>;
1055
+ declare function provideCoarIconSource(options: ProvideCoarIconSourceOptions): Provider;
1056
+ type ProvideCoarIconMapSourceOptions = Readonly<{
1057
+ key: string;
1058
+ icons: Readonly<Record<string, string>>;
1059
+ }>;
1060
+ declare function provideCoarIconMapSource(options: ProvideCoarIconMapSourceOptions): Provider;
1061
+ declare function provideCoarDefaultIconSource(key: string): Provider;
1062
+ type ProvideCoarHttpIconSourceOptions = Readonly<{
1063
+ key: string;
1064
+ getUrl: (iconName: string) => string;
1065
+ getAvailableIconKeys?: (http: HttpClient) => Observable<readonly string[]>;
1066
+ }>;
1067
+ declare function provideCoarHttpIconSource(options: ProvideCoarHttpIconSourceOptions): Provider;
1068
+
1069
+ declare const COAR_BUILTIN_ICON_SOURCE_KEY: "coar-builtin";
1070
+ /**
1071
+ * Overrides (and/or adds) built-in icons while keeping the built-in set as a base.
1072
+ *
1073
+ * This registers a map source under the fixed key `coar-builtin`, so it replaces the
1074
+ * built-in fallback source inside `CoarIconService`.
1075
+ */
1076
+ declare function provideCoarIconBuiltInOverrides(overrides: Readonly<Record<string, string>>): Provider;
1077
+
1104
1078
  /**
1105
1079
  * Loading strategy for tab content:
1106
1080
  * - 'lazy': Content is only rendered when tab is active (default)
@@ -1314,9 +1288,9 @@ declare class CoarButtonComponent {
1314
1288
  /** Button type attribute */
1315
1289
  type: _angular_core.InputSignal<"button" | "reset" | "submit">;
1316
1290
  /** Icon to display before the label */
1317
- iconStart: _angular_core.InputSignal<CoreIconName | undefined>;
1291
+ iconStart: _angular_core.InputSignal<string | undefined>;
1318
1292
  /** Icon to display after the label */
1319
- iconEnd: _angular_core.InputSignal<CoreIconName | undefined>;
1293
+ iconEnd: _angular_core.InputSignal<string | undefined>;
1320
1294
  /** Whether the button should take full width */
1321
1295
  fullWidth: _angular_core.InputSignalWithTransform<boolean, unknown>;
1322
1296
  /** Optional aria-label applied to the underlying <button> element */
@@ -1898,5 +1872,5 @@ interface CalendarDay {
1898
1872
  markerCssClass: string | null;
1899
1873
  }
1900
1874
 
1901
- export { COAR_LOCALE_SERVICE, CORE_ICONS, CoarBadgeComponent, CoarButtonComponent, CoarCardComponent, CoarCheckboxComponent, CoarCodeBlockComponent, CoarControlValueAccessor, CoarDatePickerComponent, CoarDividerComponent, CoarIconComponent, CoarIconService, CoarLabelComponent, CoarLocaleService, CoarMultiSelectComponent, CoarNoteComponent, CoarNumberInputComponent, CoarPasswordInputComponent, CoarPopoverComponent, CoarPopoverGroupService, CoarScrollbarDirective, CoarSingleSelectComponent, CoarTabComponent, CoarTabGroupComponent, CoarTableComponent, CoarTagComponent, CoarTagSelectComponent, CoarTextInputComponent, CoarTooltipDirective, coarProvideValueAccessor };
1902
- export type { BadgeSize, BadgeVariant, ButtonSize, ButtonVariant, CardColor, CardPadding, CoarCheckboxSize, CoarCheckboxState, CoarDateMarker, CoarDatePickerSize, CoarIconSize, CoarLabelSize, CoarNumberInputSize, CoarNumberInputStepperButtons, CoarPasswordInputSize, CoarScrollbarAutoHide, CoarScrollbarOverflow, CoarScrollbarTheme, CoarSelectOption, CoarSelectSize, CoarTableVariant, CoarTextInputSize, CoreIconName, DateFormatConfig, DividerAlign, DividerVariant, ICoarLocaleService, LocaleConfig, NoteColor, NotePadding, NumberFormatConfig, TabContent, TabLoadingStrategy, TagColor, TagSize };
1875
+ export { COAR_BUILTIN_ICON_SOURCE_KEY, COAR_DEFAULT_ICON_SOURCE_KEY, COAR_ICON_SOURCE_ENTRY, COAR_LOCALE_SERVICE, CoarBadgeComponent, CoarButtonComponent, CoarCardComponent, CoarCheckboxComponent, CoarCodeBlockComponent, CoarControlValueAccessor, CoarDatePickerComponent, CoarDividerComponent, CoarIconComponent, CoarIconService, CoarLabelComponent, CoarLocaleService, CoarMultiSelectComponent, CoarNoteComponent, CoarNumberInputComponent, CoarPasswordInputComponent, CoarPopoverComponent, CoarPopoverGroupService, CoarScrollbarDirective, CoarSingleSelectComponent, CoarTabComponent, CoarTabGroupComponent, CoarTableComponent, CoarTagComponent, CoarTagSelectComponent, CoarTextInputComponent, CoarTooltipDirective, coarProvideValueAccessor, provideCoarDefaultIconSource, provideCoarHttpIconSource, provideCoarIconBuiltInOverrides, provideCoarIconMapSource, provideCoarIconSource };
1876
+ export type { BadgeSize, BadgeVariant, ButtonSize, ButtonVariant, CardColor, CardPadding, CoarCheckboxSize, CoarCheckboxState, CoarDateMarker, CoarDatePickerSize, CoarIconRegisteredSource, CoarIconSize, CoarIconSource, CoarIconSourceEntry, CoarLabelSize, CoarNumberInputSize, CoarNumberInputStepperButtons, CoarPasswordInputSize, CoarScrollbarAutoHide, CoarScrollbarOverflow, CoarScrollbarTheme, CoarSelectOption, CoarSelectSize, CoarTableVariant, CoarTextInputSize, DateFormatConfig, DividerAlign, DividerVariant, ICoarLocaleService, LocaleConfig, NoteColor, NotePadding, NumberFormatConfig, ProvideCoarHttpIconSourceOptions, ProvideCoarIconMapSourceOptions, ProvideCoarIconSourceOptions, TabContent, TabLoadingStrategy, TagColor, TagSize };