shirkasoft-ui-components 1.3.15 → 1.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.
Files changed (90) hide show
  1. package/README.md +447 -71
  2. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +7 -7
  3. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
  4. package/fesm2022/shirkasoft-ui-components-button.mjs +11 -11
  5. package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
  6. package/fesm2022/shirkasoft-ui-components-chart.mjs +6 -6
  7. package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
  8. package/fesm2022/shirkasoft-ui-components-config.mjs +914 -0
  9. package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -0
  10. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +8 -8
  11. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
  12. package/fesm2022/shirkasoft-ui-components-date-picker.mjs +901 -753
  13. package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
  14. package/fesm2022/shirkasoft-ui-components-fieldset.mjs +5 -5
  15. package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
  16. package/fesm2022/shirkasoft-ui-components-file-upload.mjs +16 -9
  17. package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
  18. package/fesm2022/shirkasoft-ui-components-icons.mjs +646 -0
  19. package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -0
  20. package/fesm2022/shirkasoft-ui-components-knob.mjs +44 -17
  21. package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
  22. package/fesm2022/shirkasoft-ui-components-loading.mjs +16 -16
  23. package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
  24. package/fesm2022/shirkasoft-ui-components-modal.mjs +42 -31
  25. package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
  26. package/fesm2022/shirkasoft-ui-components-notification.mjs +8 -8
  27. package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
  28. package/fesm2022/shirkasoft-ui-components-price-input.mjs +79 -29
  29. package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
  30. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +7 -7
  31. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
  32. package/fesm2022/shirkasoft-ui-components-select.mjs +50 -23
  33. package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
  34. package/fesm2022/shirkasoft-ui-components-sidebar.mjs +6 -6
  35. package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
  36. package/fesm2022/shirkasoft-ui-components-skeleton.mjs +4 -4
  37. package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
  38. package/fesm2022/shirkasoft-ui-components-table.mjs +163 -102
  39. package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
  40. package/fesm2022/shirkasoft-ui-components-tabs.mjs +21 -23
  41. package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
  42. package/fesm2022/shirkasoft-ui-components-tag.mjs +9 -9
  43. package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
  44. package/fesm2022/shirkasoft-ui-components-text-field.mjs +63 -30
  45. package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
  46. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +280 -0
  47. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -0
  48. package/fesm2022/shirkasoft-ui-components-theme.mjs +180 -0
  49. package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -0
  50. package/fesm2022/shirkasoft-ui-components-timeline.mjs +10 -22
  51. package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
  52. package/fesm2022/shirkasoft-ui-components-toggle.mjs +60 -53
  53. package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
  54. package/fesm2022/shirkasoft-ui-components-tooltip.mjs +29 -11
  55. package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
  56. package/fesm2022/shirkasoft-ui-components-utils.mjs +22 -11
  57. package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
  58. package/fesm2022/shirkasoft-ui-components-wizard.mjs +9 -10
  59. package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
  60. package/package.json +33 -3
  61. package/src/baseline.css +2472 -0
  62. package/src/theme.css +15 -543
  63. package/src/themes/ocean.css +56 -0
  64. package/src/themes/sunset.css +55 -0
  65. package/src/themes/violet.css +25 -0
  66. package/src/tokens.css +612 -0
  67. package/types/shirkasoft-ui-components-button.d.ts +1 -1
  68. package/types/shirkasoft-ui-components-config.d.ts +368 -0
  69. package/types/shirkasoft-ui-components-confirm-dialog.d.ts +2 -1
  70. package/types/shirkasoft-ui-components-date-picker.d.ts +276 -224
  71. package/types/shirkasoft-ui-components-fieldset.d.ts +2 -1
  72. package/types/shirkasoft-ui-components-file-upload.d.ts +11 -5
  73. package/types/shirkasoft-ui-components-icons.d.ts +1422 -0
  74. package/types/shirkasoft-ui-components-knob.d.ts +28 -7
  75. package/types/shirkasoft-ui-components-modal.d.ts +11 -7
  76. package/types/shirkasoft-ui-components-notification.d.ts +2 -1
  77. package/types/shirkasoft-ui-components-price-input.d.ts +37 -9
  78. package/types/shirkasoft-ui-components-rail-sidebar.d.ts +3 -3
  79. package/types/shirkasoft-ui-components-select.d.ts +24 -8
  80. package/types/shirkasoft-ui-components-sidebar.d.ts +2 -1
  81. package/types/shirkasoft-ui-components-table.d.ts +91 -80
  82. package/types/shirkasoft-ui-components-tag.d.ts +1 -1
  83. package/types/shirkasoft-ui-components-text-field.d.ts +29 -13
  84. package/types/shirkasoft-ui-components-theme-picker.d.ts +83 -0
  85. package/types/shirkasoft-ui-components-theme.d.ts +88 -0
  86. package/types/shirkasoft-ui-components-timeline.d.ts +5 -4
  87. package/types/shirkasoft-ui-components-toggle.d.ts +20 -13
  88. package/types/shirkasoft-ui-components-tooltip.d.ts +6 -0
  89. package/types/shirkasoft-ui-components-utils.d.ts +16 -6
  90. package/types/shirkasoft-ui-components-wizard.d.ts +4 -3
package/README.md CHANGED
@@ -15,37 +15,122 @@
15
15
  <img src="projects/showcase/public/readme.png" alt="Shirkasoft UI Components showcase" />
16
16
  </p>
17
17
 
