@konce-pt/angular 0.3.0 → 0.5.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
@@ -32,15 +32,16 @@
32
32
  - 🎨 **100% tokenized** — every style is a `var(--kpt-*)` CSS custom property. Light/dark theme, neutral OKLCH palette. Swap the brand by swapping one token layer.
33
33
  - 🧩 **Standalone components** — no NgModules. Import only what you use; tree-shakeable.
34
34
  - ♿ **Built on Angular CDK** — overlays, a11y, focus management, virtual scrolling.
35
+ - 🌍 **i18n built in** — English (default) & Polish out of the box, runtime locale switch, add any language with one JSON.
35
36
 
36
37
  ## Installation
37
38
 
38
39
  ```bash
39
- npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
40
+ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles @angular/cdk
40
41
  # or: pnpm add / yarn add
41
42
  ```
42
43
 
43
- Peer dependencies: `@angular/core`, `@angular/common`, `@angular/forms`, `@angular/cdk` (all `^22`).
44
+ `@angular/core`, `@angular/common` and `@angular/forms` (all `^22`) are already in an Angular app; **`@angular/cdk` (`^22`) is a required peer** — overlay components (select, autocomplete, datepicker, date-range, dialog, drawer, tooltip, popover, menu…) build on the CDK Overlay — so install it explicitly (above). Optional: `@konce-pt/validators` for the Polish-market validators (NIP, REGON, PESEL, IBAN, postal code).
44
45
 
45
46
  ## Setup
46
47
 
@@ -63,9 +64,18 @@ Zoneless bootstrap (Angular 22) lives in your app config — no CSS imports in `
63
64
 
64
65
  ```ts
65
66
  import { provideZonelessChangeDetection } from '@angular/core';
66
- // providers: [provideZonelessChangeDetection(), /* provideKptTablerIcons() */]
67
+ // import { provideKptI18n } from '@konce-pt/angular';
68
+ // import { provideKptTablerIcons } from '@konce-pt/angular/icons';
69
+
70
+ providers: [
71
+ provideZonelessChangeDetection(), // required (zoneless)
72
+ // provideKptI18n({ locale: 'pl' }), // optional — UI is English by default; set for Polish/other
73
+ // provideKptTablerIcons(), // optional — full Tabler icon set
74
+ ]
67
75
  ```
68
76
 
77
+ The UI language defaults to **English** and works with **zero config** — `provideKptI18n(...)` is optional and only needed for Polish (or a custom language). See [Internationalization](#internationalization-i18n) below.
78
+
69
79
  Dark theme: set `<html data-theme="dark">` (or rely on `prefers-color-scheme`).
70
80
 
71
81
  > **Why not `import '…css'` in `main.ts`?** Angular CLI (`@angular/build`) turns side-effect CSS imports into a separate stylesheet that isn't linked from `index.html`, so the app builds **without styles**. Use `angular.json → styles[]` instead.
@@ -166,6 +176,40 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
166
176
  // providers: [provideKptTablerIcons()]
167
177
  ```
168
178
 
179
+ ## Internationalization (i18n)
180
+
181
+ Component labels ship in **English (default)** and **Polish**. The `KptI18n` service is `providedIn: 'root'`, so **English works out of the box with no provider**. Call `provideKptI18n(...)` only to start in Polish (or another language), or to register/override dictionaries. All user-facing strings — aria-labels, empty states, paginator, calendars, rich-text menus — read from this signal-based service, so switching locale updates the UI instantly (zoneless-friendly).
182
+
183
+ ```ts
184
+ import { provideKptI18n } from '@konce-pt/angular';
185
+ // providers: [provideKptI18n({ locale: 'pl' })] // optional — Polish UI (EN is the default)
186
+ ```
187
+
188
+ Switch at runtime:
189
+
190
+ ```ts
191
+ import { inject } from '@angular/core';
192
+ import { KptI18n } from '@konce-pt/angular';
193
+
194
+ const i18n = inject(KptI18n);
195
+ i18n.setLocale('en');
196
+ ```
197
+
198
+ **Add any language with one JSON** (shape = the `KptMessages` contract; missing keys fall back to English):
199
+
200
+ ```ts
201
+ import de from './i18n/de.json';
202
+ provideKptI18n({ locale: 'de', messages: { de } });
203
+ ```
204
+
205
+ **Override individual labels** of an existing language:
206
+
207
+ ```ts
208
+ provideKptI18n({ messages: { en: { paginator: { rowsPerPage: 'Rows per page:' } } } });
209
+ ```
210
+
211
+ Calendar weekday/month names come from the browser's `Intl` API for the active locale. Per-component label inputs (e.g. `emptyMessage`, `acceptLabel`) still take precedence over the dictionary.
212
+
169
213
  ## Documentation
