@truenas/ui-components 0.1.3 → 0.1.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.
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.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1,8 +1,9 @@
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';
6
+ import { jest } from '@jest/globals';
6
7
  import { DataSource } from '@angular/cdk/collections';
7
8
  import * as i1 from '@angular/cdk/tree';
8
9
  import { CdkTree, FlatTreeControl, CdkTreeNode, CdkNestedTreeNode } from '@angular/cdk/tree';
@@ -1147,6 +1148,97 @@ declare function tnIconMarker(iconName: string, library?: 'mdi' | 'material' | '
1147
1148
  */
1148
1149
  declare function libIconMarker(iconName: `tn-${string}`): string;
1149
1150
 
1151
+ /**
1152
+ * Mock type for TnSpriteLoaderService
1153
+ */
1154
+ interface MockSpriteLoader {
1155
+ ensureSpriteLoaded: jest.Mock;
1156
+ getIconUrl: jest.Mock;
1157
+ getSafeIconUrl: jest.Mock;
1158
+ isSpriteLoaded: jest.Mock;
1159
+ getSpriteConfig: jest.Mock;
1160
+ }
1161
+ /**
1162
+ * Mock type for TnIconRegistryService
1163
+ */
1164
+ interface MockIconRegistry {
1165
+ resolveIcon: jest.Mock;
1166
+ getSpriteLoader: jest.Mock;
1167
+ registerIcon: jest.Mock;
1168
+ registerIcons: jest.Mock;
1169
+ registerLibrary: jest.Mock;
1170
+ }
1171
+ /**
1172
+ * Options for customizing icon testing mocks
1173
+ */
1174
+ interface IconTestingMockOverrides {
1175
+ spriteLoader?: Partial<MockSpriteLoader>;
1176
+ iconRegistry?: Partial<MockIconRegistry>;
1177
+ }
1178
+ /**
1179
+ * Testing utilities for TnIcon components.
1180
+ *
1181
+ * Provides framework-specific mock implementations of icon services to simplify testing
1182
+ * components that use TnIconComponent.
1183
+ *
1184
+ * @example
1185
+ * ```typescript
1186
+ * // Simple usage - "it just works"
1187
+ * await TestBed.configureTestingModule({
1188
+ * imports: [MyComponent],
1189
+ * providers: [
1190
+ * TnIconTesting.jest.providers()
1191
+ * ]
1192
+ * }).compileComponents();
1193
+ * ```
1194
+ *
1195
+ * @example
1196
+ * ```typescript
1197
+ * // Advanced usage - customize mocks
1198
+ * await TestBed.configureTestingModule({
1199
+ * imports: [MyComponent],
1200
+ * providers: [
1201
+ * TnIconTesting.jest.providers({
1202
+ * iconRegistry: {
1203
+ * resolveIcon: jest.fn(() => ({
1204
+ * source: 'sprite',
1205
+ * spriteUrl: '#custom-icon'
1206
+ * }))
1207
+ * }
1208
+ * })
1209
+ * ]
1210
+ * }).compileComponents();
1211
+ * ```
1212
+ */
1213
+ declare const TnIconTesting: {
1214
+ /**
1215
+ * Jest-specific testing utilities.
1216
+ */
1217
+ readonly jest: {
1218
+ /**
1219
+ * Returns Angular providers with mocked icon services.
1220
+ * Creates fresh mock instances on each call to prevent test pollution.
1221
+ *
1222
+ * @param overrides Optional partial mock implementations to customize behavior
1223
+ * @returns Array of providers for TestBed
1224
+ *
1225
+ * @example
1226
+ * ```typescript
1227
+ * // Default mocks
1228
+ * TnIconTesting.jest.providers()
1229
+ *
1230
+ * // Custom sprite loader behavior
1231
+ * TnIconTesting.jest.providers({
1232
+ * spriteLoader: {
1233
+ * getIconUrl: jest.fn(() => '#custom-icon')
1234
+ * }
1235
+ * })
1236
+ * ```
1237
+ */
1238
+ readonly providers: (overrides?: IconTestingMockOverrides) => Provider[];
1239
+ };
1240
+ };
1241
+
1150
1242
  /**
1151
1243
  * Lucide Icons Integration Helper
1152
1244
  *
@@ -2789,5 +2881,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
2789
2881
  */
2790
2882
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
2791
2883
 
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 };
2884
+ 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 };
2885
+ 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 };