18
- Angular 21+ UI components library built with **Tailwind CSS**, **standalone components**, **Angular signals**, and **light/dark theme** support via CSS custom properties.
18
+ > **You are reading the `1.x` line (Angular 21).** It ships the same features as
19
+ > `2.x` (Angular 22) — install it with `pnpm add shirkasoft-ui-components@ng21`.
20
+ > Docs: https://ui-library.shirkasoft.com/v1/
21
+
22
+ ## Shirkasoft UI Components 2.0
23
+
24
+ > **La 2.0 ha llegado.** Version 2.0 is built on **Angular 22.3** and drops Tailwind from the library in favor of plain CSS driven by `--shk-*` custom properties. It ships **four color themes**, provider-based configuration and explicit `OnPush` change detection across every component.
25
+
26
+ Angular 22 UI component library built with **standalone components**, **Angular signals**, **pure CSS + CSS custom properties**, and **light/dark theme** support.
27
+
28
+ ### Angular compatibility
29
+
30
+ | Angular version | Library line | npm dist-tag | Docs |
31
+ | --------------- | ------------ | ----------------- | ------------------------------------- |
32
+ | 22.3+ | `2.x` | `latest`, `ng22` | https://ui-library.shirkasoft.com/ |
33
+ | 21.2+ | `1.x` | `ng21` | https://ui-library.shirkasoft.com/v1/ |
34
+
35
+ Both lines get the same features (configuration, theme picker, themes, pure
36
+ CSS…) and fixes; each one is built and tested with its own Angular major. If
37
+ your app is on Angular 21:
38
+
39
+ ```bash
40
+ pnpm add shirkasoft-ui-components@ng21
41
+ ```
19
42
 
20
43
  ## Installation
21
44
 
45
+ There is one release line per Angular major, each with its own npm dist-tag and
46
+ documentation site:
47
+
48
+ | Line | Angular | Install | Docs |
49
+ | ----- | ------- | ------------------------------------------ | --------------------------------------- |
50
+ | `2.x` | 22 | `npm install shirkasoft-ui-components` | https://ui-library.shirkasoft.com/ |
51
+ | `1.x` | 21 | `npm install shirkasoft-ui-components@ng21`| https://ui-library.shirkasoft.com/v1/ |
52
+
22
53
  ```bash
23
- pnpm add shirkasoft-ui-components
24
- # or
25
- npm install shirkasoft-ui-components
54
+ pnpm add shirkasoft-ui-components # Angular 22 (latest / @ng22)
55
+ pnpm add shirkasoft-ui-components@ng21 # Angular 21
26
56
  ```
27
57
 
28
58
  ### Peer Dependencies
29
59
 
30
- | Package | Minimum version |
31
- | ------------------ | --------------- |
32
- | @angular/common | ^21.2.0 |
33
- | @angular/core | ^21.2.0 |
34
- | @angular/forms | ^21.2.0 |
35
- | @angular/router | ^21.2.0 |
36
- | rxjs | ^7.8.0 |
37
- | @jsverse/transloco | >= 8.0.0 |
38
- | @lucide/angular | ^1.17.0 |
39
- | chart.js | ^4.4.0 |
60
+ | Package | Minimum version | Required by |
61
+ | ------------------ | --------------- | ------------------------------- |
62
+ | @angular/common | ^21.2.0 | always |
63
+ | @angular/core | ^21.2.0 | always |
64
+ | @angular/forms | ^21.2.0 | form controls (CVA / Signal Forms) |
65
+ | @angular/router | ^21.2.0 | components that link routes |
66
+ | rxjs | ^7.8.0 | always |
67
+ | @jsverse/transloco | >= 8.0.0 | select, table, date-picker, modal, file-upload… |
68
+ | chart.js | ^4.4.0 | chart |
69
+
70
+ `@jsverse/transloco` and `chart.js` are declared as **optional** peers. Icons
71
+ ship with the library as SVG data, so there is no icon peer to install. The root entry point is empty, so you only pay for (and only
72
+ need to install) the peers of the components you actually import.
73
+
74
+ **Tailwind is not a peer dependency.** The library compiles its own CSS, so consumers do not need Tailwind at all. `theme.css` includes `baseline.css`, a generated plain-CSS snapshot of the layout utilities used by the component templates (regenerate it with `pnpm build:baseline` after touching a template). The showcase site uses Tailwind 4, but that is app code, not part of the published package.
75
+
76
+ ## Icons
77
+
78
+ The library renders Lucide icons from plain SVG data through the
79
+ `shirkasoft-ui-components/icons` entry point. No icon package is required and
80
+ no Angular component is created per icon, which keeps the initial bundle small:
81
+
82
+ ```typescript
83
+ import { ICON_NODES, ShkIconDirective } from 'shirkasoft-ui-components/icons';
84
+
85
+ @Component({ imports: [ShkIconDirective], /* ... */ })
86
+ export class MyComponent {
87
+ protected readonly plus = ICON_NODES.LucidePlus;
88
+ }
89
+ ```
90
+
91
+ ```html
92
+ <svg [shkIcon]="plus" class="w-4 h-4"></svg>
93
+ ```
94
+
95
+ The icons used by the library are exported as data (`LucidePlus`,
96
+ `LucideChevronDown`, …) and also by kebab-case name in `ICON_BY_NAME`. The same
97
+ data can be passed to the `icon` inputs of the components, either directly or
98
+ through `getIcon('plus')` from `shirkasoft-ui-components/utils`. To add a new
99
+ icon, import its `LucideX` name anywhere under `projects/` and run
100
+ `pnpm build:icons`: the entry point is generated from the Lucide sources.
40
101
 
41
102
  ## Theme Setup
42
103
 
43
- Import the theme in your global `styles.css`:
104
+ Import the base theme in your global `styles.css`:
44
105
 
45
106
  ```css
46
- @import '@shirkasoft/ui-components/theme.css';
107
+ @import 'shirkasoft-ui-components/theme.css';
47
108
  ```
48
109
 
