ng-hub-ui-forms 22.2.0 → 22.4.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), `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).
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`), `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, typeahead, custom templates; the `buttons` / `checkbox` / `radio` formats are **deprecated** → use `hub-segmented`), `hub-datepicker` (single & range, keyboard nav, i18n).
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 and more, app-wide or per instance.
@@ -156,6 +156,33 @@ npm install ng-hub-ui-forms @angular/cdk
156
156
  <hub-input formControlName="darkMode" format="switch" label="Dark mode" />
157
157
  ```
158
158
 
159
+ #### Icon affix & typeahead (search boxes)
160
+
161
+ Project a leading / trailing icon **inside** the field, emit a debounced term on every keystroke, and let the field render its own clear button:
162
+
163
+ ```html
164
+ <!-- Project any icon (any pack via the shorthand) + debounced search + built-in clear -->
165
+ <hub-input
166
+ label="Search frameworks"
167
+ [clearable]="true"
168
+ [debounceTime]="300"
169
+ (search)="onSearch($event)"
170
+ >
171
+ <hub-icon hubInputPrefix name="fa:solid:magnifying-glass" />
172
+ </hub-input>
173
+
174
+ <!-- Projected affixes for any content (a unit label, an inline SVG…) -->
175
+ <hub-input label="Amount">
176
+ <span hubInputPrefix>€</span>
177
+ </hub-input>
178
+ ```
179
+
180
+ - Project a `<hub-icon>` (or any element) into `hubInputPrefix` / `hubInputSuffix`; the field themes it with its `--hub-input-icon-*` tokens.
181
+ - `[clearable]` renders an internal ✕ button once the field holds a value — it resets the control and emits an empty `search` term (no manual suffix wiring). The glyph is the swappable `--hub-input-clear-icon` token.
182
+ - The control reserves inline padding automatically so its text never sits under the affix.
183
+ - Affixes use logical CSS properties, so `start`/`end` follow the writing direction and **flip automatically under `dir="rtl"`**.
184
+ - `(search)` fires `debounceTime` ms after typing stops (`0` = every keystroke); identical consecutive terms are skipped, and `valueChange` stays synchronous.
185
+
159
186
  ### Select
160
187
 
161
188
  ```html
@@ -264,7 +291,7 @@ shared SCSS tokens; import them once at the app root:
264
291
  ```css
265
292
  hub-input,
266
293
  hub-select {
267
- --hub-field-border-color: #cbd5e1;
294
+ --hub-input-border-color: #cbd5e1;
268
295
  --hub-select-option-selected-bg: #e0e7ff;
269
296
  }
270
297
  ```
@@ -281,6 +308,28 @@ hub-input {
281
308
  }
282
309
  ```
283
310
 
311
+ **`hub-slider`** — `--hub-slider-track-fill` takes a full `<image>` (e.g. a `linear-gradient(to right, …)`) for the filled part of the track, which renders intact clipped to the current percentage; `--hub-slider-value-space` is the value-bubble headroom and collapses to `0` on a `[showValue]="false"` (flush) slider:
312
+
313
+ ```css
314
+ .gradient-slider {
315
+ --hub-slider-track-fill: linear-gradient(to right, #22c55e, #eab308, #ef4444);
316
+ }
317
+ ```
318
+
319
+ **`hub-select` inside a modal** — the dropdown panel stacks through `--hub-select-dropdown-z-index` (default `calc(var(--hub-sys-zindex-modal, 1055) + 5)`), so a select opened inside a `HubModal` renders above the dialog instead of being clipped underneath it.
320
+
321
+ **`hub-segmented` variants & theming** — the `color` input tints the selected segment from the semantic families (`<hub-segmented color="primary">`); any of the `--hub-segmented-*` slots can be set directly, or in one call with the SCSS mixin:
322
+
323
+ ```scss
324
+ @use 'ng-hub-ui-forms/styles' as *;
325
+
326
+ .brand-toggle {
327
+ @include hub-segmented-theme($selected-bg: gold, $selected-color: #111, $radius: 999px);
328
+ }
329
+ ```
330
+
331
+ In single-select mode the selected pill slides between options (`--hub-segmented-indicator-transition`, default `0.2s ease`; disabled under `prefers-reduced-motion`).
332
+
284
333
  ---
285
334
 
286
335
  ## ✨ Signal Forms (opt-in)