@truenas/ui-components 0.8.13 → 0.8.14

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.8.13",
3
+ "version": "0.8.14",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -18257,6 +18257,22 @@ export interface FilePickerCreateActionEvent {
18257
18257
  /** Directory being browsed when the action was triggered. */
18258
18258
  parentPath: string;
18259
18259
  }
18260
+ /**
18261
+ * Payload of `itemSelectionChange`: the committed value together with the
18262
+ * listed items it refers to, for consumers that need more than the path
18263
+ * (e.g. to require that a FILE was picked).
18264
+ */
18265
+ export interface FilePickerSelection {
18266
+ /** The committed value — the same payload `selectionChange` carries. */
18267
+ value: string | string[];
18268
+ /**
18269
+ * One entry per selected path, in value order. `null` when the picker has
18270
+ * not listed that path in this session — e.g. a typed path the user never
18271
+ * browsed to, or the browsed directory itself submitted on an empty
18272
+ * selection before its parent was listed. Empty for a cleared selection.
18273
+ */
18274
+ items: (FileSystemItem | null)[];
18275
+ }
18260
18276
  export interface FilePickerError {
18261
18277
  type: 'navigation' | 'permission' | 'creation' | 'validation';
18262
18278
  message: string;
@@ -18281,6 +18297,24 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18281
18297
  /** Consumer-defined creation flows shown as buttons in the popup footer. */
18282
18298
  createActions: import("@angular/core").InputSignal<FilePickerCreateAction[]>;
18283
18299
  allowManualInput: import("@angular/core").InputSignal<boolean>;
18300
+ /**
18301
+ * Commit typed input verbatim instead of treating it as a path to validate:
18302
+ * no `rootPath` confinement, no `callbacks.validatePath`, no `valueRoot`
18303
+ * mapping — the text the user typed is the value. Lets a field accept
18304
+ * entries the browser cannot list, e.g. `EXTERNAL:192.168.0.200\SHARE` or
18305
+ * a dataset name for a pool that is not imported. With `multiSelect`, the
18306
+ * text is split on commas into one entry per comma-separated part (trimmed,
18307
+ * empty parts dropped), so commas cannot appear inside an entry. Committing
18308
+ * closes the popup. Popup selections are unaffected. Requires
18309
+ * `allowManualInput`.
18310
+ */
18311
+ allowFreeText: import("@angular/core").InputSignal<boolean>;
18312
+ /**
18313
+ * Explicit accessible name for the path input. Inside a `tn-form-field` the
18314
+ * input is named by the field label automatically (via `aria-labelledby`),
18315
+ * so leave this unset there unless the field has no visible label.
18316
+ */
18317
+ ariaLabel: import("@angular/core").InputSignal<string | undefined>;
18284
18318
  /**
18285
18319
  * Open the picker popup when the input is clicked while no path is selected
18286
18320
  * yet — an empty field means the user is about to pick something, so the
@@ -18319,6 +18353,11 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18319
18353
  fileExtensions: import("@angular/core").InputSignal<string[] | undefined>;
18320
18354
  callbacks: import("@angular/core").InputSignal<FilePickerCallbacks | undefined>;
18321
18355
  selectionChange: import("@angular/core").OutputEmitterRef<string | string[]>;
18356
+ /**
18357
+ * Emitted alongside every `selectionChange` with the listed
18358
+ * `FileSystemItem` behind each selected path (or `null` when unknown).
18359
+ */
18360
+ itemSelectionChange: import("@angular/core").OutputEmitterRef<FilePickerSelection>;
18322
18361
  pathChange: import("@angular/core").OutputEmitterRef<string>;
18323
18362
  /** Re-emitted from the popup when one of the `createActions` buttons is pressed. */
18324
18363
  createAction: import("@angular/core").OutputEmitterRef<FilePickerCreateActionEvent>;
@@ -18336,6 +18375,20 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18336
18375
  loading: import("@angular/core").WritableSignal<boolean>;
18337
18376
  hasError: import("@angular/core").WritableSignal<boolean>;
18338
18377
  private formDisabled;
18378
+ /**
18379
+ * Field-derived ARIA for the path input when projected into a
18380
+ * `tn-form-field` (label, description, invalid, required). All-null when
18381
+ * standalone or when `ariaLabel` overrides.
18382
+ */
18383
+ protected readonly fieldAria: import("@truenas/ui-components").TnFormFieldAriaBindings;
18384
+ /**
18385
+ * Every item the picker has listed, by absolute path, so a selection can be
18386
+ * resolved back to its item even after browsing elsewhere (multi-select
18387
+ * across directories, `selectPath`, typed paths). Kept for the picker's
18388
+ * lifetime: a stale entry only means a stale `type` for a path that changed
18389
+ * on disk after it was listed.
18390
+ */
18391
+ private listedItems;
18339
18392
  isDisabled: import("@angular/core").Signal<boolean>;
18340
18393
  /** Explicit `testId` wins; otherwise the bound control's name (formControlName etc.). */
18341
18394
  protected resolvedTestId: import("@angular/core").Signal<TnTestIdValue>;
@@ -18365,6 +18418,14 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18365
18418
  * and spam `validatePath` with paths the user never meant.
18366
18419
  */
18367
18420
  onPathCommit(event: Event): void;
18421
+ /**
18422
+ * `allowFreeText` commit: the typed text is the value, verbatim (single
18423
+ * mode keeps even surrounding whitespace, as the field shows it), and a
18424
+ * field holding only whitespace clears the selection like an empty one.
18425
+ * Selection state still tracks the absolute form of each trimmed entry (the
18426
+ * same mapping `writeValue` applies) so reopening the popup reflects it.
18427
+ */
18428
+ private commitFreeText;
18368
18429
  /** `openOnClick` entry point. */
18369
18430
  onInputClick(): void;
18370
18431
  /**
@@ -18446,6 +18507,14 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18446
18507
  * would be the surprising behavior.
18447
18508
  */
18448
18509
  private updateSelection;
18510
+ /**
18511
+ * Emits `selectionChange` and `itemSelectionChange` for a committed value.
18512
+ * Items are looked up by the absolute form of each trimmed entry, which is
18513
+ * how listings are indexed — a free-text value keeps any surrounding
18514
+ * whitespace the user typed, but still resolves to the item it names.
18515
+ */
18516
+ private emitSelection;
18517
+ private indexListedItems;
18449
18518
  private normalizedValueRoot;
18450
18519
  /** Maps an internal absolute path into the `valueRoot`-relative value space. */
18451
18520
  private toValueSpace;
@@ -18475,6 +18544,16 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18475
18544
  "required": false;
18476
18545
  "isSignal": true;
18477
18546
  };
18547
+ "allowFreeText": {
18548
+ "alias": "allowFreeText";
18549
+ "required": false;
18550
+ "isSignal": true;
18551
+ };
18552
+ "ariaLabel": {
18553
+ "alias": "ariaLabel";
18554
+ "required": false;
18555
+ "isSignal": true;
18556
+ };
18478
18557
  "openOnClick": {
18479
18558
  "alias": "openOnClick";
18480
18559
  "required": false;
@@ -18522,6 +18601,7 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18522
18601
  };
18523
18602
  }, {
18524
18603
  "selectionChange": "selectionChange";
18604
+ "itemSelectionChange": "itemSelectionChange";
18525
18605
  "pathChange": "pathChange";
18526
18606
  "createAction": "createAction";
18527
18607
  "error": "error";
@@ -18605,31 +18685,35 @@ export declare class TnFilePickerHarness extends ComponentHarness {
18605
18685
  */
18606
18686
  getValue(): Promise<string>;
18607
18687
  /**
18608
- * Sets the picker's value by typing a single path into the path input and
18609
- * committing it via the input's `change` event, exactly as a user pressing
18610
- * Enter would.
18688
+ * Sets the picker's value by typing into the path input and committing it
18689
+ * via the input's `change` event, exactly as a user pressing Enter would.
18611
18690
  *
18612
- * Unlike `IxExplorerHarness.setValue` there is no `string[]` overload:
18613
- * tn-file-picker treats typed input as ONE path even in multi-select mode
18614
- * (commas are legal in paths, so they are never list separators). In
18615
- * multi-select, committing a typed path REPLACES the whole selection with
18616
- * that single path; build a real multi-selection through the popup with
18617
- * {@link clickItem} + {@link clickSelect}.
18691
+ * By default tn-file-picker treats typed input as ONE path even in
18692
+ * multi-select mode (commas are legal in paths, so they are never list
18693
+ * separators): committing a typed path REPLACES the whole selection with
18694
+ * that single path, and commits go through the component's normal
18695
+ * validation — paths outside `rootPath` are rejected (the value stays
18696
+ * unchanged and an `error` is emitted), and `callbacks.validatePath` is
18697
+ * consulted when provided. Build a real multi-selection through the popup
18698
+ * with {@link clickItem} + {@link clickSelect}.
18699
+ *
18700
+ * With `allowFreeText`, the typed text is committed verbatim with no
18701
+ * validation, and in multi-select it is split on commas — so passing a
18702
+ * `string[]` (typed joined with `', '`) sets one entry per element.
18618
18703
  *
18619
- * Commits go through the component's normal validation: paths outside
18620
- * `rootPath` are rejected (the value stays unchanged and an `error` is
18621
- * emitted), and `callbacks.validatePath` is consulted when provided.
18622
18704
  * Setting an empty string clears the selection. Has no effect when
18623
18705
  * `allowManualInput` is false (the input is readonly).
18624
18706
  *
18625
- * @param value The path to set.
18707
+ * @param value The path to set, or several entries for a free-text
18708
+ * multi-select picker.
18626
18709
  *
18627
18710
  * @example
18628
18711
  * ```typescript
18629
18712
  * await picker.setValue('/mnt/tank/media');
18713
+ * await freeTextMultiPicker.setValue(['/mnt/tank/a', 'EXTERNAL:host\\share']);
18630
18714
  * ```
18631
18715
  */
18632
- setValue(value: string): Promise<void>;
18716
+ setValue(value: string | string[]): Promise<void>;
18633
18717
  /**
18634
18718
  * Gets the path input's placeholder text.
18635
18719
  *