170
214
 
171
215
  - **Storybook** — interactive docs for every component.
@@ -192,13 +236,16 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
192
236
  - 📊 **Flagowa tabela danych** — sortowanie, filtr, paginacja, virtual scroll, zaznaczanie, przestawianie/zamrażanie kolumn, eksport CSV, szablony komórek.
193
237
  - 🎨 **100% na tokenach** — każdy styl to `var(--kpt-*)`. Motyw jasny/ciemny, neutralna paleta OKLCH.
194
238
  - 🧩 **Standalone** — bez NgModules, tree-shaking.
239
+ - 🌍 **Wbudowane i18n** — angielski (domyślny) i polski, przełączanie języka w runtime, dowolny język jednym plikiem JSON.
195
240
 
196
241
  ### Instalacja
197
242
 
198
243
  ```bash
199
- npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
244
+ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles @angular/cdk
200
245
  ```
201
246
 
247
+ `@angular/core`, `@angular/common` i `@angular/forms` (`^22`) są już w aplikacji Angulara; **`@angular/cdk` (`^22`) to wymagany peer** — komponenty overlay (select, autocomplete, datepicker, date-range, dialog, drawer, tooltip, popover, menu…) bazują na CDK Overlay — więc instaluj go jawnie (powyżej). Opcjonalnie: `@konce-pt/validators` (walidatory PL: NIP, REGON, PESEL, IBAN, kod pocztowy).
248
+
202
249
  ### Konfiguracja
203
250
 
204
251
  **Angular CLI (zalecane)** — dodaj CSS do tablicy **`styles`** w `angular.json`; kolejność ważna, `src/styles.scss` **na końcu**:
@@ -215,8 +262,45 @@ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
215
262
 
216
263
  > W Angular CLI **nie** używaj `import '…css'` w `main.ts` — bundler wrzuca taki CSS do osobnego, niepodlinkowanego arkusza i aplikacja jest bez stylów. Dla **Vite/webpack** import w `main.ts` działa (tak robi playground).
217
264
 
265
+ Zoneless bootstrap (Angular 22) w konfiguracji aplikacji — bez importów CSS w `main.ts`:
266
+
267
+ ```ts
268
+ import { provideZonelessChangeDetection } from '@angular/core';
269
+ // import { provideKptI18n } from '@konce-pt/angular';
270
+ // import { provideKptTablerIcons } from '@konce-pt/angular/icons';
271
+
272
+ providers: [
273
+ provideZonelessChangeDetection(), // wymagane (zoneless)
274
+ // provideKptI18n({ locale: 'pl' }), // opcjonalne — UI domyślnie po angielsku; ustaw dla PL/innego
275
+ // provideKptTablerIcons(), // opcjonalne — pełny zestaw Tabler
276
+ ]
277
+ ```
278
+
279
+ Język UI to domyślnie **angielski** i działa **bez żadnej konfiguracji** — `provideKptI18n(...)` jest opcjonalny, potrzebny tylko dla polskiego (lub własnego języka); szczegóły w sekcji i18n niżej.
280
+
218
281
  Motyw ciemny: `<html data-theme="dark">`; nadpisania `--kpt-color-*` w `styles.scss`. Pełny zestaw ikon Tabler: `provideKptTablerIcons()` z `@konce-pt/angular/icons`.
219
282
 
283
+ ### Internacjonalizacja (i18n)
284
+
285
+ Etykiety komponentów są dostępne po **angielsku (domyślnie)** i **polsku**. Serwis `KptI18n` jest `providedIn: 'root'`, więc **angielski działa od razu, bez providera**. `provideKptI18n(...)` wołasz tylko, by wystartować po polsku (lub w innym języku) albo zarejestrować/nadpisać słowniki. Wszystkie napisy (aria-label, stany puste, paginator, kalendarze, menu edytora) pochodzą z tego serwisu opartego o sygnały — zmiana języka odświeża UI natychmiast (zoneless).
286
+
287
+ ```ts
288
+ import { provideKptI18n } from '@konce-pt/angular';
289
+ // providers: [provideKptI18n({ locale: 'pl' })] // opcjonalne — polski interfejs (EN domyślnie)
290
+ ```
291
+
292
+ Przełączanie w runtime: `inject(KptI18n).setLocale('en')`.
293
+
294
+ **Własny język jednym plikiem JSON** (kształt = kontrakt `KptMessages`; brakujące klucze spadają na EN):
295
+
296
+ ```ts
297
+ import de from './i18n/de.json';
298
+ provideKptI18n({ locale: 'de', messages: { de } });
299
+ ```
300
+
301
+ Nadpisanie pojedynczych etykiet: `provideKptI18n({ messages: { pl: { paginator: { rowsPerPage: 'Na stronie:' } } } })`.
302
+ Nazwy dni/miesięcy w kalendarzach pochodzą z `Intl` wg locale. Inputy etykiet per-komponent (np. `emptyMessage`) mają priorytet nad słownikiem.
303
+
220
304
  ### Komponenty (70+)
221
305
 
222
306
  Formularze (Signal Forms), przyciski i akcje, layout, nawigacja, dane (z flagową `kpt-data-table`), feedback i overlay — pełna lista w tabeli powyżej. Każdy komponent ma plik `llms.txt` z opisem API obok źródła.
package/dist/README.md CHANGED
@@ -32,15 +32,16 @@
32
32
  - 🎨 **100% tokenized** — every style is a `var(--kpt-*)` CSS custom property. Light/dark theme, neutral OKLCH palette. Swap the brand by swapping one token layer.
33
33
  - 🧩 **Standalone components** — no NgModules. Import only what you use; tree-shakeable.
34
34
  - ♿ **Built on Angular CDK** — overlays, a11y, focus management, virtual scrolling.
35
+ - 🌍 **i18n built in** — English (default) & Polish out of the box, runtime locale switch, add any language with one JSON.
35
36
 
36
37
  ## Installation
37
38
 
38
39
  ```bash
39
- npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
40
+ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles @angular/cdk
40
41
  # or: pnpm add / yarn add
41
42
  ```
42
43
 
43
- Peer dependencies: `@angular/core`, `@angular/common`, `@angular/forms`, `@angular/cdk` (all `^22`).
44
+ `@angular/core`, `@angular/common` and `@angular/forms` (all `^22`) are already in an Angular app; **`@angular/cdk` (`^22`) is a required peer** — overlay components (select, autocomplete, datepicker, date-range, dialog, drawer, tooltip, popover, menu…) build on the CDK Overlay — so install it explicitly (above). Optional: `@konce-pt/validators` for the Polish-market validators (NIP, REGON, PESEL, IBAN, postal code).
44
45
 
45
46
  ## Setup
46
47
 
@@ -63,9 +64,18 @@ Zoneless bootstrap (Angular 22) lives in your app config — no CSS imports in `
63
64
 
64
65
  ```ts
65
66
  import { provideZonelessChangeDetection } from '@angular/core';
66
- // providers: [provideZonelessChangeDetection(), /* provideKptTablerIcons() */]
67
+ // import { provideKptI18n } from '@konce-pt/angular';
68
+ // import { provideKptTablerIcons } from '@konce-pt/angular/icons';
69
+
70
+ providers: [
71
+ provideZonelessChangeDetection(), // required (zoneless)
72
+ // provideKptI18n({ locale: 'pl' }), // optional — UI is English by default; set for Polish/other
73
+ // provideKptTablerIcons(), // optional — full Tabler icon set
74
+ ]
67
75
  ```
68
76
 
77
+ The UI language defaults to **English** and works with **zero config** — `provideKptI18n(...)` is optional and only needed for Polish (or a custom language). See [Internationalization](#internationalization-i18n) below.
78
+
69
79
  Dark theme: set `<html data-theme="dark">` (or rely on `prefers-color-scheme`).
70
80
 
71
81
  > **Why not `import '…css'` in `main.ts`?** Angular CLI (`@angular/build`) turns side-effect CSS imports into a separate stylesheet that isn't linked from `index.html`, so the app builds **without styles**. Use `angular.json → styles[]` instead.
@@ -166,6 +176,40 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
166
176
  // providers: [provideKptTablerIcons()]
167
177
  ```
168
178
 
179
+ ## Internationalization (i18n)
180
+
181
+ Component labels ship in **English (default)** and **Polish**. The `KptI18n` service is `providedIn: 'root'`, so **English works out of the box with no provider**. Call `provideKptI18n(...)` only to start in Polish (or another language), or to register/override dictionaries. All user-facing strings — aria-labels, empty states, paginator, calendars, rich-text menus — read from this signal-based service, so switching locale updates the UI instantly (zoneless-friendly).
182
+
183
+ ```ts
184
+ import { provideKptI18n } from '@konce-pt/angular';
185
+ // providers: [provideKptI18n({ locale: 'pl' })] // optional — Polish UI (EN is the default)
186
+ ```
187
+
188
+ Switch at runtime:
189
+
190
+ ```ts
191
+ import { inject } from '@angular/core';
192
+ import { KptI18n } from '@konce-pt/angular';
193
+
194
+ const i18n = inject(KptI18n);
195
+ i18n.setLocale('en');
196
+ ```
197
+
198
+ **Add any language with one JSON** (shape = the `KptMessages` contract; missing keys fall back to English):
199
+
200
+ ```ts
201
+ import de from './i18n/de.json';
202
+ provideKptI18n({ locale: 'de', messages: { de } });
203
+ ```
204
+
205
+ **Override individual labels** of an existing language:
206
+
207
+ ```ts
208
+ provideKptI18n({ messages: { en: { paginator: { rowsPerPage: 'Rows per page:' } } } });
209
+ ```
210
+
211
+ Calendar weekday/month names come from the browser's `Intl` API for the active locale. Per-component label inputs (e.g. `emptyMessage`, `acceptLabel`) still take precedence over the dictionary.
212
+
169
213
  ## Documentation
170
214
 
171
215
  - **Storybook** — interactive docs for every component.
@@ -192,13 +236,16 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
192
236
  - 📊 **Flagowa tabela danych** — sortowanie, filtr, paginacja, virtual scroll, zaznaczanie, przestawianie/zamrażanie kolumn, eksport CSV, szablony komórek.
193
237
  - 🎨 **100% na tokenach** — każdy styl to `var(--kpt-*)`. Motyw jasny/ciemny, neutralna paleta OKLCH.
194
238
  - 🧩 **Standalone** — bez NgModules, tree-shaking.
239
+ - 🌍 **Wbudowane i18n** — angielski (domyślny) i polski, przełączanie języka w runtime, dowolny język jednym plikiem JSON.
195
240
 
196
241
  ### Instalacja
197
242
 
198
243
  ```bash
199
- npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
244
+ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles @angular/cdk
200
245
  ```
201
246
 
247
+ `@angular/core`, `@angular/common` i `@angular/forms` (`^22`) są już w aplikacji Angulara; **`@angular/cdk` (`^22`) to wymagany peer** — komponenty overlay (select, autocomplete, datepicker, date-range, dialog, drawer, tooltip, popover, menu…) bazują na CDK Overlay — więc instaluj go jawnie (powyżej). Opcjonalnie: `@konce-pt/validators` (walidatory PL: NIP, REGON, PESEL, IBAN, kod pocztowy).
248
+
202
249
  ### Konfiguracja
