@solercia/ui 0.7.2 → 0.8.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,57 @@ All notable changes to this package are documented in this file. The format foll
5
5
  [SemVer](https://semver.org/). The package started at `0.1.0`; while it is pre-1.0 and has only a
6
6
  few consumers, `minor` versions may include breaking changes.
7
7
 
8
+ ## [0.8.1] - 2026-11-25
9
+
10
+ ### Fixed
11
+
12
+ - `chart.js` no longer lands in the initial bundle of apps that do not render `sol-chart`. The
13
+ `Chart.register()` call ran at module load, a side effect that kept chart.js in every app importing
14
+ anything from `@solercia/ui`; it now runs once, lazily, when the first chart is created. Measured
15
+ with an Angular production build of an app that only imports `SOL_I18N`: initial bundle from
16
+ 305.8 kB to 115.4 kB.
17
+
18
+ ## [0.8.0] - 2026-11-25
19
+
20
+ ### Changed
21
+
22
+ - **English is the default language.** Without a `SOL_I18N` provider, `SOL_I18N` is now an English
23
+ engine backed by the bundled catalog (it used to be an identity engine with `activeLang` `es-CO`), and
24
+ every visible default goes through a `shared.*` key: `sol-data-table` (`searchPlaceholder`,
25
+ `emptyMessage`, `actionsLabel`, `toggleDetailsLabel`, column filter «All»), `sol-search-input`,
26
+ `sol-select` (`placeholder`, `allOptionLabel`, `searchPlaceholder`, `emptyLabel`, All/None buttons),
27
+ `sol-confirm-dialog` (`title`, `confirmLabel`, `cancelLabel`), `sol-file-upload` (`label`, `hint`,
28
+ preview texts and validation messages), `sol-modal`, `sol-pagination`, `sol-wizard` and
29
+ `sol-progress-bar`. `@solercia/ui/theme-studio` and `@solercia/ui/login-appearance` also default to
30
+ English (`es*` languages keep Spanish). `sol-star-rating` formats the value with the active locale.
31
+ - **Behavior change for hosts without a catalog:** a host that relied on the hard-coded Spanish
32
+ defaults now sees English. To keep Spanish, provide
33
+ `{ provide: SOL_I18N, useFactory: () => createSolI18n({ lang: 'es-CO' }) }`, or merge
34
+ `SOL_I18N_ES_CO` (`@solercia/ui/i18n/es-CO.json`) into your engine. A host engine whose
35
+ `activeLang()` starts with `es` keeps Spanish even for keys it does not know: unknown `shared.*` keys
36
+ fall back to the bundled catalog of the active language. Explicit inputs always win.
37
+ - Those text inputs now default to `undefined` (type `string | undefined`) instead of a literal; an
38
+ explicit value, including `''`, is rendered as given.
39
+
40
+ ### Added
41
+
42
+ - Bundled catalogs `SOL_I18N_EN` and `SOL_I18N_ES_CO` (type `SolI18nCatalog`), also shipped as
43
+ `@solercia/ui/i18n/en.json` and `@solercia/ui/i18n/es-CO.json` to merge into Transloco or ngx-translate.
44
+ - `createSolI18n({ lang?, catalogs? })`: catalog-backed `SolI18n` engine with `setLang(lang)`.
45
+ - New `shared.*` keys: `modal`, `confirmDialog`, `searchInput`, `select`, `fileUpload`, `pagination`,
46
+ `wizard`, `progressBar` and `table.searchPlaceholder|empty|actions|filterAll`.
47
+ - `ariaLabel` input on `sol-modal` and `sol-drawer`, used as the accessible name when there is no title.
48
+
49
+ ### Fixed
50
+
51
+ - `sol-modal` is now an accessible modal dialog: `role="dialog"`, `aria-modal="true"`, `aria-labelledby`
52
+ bound to the title (or `aria-label`), focus moves inside on open and is trapped (Tab/Shift+Tab), focus
53
+ returns to the previously focused element on close, the page scroll is locked while open, and the
54
+ close button has an i18n label (it was a hard-coded «Cerrar»). No empty heading without a title.
55
+ - `sol-confirm-dialog`: `role="alertdialog"` moved to the panel with `aria-labelledby`/`aria-describedby`,
56
+ focus starts on Cancel, is trapped and restored, and the page scroll is locked while open.
57
+ - `sol-pagination`: the page-size label is tied to its select and the previous/next buttons have labels.
58
+
8
59
  ## [0.7.2] - 2026-11-24
9
60
 
10
61
  ### Added
package/README.md CHANGED
@@ -74,7 +74,7 @@ export const appConfig: ApplicationConfig = {
74
74
  provideTheme(),
75
75
  { provide: THEME_SOURCE, useExisting: AppThemeSource }, // optional
76
76
  { provide: SOL_TENANT_RESOLVER, useExisting: AppTenantResolver }, // optional (multi-tenant)
77
- { provide: SOL_I18N, useExisting: I18nService }, // optional (identity by default)
77
+ { provide: SOL_I18N, useExisting: I18nService }, // optional (English by default)
78
78
  ],
79
79
  };
