ng-hub-ui-forms 22.15.1 → 22.16.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
@@ -92,7 +92,7 @@ mode — no Bootstrap dependency.
92
92
 
93
93
  ## 🎯 Features
94
94
 
95
- - **Fields** — `hub-input` (text/number/email/password/color/switch/checkbox/counter, with input-group addons & masks, projected in-field affixes, a built-in `clearable` button and debounced typeahead `search`; the `file` format is **deprecated** → use `hub-file-input`), `hub-otp-input`, `hub-textarea` (+ `hubAutoresize`), `hub-slider` (single / dual thumb, gradient fill), `hub-segmented` (segmented control field — single & multiple selection, horizontal & vertical, with label + validation), `hub-select` (dropdown format, grouping, client-side search via `searchable` **and** server-side async typeahead via a `typeahead` Subject, tag creation with `addTag`, custom templates, `prepend` / `append` group addons and an attached action via `hubSelectSuffix`; the `buttons` / `checkbox` / `radio` formats are **deprecated** → use `hub-segmented`), `hub-datepicker` (single & range at any granularity from a year to a second, time picking, min/max down to the minute, keyboard nav, i18n), `hub-file-input` (drag & drop, clipboard paste, type/size limits, previews, optional upload progress).
95
+ - **Fields** — `hub-input` (text/number/email/password/color/switch/checkbox/counter, with input-group addons & masks, projected in-field affixes, a built-in `clearable` button and debounced typeahead `search`; the `file` format is **deprecated** → use `hub-file-input`), `hub-otp-input`, `hub-textarea` (+ `hubAutoresize`), `hub-slider` (single / dual thumb, gradient fill), `hub-segmented` (segmented control field — single & multiple selection, horizontal & vertical, with label + validation), `hub-select` (dropdown format, grouping, client-side search via `searchable` **and** server-side async typeahead via a `typeahead` Subject, tag creation with `addTag`, custom templates, `prepend` / `append` group addons and attached icons/buttons via `hubPrepend` / `hubAppend`; the `buttons` / `checkbox` / `radio` formats are **deprecated** → use `hub-segmented`), `hub-datepicker` (single & range at any granularity from a year to a second, time picking, min/max down to the minute, keyboard nav, i18n), `hub-file-input` (drag & drop, clipboard paste, type/size limits, previews, optional upload progress).
96
96
  - **Automatic error display** — bind a field and its control errors render below it; `hub-fieldset`, `form[hubForm]` and `hub-legend` surface group- and form-level (cross-field) errors the same way, with zero wiring.
97
97
  - **Containers** — `hub-fieldset` / `form[hubForm]` group fields and show their group errors; `hub-legend` renders an accessible legend.
98
98
  - **Configurable** — `provideHubForms({ … })` sets the invalid-feedback templates, datepicker locale/labels, file-input labels and more, app-wide or per instance.