203
250
 
204
251
  **Angular CLI (zalecane)** — dodaj CSS do tablicy **`styles`** w `angular.json`; kolejność ważna, `src/styles.scss` **na końcu**:
@@ -215,8 +262,45 @@ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
215
262
 
216
263
  > W Angular CLI **nie** używaj `import '…css'` w `main.ts` — bundler wrzuca taki CSS do osobnego, niepodlinkowanego arkusza i aplikacja jest bez stylów. Dla **Vite/webpack** import w `main.ts` działa (tak robi playground).
217
264
 
265
+ Zoneless bootstrap (Angular 22) w konfiguracji aplikacji — bez importów CSS w `main.ts`:
266
+
267
+ ```ts
268
+ import { provideZonelessChangeDetection } from '@angular/core';
269
+ // import { provideKptI18n } from '@konce-pt/angular';
270
+ // import { provideKptTablerIcons } from '@konce-pt/angular/icons';
271
+
272
+ providers: [
273
+ provideZonelessChangeDetection(), // wymagane (zoneless)
274
+ // provideKptI18n({ locale: 'pl' }), // opcjonalne — UI domyślnie po angielsku; ustaw dla PL/innego
275
+ // provideKptTablerIcons(), // opcjonalne — pełny zestaw Tabler
276
+ ]
277
+ ```
278
+
279
+ Język UI to domyślnie **angielski** i działa **bez żadnej konfiguracji** — `provideKptI18n(...)` jest opcjonalny, potrzebny tylko dla polskiego (lub własnego języka); szczegóły w sekcji i18n niżej.
280
+
218
281
  Motyw ciemny: `<html data-theme="dark">`; nadpisania `--kpt-color-*` w `styles.scss`. Pełny zestaw ikon Tabler: `provideKptTablerIcons()` z `@konce-pt/angular/icons`.
219
282
 
283
+ ### Internacjonalizacja (i18n)
284
+
285
+ Etykiety komponentów są dostępne po **angielsku (domyślnie)** i **polsku**. Serwis `KptI18n` jest `providedIn: 'root'`, więc **angielski działa od razu, bez providera**. `provideKptI18n(...)` wołasz tylko, by wystartować po polsku (lub w innym języku) albo zarejestrować/nadpisać słowniki. Wszystkie napisy (aria-label, stany puste, paginator, kalendarze, menu edytora) pochodzą z tego serwisu opartego o sygnały — zmiana języka odświeża UI natychmiast (zoneless).
286
+
287
+ ```ts
288
+ import { provideKptI18n } from '@konce-pt/angular';
289
+ // providers: [provideKptI18n({ locale: 'pl' })] // opcjonalne — polski interfejs (EN domyślnie)
290
+ ```
291
+
292
+ Przełączanie w runtime: `inject(KptI18n).setLocale('en')`.
293
+
294
+ **Własny język jednym plikiem JSON** (kształt = kontrakt `KptMessages`; brakujące klucze spadają na EN):
295
+
296
+ ```ts
297
+ import de from './i18n/de.json';
298
+ provideKptI18n({ locale: 'de', messages: { de } });
299
+ ```
300
+
301
+ Nadpisanie pojedynczych etykiet: `provideKptI18n({ messages: { pl: { paginator: { rowsPerPage: 'Na stronie:' } } } })`.
302
+ Nazwy dni/miesięcy w kalendarzach pochodzą z `Intl` wg locale. Inputy etykiet per-komponent (np. `emptyMessage`) mają priorytet nad słownikiem.
303
+
220
304
  ### Komponenty (70+)
221
305
 
222
306
  Formularze (Signal Forms), przyciski i akcje, layout, nawigacja, dane (z flagową `kpt-data-table`), feedback i overlay — pełna lista w tabeli powyżej. Każdy komponent ma plik `llms.txt` z opisem API obok źródła.