80
80
  ```
@@ -94,7 +94,7 @@ body {
94
94
  }
95
95
  ```
96
96
 
97
- A complete reference integration (with a JSON-catalog `SolI18n` engine for English and es-CO) lives in
97
+ A complete reference integration (a `SolI18n` engine that merges the bundled catalogs with its own keys) lives in
98
98
  `projects/showcase/src/app/app.config.ts` and `projects/showcase/src/app/i18n/showcase-i18n.service.ts`.
99
99
 
100
100
  ### What `ng add @solercia/ui` does
@@ -126,7 +126,9 @@ It does **not** wire `THEME_SOURCE`/`SOL_I18N` providers automatically; the scaf
126
126
  | `THEME_SOURCE` | `InjectionToken<ThemeSource>` | Host port: `loadTheme(tenantId): Promise<ThemeFile \| null>`. Default returns `null`. |
127
127
  | `SOL_TENANT_RESOLVER` | `InjectionToken<SolTenantResolver>` (optional) | Host port: `activeTenantId(): number \| null`. When provided, `ThemeService` reloads the tenant theme whenever it changes. |
128
128
  | `SOL_DEFAULT_THEME` | `InjectionToken<ThemeFile>` | Fallback theme; defaults to `SOL_BUNDLED_DEFAULT_THEME` (“Vértice”). Degradation: tenant theme → default theme → inline `:root` CSS. |
129
- | `SOL_I18N` | `InjectionToken<SolI18n>` | Host i18n engine: `activeLang: Signal<string>`, `translate(key, params?)`, `t(key, params?): Signal<string>`, `tMany(keys)`. Default is an identity engine (returns the key). The library ships `projects/solercia/ui/i18n/es-CO.json` (keys under `shared.*`), **not** an English catalog and not inside the npm package. |
129
+ | `SOL_I18N` | `InjectionToken<SolI18n>` | Host i18n engine: `activeLang: Signal<string>`, `translate(key, params?)`, `t(key, params?): Signal<string>`, `tMany(keys)`. Default is an English engine backed by the bundled catalog. |
130
+ | `createSolI18n(options?)` | function | Catalog-backed `SolI18n` engine with `setLang(lang)`. Options: `lang` (default `'en'`), `catalogs` (default `{ en: SOL_I18N_EN, 'es-CO': SOL_I18N_ES_CO }`). `createSolI18n({ lang: 'es-CO' })` gives Colombian Spanish. |
131
+ | `SOL_I18N_EN` / `SOL_I18N_ES_CO` | `SolI18nCatalog` | Bundled `shared.*` catalogs, also shipped as `@solercia/ui/i18n/en.json` and `@solercia/ui/i18n/es-CO.json` to merge into Transloco or ngx-translate. |
130
132
  | `SOL_CHART_ENGINE` | `InjectionToken<SolChartEngineFactory>` | Chart.js factory used by `sol-chart`; override only to swap or mock the engine. |
