@truenas/ui-components 0.1.24 → 0.1.25

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.24",
3
+ "version": "0.1.25",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1191,6 +1191,21 @@ declare class TnExpansionPanelComponent {
1191
1191
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnExpansionPanelComponent, "tn-expansion-panel", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "elevation": { "alias": "elevation"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "background": { "alias": "background"; "required": false; "isSignal": true; }; "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "titleStyle": { "alias": "titleStyle"; "required": false; "isSignal": true; }; }, { "expandedChange": "expandedChange"; "toggleEvent": "toggleEvent"; }, never, ["[slot=title]", "*"], true, never>;
1192
1192
  }
1193
1193
 
1194
+ /**
1195
+ * Directive to mark content for projection into the checkbox label area.
1196
+ * Use when the label needs rich content (links, icons, etc.) instead of plain text.
1197
+ *
1198
+ * @example
1199
+ * ```html
1200
+ * <tn-checkbox formControlName="terms">
1201
+ * <span tnCheckboxLabel>I agree to the <a href="/terms">Terms</a></span>
1202
+ * </tn-checkbox>
1203
+ * ```
1204
+ */
1205
+ declare class TnCheckboxLabelDirective {
1206
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnCheckboxLabelDirective, never>;
1207
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnCheckboxLabelDirective, "[tnCheckboxLabel]", never, {}, {}, never, never, true, never>;
1208
+ }
1194
1209
  declare class TnCheckboxComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {
1195
1210
  checkboxEl: _angular_core.Signal<ElementRef<HTMLInputElement>>;
1196
1211
  label: _angular_core.InputSignal<string>;
@@ -1202,8 +1217,11 @@ declare class TnCheckboxComponent implements AfterViewInit, OnDestroy, ControlVa
1202
1217
  error: _angular_core.InputSignal<string | null>;
1203
1218
  checked: _angular_core.InputSignal<boolean>;
1204
1219
  change: _angular_core.OutputEmitterRef<boolean>;
1220
+ private labelContent;
1221
+ protected hasProjectedLabel: _angular_core.Signal<boolean>;
1205
1222
  id: string;
1206
1223
  private internalChecked;
1224
+ private cvaControlled;
1207
1225
  private formDisabled;
1208
1226
  isDisabled: _angular_core.Signal<boolean>;
1209
1227
  private focusMonitor;
@@ -1219,7 +1237,182 @@ declare class TnCheckboxComponent implements AfterViewInit, OnDestroy, ControlVa
1219
1237
  onCheckboxChange(event: Event): void;
1220
1238
  classes: _angular_core.Signal<string[]>;
1221
1239
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnCheckboxComponent, never>;
1222
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnCheckboxComponent, "tn-checkbox", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "hideLabel": { "alias": "hideLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; }, { "change": "change"; }, never, never, true, never>;
1240
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnCheckboxComponent, "tn-checkbox", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "hideLabel": { "alias": "hideLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; }, { "change": "change"; }, ["labelContent"], ["[tnCheckboxLabel]"], true, never>;
1241
+ }
1242
+
1243
+ /**
1244
+ * Harness for interacting with tn-checkbox in tests.
1245
+ * Provides methods for checking, unchecking, and querying checkbox state.
1246
+ *
1247
+ * @example
1248
+ * ```typescript
1249
+ * // Find and check a checkbox
1250
+ * const checkbox = await loader.getHarness(TnCheckboxHarness.with({ label: 'Accept terms' }));
1251
+ * await checkbox.check();
1252
+ * expect(await checkbox.isChecked()).toBe(true);
1253
+ *
1254
+ * // Toggle a checkbox
1255
+ * await checkbox.toggle();
1256
+ * expect(await checkbox.isChecked()).toBe(false);
1257
+ *
1258
+ * // Find by testId
1259
+ * const terms = await loader.getHarness(TnCheckboxHarness.with({ testId: 'terms-checkbox' }));
1260
+ * ```
1261
+ */
1262
+ declare class TnCheckboxHarness extends ComponentHarness {
1263
+ /**
1264
+ * The selector for the host element of a `TnCheckboxComponent` instance.
1265
+ */
1266
+ static hostSelector: string;
1267
+ private _input;
1268
+ private _label;
1269
+ private _text;
1270
+ private _error;
1271
+ /**
1272
+ * Gets a `HarnessPredicate` that can be used to search for a checkbox
1273
+ * with specific attributes.
1274
+ *
1275
+ * @param options Options for filtering which checkbox instances are considered a match.
1276
+ * @returns A `HarnessPredicate` configured with the given options.
1277
+ *
1278
+ * @example
1279
+ * ```typescript
1280
+ * // Find by label text
1281
+ * const checkbox = await loader.getHarness(TnCheckboxHarness.with({ label: 'Accept' }));
1282
+ *
1283
+ * // Find by label regex
1284
+ * const checkbox = await loader.getHarness(TnCheckboxHarness.with({ label: /terms/i }));
1285
+ *
1286
+ * // Find by testId
1287
+ * const checkbox = await loader.getHarness(TnCheckboxHarness.with({ testId: 'my-checkbox' }));
1288
+ * ```
1289
+ */
1290
+ static with(options?: CheckboxHarnessFilters): HarnessPredicate<TnCheckboxHarness>;
1291
+ /**
1292
+ * Gets the checkbox label text content.
1293
+ *
1294
+ * @returns Promise resolving to the label text.
1295
+ *
1296
+ * @example
1297
+ * ```typescript
1298
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1299
+ * expect(await checkbox.getLabelText()).toBe('Accept terms');
1300
+ * ```
1301
+ */
1302
+ getLabelText(): Promise<string>;
1303
+ /**
1304
+ * Checks whether the checkbox is currently checked.
1305
+ *
1306
+ * @returns Promise resolving to true if the checkbox is checked.
1307
+ *
1308
+ * @example
1309
+ * ```typescript
1310
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1311
+ * expect(await checkbox.isChecked()).toBe(false);
1312
+ * ```
1313
+ */
1314
+ isChecked(): Promise<boolean>;
1315
+ /**
1316
+ * Checks whether the checkbox is disabled.
1317
+ *
1318
+ * @returns Promise resolving to true if the checkbox is disabled.
1319
+ *
1320
+ * @example
1321
+ * ```typescript
1322
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1323
+ * expect(await checkbox.isDisabled()).toBe(false);
1324
+ * ```
1325
+ */
1326
+ isDisabled(): Promise<boolean>;
1327
+ /**
1328
+ * Checks whether the checkbox is required.
1329
+ *
1330
+ * @returns Promise resolving to true if the checkbox is required.
1331
+ *
1332
+ * @example
1333
+ * ```typescript
1334
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1335
+ * expect(await checkbox.isRequired()).toBe(true);
1336
+ * ```
1337
+ */
1338
+ isRequired(): Promise<boolean>;
1339
+ /**
1340
+ * Checks whether the checkbox is in the indeterminate state.
1341
+ *
1342
+ * @returns Promise resolving to true if the checkbox is indeterminate.
1343
+ *
1344
+ * @example
1345
+ * ```typescript
1346
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1347
+ * expect(await checkbox.isIndeterminate()).toBe(false);
1348
+ * ```
1349
+ */
1350
+ isIndeterminate(): Promise<boolean>;
1351
+ /**
1352
+ * Gets the test ID attribute value.
1353
+ *
1354
+ * @returns Promise resolving to the test ID string, or null.
1355
+ *
1356
+ * @example
1357
+ * ```typescript
1358
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1359
+ * expect(await checkbox.getTestId()).toBe('terms-checkbox');
1360
+ * ```
1361
+ */
1362
+ getTestId(): Promise<string | null>;
1363
+ /**
1364
+ * Gets the error message text, if any.
1365
+ *
1366
+ * @returns Promise resolving to the error message, or null if none.
1367
+ *
1368
+ * @example
1369
+ * ```typescript
1370
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1371
+ * expect(await checkbox.getErrorText()).toBe('You must accept the terms');
1372
+ * ```
1373
+ */
1374
+ getErrorText(): Promise<string | null>;
1375
+ /**
1376
+ * Checks the checkbox. No-op if already checked.
1377
+ *
1378
+ * @example
1379
+ * ```typescript
1380
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1381
+ * await checkbox.check();
1382
+ * expect(await checkbox.isChecked()).toBe(true);
1383
+ * ```
1384
+ */
1385
+ check(): Promise<void>;
1386
+ /**
1387
+ * Unchecks the checkbox. No-op if already unchecked.
1388
+ *
1389
+ * @example
1390
+ * ```typescript
1391
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1392
+ * await checkbox.uncheck();
1393
+ * expect(await checkbox.isChecked()).toBe(false);
1394
+ * ```
1395
+ */
1396
+ uncheck(): Promise<void>;
1397
+ /**
1398
+ * Toggles the checkbox checked state by clicking the label.
1399
+ *
1400
+ * @example
1401
+ * ```typescript
1402
+ * const checkbox = await loader.getHarness(TnCheckboxHarness);
1403
+ * await checkbox.toggle();
1404
+ * ```
1405
+ */
1406
+ toggle(): Promise<void>;
1407
+ }
1408
+ /**
1409
+ * A set of criteria that can be used to filter a list of `TnCheckboxHarness` instances.
1410
+ */
1411
+ interface CheckboxHarnessFilters extends BaseHarnessFilters {
1412
+ /** Filters by label text. Supports string or regex matching. */
1413
+ label?: string | RegExp;
1414
+ /** Filters by data-testid attribute. */
1415
+ testId?: string;
1223
1416
  }
1224
1417
 
1225
1418
  declare class TnRadioComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {
@@ -4419,5 +4612,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
4419
4612
  */
4420
4613
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
4421
4614
 
4422
- export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTabsHarness, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
4423
- export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, DialogHarnessFilters, EmptyHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };
4615
+ export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTabsHarness, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
4616
+ export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, CreateFolderEvent, DateRange, DialogHarnessFilters, EmptyHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };