@truenas/ui-components 0.5.1 → 0.5.2

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.5.1",
3
+ "version": "0.5.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -2856,9 +2856,12 @@ declare class TnChipInputComponent<T = string> implements ControlValueAccessor,
2856
2856
  /**
2857
2857
  * Semantic test-id base. The library prepends the `chip-input` element type
2858
2858
  * (e.g. `testId="tags"` → `chip-input-tags`); each chip and suggestion is
2859
- * scoped beneath it.
2859
+ * scoped beneath it. Falls back to the bound control name when unset, so
2860
+ * `<tn-chip-input formControlName="isnsServers">` emits `chip-input-isns-servers`.
2860
2861
  */
2861
2862
  testId: _angular_core.InputSignal<TnTestIdValue>;
2863
+ /** Test-id base, falling back to the bound control name when `testId` is unset. */
2864
+ protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
2862
2865
  /** Emits the committed value whenever a chip is added. */
2863
2866
  chipAdded: _angular_core.OutputEmitterRef<T>;
2864
2867
  /** Emits the removed value whenever a chip is removed. */
@@ -2917,8 +2920,38 @@ declare class TnChipInputComponent<T = string> implements ControlValueAccessor,
2917
2920
  protected removeChip(index: number): void;
2918
2921
  /** The label shown on a chip for a committed value. */
2919
2922
  protected displayLabel(value: T): string;
2920
- /** Scopes a per-chip test id beneath the component's base. */
2923
+ /**
2924
+ * Scopes a per-chip test id beneath the component's base.
2925
+ *
2926
+ * The discriminator is the value itself when primitive, else the matching
2927
+ * option's label — `String(value)` on an object is `[object Object]`, which
2928
+ * would stamp an identical id on every chip. Duplicates are worse than
2929
+ * absence for automation, so an object value with no option to name it yet
2930
+ * (options still loading) stays attribute-free rather than colliding. A primitive
2931
+ * that normalizes away is dropped for the same reason — see
2932
+ * {@link discriminatedTestId}.
2933
+ */
2921
2934
  protected chipTestId(value: T): TnTestIdValue;
2935
+ /**
2936
+ * Scopes a per-suggestion test id beneath the component's base, via the shared
2937
+ * dropdown-option derivation. Unlike `tn-select` / `tn-autocomplete`, which
2938
+ * emit an unscoped `option-<value>` when they have no base, an unidentified
2939
+ * chip-input stays attribute-free — its rows carry no page-unique id, so
2940
+ * emitting one would invite collisions between inputs.
2941
+ */
2942
+ protected suggestionTestId(option: TnChipInputOption<T>): TnTestIdValue;
2943
+ /**
2944
+ * Keeps a scoped id only when both halves of it survive normalization.
2945
+ *
2946
+ * The base has to be usable: an unscoped `chip-<value>` would collide across every
2947
+ * chip-input on the page, so unidentified inputs stay attribute-free. The
2948
+ * discriminator has to contribute a segment of its own, because
2949
+ * `kebabTestSegment` drops every run of non-alphanumerics — a value like `*`, `**`
2950
+ * or a CJK-only tag normalizes to nothing and collapses the id back to the bare
2951
+ * base, stamping the same id on every chip. That is the duplicate-id case the
2952
+ * object-value path already avoids, reached through a primitive instead.
2953
+ */
2954
+ private discriminatedTestId;
2922
2955
  private isCommitKey;
2923
2956
  /** Commits typed text: resolve it to an option's value, else accept as custom. */
2924
2957
  private commitText;