@truenas/ui-components 0.3.11 → 0.3.13

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.3.11",
3
+ "version": "0.3.13",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -2175,6 +2175,188 @@ declare class TnInputDirective {
2175
2175
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnInputDirective, "input[tnInput], textarea[tnInput], div[tnInput]", never, {}, {}, never, never, true, never>;
2176
2176
  }
2177
2177
 
2178
+ /**
2179
+ * A minimal file-selection form control. Renders a styled "Choose File" button
2180
+ * that opens the native file dialog and exposes the picked `File`(s) both as a
2181
+ * `(change)` output and as the value of an Angular form control.
2182
+ *
2183
+ * The selected file name(s) are shown next to the button (toggle with
2184
+ * `showFileName`). Use inside a `<tn-form-field>` to get a label, required
2185
+ * asterisk and help tooltip.
2186
+ *
2187
+ * Like every native file input, the browser forbids programmatically setting
2188
+ * the chosen files for security reasons. Writing a non-empty value via a form
2189
+ * control therefore only updates the displayed name; writing `null` (or an empty
2190
+ * array) clears the control. User selection is the only way to populate real
2191
+ * `File` objects.
2192
+ *
2193
+ * @example
2194
+ * ```html
2195
+ * <tn-form-field label="Update File" [required]="true" tooltip="Upload a .tar file">
2196
+ * <tn-file-input accept=".tar" formControlName="update" (change)="onFile($event)" />
2197
+ * </tn-form-field>
2198
+ * ```
2199
+ */
2200
+ declare class TnFileInputComponent implements ControlValueAccessor {
2201
+ fileInputEl: _angular_core.Signal<ElementRef<HTMLInputElement>>;
2202
+ /** Label rendered inside the trigger button. */
2203
+ buttonLabel: _angular_core.InputSignal<string>;
2204
+ /**
2205
+ * Native `accept` attribute forwarded to the file input — a comma-separated
2206
+ * list of extensions and/or MIME types (e.g. `".tar,.txt"`, `"image/*"`).
2207
+ */
2208
+ accept: _angular_core.InputSignal<string | undefined>;
2209
+ /** Allow selecting more than one file. The value becomes a `File[]`. */
2210
+ multiple: _angular_core.InputSignal<boolean>;
2211
+ disabled: _angular_core.InputSignal<boolean>;
2212
+ /** Whether to render the selected file name(s) beside the button. */
2213
+ showFileName: _angular_core.InputSignal<boolean>;
2214
+ /** Text shown beside the button when no file is selected. */
2215
+ noFileText: _angular_core.InputSignal<string>;
2216
+ /**
2217
+ * Accessible label for the trigger button, forwarded to `tn-button`. Set this
2218
+ * when the visible "Choose File" text alone doesn't convey what is being
2219
+ * uploaded — e.g. pass the field label so a screen reader announces
2220
+ * "Update File" rather than just "Choose File". (`tn-form-field`'s `<label>`
2221
+ * is not programmatically associated with the projected control.)
2222
+ */
2223
+ ariaLabel: _angular_core.InputSignal<string | undefined>;
2224
+ /**
2225
+ * Semantic test-id base. Rendered under whichever attribute name is configured
2226
+ * via `TN_TEST_ATTR` (default `data-testid`).
2227
+ */
2228
+ testId: _angular_core.InputSignal<TnTestIdValue>;
2229
+ /**
2230
+ * Emitted whenever the selection changes. `null` when the input is cleared.
2231
+ * Named `selectionChange` (not `change`) to avoid colliding with the native
2232
+ * `change` event bubbling from the inner file input.
2233
+ */
2234
+ selectionChange: _angular_core.OutputEmitterRef<File | File[] | null>;
2235
+ protected selectedFiles: _angular_core.WritableSignal<File[]>;
2236
+ private formDisabled;
2237
+ protected isDisabled: _angular_core.Signal<boolean>;
2238
+ protected fileNames: _angular_core.Signal<string>;
2239
+ protected hasFiles: _angular_core.Signal<boolean>;
2240
+ private onChange;
2241
+ private onTouched;
2242
+ writeValue(value: File | File[] | null): void;
2243
+ registerOnChange(fn: (value: File | File[] | null) => void): void;
2244
+ registerOnTouched(fn: () => void): void;
2245
+ setDisabledState(isDisabled: boolean): void;
2246
+ protected openFileDialog(): void;
2247
+ /** Marks the control as touched when focus leaves it (e.g. for validation). */
2248
+ protected onBlur(): void;
2249
+ protected onFilesSelected(event: Event): void;
2250
+ private toValue;
2251
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnFileInputComponent, never>;
2252
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnFileInputComponent, "tn-file-input", never, { "buttonLabel": { "alias": "buttonLabel"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "showFileName": { "alias": "showFileName"; "required": false; "isSignal": true; }; "noFileText": { "alias": "noFileText"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
2253
+ }
2254
+
2255
+ /**
2256
+ * Harness for interacting with `tn-file-input` in tests.
2257
+ *
2258
+ * @example
2259
+ * ```typescript
2260
+ * const fileInput = await loader.getHarness(TnFileInputHarness.with({ testId: 'update' }));
2261
+ * expect(await fileInput.getButtonText()).toBe('Choose File');
2262
+ * expect(await fileInput.hasFile()).toBe(false);
2263
+ * expect(await fileInput.getFileName()).toBe('No file chosen');
2264
+ * ```
2265
+ */
2266
+ declare class TnFileInputHarness extends ComponentHarness {
2267
+ /** The selector for the host element of a `TnFileInputComponent` instance. */
2268
+ static hostSelector: string;
2269
+ private _button;
2270
+ private _native;
2271
+ private _filename;
2272
+ /**
2273
+ * Gets a `HarnessPredicate` to search for a file input with specific attributes.
2274
+ *
2275
+ * @param options Options for filtering which instances are considered a match.
2276
+ * @returns A `HarnessPredicate` configured with the given options.
2277
+ *
2278
+ * @example
2279
+ * ```typescript
2280
+ * const fileInput = await loader.getHarness(TnFileInputHarness.with({ testId: 'update' }));
2281
+ * ```
2282
+ */
2283
+ static with(options?: FileInputHarnessFilters): HarnessPredicate<TnFileInputHarness>;
2284
+ /**
2285
+ * Gets the trigger button's text.
2286
+ *
2287
+ * @returns Promise resolving to the button label.
2288
+ *
2289
+ * @example
2290
+ * ```typescript
2291
+ * expect(await fileInput.getButtonText()).toBe('Choose File');
2292
+ * ```
2293
+ */
2294
+ getButtonText(): Promise<string>;
2295
+ /**
2296
+ * Gets the displayed file-name text (or the empty-state text).
2297
+ *
2298
+ * @returns Promise resolving to the text, or null when the name is hidden.
2299
+ *
2300
+ * @example
2301
+ * ```typescript
2302
+ * expect(await fileInput.getFileName()).toBe('No file chosen');
2303
+ * ```
2304
+ */
2305
+ getFileName(): Promise<string | null>;
2306
+ /**
2307
+ * Whether a file is currently selected. A native file input reports an empty
2308
+ * `value` until the user picks a file, so this reflects real user selection.
2309
+ *
2310
+ * @returns Promise resolving to true when a file has been chosen.
2311
+ *
2312
+ * @example
2313
+ * ```typescript
2314
+ * expect(await fileInput.hasFile()).toBe(false);
2315
+ * ```
2316
+ */
2317
+ hasFile(): Promise<boolean>;
2318
+ /**
2319
+ * Whether the control is disabled.
2320
+ *
2321
+ * @returns Promise resolving to true if the button is disabled.
2322
+ *
2323
+ * @example
2324
+ * ```typescript
2325
+ * expect(await fileInput.isDisabled()).toBe(true);
2326
+ * ```
2327
+ */
2328
+ isDisabled(): Promise<boolean>;
2329
+ /**
2330
+ * Opens the native file dialog by clicking the trigger button. The browser
2331
+ * does not let tests pick a real file, so this is mainly useful for asserting
2332
+ * click handling and focus behaviour.
2333
+ *
2334
+ * @example
2335
+ * ```typescript
2336
+ * await fileInput.open();
2337
+ * ```
2338
+ */
2339
+ open(): Promise<void>;
2340
+ /**
2341
+ * Gets the test-id attribute value from the container.
2342
+ *
2343
+ * @returns Promise resolving to the test-id, or null when unset.
2344
+ *
2345
+ * @example
2346
+ * ```typescript
2347
+ * expect(await fileInput.getTestId()).toBe('file-input-update');
2348
+ * ```
2349
+ */
2350
+ getTestId(): Promise<string | null>;
2351
+ }
2352
+ /** A set of criteria for filtering a list of `TnFileInputHarness` instances. */
2353
+ interface FileInputHarnessFilters extends BaseHarnessFilters {
2354
+ /** Filters by the trigger button's text. Supports string or regex matching. */
2355
+ buttonText?: string | RegExp;
2356
+ /** Filters by data-testid attribute. */
2357
+ testId?: string;
2358
+ }
2359
+
2178
2360
  type ChipColor = 'primary' | 'secondary' | 'accent';
2179
2361
  declare class TnChipComponent implements AfterViewInit, OnDestroy {
2180
2362
  chipEl: _angular_core.Signal<ElementRef<HTMLElement>>;
@@ -8490,5 +8672,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
8490
8672
  */
8491
8673
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
8492
8674
 
8493
- export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, 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, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
8494
- export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, ChipHarnessFilters, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, FormSectionHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelMarkupSegment, LabelMarkupSegmentType, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SizeStandard, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnAutocompleteOption, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnChipInputHarnessFilters, TnChipInputOption, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnFormFieldErrorMessage, TnFormFieldErrorMessages, TnFormFieldErrorResolver, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnTestIdValue, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };
8675
+ export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFileInputComponent, TnFileInputHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, 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, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
8676
+ export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, ChipHarnessFilters, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FileInputHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, FormSectionHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelMarkupSegment, LabelMarkupSegmentType, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SizeStandard, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnAutocompleteOption, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnChipInputHarnessFilters, TnChipInputOption, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnFormFieldErrorMessage, TnFormFieldErrorMessages, TnFormFieldErrorResolver, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnTestIdValue, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };