@truenas/ui-components 0.1.77 → 0.2.1

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.77",
3
+ "version": "0.2.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1229,6 +1229,36 @@ declare class TnInputComponent implements AfterViewInit, OnDestroy, ControlValue
1229
1229
  * the a11y tree.
1230
1230
  */
1231
1231
  ariaLabel: _angular_core.InputSignal<string | undefined>;
1232
+ /**
1233
+ * Native `autocomplete` hint rendered on the input/textarea. Pass the standard
1234
+ * autofill tokens (`'username'`, `'current-password'`, `'new-password'`,
1235
+ * `'one-time-code'`, ...) so browsers and password managers can identify and
1236
+ * fill the field.
1237
+ */
1238
+ autocomplete: _angular_core.InputSignal<string | undefined>;
1239
+ /**
1240
+ * Native `name` attribute rendered on the input/textarea. Browsers and password
1241
+ * managers use it to identify the field; typically mirrors the form control name.
1242
+ */
1243
+ name: _angular_core.InputSignal<string | undefined>;
1244
+ /**
1245
+ * Renders the native `readonly` attribute: the value is visible, focusable and
1246
+ * selectable but not editable. Unlike `disabled`, a readonly field stays in the
1247
+ * tab order and its form control stays enabled.
1248
+ */
1249
+ readonly: _angular_core.InputSignal<boolean>;
1250
+ /**
1251
+ * Renders the native `required` attribute so browsers and assistive technology
1252
+ * expose the field as required. Validation itself stays with the consumer's form
1253
+ * validators (e.g. `Validators.required`); forms that fully own validation UX
1254
+ * should also set `novalidate` to suppress native submit blocking.
1255
+ *
1256
+ * Note: this drives only the native/a11y semantics. When wrapped in a
1257
+ * `tn-form-field`, the visual `*` indicator is inferred automatically from the
1258
+ * control's `Validators.required`; only validator-less setups need the form
1259
+ * field's own `required` input alongside this one.
1260
+ */
1261
+ required: _angular_core.InputSignal<boolean>;
1232
1262
  /**
1233
1263
  * Integer/decimal switch — only meaningful when `inputType` is `InputType.Number`.
1234
1264
  *
@@ -1263,6 +1293,13 @@ declare class TnInputComponent implements AfterViewInit, OnDestroy, ControlValue
1263
1293
  suffixIcon: _angular_core.InputSignal<string | undefined>;
1264
1294
  suffixIconLibrary: _angular_core.InputSignal<IconLibraryType | undefined>;
1265
1295
  suffixIconAriaLabel: _angular_core.InputSignal<string | undefined>;
1296
+ /**
1297
+ * Semantic test-id base for the suffix-action button. The library prepends the
1298
+ * element type (`button`) and renders the result under whichever attribute name
1299
+ * is configured via `TN_TEST_ATTR` (default `data-testid`) — e.g.
1300
+ * `suffixActionTestId="toggle-password"` → `button-toggle-password`.
1301
+ */
1302
+ suffixActionTestId: _angular_core.InputSignal<TnTestIdValue>;
1266
1303
  onSuffixAction: _angular_core.OutputEmitterRef<MouseEvent>;
1267
1304
  hasPrefixIcon: _angular_core.Signal<boolean>;
1268
1305
  hasSuffixIcon: _angular_core.Signal<boolean>;
@@ -1298,7 +1335,7 @@ declare class TnInputComponent implements AfterViewInit, OnDestroy, ControlValue
1298
1335
  /** Parses a sanitized string to a number, mapping empty/partial input to null (never 0). */
1299
1336
  private parseNumeric;
