@truenas/ui-components 0.1.3 → 0.1.5

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": "@truenas/ui-components",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { AfterViewInit, ElementRef, OnDestroy, TemplateRef, AfterContentInit, ChangeDetectorRef, PipeTransform, OnInit, ViewContainerRef, AfterViewChecked } from '@angular/core';
2
+ import { AfterViewInit, ElementRef, OnDestroy, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, PipeTransform, OnInit, ViewContainerRef, AfterViewChecked } from '@angular/core';
3
3
  import { ComponentHarness, BaseHarnessFilters, HarnessPredicate } from '@angular/cdk/testing';
4
4
  import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
5
5
  import { ControlValueAccessor, NgControl } from '@angular/forms';
@@ -1147,6 +1147,97 @@ declare function tnIconMarker(iconName: string, library?: 'mdi' | 'material' | '
1147
1147
  */
1148
1148
  declare function libIconMarker(iconName: `tn-${string}`): string;
1149
1149
 
1150
+ /**
1151
+ * Mock type for TnSpriteLoaderService
1152
+ */
1153
+ interface MockSpriteLoader {
1154
+ ensureSpriteLoaded: jest.Mock;
1155
+ getIconUrl: jest.Mock;
1156
+ getSafeIconUrl: jest.Mock;
1157
+ isSpriteLoaded: jest.Mock;
1158
+ getSpriteConfig: jest.Mock;
1159
+ }
1160
+ /**
1161
+ * Mock type for TnIconRegistryService
1162
+ */
1163
+ interface MockIconRegistry {
1164
+ resolveIcon: jest.Mock;
1165
+ getSpriteLoader: jest.Mock;
1166
+ registerIcon: jest.Mock;
1167
+ registerIcons: jest.Mock;
1168
+ registerLibrary: jest.Mock;
1169
+ }
1170
+ /**
1171
+ * Options for customizing icon testing mocks
1172
+ */
1173
+ interface IconTestingMockOverrides {
1174
+ spriteLoader?: Partial<MockSpriteLoader>;
1175
+ iconRegistry?: Partial<MockIconRegistry>;
1176
+ }
1177
+ /**
1178
+ * Testing utilities for TnIcon components.
1179
+ *
1180
+ * Provides framework-specific mock implementations of icon services to simplify testing
1181
+ * components that use TnIconComponent.
1182
+ *
1183
+ * @example
1184
+ * ```typescript
1185
+ * // Simple usage - "it just works"
1186
+ * await TestBed.configureTestingModule({
1187
+ * imports: [MyComponent],
1188
+ * providers: [
1189
+ * TnIconTesting.jest.providers()
1190
+ * ]
1191
+ * }).compileComponents();
1192
+ * ```
1193
+ *
1194
+ * @example
1195
+ * ```typescript
1196
+ * // Advanced usage - customize mocks
1197
+ * await TestBed.configureTestingModule({
1198
+ * imports: [MyComponent],
1199
+ * providers: [
1200
+ * TnIconTesting.jest.providers({
1201
+ * iconRegistry: {
1202
+ * resolveIcon: jest.fn(() => ({
1203
+ * source: 'sprite',
1204
+ * spriteUrl: '#custom-icon'
1205
+ * }))
1206
+ * }
1207
+ * })
1208
+ * ]
1209
+ * }).compileComponents();
1210
+ * ```
1211
+ */
1212
+ declare const TnIconTesting: {
1213
+ /**
1214
+ * Jest-specific testing utilities.
1215
+ */
1216
+ readonly jest: {
1217
+ /**
1218
+ * Returns Angular providers with mocked icon services.
1219
+ * Creates fresh mock instances on each call to prevent test pollution.
1220
+ *
1221
+ * @param overrides Optional partial mock implementations to customize behavior
1222
+ * @returns Array of providers for TestBed
1223
+ *
1224
+ * @example
1225
+ * ```typescript
1226
+ * // Default mocks
1227
+ * TnIconTesting.jest.providers()
1228
+ *
1229
+ * // Custom sprite loader behavior
1230
+ * TnIconTesting.jest.providers({
1231
+ * spriteLoader: {
1232
+ * getIconUrl: jest.fn(() => '#custom-icon')
1233
+ * }
1234
+ * })
1235
+ * ```
1236
+ */
1237
+ readonly providers: (overrides?: IconTestingMockOverrides) => Provider[];
1238
+ };
1239
+ };
1240
+
1150
1241
  /**
1151
1242
  * Lucide Icons Integration Helper
1152
1243
  *
@@ -2789,5 +2880,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
2789
2880
  */
2790
2881
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
2791
2882
 
2792
- export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogShellComponent, TnDividerComponent, TnDividerDirective, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconComponent, TnIconHarness, TnIconRegistryService, TnInputComponent, TnInputDirective, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectionListComponent, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabPanelComponent, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
2793
- export type { BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, KeyCombination, LabelType, LucideIconOptions, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, ShortcutHandler, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };
2883
+ export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogShellComponent, TnDividerComponent, TnDividerDirective, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectionListComponent, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabPanelComponent, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
2884
+ export type { BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, KeyCombination, LabelType, LucideIconOptions, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, ShortcutHandler, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };