@konce-pt/angular 0.4.0 → 0.6.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
@@ -37,11 +37,11 @@
37
37
  ## Installation
38
38
 
39
39
  ```bash
40
- 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
41
41
  # or: pnpm add / yarn add
42
42
  ```
43
43
 
44
- 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). Optional: [`@konce-pt/grid`](https://www.npmjs.com/package/@konce-pt/grid) for the mobile-first layout system — its Angular directives live in `@konce-pt/angular/grid`.
45
45
 
46
46
  ## Setup
47
47
 
@@ -64,9 +64,18 @@ Zoneless bootstrap (Angular 22) lives in your app config — no CSS imports in `
64
64
 
65
65
  ```ts
66
66
  import { provideZonelessChangeDetection } from '@angular/core';
67
- // 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
+ ]
68
75
  ```
69
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
+
70
79
  Dark theme: set `<html data-theme="dark">` (or rely on `prefers-color-scheme`).
71
80
 
72
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.
@@ -169,11 +178,11 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
169
178
 
170
179
  ## Internationalization (i18n)
171
180
 
172
- Component labels ship in **English (default)** and **Polish**. All user-facing strings — aria-labels, empty states, paginator, calendars, rich-text menus — read from a signal-based service, so switching locale updates the UI instantly (zoneless-friendly).
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).
173
182
 
174
183
  ```ts
175
184
  import { provideKptI18n } from '@konce-pt/angular';
176
- // providers: [provideKptI18n({ locale: 'pl' })] // Polish UI
185
+ // providers: [provideKptI18n({ locale: 'pl' })] // optional — Polish UI (EN is the default)
177
186
  ```
178
187
 
179
188
  Switch at runtime:
@@ -232,9 +241,11 @@ Calendar weekday/month names come from the browser's `Intl` API for the active l
232
241
  ### Instalacja
233
242
 
234
243
  ```bash
235
- 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
236
245
  ```
237
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
+
238
249
  ### Konfiguracja
239
250
 
240
251
  **Angular CLI (zalecane)** — dodaj CSS do tablicy **`styles`** w `angular.json`; kolejność ważna, `src/styles.scss` **na końcu**:
@@ -251,15 +262,33 @@ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
251
262
 
252
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).
253
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
+
254
281
  Motyw ciemny: `<html data-theme="dark">`; nadpisania `--kpt-color-*` w `styles.scss`. Pełny zestaw ikon Tabler: `provideKptTablerIcons()` z `@konce-pt/angular/icons`.
255
282
 
283
+ Układ strony: `@konce-pt/grid` (osobna paczka CSS) plus dyrektywy `[kptGrid]`, `[kptCol]`, `[kptFlex]` z `@konce-pt/angular/grid` — siatka mobile-first, utilities flexbox i opcjonalne container queries.
284
+
256
285
  ### Internacjonalizacja (i18n)
257
286
 
258
- Etykiety komponentów są dostępne po **angielsku (domyślnie)** i **polsku**. Wszystkie napisy (aria-label, stany puste, paginator, kalendarze, menu edytora) pochodzą z serwisu opartego o sygnały — zmiana języka odświeża UI natychmiast (zoneless).
287
+ 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).
259
288
 
260
289
  ```ts
261
290
  import { provideKptI18n } from '@konce-pt/angular';
262
- // providers: [provideKptI18n({ locale: 'pl' })] // polski interfejs
291
+ // providers: [provideKptI18n({ locale: 'pl' })] // opcjonalne — polski interfejs (EN domyślnie)
263
292
  ```
264
293
 
265
294
  Przełączanie w runtime: `inject(KptI18n).setLocale('en')`.
package/dist/README.md CHANGED
@@ -37,11 +37,11 @@
37
37
  ## Installation
38
38
 
39
39
  ```bash
40
- 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
41
41
  # or: pnpm add / yarn add
42
42
  ```
43
43
 
44
- 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). Optional: [`@konce-pt/grid`](https://www.npmjs.com/package/@konce-pt/grid) for the mobile-first layout system — its Angular directives live in `@konce-pt/angular/grid`.
45
45
 
46
46
  ## Setup
47
47
 
@@ -64,9 +64,18 @@ Zoneless bootstrap (Angular 22) lives in your app config — no CSS imports in `
64
64
 
65
65
  ```ts
66
66
  import { provideZonelessChangeDetection } from '@angular/core';
67
- // 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
+ ]
68
75
  ```
69
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
+
70
79
  Dark theme: set `<html data-theme="dark">` (or rely on `prefers-color-scheme`).
71
80
 
72
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.
@@ -169,11 +178,11 @@ import { provideKptTablerIcons } from '@konce-pt/angular/icons';
169
178
 
170
179
  ## Internationalization (i18n)
171
180
 
172
- Component labels ship in **English (default)** and **Polish**. All user-facing strings — aria-labels, empty states, paginator, calendars, rich-text menus — read from a signal-based service, so switching locale updates the UI instantly (zoneless-friendly).
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).
173
182
 
174
183
  ```ts
175
184
  import { provideKptI18n } from '@konce-pt/angular';
176
- // providers: [provideKptI18n({ locale: 'pl' })] // Polish UI
185
+ // providers: [provideKptI18n({ locale: 'pl' })] // optional — Polish UI (EN is the default)
177
186
  ```
178
187
 
179
188
  Switch at runtime:
@@ -232,9 +241,11 @@ Calendar weekday/month names come from the browser's `Intl` API for the active l
232
241
  ### Instalacja
233
242
 
234
243
  ```bash
235
- 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
236
245
  ```