1300
1337
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnInputComponent, never>;
1301
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnInputComponent, "tn-input", never, { "inputType": { "alias": "inputType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "allowDecimals": { "alias": "allowDecimals"; "required": false; "isSignal": true; }; "sizeStandard": { "alias": "sizeStandard"; "required": false; "isSignal": true; }; "sizeDefaultUnit": { "alias": "sizeDefaultUnit"; "required": false; "isSignal": true; }; "sizeRound": { "alias": "sizeRound"; "required": false; "isSignal": true; }; "prefixIcon": { "alias": "prefixIcon"; "required": false; "isSignal": true; }; "prefixIconLibrary": { "alias": "prefixIconLibrary"; "required": false; "isSignal": true; }; "suffixIcon": { "alias": "suffixIcon"; "required": false; "isSignal": true; }; "suffixIconLibrary": { "alias": "suffixIconLibrary"; "required": false; "isSignal": true; }; "suffixIconAriaLabel": { "alias": "suffixIconAriaLabel"; "required": false; "isSignal": true; }; }, { "onSuffixAction": "onSuffixAction"; }, never, never, true, never>;
1338
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnInputComponent, "tn-input", never, { "inputType": { "alias": "inputType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "allowDecimals": { "alias": "allowDecimals"; "required": false; "isSignal": true; }; "sizeStandard": { "alias": "sizeStandard"; "required": false; "isSignal": true; }; "sizeDefaultUnit": { "alias": "sizeDefaultUnit"; "required": false; "isSignal": true; }; "sizeRound": { "alias": "sizeRound"; "required": false; "isSignal": true; }; "prefixIcon": { "alias": "prefixIcon"; "required": false; "isSignal": true; }; "prefixIconLibrary": { "alias": "prefixIconLibrary"; "required": false; "isSignal": true; }; "suffixIcon": { "alias": "suffixIcon"; "required": false; "isSignal": true; }; "suffixIconLibrary": { "alias": "suffixIconLibrary"; "required": false; "isSignal": true; }; "suffixIconAriaLabel": { "alias": "suffixIconAriaLabel"; "required": false; "isSignal": true; }; "suffixActionTestId": { "alias": "suffixActionTestId"; "required": false; "isSignal": true; }; }, { "onSuffixAction": "onSuffixAction"; }, never, never, true, never>;
1302
1339
  }
1303
1340
 
1304
1341
  /**
@@ -1590,6 +1627,30 @@ declare class TnInputHarness extends ComponentHarness {
1590
1627
  * @returns Promise resolving to the aria-label string, or null if unset.
1591
1628
  */
1592
1629
  getAriaLabel(): Promise<string | null>;
1630
+ /**
1631
+ * Gets the native `name` attribute (set via the `name` input).
1632
+ *
1633
+ * @returns Promise resolving to the name string, or null if unset.
1634
+ */
1635
+ getName(): Promise<string | null>;
1636
+ /**
1637
+ * Gets the native `autocomplete` attribute (set via the `autocomplete` input).
1638
+ *
1639
+ * @returns Promise resolving to the autocomplete token, or null if unset.
1640
+ */
1641
+ getAutocomplete(): Promise<string | null>;
1642
+ /**
1643
+ * Checks whether the input is readonly (set via the `readonly` input).
1644
+ *
1645
+ * @returns Promise resolving to true if the input is readonly.
1646
+ */
1647
+ isReadonly(): Promise<boolean>;
1648
+ /**
1649
+ * Checks whether the input is marked required (set via the `required` input).
1650
+ *
1651
+ * @returns Promise resolving to true if the input is required.
1652
+ */
1653
+ isRequired(): Promise<boolean>;
1593
1654
  /**
1594
1655
  * Gets the placeholder text.
1595
1656
  *
@@ -1657,6 +1718,8 @@ declare class TnInputHarness extends ComponentHarness {
1657
1718
  interface InputHarnessFilters extends BaseHarnessFilters {
1658
1719
  /** Filters by placeholder text. */
1659
1720
  placeholder?: string;
1721
+ /** Filters by the native `name` attribute (typically the form control name). */
1722
+ name?: string;
1660
1723
  }
1661
1724
 
1662
1725
  declare class TnInputDirective {
@@ -3254,6 +3317,17 @@ type SubscriptSizing = 'fixed' | 'dynamic';
3254
3317
  declare class TnFormFieldComponent implements AfterContentInit {
3255
3318
  label: _angular_core.InputSignal<string>;
3256
3319
  hint: _angular_core.InputSignal<string>;
3320
+ /**
3321
+ * Forces the visual `*` required indicator next to the label. Usually
3322
+ * unnecessary: the indicator is inferred automatically when the projected
3323
+ * control carries `Validators.required`. Set this only when inference can't
3324
+ * see the requirement — e.g. a validator wrapped in `Validators.compose(...)`
3325
+ * or a custom validator that emits a `required`-style error.
3326
+ *
3327
+ * The indicator is purely visual — for native/a11y semantics pair it with the
3328
+ * projected control's own `required` input (e.g. `tn-input`'s, which renders
3329
+ * the native attribute).
3330
+ */
3257
3331
  required: _angular_core.InputSignal<boolean>;
3258
3332
  testId: _angular_core.InputSignal<TnTestIdValue>;
3259
3333
  subscriptSizing: _angular_core.InputSignal<SubscriptSizing>;
@@ -3282,6 +3356,13 @@ declare class TnFormFieldComponent implements AfterContentInit {
3282
3356
  * read this so the derived state stays reactive.
3283
3357
  */
3284
3358
  private controlState;
3359
+ /**
3360
+ * Whether the required indicator renders: forced via the `required` input, or
3361
+ * inferred from the projected control's validators (mirrors Angular Material's
3362
+ * `hasValidator(Validators.required)` approach — reference equality, so composed
3363
+ * or custom required-like validators need the explicit input).
3364
+ */
3365
+ protected showRequired: _angular_core.Signal<boolean>;
3285
3366
  protected hasError: _angular_core.Signal<boolean>;
3286
3367
  protected errorMessage: _angular_core.Signal<string>;
3287
3368
  ngAfterContentInit(): void;
@@ -3571,6 +3652,17 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
3571
3652
  * with i18n requirements can pass a translated string.
3572
3653
  */
3573
3654
  noOptionsLabel: _angular_core.InputSignal<string>;
3655
+ /**
3656
+ * When `true` (single-select mode only), prepends a synthetic "empty"
3657
+ * option to the dropdown so users can unset a chosen value: picking it
3658
+ * resets the selection to `null`, shows the placeholder again, and emits
3659
+ * `null` via `selectionChange` (and to any bound form control). Mirrors
3660
+ * webui ix-select's `--` option. Ignored when `multiple` is set — there,
3661
+ * values are cleared by toggling them off individually.
3662
+ */
3663
+ allowEmpty: _angular_core.InputSignal<boolean>;
3664
+ /** Label of the empty option rendered when `allowEmpty` is set. */
3665
+ emptyLabel: _angular_core.InputSignal<string>;
3574
3666
  disabled: _angular_core.InputSignal<boolean>;
3575
3667
  testId: _angular_core.InputSignal<TnTestIdValue>;
3576
3668
  multiple: _angular_core.InputSignal<boolean>;
@@ -3600,7 +3692,11 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
3600
3692
  * ```
3601
3693
  */
3602
3694
  compareWith: _angular_core.InputSignal<((a: T | null, b: T | null) => boolean) | undefined>;
3603
- selectionChange: _angular_core.OutputEmitterRef<T>;
3695
+ /**
3696
+ * Emits the picked value on each selection in single mode. Emits `null`
3697
+ * when the user picks the `allowEmpty` empty option to clear the field.
3698
+ */
3699
+ selectionChange: _angular_core.OutputEmitterRef<T | null>;
3604
3700
  /** Emits the full array of selected values after each toggle in multiple mode. */
3605
3701
  multiSelectionChange: _angular_core.OutputEmitterRef<T[]>;
3606
3702
  protected isOpen: _angular_core.WritableSignal<boolean>;
@@ -3620,6 +3716,17 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
3620
3716
  */
3621
3717
  protected idNamespace: _angular_core.Signal<string>;
3622
3718
  isDisabled: _angular_core.Signal<boolean>;
3719
+ /**
3720
+ * The synthetic clear-selection option (`allowEmpty`, single mode only).
3721
+ * Its value is `null` cast to `T` so it flows through the same selection
3722
+ * path as real options — `selectedValue`/`writeValue` already model "no
3723
+ * selection" as `null`, so picking it clears the field for free.
3724
+ */
3725
+ protected emptyOption: _angular_core.Signal<TnSelectOption<T> | null>;
3726
+ /** Ungrouped options as rendered: the empty option (when enabled) first. */
3727
+ protected displayOptions: _angular_core.Signal<TnSelectOption<T>[]>;
3728
+ /** Whether `option` is the synthetic `allowEmpty` clear option. */
3729
+ protected isEmptyOption(option: TnSelectOption<T>): boolean;
3623
3730
  /**
3624
3731
  * Selectable, non-disabled options in display order (regular options first,
3625
3732
  * then groups). Used by keyboard navigation so we can skip disabled
@@ -3730,7 +3837,7 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
3730
3837
  private activateFocusedOption;
3731
3838
  private scrollFocusedIntoView;
3732
3839
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSelectComponent<any>, never>;
3733
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSelectComponent<any>, "tn-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionGroups": { "alias": "optionGroups"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "noOptionsLabel": { "alias": "noOptionsLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "optionTestIdKey": { "alias": "optionTestIdKey"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; "multiSelectionChange": "multiSelectionChange"; }, never, never, true, never>;
3840
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSelectComponent<any>, "tn-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionGroups": { "alias": "optionGroups"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "noOptionsLabel": { "alias": "noOptionsLabel"; "required": false; "isSignal": true; }; "allowEmpty": { "alias": "allowEmpty"; "required": false; "isSignal": true; }; "emptyLabel": { "alias": "emptyLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "optionTestIdKey": { "alias": "optionTestIdKey"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; "multiSelectionChange": "multiSelectionChange"; }, never, never, true, never>;
3734
3841
  }
3735
3842
 
3736
3843
  /**
@@ -3864,6 +3971,22 @@ declare class TnSelectHarness extends ComponentHarness {
3864
3971
  * ```
3865
3972
  */
3866
3973
  selectOption(filter: string | RegExp): Promise<void>;
3974
+ /**
3975
+ * Clears the selection by picking the empty option. Only available when
3976
+ * the select has `allowEmpty` set (single mode); throws otherwise.
3977
+ * Opens the dropdown if needed.
3978
+ *
3979
+ * @returns Promise that resolves when the selection has been cleared.
3980
+ *
3981
+ * @example
3982
+ * ```typescript
3983
+ * const select = await loader.getHarness(TnSelectHarness);
3984
+ * await select.selectOption('Banana');
3985
+ * await select.clear();
3986
+ * expect(await select.getDisplayText()).toBe('Select a fruit'); // placeholder
3987
+ * ```
3988
+ */
3989
+ clear(): Promise<void>;
3867
3990
  /**
3868
3991
  * Gets the labels of all available options. Opens the dropdown if needed.
3869
3992
  *
@@ -5898,7 +6021,7 @@ declare class TnTimeInputComponent implements ControlValueAccessor {
5898
6021
  registerOnChange(fn: (value: string) => void): void;
5899
6022
  registerOnTouched(fn: () => void): void;
5900
6023
  setDisabledState(isDisabled: boolean): void;
5901
- onSelectionChange(value: string): void;
6024
+ onSelectionChange(value: string | null): void;
5902
6025
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnTimeInputComponent, never>;
5903
6026
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnTimeInputComponent, "tn-time-input", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "granularity": { "alias": "granularity"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
5904
6027
  }