110
+ `theme.css` is self-contained: it imports `tokens.css` (variables and
111
+ hand-written `_shk-*` utilities) and `baseline.css` (the generated plain-CSS
112
+ snapshot of the Tailwind utilities used by the templates). If your app already
113
+ generates those utilities — for example a Tailwind 4 app that scans the library
114
+ templates — import `tokens.css` instead and avoid shipping the baseline twice.
115
+
116
+ The `_shk-*` utilities live in the CSS layer `shk-tokens`, which must sort
117
+ before your utility layer so the templates' `dark:`/`hover:` variants can
118
+ override them. `theme.css` already declares this order. With `tokens.css` and
119
+ Tailwind 4, declare it yourself before the imports:
120
+
121
+ ```css
122
+ @layer theme, base, components, shk-tokens, utilities;
123
+ @import 'tailwindcss';
124
+ @import 'shirkasoft-ui-components/tokens.css';
125
+ ```
126
+
127
+ > **Unlayered app CSS wins.** CSS outside any `@layer` always beats layered
128
+ > rules, whatever the specificity. A global reset such as `button { background: none }`
129
+ > or an unlayered framework stylesheet would override the library's `_shk-*`
130
+ > utilities (the generated `baseline.css` utilities already behaved this way).
131
+ > Put such styles in a layer declared before `shk-tokens`, for example
132
+ > `@layer reset, shk-tokens, shk-utilities;` and wrap them in `@layer reset { … }`.
133
+
49
134
  The theme is based on `--shk-*` CSS variables. To customize colors, override the variables in `:root` (light mode) and `.dark` (dark mode):
50
135
 
51
136
  ```css
@@ -56,16 +141,250 @@ The theme is based on `--shk-*` CSS variables. To customize colors, override the
56
141
  }
57
142
  ```
58
143
 
144
+ ### Built-in color themes
145
+
146
+ The default (emerald) palette lives in `theme.css`. Three extra packs are shipped as
147
+ separate files scoped by a `data-shk-theme` attribute:
148
+
149
+ | Theme | Import | Attribute |
150
+ | --------- | --------------------------------------------------------- | -------------------------------- |
151
+ | `default` | `shirkasoft-ui-components/theme.css` | — (no attribute) |
152
+ | `ocean` | `shirkasoft-ui-components/themes/ocean.css` | `data-shk-theme="ocean"` |
153
+ | `violet` | `shirkasoft-ui-components/themes/violet.css` | `data-shk-theme="violet"` |
154
+ | `sunset` | `shirkasoft-ui-components/themes/sunset.css` | `data-shk-theme="sunset"` |
155
+
156
+ ```css
157
+ @import 'shirkasoft-ui-components/theme.css';
158
+ @import 'shirkasoft-ui-components/themes/ocean.css';
159
+ @import 'shirkasoft-ui-components/themes/violet.css';
160
+ @import 'shirkasoft-ui-components/themes/sunset.css';
161
+ ```
162
+
163
+ ```html
164
+ <html data-shk-theme="ocean">
165
+ ```
166
+
167
+ ### Theme service and providers
168
+
169
+ The `shirkasoft-ui-components/theme` entry point exposes `ShkThemeService` and
170
+ `provideShkTheme()`. The service persists the selection in `localStorage`, follows
171
+ `prefers-color-scheme` when the scheme is `system`, and only flips an attribute on
172
+ `<html>` — switching themes never re-renders components. `provideShkTheme()` also
173
+ applies the stored/default theme during app initialization, so it is active even if
174
+ no component injects `ShkThemeService`. It returns `EnvironmentProviders`, so register
175
+ it in the application (or route/environment) providers — not in a component's
176
+ `providers` array.
177
+
178
+ ```typescript
179
+ // app.config.ts
180
+ import { provideShkTheme } from 'shirkasoft-ui-components/theme';
181
+
182
+ export const appConfig: ApplicationConfig = {
183
+ providers: [
184
+ provideShkTheme({
185
+ defaultTheme: 'ocean',
186
+ defaultScheme: 'system',
187
+ persist: true,
188
+ }),
189
+ ],
190
+ };
191
+ ```
192
+
193
+ ```typescript
194
+ import { ShkThemeService } from 'shirkasoft-ui-components/theme';
195
+
196
+ @Component({ /* ... */ })
197
+ export class ThemeSwitcher {
198
+ readonly theme = inject(ShkThemeService);
199
+
200
+ setOcean() { this.theme.setTheme('ocean'); }
201
+ toggleDarkMode() { this.theme.toggleDark(); }
202
+ useSystem() { this.theme.setScheme('system'); }
203
+ }
204
+ ```
205
+
206
+ | Option | Default | Description |
207
+ | ------------------ | ----------------- | ---------------------------------------------- |
208
+ | `defaultTheme` | `'default'` | Theme applied when nothing is stored. |
209
+ | `defaultScheme` | `'system'` | `light`, `dark` or `system`. |
210
+ | `persist` | `true` | Store the selection in `localStorage`. |
211
+ | `storageKey` | `'shk-theme'` | Theme storage key. |
212
+ | `schemeStorageKey` | `'shk-scheme'` | Scheme storage key. |
213
+ | `attribute` | `'data-shk-theme'`| Attribute written on `<html>`. |
214
+ | `darkClass` | `'dark'` | Class toggled on `<html>` for dark mode. |
215
+
59
216
  ### Dark mode
60
217
 
61
- Add the `dark` class to the `<html>` element to enable dark mode.
218
+ Dark mode uses the `.dark` class on `<html>` and inverts `--shk-surface-50..900`.
219
+ `ShkThemeService` handles it for you; without the service, toggle the class manually:
62
220
 
63
221
  ```typescript
64
222
  document.documentElement.classList.toggle('dark');
65
223
  ```
66
224
 
225
+ To avoid a flash of the wrong theme, apply the stored values before first paint:
226
+
227
+ ```html
228
+ <script>
229
+ (function () {
230
+ var scheme = localStorage.getItem('shk-scheme');
231
+ var theme = localStorage.getItem('shk-theme');
232
+ var dark = scheme === 'dark' || (scheme !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches);
233
+ if (dark) document.documentElement.classList.add('dark');
234
+ if (theme && theme !== 'default') document.documentElement.setAttribute('data-shk-theme', theme);
235
+ })();
236
+ </script>
237
+ ```
238
+
67
239
  ---
