@truenas/ui-components 0.1.5 → 0.1.7

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.5",
3
+ "version": "0.1.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -294,6 +294,155 @@ declare class TnIconButtonComponent {
294
294
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnIconButtonComponent, "tn-icon-button", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "tooltip": { "alias": "tooltip"; "required": false; "isSignal": true; }; "library": { "alias": "library"; "required": false; "isSignal": true; }; }, { "onClick": "onClick"; }, never, never, true, never>;
295
295
  }
296
296
 
297
+ /**
298
+ * Harness for interacting with tn-icon-button in tests.
299
+ * Provides filtering by icon properties and methods for querying state and simulating interactions.
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * // Find icon button by name
304
+ * const closeBtn = await loader.getHarness(
305
+ * TnIconButtonHarness.with({ name: 'close' })
306
+ * );
307
+ *
308
+ * // Click an icon button
309
+ * const settingsBtn = await loader.getHarness(
310
+ * TnIconButtonHarness.with({ name: 'settings' })
311
+ * );
312
+ * await settingsBtn.click();
313
+ *
314
+ * // Check if disabled
315
+ * const deleteBtn = await loader.getHarness(
316
+ * TnIconButtonHarness.with({ name: 'delete' })
317
+ * );
318
+ * expect(await deleteBtn.isDisabled()).toBe(false);
319
+ * ```
320
+ */
321
+ declare class TnIconButtonHarness extends ComponentHarness {
322
+ /**
323
+ * The selector for the host element of a `TnIconButtonComponent` instance.
324
+ */
325
+ static hostSelector: string;
326
+ private button;
327
+ /**
328
+ * Gets a `HarnessPredicate` that can be used to search for an icon button
329
+ * with specific attributes.
330
+ *
331
+ * @param options Options for filtering which icon button instances are considered a match.
332
+ * @returns A `HarnessPredicate` configured with the given options.
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * // Find icon button by name
337
+ * const button = await loader.getHarness(
338
+ * TnIconButtonHarness.with({ name: 'menu' })
339
+ * );
340
+ *
341
+ * // Find icon button by library
342
+ * const customButton = await loader.getHarness(
343
+ * TnIconButtonHarness.with({ library: 'mdi' })
344
+ * );
345
+ *
346
+ * // Find icon button with specific size
347
+ * const largeButton = await loader.getHarness(
348
+ * TnIconButtonHarness.with({ size: 'lg' })
349
+ * );
350
+ * ```
351
+ */
352
+ static with(options?: IconButtonHarnessFilters): HarnessPredicate<TnIconButtonHarness>;
353
+ /**
354
+ * Gets the icon name.
355
+ *
356
+ * @returns Promise resolving to the icon name.
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * const button = await loader.getHarness(TnIconButtonHarness);
361
+ * const name = await button.getName();
362
+ * expect(name).toBe('settings');
363
+ * ```
364
+ */
365
+ getName(): Promise<string | null>;
366
+ /**
367
+ * Gets the icon library.
368
+ *
369
+ * @returns Promise resolving to the icon library.
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const button = await loader.getHarness(TnIconButtonHarness);
374
+ * const library = await button.getLibrary();
375
+ * expect(library).toBe('mdi');
376
+ * ```
377
+ */
378
+ getLibrary(): Promise<string | null>;
379
+ /**
380
+ * Gets the icon size.
381
+ *
382
+ * @returns Promise resolving to the icon size.
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * const button = await loader.getHarness(TnIconButtonHarness);
387
+ * const size = await button.getSize();
388
+ * expect(size).toBe('lg');
389
+ * ```
390
+ */
391
+ getSize(): Promise<string | null>;
392
+ /**
393
+ * Gets the icon color.
394
+ *
395
+ * @returns Promise resolving to the icon color.
396
+ *
397
+ * @example
398
+ * ```typescript
399
+ * const button = await loader.getHarness(TnIconButtonHarness);
400
+ * const color = await button.getColor();
401
+ * expect(color).toBe('primary');
402
+ * ```
403
+ */
404
+ getColor(): Promise<string | null>;
405
+ /**
406
+ * Checks whether the icon button is disabled.
407
+ *
408
+ * @returns Promise resolving to true if the button is disabled.
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * const button = await loader.getHarness(
413
+ * TnIconButtonHarness.with({ name: 'delete' })
414
+ * );
415
+ * expect(await button.isDisabled()).toBe(false);
416
+ * ```
417
+ */
418
+ isDisabled(): Promise<boolean>;
419
+ /**
420
+ * Clicks the icon button.
421
+ *
422
+ * @returns Promise that resolves when the click action is complete.
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const button = await loader.getHarness(
427
+ * TnIconButtonHarness.with({ name: 'close' })
428
+ * );
429
+ * await button.click();
430
+ * ```
431
+ */
432
+ click(): Promise<void>;
433
+ }
434
+ /**
435
+ * A set of criteria that can be used to filter a list of `TnIconButtonHarness` instances.
436
+ */
437
+ interface IconButtonHarnessFilters extends BaseHarnessFilters {
438
+ /** Filters by icon name. */
439
+ name?: string;
440
+ /** Filters by icon library (material, mdi, custom, lucide). */
441
+ library?: string;
442
+ /** Filters by icon size (xs, sm, md, lg, xl). */
443
+ size?: string;
444
+ }
445
+
297
446
  declare enum InputType {
298
447
  Email = "email",
299
448
  Password = "password",
@@ -768,7 +917,7 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor {
768
917
 
769
918
  /**
770
919
  * Harness for interacting with tn-icon in tests.
771
- * Provides filtering by icon name and library for existence checks.
920
+ * Provides filtering by icon name and library for existence checks, as well as click interaction.
772
921
  *
773
922
  * @example
774
923
  * ```typescript
@@ -789,6 +938,12 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor {
789
938
  * const hasIcon = await loader.hasHarness(
790
939
  * TnIconHarness.with({ name: 'check' })
791
940
  * );
941
+ *
942
+ * // Click an icon
943
+ * const closeIcon = await loader.getHarness(
944
+ * TnIconHarness.with({ name: 'close' })
945
+ * );
946
+ * await closeIcon.click();
792
947
  * ```
793
948
  */
794
949
  declare class TnIconHarness extends ComponentHarness {
@@ -874,6 +1029,18 @@ declare class TnIconHarness extends ComponentHarness {
874
1029
  * ```
875
1030
  */
876
1031
  getColor(): Promise<string | null>;
1032
+ /**
1033
+ * Clicks the icon.
1034
+ *
1035
+ * @returns Promise that resolves when the click action is complete.
1036
+ *
1037
+ * @example
1038
+ * ```typescript
1039
+ * const icon = await loader.getHarness(TnIconHarness.with({ name: 'close' }));
1040
+ * await icon.click();
1041
+ * ```
1042
+ */
1043
+ click(): Promise<void>;
877
1044
  }
878
1045
  /**
879
1046
  * A set of criteria that can be used to filter a list of `TnIconHarness` instances.
@@ -2880,5 +3047,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
2880
3047
  */
2881
3048
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
2882
3049
 
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 };
3050
+ 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, TnIconButtonHarness, 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 };
3051
+ export type { BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconButtonHarnessFilters, 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 };