ng-hub-ui-forms 22.43.0 → 22.44.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": "ng-hub-ui-forms",
3
- "version": "22.43.0",
3
+ "version": "22.44.1",
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": {
@@ -76,13 +76,20 @@ hub-timepicker {
76
76
  text-overflow: ellipsis;
77
77
  }
78
78
 
79
- // Control, helper text and validation feedback all stack in the second
80
- // column, so the form-text / errors stay BELOW the control even when the
81
- // label is placed horizontally.
82
- > .hub-field__body,
79
+ // The control sits in the second column, under the label's own row.
80
+ > .hub-field__body {
81
+ grid-column: 2;
82
+ min-width: 0;
83
+ }
84
+
85
+ // Helper text and validation feedback run the full row instead: anchored to the
86
+ // label's column only, they would start wherever the label happens to end and
87
+ // read as attached to the control alone; anchored to the control's column only,
88
+ // as before, they would start short of the label with nothing above them there.
89
+ // Spanning both keeps one left edge for the field, horizontal or not.
83
90
  > .hub-field__form-text,
84
91
  > .hub-field__feedback {
85
- grid-column: 2;
92
+ grid-column: 1 / -1;
86
93
  min-width: 0;
87
94
  }
88
95
  }
@@ -119,17 +126,16 @@ hub-timepicker {
119
126
  }
120
127
 
121
128
  /**
122
- * Label row: the label at one end, the helper-text trigger at the other.
129
+ * Label row: the label, then the helper-text trigger right beside it.
123
130
  *
124
131
  * Only rendered when a field asks for `formTextType="tooltip"`. The label stays a
125
132
  * direct child of `.hub-field` in every other case, because that is what the
126
133
  * horizontal grid and a good deal of existing markup address.
127
134
  *
128
- * The mark is pushed to the end with an auto margin rather than with
129
- * `justify-content: space-between`, which only separates two children: a floating-label
130
- * field puts the hint in the row on its own, and space-between would leave it hanging at
131
- * the start. The auto margin sends it to the end either way, so a column of fields lines
132
- * its question marks up instead of scattering them wherever each label happens to stop.
135
+ * The mark sits immediately after the label, one `gap` away, in both the stacked and the
136
+ * horizontal layout — never pushed to the row's far edge: the row can be as wide as the
137
+ * control below it, which the label rarely is, and a mark parked out at that edge reads as
138
+ * unrelated to the label it explains.
133
139
  */
134
140
  &__label-row {
135
141
  display: flex;
@@ -139,10 +145,6 @@ hub-timepicker {
139
145
  > .hub-field__label {
140
146
  min-width: 0;
141
147
  }
142
-
143
- > .hub-field__hint {
144
- margin-inline-start: auto;
145
- }
146
148
  }
147
149
 
148
150
  &__required {
@@ -287,6 +289,39 @@ hub-timepicker {
287
289
  }
288
290
  }
289
291
 
292
+ /**
293
+ * Feedback as a tooltip, asked for by a container through `HUB_FIELD_FEEDBACK` (the paginable
294
+ * table does it under `flushFields`).
295
+ *
296
+ * The message leaves the page but not the accessibility tree, the same clipped box as the
297
+ * visually-hidden label, so the row keeps its height and the alert is still read out. The
298
+ * field says it is wrong with a danger ring drawn inside its own box, which survives the
299
+ * table taking the border away and never moves the layout. The tooltip takes the danger
300
+ * colour from here: the controller copies `--hub-tooltip-*` off the host when it opens.
301
+ */
302
+ .hub-field-host--feedback-tooltip {
303
+ --hub-tooltip-bg: var(--hub-form-invalid-border-color);
304
+ --hub-tooltip-color: var(--hub-sys-color-danger-on, #fff);
305
+
306
+ .hub-field__feedback {
307
+ position: absolute;
308
+ width: 1px;
309
+ height: 1px;
310
+ padding: 0;
311
+ margin: -1px;
312
+ overflow: hidden;
313
+ clip-path: inset(50%);
314
+ white-space: nowrap;
315
+ border: 0;
316
+ }
317
+
318
+ // On the body rather than the field, so a horizontal field's label and required mark stay outside.
319
+ .hub-field--invalid > .hub-field__body {
320
+ border-radius: var(--hub-input-border-radius);
321
+ box-shadow: inset 0 0 0 var(--hub-input-border-width, 1px) var(--hub-form-invalid-border-color);
322
+ }
323
+ }
324
+
290
325
  /**
291
326
  * Read-only fields.
292
327
  *
@@ -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>;