68
240
 
241
+ ## Configuration (`shirkasoft-ui-components/config`)
242
+
243
+ Library-wide options live in a single **options registry**: every option has a
244
+ key (`dates.format`), a module, a type and a default. Configure the modules you
245
+ need at bootstrap; change any option at runtime and every component that uses it
246
+ updates by itself. Component inputs always win over the configured value.
247
+
248
+ ```typescript
249
+ // app.config.ts
250
+ import {
251
+ provideShk, withDates, withNumbers, withTheme, withOptions, withPersistence,
252
+ } from 'shirkasoft-ui-components/config';
253
+
254
+ export const appConfig: ApplicationConfig = {
255
+ providers: [
256
+ provideShk(
257
+ withDates({ locale: 'es', format: 'dd/MM/yyyy', hourFormat: '24' }),
258
+ withNumbers({ locale: 'es-ES', currency: 'EUR', decimals: 2 }),
259
+ withTheme({
260
+ defaultTheme: 'indigo',
261
+ defaultScheme: 'system',
262
+ themes: { indigo: { primary: '#4f46e5', label: 'Índigo' }, marca: '#0f766e' },
263
+ }),
264
+ withOptions([{ key: 'app.pageSize', module: 'app', type: 'number', default: 20, label: 'Filas' }]),
265
+ withPersistence(), // remembers changed options in localStorage
266
+ ),
267
+ ],
268
+ };
269
+ ```
270
+
271
+ | Module | Options | Used by |
272
+ | --------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------- |
273
+ | `withDates` | `dates.locale` · `dates.format` · `dates.displayStyle` · `dates.hourFormat` · `dates.weekStart` | date picker, table `date` columns |
274
+ | `withNumbers` | `numbers.locale` · `numbers.currency` · `numbers.currencySymbol` · `numbers.decimals` | price input, table `currency` columns |
275
+ | `withTheme` | `theme.name` · `theme.scheme` · `theme.primary` | the whole UI (CSS variables) |
276
+ | `withOptions` | your own keys | your app |
277
+
278
+ Without any configuration the components behave as before: dates `dd/MM/yyyy`
279
+ (`MM/dd/yyyy` for English locales), month names in Spanish, `$` and two decimals.
280
+
281
+ **Runtime changes and settings screens.** `ShkConfigService` is the registry:
282
+
283
+ ```typescript
284
+ const config = inject(ShkConfigService);
285
+
286
+ config.options(); // every option: definition + current value
287
+ config.modules(); // ['dates', 'numbers', 'theme', 'app']
288
+ config.get('dates.format')(); // signal → 'dd/MM/yyyy'
289
+ config.set('numbers.currency', 'CUP'); // validated; invalid values throw
290
+ config.reset('numbers.currency'); // back to the default (or reset() for all)
291
+ ```
292
+
293
+ `set` validates against the definition (type, `choices`, `min`/`max`). Options
294
+ with `allowCustom` (locales, currency codes, date patterns) also accept values
295
+ outside their suggested choices.
296
+
297
+ **Date patterns** (`dates.format`, `Column.dateFormat`): `yyyy y yy` year ·
298
+ `MMMM MMM MM M` month · `dd d` day · `EEEE EEE` weekday · `HH H hh h` hour ·
299
+ `mm` · `ss` · `a` · `'literal'` — the common Angular `DatePipe` tokens, so
300
+ existing column patterns such as `'MMM d, y'` keep working. Table columns also
301
+ accept the Angular named formats `shortDate`, `mediumDate`, `longDate`,
302
+ `fullDate`, `short`, `medium`, `long` and `full`. Month and weekday names keep
303
+ the locale's casing (`31 dic 2026`, `Dec 31, 2026`).
304
+
305
+ **Decimals**: `numbers.decimals` defaults to `null`, meaning the currency's own
306
+ digits (`$1,234.50`, `¥1,000`, `BD 1.500`); set a number to force them. The helpers `formatDate`, `formatCurrency`,
307
+ `formatNumber` and `currencySymbol` are exported for app code too.
308
+
309
+ **Custom themes** are generated from one color with CSS `color-mix()`: the color
310
+ becomes `--shk-primary-600` and the rest of the 50–950 scale is derived. They
311
+ are activated like the built-in ones (`theme.name`, `ShkThemeService.setTheme`).
312
+ `theme.primary` overrides the primary color on top of any theme at runtime.
313
+ `withTheme()` replaces `provideShkTheme()`; do not register both.
314
+
315
+ **Surface palettes** (`theme.surface`): `slate`, `gray`, `zinc`, `neutral`,
316
+ `stone` replace the neutral scale (backgrounds, borders, text) on top of any
317
+ theme, in light and dark mode (`<html data-shk-surface="slate">`).
318
+
319
+ ### Theme picker (`shk-theme-picker`)
320
+
321
+ A palette button that opens a panel to change the theme at runtime: **primary
322
+ color** (`theme.primary`), **surface** (`theme.surface`) and **presets** (the
323
+ theme packs, `theme.name`; picking one clears the color/surface overrides).
324
+ It needs `withTheme()`; add `withPersistence()` to remember the choice.
325
+
326
+ ```typescript
327
+ import { ThemePickerComponent } from 'shirkasoft-ui-components/theme-picker';
328
+ ```
329
+
330
+ ```html
331
+ <shk-theme-picker />
332
+ <!-- custom colors / labels -->
333
+ <shk-theme-picker
334
+ [primaryColors]="[{ color: '#0f766e', label: 'Marca' }, { color: '#2563eb', label: 'Azul' }]"
335
+ [showPresets]="false"
336
+ triggerLabel="Personalizar tema"
337
+ />
338
+ ```
339
+
340
+ | Input | Type | Default |
341
+ | --------------- | ------------------ | ----------------------------------------- |
342
+ | `primaryColors` | `ShkPickerColor[]` | 16 colors (Tailwind 600, no red/rose) |
343
+ | `showSurface` | `boolean` | `true` |
344
+ | `showPresets` | `boolean` | `true` (shown with more than one preset) |
345
+ | `triggerLabel` | `string` | `'Personalizar tema'` |
346
+ | `primaryLabel` | `string` | `'Primario'` |
347
+ | `surfaceLabel` | `string` | `'Superficie'` |
348
+ | `presetsLabel` | `string` | `'Temas'` |
349
+
350
+ ## Signal Forms (Angular 22)
351
+
352
+ The form controls implement the new Angular Signal Forms contracts, so they can
353
+ be bound with `[formField]` in addition to `ControlValueAccessor`:
354
+
355
+ | Component | Contract |
356
+ | ----------- | ----------------------------------- |
357
+ | Knob | `FormValueControl<number>` |
358
+ | Toggle | `FormCheckboxControl` |
359
+ | TextField | `FormValueControl<string>` |
360
+ | Select | `FormValueControl<any>` |
361
+ | DatePicker | `FormValueControl<string \| null>` |
362
+ | PriceInput | `FormValueControl<number \| null>` |
363
+ | FileUpload | `FormValueControl<File[]>` |
364
+
365
+ ```typescript
366
+ import { signal } from '@angular/core';
367
+ import { form, FormField } from '@angular/forms/signals';
368
+
369
+ @Component({
370
+ imports: [FormField, KnobComponent, ToggleComponent],
371
+ /* ... */
372
+ })
373
+ export class VolumeForm {
374
+ model = signal({ volume: 60, notifications: true });
375
+ volumeForm = form(this.model);
376
+ }
377
+ ```
378
+
379
+ ```html
380
+ <shk-knob [formField]="volumeForm.volume" [size]="120" />
381
+ <shk-toggle [formField]="volumeForm.notifications" mode="toggle" label="Notificaciones" />
382
+ ```
383
+
384
+ The contracts are imported with `import type`, so they add **zero runtime cost**
385
+ to the library. Both components keep their `ControlValueAccessor` support for
386
+ reactive and template-driven forms.
387
+
69
388
  ## Components