131
133
  | `SOL_CALENDAR_COLOR` | `InjectionToken<SolCalendarColorStrategy>` | Calendar event color strategy (`resolve(event, isDark): { bg, border, text }`). Default derives from `event.color` with `color-mix()` over tokens. |
132
134
  | `KanbanReorderService` | service | Pure reorder helper: `reorder(columns, rawDropEvent) → { columns, moved } \| null`. Used by the board; reusable by hosts. |
@@ -141,13 +143,23 @@ No zone.js required: the library works with `provideZonelessChangeDetection()` (
141
143
  - **Theming.** The host implements two optional ports: `SOL_TENANT_RESOLVER` (who the active tenant is)
142
144
  and `THEME_SOURCE` (how to load its `ThemeFile`). Degradation, best to worst: tenant theme from
143
145
  `THEME_SOURCE` → `SOL_DEFAULT_THEME` (bundled «Vértice») → inline `:root` CSS in the host's `styles.css`.
144
- - **i18n.** `SOL_I18N` is a `SolI18n` contract (`t`, `translate`, `activeLang`, `tMany`) with an identity
145
- default that returns the key, mirroring Angular Material's `*Intl` services. Bind Transloco,
146
- ngx-translate or your own engine. The repository ships a Colombian Spanish catalog
147
- ([`projects/solercia/ui/i18n/es-CO.json`](./projects/solercia/ui/i18n/es-CO.json)) and the showcase
148
- ships an English one ([`projects/showcase/src/app/i18n/en.json`](./projects/showcase/src/app/i18n/en.json)).
149
- - **Hard-coded defaults.** A few inputs default to Spanish text (`searchPlaceholder`, `actionsLabel`,
150
- `confirmLabel`, file upload `label`/`hint`). Set them explicitly in other languages.
146
+ - **i18n.** `SOL_I18N` is a `SolI18n` contract (`t`, `translate`, `activeLang`, `tMany`), mirroring
147
+ Angular Material's `*Intl` services. **English is the default**: without a provider every component
148
+ text comes from the bundled English catalog. Every visible default goes through a `shared.*` key;
149
+ an explicit input (`searchPlaceholder`, `actionsLabel`, `confirmLabel`, `label`…) always wins.
150
+ - **Bundled catalogs.** `SOL_I18N_EN` and `SOL_I18N_ES_CO` (also `@solercia/ui/i18n/en.json` and
151
+ `@solercia/ui/i18n/es-CO.json`) hold every `shared.*` key. When your engine returns a `shared.*` key
152
+ unchanged, the component falls back to the bundled catalog of the active language (`es*` → Colombian
153
+ Spanish, anything else → English), so a host catalog does not need every library key.
154
+ - **Spanish.** Use the bundled engine, or merge the catalog into yours:
155
+
156
+ ```ts
157
+ import { SOL_I18N, SOL_I18N_ES_CO, createSolI18n } from '@solercia/ui';
158
+
159
+ { provide: SOL_I18N, useFactory: () => createSolI18n({ lang: 'es-CO' }) } // bundled engine
160
+ // Transloco / ngx-translate: merge SOL_I18N_ES_CO (or @solercia/ui/i18n/es-CO.json) into the
161
+ // es-CO translations and bind SOL_I18N to an adapter whose activeLang() returns 'es-CO'.
162
+ ```
151
163
 
152
164
  In-depth guides:
153
165
 
@@ -348,7 +360,7 @@ Label/hint/error wrapper for any projected control.
348
360
  #### `sol-search-input` — `SolSearchInputComponent`
349
361
  | Input | Type | Default | Req |
350
362
  |---|---|---|---|
351
- | `placeholder` | `string` | `'Buscar...'` | |
363
+ | `placeholder` | `string` | `shared.searchInput.placeholder` («Search...») | |
352
364
 
353
365
  Outputs: `searchChange: string`. (Debounce behavior: not verified.)
354
366
 
@@ -379,17 +391,17 @@ Searchable single/multi select; bottom sheet below `mobileBreakpoint`.
379
391
  | Input | Type | Default | Req |
380
392
  |---|---|---|---|
381
393
  | `options` | `SolSelectOption[]` (`{ value: string; label: string }`) | `[]` | |
382
- | `placeholder` | `string` | `'Selecciona...'` | |
394
+ | `placeholder` | `string` | `shared.select.placeholder` («Select...») | |
383
395
  | `label` | `string` | `''` | |
384
396
  | `error` | `string` | `''` | |
385
397
  | `disabled` | `boolean` | `false` | |
386
398
  | `searchable` | `boolean` | `true` | |
387
399
  | `multiple` | `boolean` | `false` | |
388
400
  | `showAllOption` | `boolean` | `false` | |
389
- | `allOptionLabel` | `string` | `'Todos'` | |
401
+ | `allOptionLabel` | `string` | `shared.select.all` («All») | |
390
402
  | `ariaLabel` | `string` | `''` | |
391
- | `searchPlaceholder` | `string` | `'Buscar...'` | |
392
- | `emptyLabel` | `string` | `'Sin resultados'` | |
403
+ | `searchPlaceholder` | `string` | `shared.select.searchPlaceholder` («Search...») | |
404
+ | `emptyLabel` | `string` | `shared.select.empty` («No results») | |
393
405
  | `value` | `string \| null \| undefined` | `undefined` | |
394
406
  | `mobileBreakpoint` | `number` | `640` | |
395
407
 
@@ -546,8 +558,8 @@ Drag-and-drop image picker with validation and preview.
546
558
  |---|---|---|---|
547
559
  | `accept` | `string` | `'image/jpeg,image/png,image/webp,image/gif'` | |
548
560
  | `maxSizeBytes` | `number` | `5 * 1024 * 1024` | |
549
- | `label` | `string` | `'Arrastra o haz clic para subir'` | |
550
- | `hint` | `string` | `'JPG, PNG, WEBP o GIF · máx. 5 MB'` | |
561
+ | `label` | `string` | `shared.fileUpload.label` («Drag or click to upload») | |
562
+ | `hint` | `string` | `shared.fileUpload.hint` («JPG, PNG, WEBP or GIF · max. 5 MB») | |
551
563
 
552
564
  Outputs: `fileSelected: File`, `previewReady: string` (data URL), `fileError: string`, `fileRemoved: void`.
553
565
 
@@ -745,7 +757,7 @@ Outputs: `itemSelected: T`, `markedRead: T`, `markedAllRead: void`, `retryReques
745
757
  ### Overlays
746
758
 
747
759
  #### `sol-modal` — `SolModalComponent`
748
- Host-controlled modal; Escape closes, focus trapped, body scroll locked.
760
+ Host-controlled modal dialog; Escape closes, focus trapped and restored, body scroll locked.
749
761
 
750
762
  | Input | Type | Default | Req |
751
763
  |---|---|---|---|
@@ -754,8 +766,12 @@ Host-controlled modal; Escape closes, focus trapped, body scroll locked.
754
766
  | `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | |
755
767
  | `closeable` | `boolean` | `true` | |
756
768
  | `closeOnBackdrop` | `boolean` | `false` | |
769
+ | `ariaLabel` | `string` | `''` (used only when there is no `title`) | |
757
770
 
758
- Outputs: `closed: void`. Content: body (single slot; place footer buttons inside). Note: the panel has no `role="dialog"`/`aria-modal` attribute in the current template.
771
+ Outputs: `closed: void`. Content: body (single slot; place footer buttons inside). Accessibility: the panel
772
+ is `role="dialog"` + `aria-modal="true"`, labelled by the title (or `ariaLabel`); focus moves into it on
773
+ open, Tab/Shift+Tab stay inside, Escape closes when `closeable`, focus returns to the previously focused
774
+ element and the page scroll is locked while open. The close button reads `shared.modal.close`.
759
775
 
760
776
  ```html
761
777
  <sol-modal [open]="open()" title="Invite a teammate" (closed)="open.set(false)">
@@ -774,8 +790,9 @@ Outputs: `closed: void`. Content: body (single slot; place footer buttons inside
774
790
  | `variant` | `'panel' \| 'sheet'` | `'panel'` | |
775
791
  | `closeable` | `boolean` | `true` | |
776
792
  | `closeOnBackdrop` | `boolean` | `true` | |
793
+ | `ariaLabel` | `string` | `''` (used only when there is no `title`) | |
777
794
 
778
- Outputs: `closed: void`. Content: body + `[drawerFooter]` slot.
795
+ Outputs: `closed: void`. Content: body + `[drawerFooter]` slot. Same dialog accessibility as `sol-modal`.
779
796
 
780
797
  ```html
781
798
  <sol-drawer [open]="filtersOpen()" title="Filters" (closed)="filtersOpen.set(false)">
@@ -788,13 +805,15 @@ Outputs: `closed: void`. Content: body + `[drawerFooter]` slot.
788
805
  | Input | Type | Default | Req |
789
806
  |---|---|---|---|
790
807
  | `open` | `boolean` | `false` | |
791
- | `title` | `string` | `'¿Estás seguro?'` | |
808
+ | `title` | `string` | `shared.confirmDialog.title` («Are you sure?») | |
792
809
  | `message` | `string` | `''` | |
793
- | `confirmLabel` | `string` | `'Confirmar'` | |
794
- | `cancelLabel` | `string` | `'Cancelar'` | |
810
+ | `confirmLabel` | `string` | `shared.confirmDialog.confirm` («Confirm») | |
811
+ | `cancelLabel` | `string` | `shared.confirmDialog.cancel` («Cancel») | |
795
812
  | `variant` | `'danger' \| 'warning' \| 'info'` | `'danger'` | |
796
813
 
797
- Outputs: `confirm: void`, `cancel: void`.
814
+ Outputs: `confirm: void`, `cancel: void`. Accessibility: the panel is `role="alertdialog"` +
815
+ `aria-modal="true"`, labelled by the title and described by the message; focus starts on Cancel (the
816
+ least destructive action), stays inside, returns to the trigger on close, and the page scroll is locked.
798
817
 
799
818
  ```html
800
819
  <sol-confirm-dialog [open]="confirming()" title="Delete this project?" confirmLabel="Delete" cancelLabel="Cancel"
@@ -963,16 +982,16 @@ Sorting, per-column filters, global search, pagination, edit/delete actions, row
963
982
  | `data` | `SolDataTableRow[]` (`Record<string, unknown>`) | `[]` | |
964
983
  | `columns` | `DataTableColumn[]` (`{ key, label, sortable?, width?, badge?, filter?: 'text' \| 'select', cellTemplate? }`) | `[]` | |
965
984
  | `loading` | `boolean` | `false` | |
966
- | `searchPlaceholder` | `string` | `'Buscar...'` | |
967
- | `emptyMessage` | `string` | `'No hay datos disponibles'` | |
985
+ | `searchPlaceholder` | `string` | `shared.table.searchPlaceholder` («Search...») | |
986
+ | `emptyMessage` | `string` | `shared.table.empty` («No data available») | |
968
987
  | `paginated` | `boolean` | `true` | |
969
988
  | `showToolbar` | `boolean` | `true` | |
970
989
  | `filterPosition` | `'left' \| 'right'` | `'left'` | |
971
990
  | `showActions` / `showEditAction` / `showDeleteAction` | `boolean` | `true` | |
972
991
  | `trackByKey` | `string` | `'id'` | |
973
- | `actionsLabel` | `string` | `'Acciones'` | |
992
+ | `actionsLabel` | `string` | `shared.table.actions` («Actions») | |
974
993
  | `actionsPosition` | `'start' \| 'end'` | `'end'` | |
975
- | `toggleDetailsLabel` | `string` | `'Mostrar u ocultar el detalle de la fila'` | |
994
+ | `toggleDetailsLabel` | `string` | `shared.table.toggleDetails` («Show or hide the row details») | |
976
995
  | `rowReveal` | `boolean` | `true` | |
977
996
  | `collapseWidth` | `number` (px) | `767` | |
978
997
  | `variant` | `'clean' \| 'zebra' \| 'bordered' \| 'emphasis-header' \| 'banded' \| null` | `null` (theme) | |
@@ -1190,7 +1209,7 @@ npm start # builds the library and serves the showcase on http://localhost:420
1190
1209
  ```
1191
1210
 
1192
1211
  The showcase is also the reference integration: zoneless bootstrap, `provideTheme()`, a `THEME_SOURCE`
1193
- adapter and a JSON-catalog `SolI18n` engine with English and Spanish
1212
+ adapter and a `SolI18n` engine that merges the bundled English and Spanish catalogs with its own keys
1194
1213
  ([`app.config.ts`](./projects/showcase/src/app/app.config.ts)). Each page shows live variants, sizes and
1195
1214
  states with a collapsible code snippet, in light and dark mode, down to 390 px.
1196
1215
 
@@ -1221,7 +1240,8 @@ npm run build # dist/solercia/ui
1221
1240
  npm run build:showcase # library + showcase
1222
1241
  ```
1223
1242
 
1224
- Text-asserting tests use the library's own catalog, `projects/solercia/ui/i18n/es-CO.json`.
1243
+ Text-asserting tests use the library's own catalogs, `projects/solercia/ui/i18n/en.json` and `es-CO.json`
1244
+ (add every new `shared.*` key to both; `catalog-*.ts` mirror them and a spec keeps them in sync).
1225
1245
  Rebuilding the library while `ng serve showcase` runs deletes `dist/solercia/ui`: restart the dev server.
1226
1246
 
1227
1247
  ### Releasing
@@ -1166,7 +1166,7 @@ function interpolate(template, params) {
1166
1166
  /**
1167
1167
  * Translator (call in an injection context): resolves `sol.loginAppearance.<key>` with `SOL_I18N`
1168
1168
  * and, when the host lacks the key, falls back to the default dictionary of the active language
1169
- * (`en*` → English; anything else → Colombian Spanish). Reads `activeLang()`, so it reacts to
1169
+ * (`es*` → Colombian Spanish; anything else → English). Reads `activeLang()`, so it reacts to
1170
1170
  * language changes.
1171
1171
  */
1172
1172
  function injectLoginAppearanceText() {
@@ -1176,8 +1176,8 @@ function injectLoginAppearanceText() {
1176
1176
  const translated = i18n.translate(fullKey, params);
1177
1177
  if (translated && translated !== fullKey)
1178
1178
  return translated;
1179
- const dictionary = i18n.activeLang().toLowerCase().startsWith('en') ? SOL_LOGIN_APPEARANCE_I18N_EN : SOL_LOGIN_APPEARANCE_I18N_ES_CO;
1180
- return interpolate(lookup(dictionary, key) ?? lookup(SOL_LOGIN_APPEARANCE_I18N_ES_CO, key) ?? fullKey, params);
1179
+ const dictionary = i18n.activeLang().toLowerCase().startsWith('es') ? SOL_LOGIN_APPEARANCE_I18N_ES_CO : SOL_LOGIN_APPEARANCE_I18N_EN;
1180
+ return interpolate(lookup(dictionary, key) ?? lookup(SOL_LOGIN_APPEARANCE_I18N_EN, key) ?? fullKey, params);
1181
1181
  };
1182
1182
  }
1183
1183