@cocoar/ui-components 0.1.0-beta.72 → 0.1.0-beta.79

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.72",
3
+ "version": "0.1.0-beta.79",
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"
170
110
  */
171
- name: _angular_core.InputSignal<CoreIconName | undefined>;
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.
117
+ */
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,78 @@ 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 sourceEntries;
1005
+ private readonly defaultSourceOverrides;
1006
+ private readonly sourceByKey;
1067
1007
  /**
1068
- * Get an icon by name. Handles both built-in and customer icons.
1008
+ * Get an icon by name from a specific icon source.
1069
1009
  *
1070
- * @param name - Icon identifier (e.g., "settings" or "customer:invoicePaid")
1071
- * @returns Observable of SVG string, or null if not found
1010
+ * - If `sourceKey` is omitted, the default source is used.
1011
+ * - If no source is configured, this throws to make misconfiguration obvious.
1072
1012
  */
1073
- getIcon(name: string): Observable<string | null>;
1013
+ getIcon(name: string, sourceKey?: string): Observable<string | null>;
1074
1014
  /**
1075
- * Parse icon name into source type and key.
1015
+ * List all registered icon sources.
1076
1016
  *
1077
- * Examples:
1078
- * - "settings" -> { source: "builtin", key: "settings" }
1079
- * - "customer:invoicePaid" -> { source: "customer", key: "invoicePaid" }
1017
+ * This is useful for UIs that allow users to browse icons grouped by source.
1080
1018
  */
1081
- private parseIconName;
1019
+ getRegisteredSources(): ReadonlyArray<CoarIconRegisteredSource>;
1082
1020
  /**
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.
1089
- */
1090
- private getCustomerIcon;
1091
- /**
1092
- * Clear the customer icon cache.
1093
- * Useful when icons are updated on the server.
1021
+ * Get the available icon keys from a specific source.
1022
+ *
1023
+ * Throws if the source does not support listing keys.
1094
1024
  */
1025
+ getAvailableIconKeys(sourceKey?: string): Observable<readonly string[]>;
1095
1026
  clearCache(): void;
1096
- /**
1097
- * Clear a specific icon from the cache.
1098
- */
1099
1027
  clearIconCache(name: string): void;
1028
+ private getSourceOrThrow;
1029
+ private getSourceEntryOrThrow;
1030
+ private getDefaultSourceKeyOrThrow;
1100
1031
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarIconService, never>;
1101
1032
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CoarIconService>;
1102
1033
  }
1103
1034
 
1035
+ interface CoarIconSource {
1036
+ getIcon(name: string): Observable<string | null>;
1037
+ getAvailableIconKeys?(): Observable<readonly string[]>;
1038
+ clearCache?(): void;
1039
+ clearIconCache?(name: string): void;
1040
+ }
1041
+ type CoarIconSourceEntry = Readonly<{
1042
+ key: string;
1043
+ source: CoarIconSource;
1044
+ }>;
1045
+ declare const COAR_ICON_SOURCE_ENTRY: InjectionToken<Readonly<{
1046
+ key: string;
1047
+ source: CoarIconSource;
1048
+ }>>;
1049
+ declare const COAR_DEFAULT_ICON_SOURCE_KEY: InjectionToken<string>;
1050
+ type ProvideCoarIconSourceOptions = Readonly<{
1051
+ key: string;
1052
+ source: CoarIconSource;
1053
+ }>;
1054
+ declare function provideCoarIconSource(options: ProvideCoarIconSourceOptions): Provider;
1055
+ type ProvideCoarIconMapSourceOptions = Readonly<{
1056
+ key: string;
1057
+ icons: Readonly<Record<string, string>>;
1058
+ }>;
1059
+ declare function provideCoarIconMapSource(options: ProvideCoarIconMapSourceOptions): Provider;
1060
+ declare function provideCoarDefaultIconSource(key: string): Provider;
1061
+ type ProvideCoarHttpIconSourceOptions = Readonly<{
1062
+ key: string;
1063
+ getUrl: (iconName: string) => string;
1064
+ getAvailableIconKeys?: (http: HttpClient) => Observable<readonly string[]>;
1065
+ }>;
1066
+ declare function provideCoarHttpIconSource(options: ProvideCoarHttpIconSourceOptions): Provider;
1067
+
1068
+ declare function provideCoarIconBuiltInSourceAs(key: string): Provider;
1069
+
1104
1070
  /**
1105
1071
  * Loading strategy for tab content:
1106
1072
  * - 'lazy': Content is only rendered when tab is active (default)
@@ -1314,9 +1280,9 @@ declare class CoarButtonComponent {
1314
1280
  /** Button type attribute */
1315
1281
  type: _angular_core.InputSignal<"button" | "reset" | "submit">;
1316
1282
  /** Icon to display before the label */
1317
- iconStart: _angular_core.InputSignal<CoreIconName | undefined>;
1283
+ iconStart: _angular_core.InputSignal<string | undefined>;
1318
1284
  /** Icon to display after the label */
1319
- iconEnd: _angular_core.InputSignal<CoreIconName | undefined>;
1285
+ iconEnd: _angular_core.InputSignal<string | undefined>;
1320
1286
  /** Whether the button should take full width */
1321
1287
  fullWidth: _angular_core.InputSignalWithTransform<boolean, unknown>;
1322
1288
  /** Optional aria-label applied to the underlying <button> element */
@@ -1898,5 +1864,5 @@ interface CalendarDay {
1898
1864
  markerCssClass: string | null;
1899
1865
  }
1900
1866
 
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 };
1867
+ export { 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, provideCoarIconBuiltInSourceAs, provideCoarIconMapSource, provideCoarIconSource };
1868
+ 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 };