70
389
 
71
390
  | # | Component | Selector | ControlValueAccessor | Associated service |
@@ -84,12 +403,20 @@ document.documentElement.classList.toggle('dark');
84
403
  | 12 | Tooltip | `shk-tooltip` | — | — |
85
404
  | 13 | Sidebar | `shk-sidebar` | — | — |
86
405
  | 14 | Rail Sidebar | `shk-rail-sidebar` | — | — |
87
- | 15 | Skeleton | `shk-skeleton` | — | — |
88
- | 16 | Tag | `shk-tag` | — | — |
89
- | 17 | Button | `shk-button` | — | — |
90
- | 18 | Knob | `shk-knob` | ✅ | — |
91
- | 19 | Loading | `shk-loading-*` | — | — |
92
- | 20 | Tabs | `shk-tabs` | — | — |
406
+ | 15 | Timeline | `shk-timeline` | — | — |
407
+ | 16 | Fieldset | `shk-fieldset` | — | — |
408
+ | 17 | Wizard | `shk-wizard` | — | — |
409
+ | 18 | Skeleton | `shk-skeleton` | — | — |
410
+ | 19 | Tag | `shk-tag` | — | — |
411
+ | 20 | Button | `shk-button` | — | — |
412
+ | 21 | Knob | `shk-knob` | ✅ | — |
413
+ | 22 | Loading | `shk-loading-*` | — | — |
414
+ | 23 | Tabs | `shk-tabs` | — | — |
415
+ | 24 | Breadcrumb | `shk-breadcrumb` | — | `BreadcrumbService` |
416
+
417
+ All form controls also implement the Signal Forms contracts listed above, on top
418
+ of `ControlValueAccessor` (except `FileUpload`, which exposes `value` and
419
+ `touch` for `[formField]` only).
93
420
 
94
421
  ---
95
422
 
@@ -140,7 +467,8 @@ Text input with support for input, textarea, password, search, credit card forma
140
467
 
141
468
  ### Toggle (`shk-toggle`)
142
469
 
143
- Switch or checkbox. Implements `ControlValueAccessor`.
470
+ Switch or checkbox. Implements `ControlValueAccessor` and the Signal Forms
471
+ `FormCheckboxControl` contract.
144
472
 
