ng-hub-ui-forms 21.0.0 → 22.1.2

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
@@ -26,13 +26,16 @@ This library is part of the **ng-hub-ui** ecosystem:
26
26
  - [**ng-hub-ui-breadcrumbs**](https://www.npmjs.com/package/ng-hub-ui-breadcrumbs)
27
27
  - [**ng-hub-ui-calendar**](https://www.npmjs.com/package/ng-hub-ui-calendar)
28
28
  - [**ng-hub-ui-dropdown**](https://www.npmjs.com/package/ng-hub-ui-dropdown)
29
+ - [**ng-hub-ui-ds**](https://www.npmjs.com/package/ng-hub-ui-ds)
29
30
  - [**ng-hub-ui-forms**](https://www.npmjs.com/package/ng-hub-ui-forms) ← You are here
30
31
  - [**ng-hub-ui-history**](https://www.npmjs.com/package/ng-hub-ui-history)
32
+ - [**ng-hub-ui-milestones**](https://www.npmjs.com/package/ng-hub-ui-milestones)
31
33
  - [**ng-hub-ui-modal**](https://www.npmjs.com/package/ng-hub-ui-modal)
32
34
  - [**ng-hub-ui-nav**](https://www.npmjs.com/package/ng-hub-ui-nav)
33
35
  - [**ng-hub-ui-paginable**](https://www.npmjs.com/package/ng-hub-ui-paginable)
34
36
  - [**ng-hub-ui-panels**](https://www.npmjs.com/package/ng-hub-ui-panels)
35
37
  - [**ng-hub-ui-portal**](https://www.npmjs.com/package/ng-hub-ui-portal)
38
+ - [**ng-hub-ui-skeleton**](https://www.npmjs.com/package/ng-hub-ui-skeleton)
36
39
  - [**ng-hub-ui-sortable**](https://www.npmjs.com/package/ng-hub-ui-sortable)
37
40
  - [**ng-hub-ui-stepper**](https://www.npmjs.com/package/ng-hub-ui-stepper)
38
41
  - [**ng-hub-ui-utils**](https://www.npmjs.com/package/ng-hub-ui-utils)
@@ -81,14 +84,15 @@ The required `email` field reveals its error automatically on submit — no manu
81
84
  `ng-hub-ui-forms` unifies a set of accessible form fields behind one contract:
82
85
  bind them with **Reactive Forms** and the matching validation errors appear
83
86
  **automatically** at the control, group and form level. Fields are standalone,
84
- `OnPush` and signal-native; the select is a maintained fork of ng-select; the
87
+ `OnPush` and signal-native; the select is a maintained fork of
88
+ [ng-select](https://github.com/ng-select/ng-select) (see [Credits](#-credits)); the
85
89
  datepicker is built from scratch on native `Date` and the Angular CDK overlay.
86
90
  Everything is themed through canonical `--hub-*` CSS variables with runtime dark
87
91
  mode — no Bootstrap dependency.
88
92
 
89
93
  ## 🎯 Features
90
94
 
91
- - **Fields** — `hub-input` (text/number/email/password/color/switch/checkbox/counter, with input-group addons & masks), `hub-otp`, `hub-textarea` (+ `hubAutoresize`), `hub-slider`, `hub-select` (dropdown / buttons / checkbox / radio formats, grouping, typeahead, custom templates), `hub-datepicker` (single & range, keyboard nav, i18n).
95
+ - **Fields** — `hub-input` (text/number/email/password/color/switch/checkbox/counter, with input-group addons & masks), `hub-otp-input`, `hub-textarea` (+ `hubAutoresize`), `hub-slider`, `hub-select` (dropdown / buttons / checkbox / radio formats, grouping, typeahead, custom templates), `hub-datepicker` (single & range, keyboard nav, i18n).
92
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.
93
97
  - **Containers** — `hub-fieldset` / `form[hubForm]` group fields and show their group errors; `hub-legend` renders an accessible legend.
94
98
  - **Configurable** — `provideHubForms({ … })` sets the invalid-feedback templates, datepicker locale/labels and more, app-wide or per instance.
@@ -182,6 +186,22 @@ form = new FormGroup(
182
186
  On submit, each invalid field shows its error and the cross-field `hubAreEqual`
183
187
  error is surfaced by the fieldset/form — no manual error markup anywhere.
184
188
 
189
+ ### Validation states (invalid is automatic, valid is opt-in)
190
+
191
+ The **invalid** state is always automatic: a touched, invalid field shows its
192
+ error styling and message with no configuration. The **valid / success** state is
193
+ strictly **opt-in** — success is *never* shown automatically. Enable it per field
194
+ with the `showValid` input, and optionally add a `validFeedback` message that
195
+ renders below the control once the field is touched and valid:
196
+
197
+ ```html
198
+ <hub-input formControlName="username" label="Username" required [showValid]="true" validFeedback="Looks good!" />
199
+ ```
200
+
201
+ To turn the success state on for every field at once, set it globally — see
202
+ [Configuration](#-configuration). A per-field `showValid` always overrides the
203
+ global default.
204
+
185
205
  ---
186
206
 
187
207
  ## 🛠️ Configuration
@@ -194,12 +214,18 @@ import { provideHubForms } from 'ng-hub-ui-forms';
194
214
  bootstrapApplication(AppComponent, {
195
215
  providers: [
196
216
  provideHubForms({
217
+ showValid: true,
197
218
  datepicker: { firstDayOfWeek: 1, displayFormat: 'dd/MM/yyyy' }
198
219
  })
199
220
  ]
200
221
  });
201
222
  ```
202
223
 
224
+ `showValid` (default `false`) turns the opt-in valid/success state on for every
225
+ field once it is touched and valid. The invalid state is unaffected — it is always
226
+ automatic; only success is gated behind this flag. A per-field `showValid` input
227
+ overrides the global default.
228
+
203
229
  ---
204
230
 
205
231
  ## 🎨 Styling
@@ -219,6 +245,18 @@ hub-select {
219
245
  }
220
246
  ```
221
247
 
248
+ The opt-in valid/success state is themed through four tokens (chained to the
249
+ `--hub-sys-color-success` family by default):
250
+
251
+ ```css
252
+ hub-input {
253
+ --hub-form-valid-color: #198754;
254
+ --hub-form-valid-border-color: #198754;
255
+ --hub-form-valid-focus-ring-color: rgba(25, 135, 84, 0.25);
256
+ --hub-form-valid-feedback-color: #198754;
257
+ }
258
+ ```
259
+
222
260
  ---
223
261
 
224
262
  ## ✨ Signal Forms (opt-in)
@@ -247,6 +285,14 @@ See [CHANGELOG.md](./CHANGELOG.md).
247
285
 
248
286
  ---
249
287
 
288
+ ## 🙏 Credits
289
+
290
+ `hub-select` is a maintained **fork of [ng-select](https://github.com/ng-select/ng-select)** by the ng-select contributors. The upstream `src/ng-select` sources are vendored in place and re-themed with `--hub-*` tokens — pinned to upstream **`v23.0.1`** (tracked in [`src/lib/select/UPSTREAM`](./src/lib/select/UPSTREAM); deviations documented in [`src/lib/select/PATCHES.md`](./src/lib/select/PATCHES.md)). ng-select is distributed under the [MIT License](https://github.com/ng-select/ng-select/blob/master/LICENSE.md), and the original copyright notices are retained in the vendored files.
291
+
292
+ The datepicker, inputs and validation layer are original to `ng-hub-ui-forms`.
293
+
294
+ ---
295
+
250
296
  ## 📄 License
251
297
 
252
298
  MIT © [Carlos Morcillo](https://www.carlosmorcillo.com)