ng-hub-ui-forms 22.42.1 → 22.44.0

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": "ng-hub-ui-forms",
3
- "version": "22.42.1",
3
+ "version": "22.44.0",
4
4
  "license": "MIT",
5
5
  "description": "Accessible, signal-based form fields for Angular (input, textarea, slider, segmented, select, datepicker, file input with drag & drop and upload progress) with automatic error display for controls, FormGroups and FormArrays. Reactive Forms today, Signal Forms ready. Part of the ng-hub-ui family.",
6
6
  "author": "Carlos Morcillo Fernández <carlos.morcillo@me.com> (https://www.carlosmorcillo.com)",
@@ -41,7 +41,7 @@
41
41
  "@angular/forms": ">=21.0.0",
42
42
  "@angular/platform-browser": ">=21.0.0",
43
43
  "ng-hub-ui-ds": ">=22.14.1",
44
- "ng-hub-ui-utils": ">=22.12.0"
44
+ "ng-hub-ui-utils": ">=22.21.0"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "ng-hub-ui-ds": {
@@ -287,6 +287,39 @@ hub-timepicker {
287
287
  }
288
288
  }
289
289
 
290
+ /**
291
+ * Feedback as a tooltip, asked for by a container through `HUB_FIELD_FEEDBACK` (the paginable
292
+ * table does it under `flushFields`).
293
+ *
294
+ * The message leaves the page but not the accessibility tree, the same clipped box as the
295
+ * visually-hidden label, so the row keeps its height and the alert is still read out. The
296
+ * field says it is wrong with a danger ring drawn inside its own box, which survives the
297
+ * table taking the border away and never moves the layout. The tooltip takes the danger
298
+ * colour from here: the controller copies `--hub-tooltip-*` off the host when it opens.
299
+ */
300
+ .hub-field-host--feedback-tooltip {
301
+ --hub-tooltip-bg: var(--hub-form-invalid-border-color);
302
+ --hub-tooltip-color: var(--hub-sys-color-danger-on, #fff);
303
+
304
+ .hub-field__feedback {
305
+ position: absolute;
306
+ width: 1px;
307
+ height: 1px;
308
+ padding: 0;
309
+ margin: -1px;
310
+ overflow: hidden;
311
+ clip-path: inset(50%);
312
+ white-space: nowrap;
313
+ border: 0;
314
+ }
315
+
316
+ // On the body rather than the field, so a horizontal field's label and required mark stay outside.
317
+ .hub-field--invalid > .hub-field__body {
318
+ border-radius: var(--hub-input-border-radius);
319
+ box-shadow: inset 0 0 0 var(--hub-input-border-width, 1px) var(--hub-form-invalid-border-color);
320
+ }
321
+ }
322
+
290
323
  /**
291
324
  * Read-only fields.
292
325
  *
@@ -175,6 +175,12 @@ declare abstract class HubFieldControl extends HubFormControl implements Control
175
175
  * a template keeps its helper text where the template can actually be shown.
176
176
  */
177
177
  protected readonly showsFormTextTooltip: _angular_core.Signal<boolean>;
178
+ /**
179
+ * Whether a container above asked for the validation message as a tooltip
180
+ * (see `HUB_FIELD_FEEDBACK`). The message block stays in the page, out of sight, so it is
181
+ * still announced; the field marks itself in the danger colour instead.
182
+ */
183
+ protected readonly feedbackAsTooltip: _angular_core.Signal<boolean>;
178
184
  onChange: (value: any) => void;
179
185
  onTouched: () => void;
180
186
  protected readonly _nativeErrors: _angular_core.WritableSignal<ValidationErrors | null>;
@@ -399,6 +405,11 @@ interface HubDatepickerConfig {
399
405
  hourFormat: '12' | '24' | undefined;
400
406
  /** `Intl` options composed over {@link displayFormat} when the granularity carries a time. */
401
407
  timeDisplayFormat: Intl.DateTimeFormatOptions;
408
+ /**
409
+ * Whether the date can be typed into the input. `false` restores the read-only input that
410
+ * only the calendar writes to. A per-field `typeable` input overrides it.
411
+ */
412
+ typeable: boolean;
402
413
  /** Localizable labels. */
403
414
  labels: HubDatepickerLabels;
404
415
  }
@@ -2190,6 +2201,10 @@ interface DatepickerCell {
2190
2201
  * control holds) and `displayFormat` (what the user reads).
2191
2202
  * - `min` / `max` bounds — honouring the time, not just the day — and a `disabledDates` predicate.
2192
2203
  * - Keyboard navigation (arrows, Home/End, PageUp/Down, Enter, Escape) in every panel.
2204
+ * - Typing: the input accepts the date by hand (`typeable`, on by default). The text is parsed
2205
+ * on blur or Enter; text that is not a date leaves the value `null`, stays visible so it can be
2206
+ * fixed, and raises `hubDatepickerParse`. `min`, `max` and `disabledDates` also validate as
2207
+ * `hubDatepickerMin`, `hubDatepickerMax` and `hubDatepickerDisabled`.
2193
2208
  * - `Today`, `Clear` and — while picking a time — `Done` shortcuts.
2194
2209
  * - Full i18n: locale-driven month, weekday and AM/PM names plus overridable `labels`,
2195
2210
  * `displayFormat`, `weekdayFormat`, `firstDayOfWeek` and `rangeSeparator` — per instance or
@@ -2250,6 +2265,11 @@ declare class HubDatepickerComponent extends HubFieldControl {
2250
2265
  protected readonly _previewTarget: _angular_core.WritableSignal<Date | null>;
2251
2266
  /** Whether the calendar overlay is open. */
2252
2267
  protected readonly _open: _angular_core.WritableSignal<boolean>;
2268
+ /**
2269
+ * What the user has typed and not yet committed; `null` while the input just shows the value.
2270
+ * Kept after a failed parse so the text can be fixed instead of being wiped.
2271
+ */
2272
+ protected readonly _text: _angular_core.WritableSignal<string | null>;
2253
2273
  /** Selection mode (`single` or `range`). */
2254
2274
  readonly mode: _angular_core.InputSignal<HubDatepickerMode>;
2255
2275
  /**
@@ -2327,6 +2347,11 @@ declare class HubDatepickerComponent extends HubFieldControl {
2327
2347
  readonly labels: _angular_core.InputSignal<Partial<HubDatepickerLabels>>;
2328
2348
  /** Whether the picker is read-only. */
2329
2349
  readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
2350
+ /**
2351
+ * Whether the date can be typed into the input. Defaults to the global
2352
+ * {@link HubDatepickerConfig.typeable}; `readonly` and `disabled` still win.
2353
+ */
2354
+ readonly typeable: _angular_core.InputSignalWithTransform<boolean, unknown>;
2330
2355
  /** Extra CSS classes applied to the host element. */
2331
2356
  readonly classlist: _angular_core.InputSignal<string>;
2332
2357
  /** Text shown before the control as a group addon. A string is one; an array a run. */
@@ -2421,6 +2446,10 @@ declare class HubDatepickerComponent extends HubFieldControl {
2421
2446
  protected readonly isLabelRaised: _angular_core.Signal<boolean>;
2422
2447
  /** Tracks focus for {@link isLabelRaised}. */
2423
2448
  protected setFocused(focused: boolean): void;
2449
+ /** Whether the input takes typed text. */
2450
+ protected readonly _typeable: _angular_core.Signal<boolean>;
2451
+ /** What the input shows: the text being typed, or else the formatted value. */
2452
+ protected readonly inputText: _angular_core.Signal<string>;
2424
2453
  /** Locale-formatted display string for the input. */
2425
2454
  protected readonly displayValue: _angular_core.Signal<string>;
2426
2455
  protected readonly weekdays: _angular_core.Signal<string[]>;
@@ -2442,6 +2471,31 @@ declare class HubDatepickerComponent extends HubFieldControl {
2442
2471
  /** Enriched 6×7 grid for the displayed month. */
2443
2472
  protected readonly grid: _angular_core.Signal<DatepickerCell[]>;
2444
2473
  writeValue(value: unknown): void;
2474
+ /**
2475
+ * The component injects `NgControl` itself to be its own accessor, so an `NG_VALIDATORS`
2476
+ * provider pointing back at it would be a circular dependency. The validator is added to the
2477
+ * bound control instead, and removed when the field goes away.
2478
+ */
2479
+ ngAfterContentInit(): void;
2480
+ /**
2481
+ * Without a reactive control the base class derives errors from native validity only, which
2482
+ * knows nothing about parsing or bounds.
2483
+ */
2484
+ protected updateNativeErrors(target?: EventTarget | null): void;
2485
+ /**
2486
+ * Text that is not a date leaves the value null, which also trips `required`. Saying "required" to
2487
+ * someone who just typed would be wrong, so the parse error stands alone in the messages; the
2488
+ * control keeps both keys.
2489
+ */
2490
+ get errors(): ValidationErrors | null;
2491
+ /** A click on a typeable input opens the calendar but never closes it: it may be placing the caret. */
2492
+ protected onInputClick(): void;
2493
+ /** Keeps the typed text and lets the calendar follow it while it already reads as a date. */
2494
+ protected onInput(event: Event): void;
2495
+ /** Commits what was typed unless focus only moved into the field's own calendar. */
2496
+ protected onInputBlur(event: FocusEvent): void;
2497
+ /** Enter commits pending text instead of submitting the form around the field. */
2498
+ protected onInputEnter(event: Event): void;
2445
2499
  /** Opens the calendar (no-op when disabled/read-only). */
2446
2500
  protected open(): void;
2447
2501
  /** Closes the calendar and marks the control as touched. */
@@ -2493,7 +2547,7 @@ declare class HubDatepickerComponent extends HubFieldControl {
2493
2547
  /** Moves the period grid's focus without selecting. */
2494
2548
  protected onPeriodFocusMove(date: Date): void;
2495
2549
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<HubDatepickerComponent, never>;
2496
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubDatepickerComponent, "hub-datepicker", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "granularity": { "alias": "granularity"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "parse": { "alias": "parse"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "weekdayFormat": { "alias": "weekdayFormat"; "required": false; "isSignal": true; }; "monthFormat": { "alias": "monthFormat"; "required": false; "isSignal": true; }; "displayFormat": { "alias": "displayFormat"; "required": false; "isSignal": true; }; "timeDisplayFormat": { "alias": "timeDisplayFormat"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "rangeSeparator": { "alias": "rangeSeparator"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "showToday": { "alias": "showToday"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; "prepend": { "alias": "prepend"; "required": false; "isSignal": true; }; "append": { "alias": "append"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "opened": "opened"; "closed": "closed"; "viewChange": "viewChange"; "cleared": "cleared"; }, ["_prependTpl", "_appendTpl"], never, true, never>;
2550
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubDatepickerComponent, "hub-datepicker", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "granularity": { "alias": "granularity"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "parse": { "alias": "parse"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "weekdayFormat": { "alias": "weekdayFormat"; "required": false; "isSignal": true; }; "monthFormat": { "alias": "monthFormat"; "required": false; "isSignal": true; }; "displayFormat": { "alias": "displayFormat"; "required": false; "isSignal": true; }; "timeDisplayFormat": { "alias": "timeDisplayFormat"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "rangeSeparator": { "alias": "rangeSeparator"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "showToday": { "alias": "showToday"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "typeable": { "alias": "typeable"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; "prepend": { "alias": "prepend"; "required": false; "isSignal": true; }; "append": { "alias": "append"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "opened": "opened"; "closed": "closed"; "viewChange": "viewChange"; "cleared": "cleared"; }, ["_prependTpl", "_appendTpl"], never, true, never>;
2497
2551
  }
2498
2552
 
2499
2553
  /**