145
473
  ```html
146
474
  <shk-toggle
@@ -155,12 +483,13 @@ Switch or checkbox. Implements `ControlValueAccessor`.
155
483
  | ---------- | ------------------------ | ----------- |
156
484
  | `label` | `string` | `''` |
157
485
  | `mode` | `'toggle' \| 'checkbox'` | `'toggle'` |
158
- | `checked` | `boolean` | `undefined` |
486
+ | `checked` | `model<boolean>` | `false` |
159
487
  | `disabled` | `boolean` | `false` |
160
488
 
161
489
  | Output | Type |
162
490
  | --------------- | --------- |
163
491
  | `checkedChange` | `boolean` |
492
+ | `touch` | `void` |
164
493
 
165
494
  ---
166
495
 
@@ -406,10 +735,6 @@ interface Column {
406
735
  currency?: string; // template 'currency', default 'USD'
407
736
  image?: (row: any) => string | undefined; // avatar/flag before the text
408
737
  imageWidth?: number; // default 28
409
- required?: boolean | ((row: any) => boolean); // with validateRequired: flags rows where it's empty (function = conditional)
410
- missingMessage?: string; // text in the empty cell (default "Falta <header>")
411
- missingSeverity?: 'error' | 'warning'; // mandatory (red) or informative (amber); default: table's missingAsError
412
- isMissing?: (row: any) => boolean; // custom rule (default: null/undefined/blank/[])
413
738
  format?: (row: any) => string;
414
739
  tagValue?: (row: any) => string;
415
740
  tagSeverity?: (row: any) => 'success' | 'danger' | 'warn' | 'info' | undefined;
@@ -484,8 +809,7 @@ interface FilterChangeEvent {
484
809
  | `searchPlaceholder` | `string` | `''` |
485
810
  | `globalFilterFields` | `string[]` (dot paths) | `[]` (all primitive values) |
486
811
  | `showGridlines` | `boolean` | `false` |
487
- | `validateRequired` | `boolean` | `false` |
488
- | `missingAsError` | `boolean` (with `validateRequired`) | `true` |
812
+ | `rowValidations` | `Record<string, RowValidation>` | `{}` |
489
813
  | `resizableColumns` | `boolean` (only with `showGridlines`) | `true` |
490
814
  | `columnWidths` | `Record<string, number>` (two-way `[(columnWidths)]`) | `{}` |
491
815
  | `stateKey` | `string` (persists column widths) | `''` |
@@ -501,6 +825,7 @@ interface FilterChangeEvent {
501
825
  | `activeFilter` | `string` | `''` |
502
826
  | `customTemplates` | `{ [key: string]: any }` | `{}` |
503
827
  | `selectable` | `boolean` | `false` |
828
+ | `selectOnRowClick` | `boolean` | `false` |
504
829
  | `dataKey` | `string` | `'id'` |
505
830
  | `isRowSelectable` | `(row: any) => boolean` | `undefined` |
506
831
  | `bulkActions` | `BulkAction[]` | `[]` |
@@ -516,7 +841,7 @@ interface FilterChangeEvent {
516
841
  | `columnResize` | `{ field: string; width: number \| null }` |
517
842
  | `selectionChange` | `any[]` |
518
843
 
519
- **Row selection.** With `[selectable]="true"` a leading checkbox column is rendered. The header checkbox selects/deselects the rows of the current page (indeterminate when partially selected); selection persists across pages and is keyed by `dataKey`. While rows are selected, `bulkActions` appear in the header and receive the selected rows. In client mode, rows removed from `data` are dropped from the selection automatically (not while `loading` is true, nor while `data` is still empty before the first load); in server mode, reset it via `[(selection)]` or `clearSelection()`. The selection is independent of the global search and column filters: rows hidden by a filter stay selected and are passed to `bulkActions` too.
844
+ **Row selection.** With `[selectable]="true"` a leading checkbox column is rendered. The header checkbox selects/deselects the rows of the current page (indeterminate when partially selected); selection persists across pages and is keyed by `dataKey`. While rows are selected, `bulkActions` appear in the header and receive the selected rows. In client mode, rows removed from `data` are dropped from the selection automatically (not while `loading` is true, nor while `data` is still empty before the first load); in server mode, reset it via `[(selection)]` or `clearSelection()`. The selection is independent of the global search and column filters: rows hidden by a filter stay selected and are passed to `bulkActions` too. With `[selectOnRowClick]="true"` a click anywhere on the row toggles it (clicks on buttons, links and form controls inside the row are ignored).
520
845
 
521
846
  ```html
522
847
  <shk-table [data]="users()" [columns]="columns" [selectable]="true"
@@ -532,32 +857,28 @@ i18n keys used: `table.selected` (`{{count}}`), `table.selectAll`, `table.select
532
857
  - `boolean`: tri-state checkbox (any → yes → no), applied immediately.
533
858
  - `range`: two-thumb slider between `filterMin` and `filterMax`, applied on release.
534
859
 
535
- **Missing data validation.** Opt-in with `[validateRequired]="true"` and mark the mandatory columns with `required: true` (or a per-row condition). Each row is checked field by field: the empty cell shows "Falta <header>" (or `missingMessage`) and the whole row is highlighted — red when a field with severity `'error'` is missing, amber when only `'warning'` fields are missing (error wins). Empty means `null`, `undefined`, blank text or empty array; `0` and `false` are valid. Use `isMissing: (row) => boolean` for custom rules.
860
+ **Row severity validation.** `[rowValidations]` takes one rule per payload field (the key is the field; dot paths like `'invoice.total'` work). Each rule applies a `condition(value, row)` and, when it returns `true`, paints the **whole row** with a tinted tone: `low` blue (informational), `moderate` amber (needs attention) or `critical` red (blocks). When a row has several issues the worst severity wins (`critical` > `moderate` > `low`). Nothing is written into the cells: they keep showing their real values. The rows that have issues also get a severity icon (info / triangle / octagon in the row color) at the beginning of the **actions column**, before the row actions; its tooltip lists every message, one per line, on hover or keyboard focus.
536
861
 
537
862
  ```typescript
538
- cols: Column[] = [
539
- { field: 'name', header: 'Nombre', required: true },
540
- { field: 'email', header: 'Email', required: true, missingMessage: 'Sin correo' },
541
- // conditional: mandatory only when the row/payload meets the condition
542
- { field: 'rfc', header: 'RFC', required: (row) => row.tipo === 'empresa' },
543
- ];
863
+ rowValidations: Record<string, RowValidation> = {
864
+ valor_factura: {
865
+ condition: (value, row) => !row.factura_id || value == null || Number(value) <= 0,
866
+ severity: 'critical',
867
+ message: 'items.validation.valorFactura', // i18n key (Transloco)
868
+ messageParams: (value, row) => ({ invoice: row.factura_id ?? '—' }),
869
+ },
870
+ documentos: { condition: (value) => !value?.trim(), severity: 'moderate', message: 'items.validation.documentos' },
871
+ peso_bruto: { condition: (value, row) => Number(value) > Number(row.peso_neto), severity: 'low' },
872
+ };
544
873
  ```
545
874
 
546
- `required` can be a function evaluated per row (and per payload in `validateRow`): when it returns `false` the field is optional for that row; when `true`, it's checked like a regular required field.
547
875
  ```html
