@truenas/ui-components 0.2.0 → 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.2.0",
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;