ng-hub-ui-forms 22.30.0 → 22.32.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/README.md CHANGED
@@ -149,6 +149,40 @@ npm install ng-hub-ui-forms @angular/cdk
149
149
 
150
150
  ## ⚙️ Usage
151
151
 
152
+ ### Helper text
153
+
154
+ Every field takes `formText`, and `formTextType` says where it goes.
155
+
156
+ ```html
157
+ <!-- one sentence: below, where it is read without being asked for -->
158
+ <hub-input label="Name" formText="As it appears on the card." />
159
+
160
+ <!-- more than one: behind a question mark at the end of the label row -->
161
+ <hub-input
162
+ label="IBAN"
163
+ formTextType="tooltip"
164
+ formText="The account the refund is paid into. It must belong to the cardholder — a transfer to a third party is rejected by the bank."
165
+ />
166
+ ```
167
+
168
+ The rule the product settled on is **one sentence below, more than one in the tooltip**. A paragraph
169
+ under every field turns a form into a document, pushes the next field off the screen, and is read by
170
+ nobody who already knew what the field was for.
171
+
172
+ The mark is pushed to the end of the label row, so a column of fields lines its question marks up
173
+ instead of scattering them wherever each label happens to stop. It is a `<button>` beside the label
174
+ and never inside it: activating a label focuses the control it names, so a mark nested in one would
175
+ open the tooltip _and_ jump the caret into the field. Its accessible name is the helper text itself.
176
+
177
+ `formTextType="tooltip"` needs the tooltip stylesheet, which this package does not pull in for you:
178
+
179
+ ```scss
180
+ @use 'ng-hub-ui-utils/styles/tooltip';
181
+ ```
182
+
183
+ A projected `hubFormText` template keeps its block below even in tooltip mode. The tooltip takes a
184
+ string, so asking it to carry markup would drop the markup silently.
185
+
152
186
  ### Input
153
187
 
154
188
  ```html
@@ -213,9 +247,9 @@ provideHubForms({
213
247
  #### Plain-text fields
214
248
 
215
249
  `readonly` and `plaintext` are the two halves of a shut field, and the difference is who the
216
- field is for. `readonly` is a *state* of a field somebody is still filling in, and a theme can
250
+ field is for. `readonly` is a _state_ of a field somebody is still filling in, and a theme can
217
251
  give it a box — `--hub-input-readonly-bg`, `--hub-input-readonly-border-color`, `-color` and
218
- `-cursor` exist to be set. `plaintext` is for a value that is merely being *shown*: a record
252
+ `-cursor` exist to be set. `plaintext` is for a value that is merely being _shown_: a record
219
253
  open for consultation, a figure the server settled, a field a plan has locked. There the box is
220
254
  noise, and having none is what `plaintext` is rather than a colour it happens to wear.
221
255
 
@@ -228,8 +262,8 @@ noise, and having none is what `plaintext` is rather than a colour it happens to
228
262
  >
229
263
  > ```css
230
264
  > .hub-field--readonly {
231
- > --hub-input-readonly-bg: var(--hub-sys-surface-sunken);
232
- > --hub-input-readonly-border-color: var(--hub-sys-border-subtle);
265
+ > --hub-input-readonly-bg: var(--hub-sys-surface-sunken);
266
+ > --hub-input-readonly-border-color: var(--hub-sys-border-subtle);
233
267
  > }
234
268
  > ```
235
269
 
@@ -247,7 +281,6 @@ its label — a label and its value are one thing and should read as a pair —
247
281
  padding below holds the control at exactly an editable field's height, so a grid mixing the two
248
282
  still lines up. Replace it with a single value and you give up one of the two.
249
283
 
250
-
251
284
  ```html
252
285
  <!-- being filled in, so it keeps the box -->
253
286
  <hub-input formControlName="reference" label="Reference" [readonly]="true" />