548
- <shk-table [data]="users" [columns]="cols" [validateRequired]="true" />
876
+ <shk-table [data]="items" [columns]="cols" [rowValidations]="rowValidations" />
549
877
  ```
550
878
 
551
- Each column sets the severity of its missing value with `missingSeverity`: `'error'` (red, mandatory) or `'warning'` (amber, informative), so mandatory and informative fields can live in the same `columns` array. Columns without it use the table's `missingAsError` (errors by default; `false` = warnings).
879
+ `message` is a translation key resolved with the table's Transloco service (`{{param}}` interpolation included); when the app doesn't register the key, the string is used as literal text. `rowSeverity(row)` returns `'low' | 'moderate' | 'critical' | null`. The actions column is rendered automatically when there are violations, even if the table has no `rowActions`.
552
880
 
553
- ```typescript
554
- cols: Column[] = [
555
- { field: 'email', header: 'Email', required: true }, // error
556
- { field: 'phone', header: 'Teléfono', required: true, missingSeverity: 'warning' }, // informative
557
- ];
558
- ```
559
-
560
- **Validating a modal payload.** `validateRow(obj)` returns the `required` columns the object is missing (`[{ field, header, severity }]`, empty when complete); it works even with `validateRequired` off. Combined with the modal's optional `onAccept`, the data coming from a form can be added and flagged:
881
+ **Validating a modal payload.** `validateRow(obj)` returns the violations of any object (`[{ field, severity, message }]`, empty when clean) with the messages already translated. It doesn't need the row to be displayed, so it can be used before adding it:
561
882
 
562
883
  ```typescript
563
884
  table = viewChild.required(TableComponent);
@@ -566,14 +887,14 @@ this.modalSrv.open({
566
887
  title: 'Nuevo usuario',
567
888
  component: NewUserFormComponent, // submitSuccess.emit(this.form.getRawValue())
568
889
  onAccept: (payload) => {
569
- const missing = this.table().validateRow(payload);
570
- this.users.update((u) => [...u, payload]); // the row is flagged by validateRequired
571
- if (missing.length) this.notify('Faltan: ' + missing.map((m) => m.header).join(', '));
890
+ const issues = this.table().validateRow(payload); // [{ field, severity, message }]
891
+ this.users.update((u) => [...u, payload]); // the new row is painted by severity
892
+ if (issues.length) this.notify(issues.map((i) => i.message).join(' · '), 'warning');
572
893
  },
573
894
  });
574
895
  ```
575
896
 
576
- i18n: `table.missing.cell` (Spanish fallback).
897
+ i18n: none — the messages belong to the app (`message` key of each rule).
577
898
 
578
899
  **Resizable columns.** With `[showGridlines]="true"` each header has a handle on its right border: drag it to widen/narrow the column (minimum 60px; the table scrolls horizontally when it no longer fits), use the arrow keys on it (Shift = 50px steps), or double click it to go back to the automatic width. Disable it with `[resizableColumns]="false"`. Every change emits `columnResize`. The row actions column can be resized too (its width is stored under the `actions` key); its automatic width fits the most actions visible in a row of the current page (honouring each action's `isVisible`), not every action defined.
579
900
 
@@ -969,6 +1290,10 @@ interface RailSidebarItem {
969
1290
  | `openMenuLabel` | `string` | `'Abrir menú'` |
970
1291
  | `closeMenuLabel` | `string` | `'Cerrar menú'` |
971
1292
 
1293
+ The mobile hamburger uses `z-index: var(--shk-rail-hamburger-z, 1)`, enough to sit
1294
+ above the rail's own content without covering your app's fixed layers. If a positioned
1295
+ sibling covers it, raise it: `shk-rail-sidebar { --shk-rail-hamburger-z: 20; }`.
1296
+
972
1297
  | Output | Type |
973
1298
  | ----------------- | ---------------------- |
974
1299
  | `sectionSelected` | `{ key, routerLink? }` |
@@ -1080,7 +1405,9 @@ type ButtonIconPosition = 'left' | 'right' | 'top' | 'bottom';
1080
1405
 
1081
1406
  ### Knob (`shk-knob`)
1082
1407
 
1083
- SVG radial knob with pointer drag and keyboard (arrow keys) support. Implements `ControlValueAccessor` (reactive forms / `[(ngModel)]`), and also offers `[(value)]`.
1408
+ SVG radial knob with pointer drag and keyboard (arrow keys) support. Implements
1409
+ `ControlValueAccessor` (reactive forms / `[(ngModel)]`), the Signal Forms
1410
+ `FormValueControl<number>` contract, and also offers `[(value)]`.
1084
1411
 
1085
1412
  ```html
1086
1413
  <shk-knob [formControl]="scoreCtrl" [min]="0" [max]="10" [step]="0.5" [size]="120" />
@@ -1090,8 +1417,8 @@ SVG radial knob with pointer drag and keyboard (arrow keys) support. Implements
1090
1417
  | Input | Type | Default |
1091
1418
  | ------------- | --------- | -------------------------------- |
1092
1419
  | `value` | `model<number>` | `0` |
1093
- | `min` | `number` | `0` |
1094
- | `max` | `number` | `100` |
1420
+ | `min` | `number \| undefined` | `0` |
1421
+ | `max` | `number \| undefined` | `100` |
1095
1422
  | `step` | `number` | `1` |
1096
1423
  | `size` | `number` | `100` (px) |
1097
1424
  | `strokeWidth` | `number` | `14` |
@@ -1106,6 +1433,7 @@ SVG radial knob with pointer drag and keyboard (arrow keys) support. Implements
1106
1433
  | -------- | -------- |
1107
1434
  | `change` | `number` |
1108
1435
  | `end` | `number` |
