ng-hub-ui-forms 22.36.0 β†’ 22.37.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
@@ -96,8 +96,9 @@ mode β€” no Bootstrap dependency.
96
96
 
97
97
  ## 🎯 Features
98
98
 
99
- - **Fields** β€” `hub-input` (text/number/email/password/color/switch/checkbox/counter, the colour format as a hex field or, given a palette, a grid of swatches, with input-group addons & masks, projected in-field affixes, a built-in `clearable` button, the mixed `indeterminate` state on checkboxes 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-timepicker` (a time of day as `HH:MM`, on the platform's own time control, with `min` / `max` / `step`), `hub-file-input` (drag & drop, clipboard paste, type/size limits, previews as a list, as tiles or inside the field together with the files a record already has, optional upload progress).
99
+ - **Fields** β€” `hub-input` (text/number/email/password/color/switch/checkbox/counter, the colour format as a hex field or, given a palette, a grid of swatches, with input-group addons & masks, projected in-field affixes, a built-in `clearable` button, the mixed `indeterminate` state on checkboxes 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-timepicker` (a time of day as `HH:MM`, on the platform's own time control, with `min` / `max` / `step`), `hub-file-input` (drag & drop, clipboard paste, type/size limits, previews as a list, as tiles or inside the field together with the files a record already has, optional upload progress, and an `appearance="compact"` that puts the whole field on one row).
100
100
  - **Automatic error display** β€” bind a field and its control errors render below it; `fieldset[hubFieldset]`, `form[hubForm]` and `hub-legend` surface group- and form-level (cross-field) errors the same way, with zero wiring.
101
+ - **Drop zone** β€” `hubFileDrop` turns a container, or the whole page, into a target for dropped files: its own card while the drag is over it, the same constraints and the same rejection shape a file field uses, and the `preventDefault` that stops the browser opening a file dropped beside the target.
101
102
  - **Containers** β€” `fieldset[hubFieldset]` (or the `<hub-fieldset>` element) / `form[hubForm]` group fields and show their group errors; `hub-legend` renders an accessible legend.
102
103
  - **Configurable** β€” `provideHubForms({ … })` sets the invalid-feedback templates, datepicker locale/labels, file-input labels and more, app-wide or per instance.
103
104
  - **Validators & helpers** β€” `hubAreEqual` cross-field validator, the file validators (`hubAcceptedFiles`, `hubMaxFileSize`, `hubMinFileSize`, `hubMaxTotalSize`, `hubMaxFiles`, `hubMinFiles`), `hubValidationError` / `hubFormText` projection directives, and a set of utility pipes.
@@ -238,12 +239,12 @@ readonly palettes = HUB_COLOR_PALETTES;
238
239
 
239
240
  Which field is drawn:
240
241
 
241
- | `swatches` | Application palette (`provideHubForms`) | Result |
242
- | ---------------- | --------------------------------------- | -------------------------------- |
243
- | `null` (default) | none (default) | hex field |
242
+ | `swatches` | Application palette (`provideHubForms`) | Result |
243
+ | ---------------- | --------------------------------------- | --------------------------------- |
244
+ | `null` (default) | none (default) | hex field |
244
245
  | `null` | a list | grid with the application palette |
245
- | `[]` | any | hex field |
246
- | a list | any | grid with the field's list |
246
+ | `[]` | any | hex field |
247
+ | a list | any | grid with the field's list |
247
248
 
248
249
  A list in which no entry is a colour also leaves the hex field.
249
250
 
@@ -385,20 +386,20 @@ the `ng-*-tmp` attributes of the vendored engine underneath are deprecated and d
385
386
  </hub-select>
386
387
  ```
387
388
 
388
- | Slot | Draws | Context |
389
- | --- | --- | --- |
390
- | `hubSelectOption` | one option in the list | `item`, `item$`, `index`, `searchTerm` |
391
- | `hubSelectOptgroup` | a group header, with `groupBy` | `item`, `item$`, `index`, `searchTerm` |
392
- | `hubSelectLabel` | the selected value, single mode | `item`, `label`, `clear` |
393
- | `hubSelectMultiLabel` | all selected values at once, multiple mode | `items`, `clear` |
394
- | `hubSelectHeader` | a fixed block above the list | `searchTerm` |
395
- | `hubSelectFooter` | a fixed block below the list | `searchTerm` |
396
- | `hubSelectNotFound` | the "no items found" message | `searchTerm` |
397
- | `hubSelectTypeToSearch` | the "type to search" hint | β€” |
398
- | `hubSelectLoadingText` | the "loading…" message | `searchTerm` |
399
- | `hubSelectLoadingSpinner` | the spinner in the control | β€” |
400
- | `hubSelectTag` | the "add \<term\>" row, with `addTag` | `searchTerm` |
401
- | `hubSelectClearButton` | the clear (Γ—) control | β€” |
389
+ | Slot | Draws | Context |
390
+ | ------------------------- | ------------------------------------------ | -------------------------------------- |
391
+ | `hubSelectOption` | one option in the list | `item`, `item$`, `index`, `searchTerm` |
392
+ | `hubSelectOptgroup` | a group header, with `groupBy` | `item`, `item$`, `index`, `searchTerm` |
393
+ | `hubSelectLabel` | the selected value, single mode | `item`, `label`, `clear` |
394
+ | `hubSelectMultiLabel` | all selected values at once, multiple mode | `items`, `clear` |
395
+ | `hubSelectHeader` | a fixed block above the list | `searchTerm` |
396
+ | `hubSelectFooter` | a fixed block below the list | `searchTerm` |
397
+ | `hubSelectNotFound` | the "no items found" message | `searchTerm` |
398
+ | `hubSelectTypeToSearch` | the "type to search" hint | β€” |
399
+ | `hubSelectLoadingText` | the "loading…" message | `searchTerm` |
400
+ | `hubSelectLoadingSpinner` | the spinner in the control | β€” |
401
+ | `hubSelectTag` | the "add \<term\>" row, with `addTag` | `searchTerm` |
402
+ | `hubSelectClearButton` | the clear (Γ—) control | β€” |
402
403
 
403
404
  Import the directive you use β€” `HubSelectOptionDirective`, `HubSelectLabelDirective` and so on.
404
405
 
@@ -659,6 +660,21 @@ Customize it without forking the template: the `--hub-file-input-*` tokens (ever
659
660
  </hub-file-input>
660
661
  ```
661
662
 
663
+ #### One row instead of a panel
664
+
665
+ `appearance="compact"` drops the glyph and the drag copy and keeps the browse control and the
666
+ constraints, on a row that stands at the same height as the fields beside it. It is for the file
667
+ that is not what the screen is about β€” a logo among four text inputs, where the panel took half a
668
+ dialog to ask for one small image.
669
+
670
+ ```html
671
+ <hub-file-input formControlName="logo" label="Logo" accept="image/*" appearance="compact" />
672
+ ```
673
+
674
+ The row still takes a drop: what goes is the copy that described one, not the behaviour. A field
675
+ that has to **show** what it holds gets its height from `preview="inline"` instead, which needs room
676
+ for the picture and is sized through its own `--hub-file-input-inline-*` tokens.
677
+
662
678
  #### Inline preview and stored files
663
679
 
664
680
  `preview="inline"` puts the file inside the field. One tile fills it: the image when the browser can
@@ -743,6 +759,35 @@ The dropzone is built from a glyph, an invitation and a browse action, each them
743
759
  </hub-file-input>
744
760
  ```
745
761
 
762
+ ### Drop zone for a container or the whole page
763
+
764
+ A file field only accepts a drop inside its own box, which is right for a field and wrong for a
765
+ screen: on a list of expenses the gesture is to drop the receipt anywhere on it. `hubFileDrop`
766
+ watches the host and its subtree, or the whole document with `hubFileDrop="window"`.
767
+
768
+ ```html
769
+ <section
770
+ hubFileDrop="window"
771
+ accept="image/*,.pdf"
772
+ [maxSize]="2 * 1024 * 1024"
773
+ [maxFiles]="4"
774
+ (filesDropped)="attach($event)"
775
+ (rejected)="warn($event)"
776
+ >
777
+ <router-outlet />
778
+ </section>
779
+ ```
780
+
781
+ - It applies `accept`, `maxSize`, `minSize` and `maxFiles` itself and reports refusals as
782
+ `HubFileRejection[]`, the same shape `<hub-file-input>` uses, so one handler serves both.
783
+ - The window scope also claims the drag, which is what stops the browser opening a file dropped
784
+ beside the target instead of on it β€” and with it the page, and whatever was typed into it.
785
+ - It raises its own card, dressed from the `--hub-file-drop-*` tokens and stacked above the modal
786
+ layer, because a screen can be a modal. `[overlay]="false"` keeps the behaviour and leaves the
787
+ drawing to you; the host carries `hub-file-drop--active` while a drag is over it.
788
+ - Dragging is a pointer gesture, so the card is `aria-hidden` and the keyboard route stays a real
789
+ file field's. The zone is an addition to one, never a replacement.
790
+
746
791
  ### Automatic errors at every level
747
792
 
748
793
  ```html
@@ -949,12 +994,13 @@ import { HubSignalFieldControl, hubSignalErrorMessages } from 'ng-hub-ui-forms/s
949
994
  <hub-input formControlName="q" label="Search orders" labelType="visually-hidden" placeholder="Search" />
950
995
  ```
951
996
 
952
- A hidden label rather than an `aria-label` on purpose: a label stays *associated* with its
953
- control, so it is one string in the template that both the eye and the screen reader can be
954
- given or denied, and it never silently replaces a name the application set for itself. The two
955
- exceptions are `hub-otp-input` and `hub-segmented`, which render a group rather than a single
956
- control: a `<label for>` aimed at a `<div>` names nothing, so those two carry the text on the
957
- group as `aria-label`.
997
+ A hidden label rather than an `aria-label` on purpose: a label stays _associated_ with its
998
+ control, so it is one string in the template that both the eye and the screen reader can be
999
+ given or denied, and it never silently replaces a name the application set for itself. The two
1000
+ exceptions are `hub-otp-input` and `hub-segmented`, which render a group rather than a single
1001
+ control: a `<label for>` aimed at a `<div>` names nothing, so those two carry the text on the
1002
+ group as `aria-label`.
1003
+
958
1004
  - `required` β€” set inline or derived from `Validators.required`, with `formControlName` **or** a direct `[formControl]` binding β€” is reflected as `aria-required` on every field, including the select's combobox search input, the segmented `radiogroup` and each OTP cell. On a reactive binding the control's validators decide: an inline `required` is overwritten by them, so declare it on the validators. Template-driven bindings (`ngModel`) keep honouring the inline input.
959
1005
  - Validation errors render in an `role="alert"` region tied to the field.
960
1006
  - The select exposes correct combobox/listbox semantics; the datepicker is fully keyboard-navigable.