237
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
+
238
249
  ### Konfiguracja
239
250
 
240
251
  **Angular CLI (zalecane)** — dodaj CSS do tablicy **`styles`** w `angular.json`; kolejność ważna, `src/styles.scss` **na końcu**:
@@ -251,15 +262,33 @@ npm i @konce-pt/angular @konce-pt/tokens @konce-pt/styles
251
262
 
252
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).
253
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
+
254
281
  Motyw ciemny: `<html data-theme="dark">`; nadpisania `--kpt-color-*` w `styles.scss`. Pełny zestaw ikon Tabler: `provideKptTablerIcons()` z `@konce-pt/angular/icons`.
255
282
 
283
+ Układ strony: `@konce-pt/grid` (osobna paczka CSS) plus dyrektywy `[kptGrid]`, `[kptCol]`, `[kptFlex]` z `@konce-pt/angular/grid` — siatka mobile-first, utilities flexbox i opcjonalne container queries.
284
+
256
285
  ### Internacjonalizacja (i18n)
257
286
 
258
- Etykiety komponentów są dostępne po **angielsku (domyślnie)** i **polsku**. Wszystkie napisy (aria-label, stany puste, paginator, kalendarze, menu edytora) pochodzą z serwisu opartego o sygnały — zmiana języka odświeża UI natychmiast (zoneless).
287
+ 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).
259
288
 
260
289
  ```ts
261
290
  import { provideKptI18n } from '@konce-pt/angular';
262
- // providers: [provideKptI18n({ locale: 'pl' })] // polski interfejs
291
+ // providers: [provideKptI18n({ locale: 'pl' })] // opcjonalne — polski interfejs (EN domyślnie)
263
292
  ```
264
293
 
265
294
  Przełączanie w runtime: `inject(KptI18n).setLocale('en')`.
@@ -0,0 +1,51 @@
1
+ # KptChart (kpt-chart)
2
+
3
+ Wykres SVG w czystym Angularze (sygnały, zoneless), bez zależności typu Chart.js/D3.
4
+ Rdzeń obliczeń to czysty TypeScript (przenośny do React w Fazie 2).
5
+ Import: `import { KptChart } from '@konce-pt/angular/charts';`
6
+
7
+ ## Typy wykresów (config.type)
8
+ - `line` — liniowy; interpolacja `linear` | `cubic` | `cubic-monotonic`; `area?: boolean`, `points?: boolean`,
9
+ `crosshair?: boolean` (hover punktu → pionowa prowadnica + podświetlona pigułka etykiety osi X)
10
+ - `bar` — słupkowy; `orientation: 'vertical' | 'horizontal'`, `borderRadius?: px`
11
+ - `pie` — kołowy
12
+ - `doughnut` — pierścieniowy; `innerRadius?: 0..1` (domyślnie 0.6)
13
+ - `polarArea` — równe kąty, promień ∝ wartość
14
+ - `radar` — osie promieniowe + wielokąt serii
15
+
16
+ ## Wejścia
17
+ - `config: KptChartConfig` (wymagane) — jeden obiekt sterujący całością
18
+ - `width` / `height`: jednostki viewBoxa (600×360); wykres skaluje się do kontenera
19
+
20
+ ## KptChartConfig (skrót)
21
+ - `labels: string[]`, `series: { name; data: number[]; color? }[]`
22
+ - `legend`: `{ display?, position: top|bottom|left|right, align: start|center|end, pointStyle: circle|rect|rectRot|triangle|line, title? }`
23
+ - `title` / `subtitle`: `{ display?, text, align, color?, font?, padding? }`
24
+ - `tooltip`: `{ enabled?, format?(ctx: {series,label,value}): string }`
25
+ - `animation`: `{ enabled?, duration=400, delay=0, stagger=60 }`
26
+
27
+ ## Interakcje
28
+ - Hover na punkcie/słupku/wycinku → tooltip (seria, etykieta, wartość); dymek clampowany do krawędzi.
29
+ - Klik w legendę → ukrycie/pokazanie serii (pie/doughnut/polar: ukrycie wycinka) z przeliczeniem skali.
30
+ - Hover na legendzie → podświetlenie serii, wygaszenie pozostałych.
31
+
32
+ ## Animacje
33
+ Linia: `stroke-dasharray/offset`. Słupki: `scaleY/scaleX` (origin od osi). Wycinki/radar: `scale` od środka.
34
+ Stagger `delay = index * stagger`. Wyłączane przez `animation.enabled=false` i `prefers-reduced-motion`.
35
+
36
+ ## Przykład
37
+ <kpt-chart [config]="{
38
+ type: 'line',
39
+ labels: ['Sty','Lut','Mar'],
40
+ series: [{ name: 'Sprzedaż', data: [12, 19, 7] }],
41
+ interpolation: 'cubic-monotonic',
42
+ legend: { position: 'top' }
43
+ }" />
44
+
45
+ ## Tokeny / stylowanie
46
+ Paleta z tokenów semantycznych (`--kpt-color-primary|info|success|warning|danger` + skala).
47
+ SCSS w `@layer kpt.components`, klasy `kpt-chart__*`. Kolory serii nadpisywalne przez `series[].color`.
48
+
49
+ ## Rdzeń (pure TS, opcjonalnie)
50
+ Eksport funkcji: `linePath`, `areaPath`, `barLayout`, `pieSlices`, `polarSlices`, `radarGrid`,
51
+ `radarPoints`, `niceScale`, `seriesColor`, `KPT_CHART_PALETTE` — do własnych rozszerzeń/SSR.