1436
+ | `touch` | `void` |
1109
1437
 
1110
1438
  ---
1111
1439
 
@@ -1205,30 +1533,63 @@ pnpm serve
1205
1533
  # Build the showcase
1206
1534
  pnpm build:showcase
1207
1535
 
1536
+ # Build the showcase + stats and print bundle sizes
1537
+ pnpm build:showcase:stats
1538
+ pnpm measure
1539
+
1540
+ # Regenerate the plain-CSS baseline used by the library templates
1541
+ pnpm build:baseline
1542
+
1543
+ # Regenerate the icon data from the Lucide sources
1544
+ pnpm build:icons
1545
+
1546
+ # Lighthouse audit against the production build (requires Chrome)
1547
+ pnpm lighthouse
1548
+
1208
1549
  # Watch for library changes
1209
1550
  pnpm watch
1210
1551
  ```
1211
1552
 
1212
- ### Versioning
1553
+ `pnpm serve` compiles the library straight from `projects/ui-components`
1554
+ (`projects/showcase/tsconfig.app.dev.json`), so library edits reload instantly
1555
+ and you do not need `pnpm build` or `pnpm watch` while developing. Production
1556
+ showcase builds (`pnpm build:showcase`) still resolve the packaged `dist/`
1557
+ output, so run `pnpm build` first for those.
1213
1558
 
1214
- ```bash
1215
- pnpm version:patch # 1.0.23 → 1.0.24 (creates commit + tag locally)
1216
- pnpm version:minor # 1.0.23 → 1.1.0
1217
- pnpm version:major # 1.0.23 → 2.0.0
1218
- ```
1559
+ ### Versioning and release lines
1219
1560
 
1220
- ### Push code (without publishing)
1561
+ Each supported Angular major has its own branch, npm major, dist-tag and docs:
1221
1562
 
1222
- ```bash
1223
- git push origin main
1224
- ```
1563
+ | Branch | npm | Angular | npm dist-tags | Showcase | Support |
1564
+ | ------ | ---- | ------- | ----------------- | -------- | ---------------------------------------- |
1565
+ | `main` | 2.x | 22 | `latest`, `ng22` | `/` | Active |
1566
+ | `1.x` | 1.x | 21 | `ng21` | `/v1/` | Until Angular 21 reaches end of support |
1225
1567
 
1226
- ### Push code + publish to npm
1568
+ Both lines get the same features and fixes: land a change on one branch and
1569
+ `git cherry-pick` it onto the other (code is kept compatible with both majors).
1570
+ The scripts read the current branch and refuse to cross lines:
1227
1571
 
1228
1572
  ```bash
1229
- git push origin main --tags
1573
+ pnpm version:patch # 2.0.0 → 2.0.1 on main, 1.4.0 → 1.4.1 on 1.x (commit + git tag)
1574
+ pnpm version:minor # 2.0.0 → 2.1.0
1575
+ git push origin <branch> --follow-tags
1230
1576
  ```
1231
1577
 
1578
+ There is no `version:major`: a new Angular major gets a new branch and line.
1579
+
1580
+ > **1.x numbering fix.** After `1.3.15`, versions `1.13.16`–`1.13.18` and
1581
+ > `1.14.0` were published by mistake (they should have been `1.3.x`/`1.4.0`).
1582
+ > They are deprecated and the 1.x line continues at **`1.4.0`**. Because npm
1583
+ > orders `1.4.0` below `1.13.x`, apps whose `package.json` has `^1.13.x` or
1584
+ > `^1.14.0` will not receive new 1.x releases: change the dependency to
1585
+ > `shirkasoft-ui-components@ng21` (or `^1.4.0`).
1586
+
1587
+ ### Performance
1588
+
1589
+ Bundle sizes, the before/after comparison and the measurement methodology live
1590
+ in [PERFORMANCE.md](./PERFORMANCE.md). The showcase is **zoneless**: there is no
1591
+ `zone.js` polyfill, and every component uses `OnPush` + signals.
1592
+
1232
1593
  ---
1233
1594
 
1234
1595
  ## Publishing
@@ -1237,8 +1598,23 @@ git push origin main --tags
1237
1598
 
1238
1599
  | Workflow | Trigger | Description |
1239
1600
  | ------------------- | --------------------------------------------- | ------------------------------------------------------------------------- |
1240
- | **Publish to npm** | Manual (`workflow_dispatch`) or push `v*` tag | Builds library, publishes to npm, builds showcase, deploys to public repo |
1241
- | **Deploy Showcase** | Push to `main`/`master` or manual | Builds library + showcase, deploys to GitHub Pages public repo |
1601
+ | **Publish to npm** | Manual (`workflow_dispatch`) or push `v*` tag | Builds the library and publishes it with its line's dist-tag (`latest`+`ng22` for 2.x, `ng21` for 1.x) |
1602
+ | **Deploy Showcase** | Push to `main` or `1.x`, or manual | Builds the line's showcase and deploys it to its gh-pages folder (`/` or `/v1/`), keeping the other |
1603
+ | **Lighthouse CI** | Pull request or manual | Audits the production build (LCP, CLS, TBT) and fails on regressions |
1604
+
1605
+ The showcase deployment publishes `projects/showcase/public/README.md` next to
1606
+ the site, so the public deploy repository always shows the changelog of the
1607
+ version that is online.
1608
+
1609
+ The workflows need the `NPM_TOKEN` repository secret; the deploy uses the
1610
+ built-in `GITHUB_TOKEN`.
1611
+
1612
+ ### Manual deploy of the showcase
1613
+
1614
+ ```bash
1615
+ pnpm deploy:showcase # builds this line's site and commits it to the local gh-pages branch
1616
+ pnpm deploy:showcase -- --push # … and pushes it
1617
+ ```
1242
1618
 
1243
1619
  ### Manual publish (without GitHub Actions)
1244
1620