@@ -232,91 +232,37 @@ provideHubForms({
232
232
  <hub-select formControlName="city" label="City" [items]="cities" bindLabel="name" bindValue="id" groupBy="country" />
233
233
  ```
234
234
 
235
- #### Addons and attached actions
235
+ #### Addons and attached content
236
236
 
237
- `prepend` / `append` are the same group addons `hub-input` has: a string is one addon, an array
238
- a run of them. They share the field's border and are not focusable.
237
+ `prepend` / `append` are group addons carrying **text** a currency, a unit, a protocol.
238
+ Available on `hub-input`, `hub-select`, `hub-textarea` and `hub-datepicker`: every field that
239
+ renders as a box with a value.
239
240
 
240
241
  ```html
241
- <hub-select formControlName="budget" label="Budget" prepend="€" append="/ month" [items]="tiers" />
242
- <hub-select formControlName="endpoint" [prepend]="['https://', 'api.']" [items]="regions" />
242
+ <hub-input formControlName="amount" label="Amount" prepend="€" append=".00" />
243
+ <hub-textarea formControlName="notes" label="Notes" append="Markdown" />
243
244
  ```
244
245
 
245
- For an **interactive** control attached to the edge a button acting on whatever is selected —
246
- project a `hubSelectSuffix` template. It is a template rather than plain content because the
247
- select's catch-all `<ng-content>` carries `<ng-option>` through to the engine and would swallow
248
- it; rendering from a template also keeps the action after the control in the DOM, so tabbing
249
- reaches the field before the button acting on it.
246
+ For an **icon or a button** anything richer than text project a `[hubPrepend]` /
247
+ `[hubAppend]` template. Both compose: the strings render first, so projected content is always
248
+ outermost on its side. A unit labels the field; the action sits beyond it.
250
249
 
251
250
  ```html
252
- <hub-select formControlName="product" label="Product" [items]="products" bindLabel="name">
253
- <ng-template hubSelectSuffix>
254
- <button type="button" aria-label="Configure the selected product" (click)="configure()">
255
- <hub-icon name="fa:solid:gear" />
251
+ <hub-input formControlName="query" label="Search">
252
+ <ng-template hubAppend>
253
+ <button type="button" aria-label="Run the search" (click)="search()">
254
+ <hub-icon name="fa:solid:magnifying-glass" />
256
255
  </button>
257
256
  </ng-template>
258
- </hub-select>
259
- ```
260
-
261
- > Import `HubSelectSuffixDirective` from `ng-hub-ui-forms`. Both mechanisms compose; with an
262
- > append addon and an action present, the action is the outermost element.
263
-
264
- Custom option/label templates are projected straight through to the engine:
265
-
266
- ```html
267
- <hub-select formControlName="assignee" [items]="people" bindLabel="name">
268
- <ng-template ng-label-tmp let-item="item">{{ item.emoji }} {{ item.name }}</ng-template>
269
- <ng-template ng-option-tmp let-item="item"><strong>{{ item.name }}</strong> — {{ item.role }}</ng-template>
270
- </hub-select>
271
- ```
272
-
273
- > Import `NgOptionTemplateDirective` / `NgLabelTemplateDirective` from `ng-hub-ui-forms`.
274
- > The dropdown panel renders to `body` by default (`appendTo`) so it is never clipped by cards or scroll containers.
275
-
276
- #### Async typeahead & tags
277
-
278
- `searchable` filters the already-loaded `items` client-side. For **server-side** loading, pass a `typeahead` Subject instead — the control stops filtering locally, pushes each term to the Subject, and you feed the results back through `[items]`:
279
-
280
- ```html
281
- <hub-select
282
- formControlName="city"
283
- label="City"
284
- [items]="cities()"
285
- bindLabel="name"
286
- bindValue="code"
287
- [typeahead]="citySearch$"
288
- [minTermLength]="2"
289
- [loading]="loading()"
290
- />
291
-
292
- <!-- tagging: create items from the typed term -->
293
- <hub-select formControlName="tags" [items]="tags" [multiple]="true" [addTag]="true" addTagText="Create tag" />
294
- ```
295
-
296
- - `typeahead` (`Subject<string> | undefined`, default `undefined`) — receives every search-term change for async loading; pair with the `onSearch` output if you also need the matched items.
297
- - `minTermLength` (`number`, default `0`) — minimum term length before filtering (or the `typeahead` Subject) kicks in.
298
- - `addTag` (`boolean | (term: string) => any | Promise<any>`, default `false`) — `true` adds the term as-is; a function maps the term to a new item (sync or `Promise`).
299
- - `addTagText` (`string`, default `'Add item'`) — label of the "add item" row shown while typing.
300
- - `compareWith` (`(a, b) => boolean | undefined`, default `undefined`) — custom item/value equality (e.g. objects compared by id); when omitted, the engine's built-in comparison (including `bindValue` matching) applies.
301
-
302
- ### Segmented
303
-
304
- ```html
305
- <hub-segmented formControlName="view" label="View" [options]="viewOptions" />
257
+ </hub-input>
306
258
  ```
307
259
 
308
- A projected `hubSegmentedOption` template replaces each segment's content (icons, badges, rich markup) while the component keeps owning selection, keyboard navigation and ARIA. Context: the option (implicit), `selected` and `index`:
309
-
310
- ```html
311
- <hub-segmented formControlName="view" label="View" [options]="viewOptions">
312
- <ng-template hubSegmentedOption let-option let-selected="selected" let-index="index">
313
- <hub-icon [name]="option.value" />
314
- {{ option.label }}
315
- </ng-template>
316
- </hub-segmented>
317
- ```
260
+ Whatever is projected wears the field's border, radius and height rather than its own, so a
261
+ button does not draw a second, thicker seam beside the control.
318
262
 
319
- > Import `HubSegmentedOptionDirective` from `ng-hub-ui-forms`; the context is typed as `HubSegmentedOptionContext`.
263
+ > Import `HubPrependDirective` / `HubAppendDirective` from `ng-hub-ui-forms`.
264
+ > `[hubSelectSuffix]` is **deprecated** in favour of `[hubAppend]`, which does the same on every
265
+ > field rather than only on the select.
320
266
 
321
267
  ### Datepicker
322
268