@konce-pt/react 0.8.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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/accordion/accordion.d.ts +45 -0
  4. package/dist/accordion/accordion.js +69 -0
  5. package/dist/alert/alert.d.ts +25 -0
  6. package/dist/alert/alert.js +31 -0
  7. package/dist/app-shell/app-shell.d.ts +94 -0
  8. package/dist/app-shell/app-shell.js +105 -0
  9. package/dist/auth/auth-types.d.ts +44 -0
  10. package/dist/auth/auth-types.js +2 -0
  11. package/dist/auth/auth.d.ts +76 -0
  12. package/dist/auth/auth.js +184 -0
  13. package/dist/autocomplete/autocomplete.d.ts +18 -0
  14. package/dist/autocomplete/autocomplete.js +72 -0
  15. package/dist/avatar/avatar.d.ts +33 -0
  16. package/dist/avatar/avatar.js +30 -0
  17. package/dist/avatar-group/avatar-group.d.ts +21 -0
  18. package/dist/avatar-group/avatar-group.js +15 -0
  19. package/dist/badge/badge.d.ts +25 -0
  20. package/dist/badge/badge.js +14 -0
  21. package/dist/bottom-sheet/bottom-sheet.d.ts +21 -0
  22. package/dist/bottom-sheet/bottom-sheet.js +22 -0
  23. package/dist/breadcrumb/breadcrumb.d.ts +19 -0
  24. package/dist/breadcrumb/breadcrumb.js +20 -0
  25. package/dist/button/button.d.ts +27 -0
  26. package/dist/button/button.js +49 -0
  27. package/dist/button-group/button-group.d.ts +25 -0
  28. package/dist/button-group/button-group.js +30 -0
  29. package/dist/card/card.d.ts +66 -0
  30. package/dist/card/card.js +96 -0
  31. package/dist/carousel/carousel.d.ts +20 -0
  32. package/dist/carousel/carousel.js +24 -0
  33. package/dist/charts/chart-legend.d.ts +23 -0
  34. package/dist/charts/chart-legend.js +9 -0
  35. package/dist/charts/chart-tooltip.d.ts +21 -0
  36. package/dist/charts/chart-tooltip.js +13 -0
  37. package/dist/charts/chart.d.ts +18 -0
  38. package/dist/charts/chart.js +231 -0
  39. package/dist/charts-entry/public-api.d.ts +4 -0
  40. package/dist/charts-entry/public-api.js +7 -0
  41. package/dist/checkbox/checkbox.d.ts +33 -0
  42. package/dist/checkbox/checkbox.js +29 -0
  43. package/dist/chip/chip.d.ts +22 -0
  44. package/dist/chip/chip.js +16 -0
  45. package/dist/chips-input/chips-input.d.ts +25 -0
  46. package/dist/chips-input/chips-input.js +54 -0
  47. package/dist/clock/clock.d.ts +17 -0
  48. package/dist/clock/clock.js +57 -0
  49. package/dist/color-picker/color-picker.d.ts +23 -0
  50. package/dist/color-picker/color-picker.js +28 -0
  51. package/dist/confirm/confirm-container.d.ts +13 -0
  52. package/dist/confirm/confirm-container.js +26 -0
  53. package/dist/confirm/confirm-store.d.ts +29 -0
  54. package/dist/confirm/confirm-store.js +52 -0
  55. package/dist/context-menu/context-menu.d.ts +21 -0
  56. package/dist/context-menu/context-menu.js +36 -0
  57. package/dist/data-table/data-table-types.d.ts +67 -0
  58. package/dist/data-table/data-table-types.js +1 -0
  59. package/dist/data-table/data-table.d.ts +62 -0
  60. package/dist/data-table/data-table.js +453 -0
  61. package/dist/data-table/export-csv.d.ts +7 -0
  62. package/dist/data-table/export-csv.js +19 -0
  63. package/dist/data-view/data-view.d.ts +21 -0
  64. package/dist/data-view/data-view.js +25 -0
  65. package/dist/date-range/date-range.d.ts +30 -0
  66. package/dist/date-range/date-range.js +155 -0
  67. package/dist/datepicker/datepicker.d.ts +39 -0
  68. package/dist/datepicker/datepicker.js +202 -0
  69. package/dist/dialog/dialog.d.ts +35 -0
  70. package/dist/dialog/dialog.js +59 -0
  71. package/dist/divider/divider.d.ts +16 -0
  72. package/dist/divider/divider.js +13 -0
  73. package/dist/drawer/drawer.d.ts +25 -0
  74. package/dist/drawer/drawer.js +25 -0
  75. package/dist/empty/empty.d.ts +18 -0
  76. package/dist/empty/empty.js +14 -0
  77. package/dist/fab/fab.d.ts +22 -0
  78. package/dist/fab/fab.js +17 -0
  79. package/dist/fieldset/fieldset.d.ts +22 -0
  80. package/dist/fieldset/fieldset.js +24 -0
  81. package/dist/file-upload/file-upload.d.ts +22 -0
  82. package/dist/file-upload/file-upload.js +50 -0
  83. package/dist/form-field/form-field-context.d.ts +23 -0
  84. package/dist/form-field/form-field-context.js +17 -0
  85. package/dist/form-field/form-field.d.ts +39 -0
  86. package/dist/form-field/form-field.js +41 -0
  87. package/dist/galleria/galleria.d.ts +22 -0
  88. package/dist/galleria/galleria.js +21 -0
  89. package/dist/grid/col.d.ts +39 -0
  90. package/dist/grid/col.js +32 -0
  91. package/dist/grid/flex.d.ts +45 -0
  92. package/dist/grid/flex.js +35 -0
  93. package/dist/grid/grid.d.ts +47 -0
  94. package/dist/grid/grid.js +38 -0
  95. package/dist/grid/layout.d.ts +18 -0
  96. package/dist/grid/layout.js +32 -0
  97. package/dist/grid-entry/public-api.d.ts +6 -0
  98. package/dist/grid-entry/public-api.js +8 -0
  99. package/dist/i18n/i18n-context.d.ts +45 -0
  100. package/dist/i18n/i18n-context.js +65 -0
  101. package/dist/icon/icon-registry.d.ts +16 -0
  102. package/dist/icon/icon-registry.js +43 -0
  103. package/dist/icon/icon.d.ts +17 -0
  104. package/dist/icon/icon.js +23 -0
  105. package/dist/icon-button/icon-button.d.ts +23 -0
  106. package/dist/icon-button/icon-button.js +14 -0
  107. package/dist/icons-entry/public-api.d.ts +12 -0
  108. package/dist/icons-entry/public-api.js +20 -0
  109. package/dist/image/image.d.ts +17 -0
  110. package/dist/image/image.js +16 -0
  111. package/dist/input/input.d.ts +41 -0
  112. package/dist/input/input.js +36 -0
  113. package/dist/input-mask/input-mask.d.ts +19 -0
  114. package/dist/input-mask/input-mask.js +65 -0
  115. package/dist/input-number/input-number.d.ts +28 -0
  116. package/dist/input-number/input-number.js +52 -0
  117. package/dist/input-otp/input-otp.d.ts +21 -0
  118. package/dist/input-otp/input-otp.js +59 -0
  119. package/dist/internal/cn.d.ts +9 -0
  120. package/dist/internal/cn.js +19 -0
  121. package/dist/internal/compose-refs.d.ts +6 -0
  122. package/dist/internal/compose-refs.js +16 -0
  123. package/dist/internal/overlay-container.d.ts +3 -0
  124. package/dist/internal/overlay-container.js +19 -0
  125. package/dist/internal/overlay.d.ts +26 -0
  126. package/dist/internal/overlay.js +64 -0
  127. package/dist/internal/slot.d.ts +23 -0
  128. package/dist/internal/slot.js +49 -0
  129. package/dist/internal/types.d.ts +25 -0
  130. package/dist/internal/types.js +1 -0
  131. package/dist/internal/use-breakpoint.d.ts +18 -0
  132. package/dist/internal/use-breakpoint.js +52 -0
  133. package/dist/internal/use-controllable-state.d.ts +11 -0
  134. package/dist/internal/use-controllable-state.js +18 -0
  135. package/dist/internal/use-id.d.ts +9 -0
  136. package/dist/internal/use-id.js +13 -0
  137. package/dist/knob/knob.d.ts +27 -0
  138. package/dist/knob/knob.js +86 -0
  139. package/dist/listbox/listbox.d.ts +28 -0
  140. package/dist/listbox/listbox.js +43 -0
  141. package/dist/map/map-create-dialog.d.ts +21 -0
  142. package/dist/map/map-create-dialog.js +196 -0
  143. package/dist/map/map-hours-field.d.ts +22 -0
  144. package/dist/map/map-hours-field.js +90 -0
  145. package/dist/map/map-image-field.d.ts +24 -0
  146. package/dist/map/map-image-field.js +61 -0
  147. package/dist/map/map-legend.d.ts +29 -0
  148. package/dist/map/map-legend.js +41 -0
  149. package/dist/map/map-poi-card.d.ts +42 -0
  150. package/dist/map/map-poi-card.js +152 -0
  151. package/dist/map/map-search.d.ts +37 -0
  152. package/dist/map/map-search.js +201 -0
  153. package/dist/map/map.d.ts +113 -0
  154. package/dist/map/map.js +425 -0
  155. package/dist/map/ports.d.ts +76 -0
  156. package/dist/map/ports.js +174 -0
  157. package/dist/map-entry/public-api.d.ts +20 -0
  158. package/dist/map-entry/public-api.js +19 -0
  159. package/dist/megamenu/megamenu.d.ts +17 -0
  160. package/dist/megamenu/megamenu.js +28 -0
  161. package/dist/menu/menu-item.d.ts +33 -0
  162. package/dist/menu/menu-item.js +1 -0
  163. package/dist/menu/menu-rows.d.ts +9 -0
  164. package/dist/menu/menu-rows.js +15 -0
  165. package/dist/menu/menu.d.ts +22 -0
  166. package/dist/menu/menu.js +31 -0
  167. package/dist/menubar/menubar.d.ts +16 -0
  168. package/dist/menubar/menubar.js +39 -0
  169. package/dist/meter-group/meter-group.d.ts +20 -0
  170. package/dist/meter-group/meter-group.js +24 -0
  171. package/dist/order-list/order-list.d.ts +18 -0
  172. package/dist/order-list/order-list.js +37 -0
  173. package/dist/paginator/paginator.d.ts +29 -0
  174. package/dist/paginator/paginator.js +45 -0
  175. package/dist/panel/panel.d.ts +31 -0
  176. package/dist/panel/panel.js +36 -0
  177. package/dist/password/password.d.ts +28 -0
  178. package/dist/password/password.js +37 -0
  179. package/dist/pick-list/pick-list.d.ts +28 -0
  180. package/dist/pick-list/pick-list.js +65 -0
  181. package/dist/popover/popover.d.ts +23 -0
  182. package/dist/popover/popover.js +27 -0
  183. package/dist/progress/progress.d.ts +19 -0
  184. package/dist/progress/progress.js +21 -0
  185. package/dist/public-api.d.ts +181 -0
  186. package/dist/public-api.js +105 -0
  187. package/dist/radio-group/radio-group.d.ts +24 -0
  188. package/dist/radio-group/radio-group.js +23 -0
  189. package/dist/rating/rating.d.ts +22 -0
  190. package/dist/rating/rating.js +30 -0
  191. package/dist/rich-text/lists.d.ts +17 -0
  192. package/dist/rich-text/lists.js +144 -0
  193. package/dist/rich-text/rich-text.d.ts +28 -0
  194. package/dist/rich-text/rich-text.js +654 -0
  195. package/dist/rich-text/sanitize.d.ts +10 -0
  196. package/dist/rich-text/sanitize.js +85 -0
  197. package/dist/rich-text/tables.d.ts +44 -0
  198. package/dist/rich-text/tables.js +268 -0
  199. package/dist/roadmap/roadmap.d.ts +37 -0
  200. package/dist/roadmap/roadmap.js +271 -0
  201. package/dist/roadmap-entry/public-api.d.ts +4 -0
  202. package/dist/roadmap-entry/public-api.js +7 -0
  203. package/dist/scroll-top/scroll-top.d.ts +16 -0
  204. package/dist/scroll-top/scroll-top.js +38 -0
  205. package/dist/select/select.d.ts +37 -0
  206. package/dist/select/select.js +117 -0
  207. package/dist/shared/types.d.ts +8 -0
  208. package/dist/shared/types.js +1 -0
  209. package/dist/sidenav/sidenav.d.ts +26 -0
  210. package/dist/sidenav/sidenav.js +41 -0
  211. package/dist/skeleton/skeleton.d.ts +20 -0
  212. package/dist/skeleton/skeleton.js +15 -0
  213. package/dist/slider/slider.d.ts +28 -0
  214. package/dist/slider/slider.js +30 -0
  215. package/dist/speed-dial/speed-dial.d.ts +20 -0
  216. package/dist/speed-dial/speed-dial.js +23 -0
  217. package/dist/spinner/spinner.d.ts +15 -0
  218. package/dist/spinner/spinner.js +14 -0
  219. package/dist/split-button/split-button.d.ts +28 -0
  220. package/dist/split-button/split-button.js +34 -0
  221. package/dist/splitter/splitter.d.ts +39 -0
  222. package/dist/splitter/splitter.js +80 -0
  223. package/dist/stepper/stepper.d.ts +51 -0
  224. package/dist/stepper/stepper.js +71 -0
  225. package/dist/switch/switch.d.ts +39 -0
  226. package/dist/switch/switch.js +30 -0
  227. package/dist/switch-group/switch-group.d.ts +29 -0
  228. package/dist/switch-group/switch-group.js +47 -0
  229. package/dist/tabs/tabs.d.ts +38 -0
  230. package/dist/tabs/tabs.js +74 -0
  231. package/dist/textarea/textarea.d.ts +28 -0
  232. package/dist/textarea/textarea.js +44 -0
  233. package/dist/timeline/timeline.d.ts +19 -0
  234. package/dist/timeline/timeline.js +12 -0
  235. package/dist/toast/toast-container.d.ts +12 -0
  236. package/dist/toast/toast-container.js +23 -0
  237. package/dist/toast/toast-store.d.ts +26 -0
  238. package/dist/toast/toast-store.js +51 -0
  239. package/dist/toolbar/toolbar.d.ts +29 -0
  240. package/dist/toolbar/toolbar.js +24 -0
  241. package/dist/tooltip/tooltip.d.ts +26 -0
  242. package/dist/tooltip/tooltip.js +113 -0
  243. package/dist/tree/tree.d.ts +31 -0
  244. package/dist/tree/tree.js +62 -0
  245. package/package.json +91 -0
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../internal/cn.js";
3
+ import { useControllableState } from "../internal/use-controllable-state.js";
4
+ /**
5
+ * Segmentowana grupa przycisków (toggle) — pojedynczy wybór z opcji.
6
+ *
7
+ * Działa kontrolowana (`value` + `onValueChange`) i niekontrolowana (`defaultValue`).
8
+ *
9
+ * @example
10
+ * <KptButtonGroup value={view} onValueChange={setView}
11
+ * options={[{ label: 'Lista', value: 'list' }, { label: 'Siatka', value: 'grid' }]} />
12
+ */
13
+ export function KptButtonGroup({ options = [], value, defaultValue, onValueChange, size = 'md', disabled = false, onTouch, hostProps, className, ...rest }) {
14
+ const { className: hostClassName, ...hostRest } = hostProps ?? {};
15
+ const [current, setCurrent] = useControllableState({
16
+ value,
17
+ defaultValue,
18
+ onChange: onValueChange,
19
+ });
20
+ const select = (option) => {
21
+ if (option.disabled || disabled)
22
+ return;
23
+ setCurrent(option.value);
24
+ onTouch?.();
25
+ };
26
+ return (_jsx("span", { className: cn('kpt-button-group-host', hostClassName), ...hostRest, children: _jsx("div", { className: cn('kpt-button-group', className), role: "group", "data-size": size, ...rest, children: options.map((option) => {
27
+ const active = option.value === current;
28
+ return (_jsx("button", { type: "button", className: cn('kpt-button-group__item', active && 'is-active'), disabled: disabled || option.disabled, "aria-pressed": active, onClick: () => select(option), children: option.label }, String(option.value)));
29
+ }) }) }));
30
+ }
@@ -0,0 +1,66 @@
1
+ import { type ComponentPropsWithRef } from 'react';
2
+ export type KptCardVariant = 'elevated' | 'outlined';
3
+ export interface KptCardProps extends ComponentPropsWithRef<'div'> {
4
+ /** Wariant wizualny. */
5
+ variant?: KptCardVariant;
6
+ /** Opcjonalny tekst nagłówka. Dla bogatszego nagłówka użyj `<KptCard.Header>`. */
7
+ header?: string;
8
+ /** Body bez wewnętrznego paddingu — dla układów zarządzających własnymi sekcjami. */
9
+ flush?: boolean;
10
+ }
11
+ /**
12
+ * Karta Koncept UI — powierzchnia z wyniesieniem (`elevated`) albo obramowaniem (`outlined`).
13
+ *
14
+ * Ciało karty renderuje sama karta; `flush` zdejmuje jego padding. Do bogatych układów
15
+ * służą komponenty składane: `KptCard.Media`, `.Lead`, `.Title`, `.Subtitle`, `.Section`,
16
+ * `.Tags`, `.Meta`, `.Actions`, `.Header`, `.Footer`.
17
+ *
18
+ * @example
19
+ * <KptCard header="Ustawienia" variant="outlined">
20
+ * <p>Treść…</p>
21
+ * <KptCard.Footer><KptButton>Zapisz</KptButton></KptCard.Footer>
22
+ * </KptCard>
23
+ */
24
+ export declare function KptCard({ variant, header, flush, className, children, ...rest }: Readonly<KptCardProps>): import("react").JSX.Element;
25
+ export declare namespace KptCard {
26
+ var Header: typeof KptCardHeader;
27
+ var Footer: typeof KptCardFooter;
28
+ var Media: typeof KptCardMedia;
29
+ var Lead: typeof KptCardLead;
30
+ var Title: typeof KptCardTitle;
31
+ var Subtitle: typeof KptCardSubtitle;
32
+ var Section: typeof KptCardSection;
33
+ var Tags: typeof KptCardTags;
34
+ var Meta: typeof KptCardMeta;
35
+ var Actions: typeof KptCardActions;
36
+ }
37
+ /** Nagłówek karty — alternatywa dla propa `header`, gdy potrzebna jest bogatsza treść. */
38
+ export declare function KptCardHeader({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
39
+ export declare namespace KptCardHeader {
40
+ var kptCardSlot: "header";
41
+ }
42
+ /**
43
+ * Stopka karty. Nosi atrybut `kptcardfooter` — to po nim celuje wspólny SCSS
44
+ * (nazwy atrybutów w selektorach CSS są w HTML case-insensitive, więc ta sama
45
+ * reguła `[kptCardFooter]` obsługuje oba porty).
46
+ */
47
+ export declare function KptCardFooter({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
48
+ export declare namespace KptCardFooter {
49
+ var kptCardSlot: "footer";
50
+ }
51
+ /** Obraz na pełną szerokość, przycięty do promienia karty. Ustaw `aspect-ratio`/`height`. */
52
+ export declare function KptCardMedia({ className, alt, ...rest }: Readonly<ComponentPropsWithRef<'img'>>): import("react").JSX.Element;
53
+ /** Wiersz nagłówkowy (awatar + tytuły), z paddingiem. */
54
+ export declare function KptCardLead({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
55
+ /** Typografia tytułu. */
56
+ export declare function KptCardTitle({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
57
+ /** Typografia podtytułu (kolor przygaszony). */
58
+ export declare function KptCardSubtitle({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
59
+ /** Sekcja z paddingiem — kolumna z odstępami. */
60
+ export declare function KptCardSection({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
61
+ /** Wiersz chipów/tagów. */
62
+ export declare function KptCardTags({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
63
+ /** Wiersz „ikona + tekst" (ocena, lokalizacja) w przygaszonym kolorze. */
64
+ export declare function KptCardMeta({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
65
+ /** Wiersz przycisków o równych szerokościach. */
66
+ export declare function KptCardActions({ className, ...rest }: Readonly<ComponentPropsWithRef<'div'>>): import("react").JSX.Element;
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, isValidElement } from 'react';
3
+ import { cn } from "../internal/cn.js";
4
+ /*
5
+ * Karta odtwarza projekcję treści z Angulara: nagłówek i stopka są wyjmowane
6
+ * z dzieci i renderowane poza `.kpt-card__body`, dokładnie tam, gdzie stawia je
7
+ * szablon Angulara. Dzięki temu drzewo DOM jest identyczne, a wspólny SCSS
8
+ * (`[kptCardFooter]` poza body) trafia we właściwe węzły.
9
+ */
10
+ /**
11
+ * Karta Koncept UI — powierzchnia z wyniesieniem (`elevated`) albo obramowaniem (`outlined`).
12
+ *
13
+ * Ciało karty renderuje sama karta; `flush` zdejmuje jego padding. Do bogatych układów
14
+ * służą komponenty składane: `KptCard.Media`, `.Lead`, `.Title`, `.Subtitle`, `.Section`,
15
+ * `.Tags`, `.Meta`, `.Actions`, `.Header`, `.Footer`.
16
+ *
17
+ * @example
18
+ * <KptCard header="Ustawienia" variant="outlined">
19
+ * <p>Treść…</p>
20
+ * <KptCard.Footer><KptButton>Zapisz</KptButton></KptCard.Footer>
21
+ * </KptCard>
22
+ */
23
+ export function KptCard({ variant = 'elevated', header, flush = false, className, children, ...rest }) {
24
+ const headers = [];
25
+ const footers = [];
26
+ const body = [];
27
+ Children.forEach(children, (child) => {
28
+ const bucket = isValidElement(child) ? slotOf(child) : 'body';
29
+ if (bucket === 'header')
30
+ headers.push(child);
31
+ else if (bucket === 'footer')
32
+ footers.push(child);
33
+ else
34
+ body.push(child);
35
+ });
36
+ return (_jsxs("div", { className: cn('kpt-card', className), "data-variant": variant, ...rest, children: [header ? _jsx("div", { className: "kpt-card__header", children: header }) : null, headers, _jsx("div", { className: cn('kpt-card__body', flush && 'kpt-card__body--flush'), children: body }), footers] }));
37
+ }
38
+ function slotOf(child) {
39
+ return child.type?.kptCardSlot ?? 'body';
40
+ }
41
+ /** Nagłówek karty — alternatywa dla propa `header`, gdy potrzebna jest bogatsza treść. */
42
+ export function KptCardHeader({ className, ...rest }) {
43
+ return _jsx("div", { className: cn('kpt-card__header', className), ...rest });
44
+ }
45
+ KptCardHeader.kptCardSlot = 'header';
46
+ /**
47
+ * Stopka karty. Nosi atrybut `kptcardfooter` — to po nim celuje wspólny SCSS
48
+ * (nazwy atrybutów w selektorach CSS są w HTML case-insensitive, więc ta sama
49
+ * reguła `[kptCardFooter]` obsługuje oba porty).
50
+ */
51
+ export function KptCardFooter({ className, ...rest }) {
52
+ return _jsx("div", { kptcardfooter: '', className: className, ...rest });
53
+ }
54
+ KptCardFooter.kptCardSlot = 'footer';
55
+ /** Obraz na pełną szerokość, przycięty do promienia karty. Ustaw `aspect-ratio`/`height`. */
56
+ export function KptCardMedia({ className, alt = '', ...rest }) {
57
+ return _jsx("img", { className: cn('kpt-card__media', className), alt: alt, ...rest });
58
+ }
59
+ /** Wiersz nagłówkowy (awatar + tytuły), z paddingiem. */
60
+ export function KptCardLead({ className, ...rest }) {
61
+ return _jsx("div", { className: cn('kpt-card__lead', className), ...rest });
62
+ }
63
+ /** Typografia tytułu. */
64
+ export function KptCardTitle({ className, ...rest }) {
65
+ return _jsx("div", { className: cn('kpt-card__title', className), ...rest });
66
+ }
67
+ /** Typografia podtytułu (kolor przygaszony). */
68
+ export function KptCardSubtitle({ className, ...rest }) {
69
+ return _jsx("div", { className: cn('kpt-card__subtitle', className), ...rest });
70
+ }
71
+ /** Sekcja z paddingiem — kolumna z odstępami. */
72
+ export function KptCardSection({ className, ...rest }) {
73
+ return _jsx("div", { className: cn('kpt-card__section', className), ...rest });
74
+ }
75
+ /** Wiersz chipów/tagów. */
76
+ export function KptCardTags({ className, ...rest }) {
77
+ return _jsx("div", { className: cn('kpt-card__tags', className), ...rest });
78
+ }
79
+ /** Wiersz „ikona + tekst" (ocena, lokalizacja) w przygaszonym kolorze. */
80
+ export function KptCardMeta({ className, ...rest }) {
81
+ return _jsx("div", { className: cn('kpt-card__meta', className), ...rest });
82
+ }
83
+ /** Wiersz przycisków o równych szerokościach. */
84
+ export function KptCardActions({ className, ...rest }) {
85
+ return _jsx("div", { className: cn('kpt-card__actions', className), ...rest });
86
+ }
87
+ KptCard.Header = KptCardHeader;
88
+ KptCard.Footer = KptCardFooter;
89
+ KptCard.Media = KptCardMedia;
90
+ KptCard.Lead = KptCardLead;
91
+ KptCard.Title = KptCardTitle;
92
+ KptCard.Subtitle = KptCardSubtitle;
93
+ KptCard.Section = KptCardSection;
94
+ KptCard.Tags = KptCardTags;
95
+ KptCard.Meta = KptCardMeta;
96
+ KptCard.Actions = KptCardActions;
@@ -0,0 +1,20 @@
1
+ import type { ComponentPropsWithRef, ReactNode } from 'react';
2
+ import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
3
+ export interface KptCarouselProps<T> extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'children'>, KptI18nOverrides {
4
+ items?: T[];
5
+ activeIndex?: number;
6
+ defaultActiveIndex?: number;
7
+ onActiveIndexChange?: (index: number) => void;
8
+ /** Szablon slajdu — odpowiednik `<ng-template let-item let-i="index">` z Angulara. */
9
+ renderSlide: (item: T, index: number) => ReactNode;
10
+ }
11
+ /**
12
+ * Karuzela slajdów. Dane przez `items`, wygląd slajdu przez `renderSlide`.
13
+ *
14
+ * Tor przesuwa się jednym `translateX` o wielokrotność 100%, więc slajdy jadą płynnie, a każdy
15
+ * zostaje zamontowany — przewijanie nie gubi stanu treści.
16
+ *
17
+ * @example
18
+ * <KptCarousel items={photos} renderSlide={(photo) => <img src={photo} style={{ width: '100%' }} />} />
19
+ */
20
+ export declare function KptCarousel<T>({ items, activeIndex, defaultActiveIndex, onActiveIndexChange, renderSlide, locale, dictionary, className, ...rest }: Readonly<KptCarouselProps<T>>): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../internal/cn.js";
3
+ import { useControllableState } from "../internal/use-controllable-state.js";
4
+ import { useKptMessages } from "../i18n/i18n-context.js";
5
+ import { KptIcon } from "../icon/icon.js";
6
+ /**
7
+ * Karuzela slajdów. Dane przez `items`, wygląd slajdu przez `renderSlide`.
8
+ *
9
+ * Tor przesuwa się jednym `translateX` o wielokrotność 100%, więc slajdy jadą płynnie, a każdy
10
+ * zostaje zamontowany — przewijanie nie gubi stanu treści.
11
+ *
12
+ * @example
13
+ * <KptCarousel items={photos} renderSlide={(photo) => <img src={photo} style={{ width: '100%' }} />} />
14
+ */
15
+ export function KptCarousel({ items = [], activeIndex, defaultActiveIndex = 0, onActiveIndexChange, renderSlide, locale, dictionary, className, ...rest }) {
16
+ const { t } = useKptMessages({ locale, dictionary });
17
+ const [active, setActive] = useControllableState({
18
+ value: activeIndex,
19
+ defaultValue: defaultActiveIndex,
20
+ onChange: onActiveIndexChange,
21
+ });
22
+ const goTo = (index) => setActive(Math.min(Math.max(index, 0), items.length - 1));
23
+ return (_jsx("div", { className: cn('kpt-carousel-host', className), ...rest, children: _jsxs("div", { className: "kpt-carousel", children: [_jsx("div", { className: "kpt-carousel__viewport", children: _jsx("div", { className: "kpt-carousel__track", style: { transform: `translateX(-${active * 100}%)` }, children: items.map((item, index) => (_jsx("div", { className: "kpt-carousel__slide", children: renderSlide(item, index) }, index))) }) }), _jsx("button", { type: "button", className: "kpt-carousel__nav kpt-carousel__nav--prev", disabled: active === 0, "aria-label": t('common.previous'), onClick: () => goTo(active - 1), children: _jsx(KptIcon, { name: "chevron-left" }) }), _jsx("button", { type: "button", className: "kpt-carousel__nav kpt-carousel__nav--next", disabled: active >= items.length - 1, "aria-label": t('common.next'), onClick: () => goTo(active + 1), children: _jsx(KptIcon, { name: "chevron-right" }) }), _jsx("div", { className: "kpt-carousel__dots", children: items.map((_, index) => (_jsx("button", { type: "button", className: cn('kpt-carousel__dot', index === active && 'is-active'), "aria-label": t('carousel.slide', { index: index + 1 }), onClick: () => goTo(index) }, index))) })] }) }));
24
+ }
@@ -0,0 +1,23 @@
1
+ import type { KptAlign, KptLegendPosition, KptLegendTitle, KptPointStyle } from '@konce-pt/chart';
2
+ export interface KptChartLegendItem {
3
+ key: string;
4
+ name: string;
5
+ color: string;
6
+ hidden: boolean;
7
+ }
8
+ export interface KptChartLegendProps {
9
+ items?: KptChartLegendItem[];
10
+ position?: KptLegendPosition;
11
+ align?: KptAlign;
12
+ pointStyle?: KptPointStyle;
13
+ title?: KptLegendTitle;
14
+ /** Kliknięcie elementu — przełącz widoczność serii albo wycinka. */
15
+ onToggle?: (key: string) => void;
16
+ /** Wejście i wyjście kursora — podświetl serię albo wyczyść podświetlenie. */
17
+ onHighlight?: (key: string | null) => void;
18
+ }
19
+ /**
20
+ * Legenda wykresu — klikalne elementy, podświetlanie pod kursorem, pozycja, wyrównanie i styl
21
+ * punktu. Element wewnętrzny biblioteki, nie część publicznego API.
22
+ */
23
+ export declare function KptChartLegend({ items, position, align, pointStyle, title, onToggle, onHighlight, }: Readonly<KptChartLegendProps>): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../internal/cn.js";
3
+ /**
4
+ * Legenda wykresu — klikalne elementy, podświetlanie pod kursorem, pozycja, wyrównanie i styl
5
+ * punktu. Element wewnętrzny biblioteki, nie część publicznego API.
6
+ */
7
+ export function KptChartLegend({ items = [], position = 'bottom', align = 'center', pointStyle = 'circle', title, onToggle, onHighlight, }) {
8
+ return (_jsx("div", { className: "kpt-chart-legend-host", children: _jsxs("div", { className: "kpt-chart__legend", "data-position": position, "data-align": align, children: [title?.display && title.text ? (_jsx("div", { className: "kpt-chart__legend-title", "data-align": title.position ?? 'start', children: title.text })) : null, _jsx("ul", { className: "kpt-chart__legend-list", children: items.map((item) => (_jsx("li", { children: _jsxs("button", { type: "button", className: cn('kpt-chart__legend-item', item.hidden && 'kpt-chart__legend-item--hidden'), onClick: () => onToggle?.(item.key), onPointerEnter: () => onHighlight?.(item.key), onPointerLeave: () => onHighlight?.(null), children: [_jsx("span", { className: "kpt-chart__legend-marker", "data-style": pointStyle, style: { ['--kpt-chart-legend-color']: item.color } }), _jsx("span", { className: "kpt-chart__legend-label", children: item.name })] }) }, item.key))) })] }) }));
9
+ }
@@ -0,0 +1,21 @@
1
+ export interface KptChartTooltipRow {
2
+ name: string;
3
+ value: string;
4
+ color: string;
5
+ }
6
+ export interface KptChartTooltipState {
7
+ /** Pozycja pozioma w % szerokości kontenera (0–100). */
8
+ x: number;
9
+ /** Pozycja pionowa w % wysokości kontenera (0–100). */
10
+ y: number;
11
+ label: string;
12
+ rows: KptChartTooltipRow[];
13
+ }
14
+ export interface KptChartTooltipProps {
15
+ state: KptChartTooltipState | null;
16
+ }
17
+ /**
18
+ * Dymek wykresu — pozycjonowany procentowo względem kontenera, niezależnie od skali SVG, więc
19
+ * nie trzeba przeliczać jednostek viewBoxa na piksele. Element wewnętrzny biblioteki.
20
+ */
21
+ export declare function KptChartTooltip({ state }: Readonly<KptChartTooltipProps>): import("react").JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../internal/cn.js";
3
+ /**
4
+ * Dymek wykresu — pozycjonowany procentowo względem kontenera, niezależnie od skali SVG, więc
5
+ * nie trzeba przeliczać jednostek viewBoxa na piksele. Element wewnętrzny biblioteki.
6
+ */
7
+ export function KptChartTooltip({ state }) {
8
+ if (!state)
9
+ return null;
10
+ // Margines 6% trzyma dymek w granicach kontenera przy skrajnych punktach.
11
+ const left = Math.min(94, Math.max(6, state.x));
12
+ return (_jsx("div", { className: "kpt-chart-tooltip-host", children: _jsxs("div", { className: cn('kpt-chart__tooltip', state.y < 22 && 'kpt-chart__tooltip--flip'), style: { left: `${left}%`, top: `${state.y}%` }, role: "tooltip", children: [state.label ? _jsx("div", { className: "kpt-chart__tooltip-title", children: state.label }) : null, state.rows.map((row, index) => (_jsxs("div", { className: "kpt-chart__tooltip-row", children: [_jsx("span", { className: "kpt-chart__tooltip-dot", style: { backgroundColor: row.color } }), _jsx("span", { className: "kpt-chart__tooltip-name", children: row.name }), _jsx("span", { className: "kpt-chart__tooltip-val", children: row.value })] }, index)))] }) }));
13
+ }
@@ -0,0 +1,18 @@
1
+ import { type ComponentPropsWithRef } from 'react';
2
+ import { type KptChartConfig } from '@konce-pt/chart';
3
+ export interface KptChartProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
4
+ config: KptChartConfig;
5
+ /** Szerokość viewBoxa w jednostkach SVG; wykres skaluje się do kontenera. */
6
+ width?: number;
7
+ /** Wysokość viewBoxa w jednostkach SVG. */
8
+ height?: number;
9
+ }
10
+ /**
11
+ * Wykres SVG sterowany jednym obiektem `config`: line, bar, pie, doughnut, polarArea, radar.
12
+ * Cała geometria pochodzi z `@konce-pt/chart` — paczki bez frameworka, wspólnej z portem
13
+ * Angulara; komponent renderuje wyłącznie SVG, bez manipulacji DOM.
14
+ *
15
+ * @example
16
+ * <KptChart config={{ type: 'line', labels: ['Sty', 'Lut'], series: [{ name: 'Sprzedaż', data: [12, 19] }] }} />
17
+ */
18
+ export declare function KptChart({ config, width, height, className, style, ...rest }: Readonly<KptChartProps>): import("react").JSX.Element;
@@ -0,0 +1,231 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { areaPath, bandScale, barLayout, extent, formatNumber, linePath, linearScale, niceScale, pieSlices, plotArea, polarSlices, polarToCartesian, polygonPath, radarGrid, radarPoints, radialArea, seriesColor, } from '@konce-pt/chart';
4
+ import { cn } from "../internal/cn.js";
5
+ import { KptChartLegend } from "./chart-legend.js";
6
+ import { KptChartTooltip } from "./chart-tooltip.js";
7
+ const VERTICAL_INSETS = { top: 12, right: 16, bottom: 28, left: 46 };
8
+ const HORIZONTAL_INSETS = { top: 12, right: 16, bottom: 28, left: 76 };
9
+ function styleFor(align) {
10
+ if (align === 'center')
11
+ return 'center';
12
+ if (align === 'end')
13
+ return 'right';
14
+ return 'left';
15
+ }
16
+ /**
17
+ * Wykres SVG sterowany jednym obiektem `config`: line, bar, pie, doughnut, polarArea, radar.
18
+ * Cała geometria pochodzi z `@konce-pt/chart` — paczki bez frameworka, wspólnej z portem
19
+ * Angulara; komponent renderuje wyłącznie SVG, bez manipulacji DOM.
20
+ *
21
+ * @example
22
+ * <KptChart config={{ type: 'line', labels: ['Sty', 'Lut'], series: [{ name: 'Sprzedaż', data: [12, 19] }] }} />
23
+ */
24
+ export function KptChart({ config, width = 600, height = 360, className, style, ...rest }) {
25
+ const [hidden, setHidden] = useState(new Set());
26
+ const [highlighted, setHighlighted] = useState(null);
27
+ const [tooltip, setTooltip] = useState(null);
28
+ /** Indeks kategorii pod kursorem — prowadnica crosshair w wykresie liniowym. */
29
+ const [activeIndex, setActiveIndex] = useState(null);
30
+ const anim = {
31
+ enabled: config.animation?.enabled ?? true,
32
+ duration: config.animation?.duration ?? 400,
33
+ delay: config.animation?.delay ?? 0,
34
+ stagger: config.animation?.stagger ?? 60,
35
+ };
36
+ const legendOpts = {
37
+ display: config.legend?.display ?? true,
38
+ position: config.legend?.position ?? 'bottom',
39
+ align: config.legend?.align ?? 'center',
40
+ pointStyle: config.legend?.pointStyle ?? 'circle',
41
+ title: config.legend?.title,
42
+ };
43
+ const isPieLike = config.type === 'pie' || config.type === 'doughnut' || config.type === 'polarArea';
44
+ const legendItems = isPieLike
45
+ ? config.labels.map((label, i) => ({
46
+ key: `cat:${i}`,
47
+ name: label,
48
+ color: seriesColor(config.series[0]?.color, i),
49
+ hidden: hidden.has(`cat:${i}`),
50
+ }))
51
+ : config.series.map((s, i) => ({
52
+ key: `ser:${s.name}`,
53
+ name: s.name,
54
+ color: seriesColor(s.color, i),
55
+ hidden: hidden.has(`ser:${s.name}`),
56
+ }));
57
+ const dim = (key) => highlighted !== null && highlighted !== key;
58
+ const showTip = (tipX, tipY, name, label, value, color) => {
59
+ if (config.tooltip?.enabled === false)
60
+ return;
61
+ const format = config.tooltip?.format;
62
+ const text = format ? format({ series: name, label, value }) : formatNumber(value);
63
+ setTooltip({ x: (tipX / width) * 100, y: (tipY / height) * 100, label, rows: [{ name, value: text, color }] });
64
+ };
65
+ const hideTip = () => setTooltip(null);
66
+ const toggle = (key) => {
67
+ const next = new Set(hidden);
68
+ if (next.has(key))
69
+ next.delete(key);
70
+ else
71
+ next.add(key);
72
+ setHidden(next);
73
+ };
74
+ // ── Wykres liniowy ──
75
+ const lineVm = (() => {
76
+ if (config.type !== 'line')
77
+ return null;
78
+ const active = config.series.map((s, i) => ({ s, i })).filter(({ s }) => !hidden.has(`ser:${s.name}`));
79
+ const values = active.flatMap(({ s }) => s.data);
80
+ const [mn, mx] = extent(values.length ? values : [0]);
81
+ const scale = niceScale(Math.min(0, mn), Math.max(0, mx), 5);
82
+ const plot = plotArea(width, height, VERTICAL_INSETS);
83
+ const yScale = linearScale(scale.min, scale.max, plot.y + plot.height, plot.y);
84
+ const count = config.labels.length;
85
+ const xAt = (i) => count > 1 ? plot.x + (i / (count - 1)) * plot.width : plot.x + plot.width / 2;
86
+ const baseline = yScale(0);
87
+ const interpolation = config.interpolation ?? 'linear';
88
+ const showPoints = config.points ?? true;
89
+ const grid = scale.ticks.map((t) => ({
90
+ x1: plot.x,
91
+ y1: yScale(t),
92
+ x2: plot.x + plot.width,
93
+ y2: yScale(t),
94
+ }));
95
+ const valueLabels = scale.ticks.map((t) => ({
96
+ x: plot.x - 8,
97
+ y: yScale(t) + 3,
98
+ text: formatNumber(t),
99
+ anchor: 'end',
100
+ }));
101
+ const catLabels = config.labels.map((label, i) => ({
102
+ x: xAt(i),
103
+ y: plot.y + plot.height + 18,
104
+ text: label,
105
+ anchor: 'middle',
106
+ }));
107
+ const crosshairCat = config.crosshair && activeIndex !== null ? catLabels[activeIndex] : undefined;
108
+ const pillWidth = crosshairCat ? Math.max(28, crosshairCat.text.length * 7 + 16) : 0;
109
+ return (_jsxs(_Fragment, { children: [_jsx("g", { className: "kpt-chart__grid", children: grid.map((g, i) => (_jsx("line", { className: "kpt-chart__gridline", x1: g.x1, y1: g.y1, x2: g.x2, y2: g.y2 }, i))) }), crosshairCat ? (_jsx("line", { className: "kpt-chart__crosshair", x1: crosshairCat.x, y1: plot.y, x2: crosshairCat.x, y2: plot.y + plot.height })) : null, _jsx("g", { className: "kpt-chart__axis", children: [...valueLabels, ...catLabels].map((l, i) => (_jsx("text", { x: l.x, y: l.y, textAnchor: l.anchor, children: l.text }, i))) }), crosshairCat ? (_jsxs("g", { className: "kpt-chart__cat-active", children: [_jsx("rect", { x: crosshairCat.x - pillWidth / 2, y: crosshairCat.y - 13, width: pillWidth, height: 18, rx: 9 }), _jsx("text", { x: crosshairCat.x, y: crosshairCat.y, textAnchor: "middle", children: crosshairCat.text })] })) : null, active.map(({ s, i }) => {
110
+ const key = `ser:${s.name}`;
111
+ const color = seriesColor(s.color, i);
112
+ const points = s.data.map((v, idx) => ({
113
+ x: xAt(idx),
114
+ y: yScale(v),
115
+ value: v,
116
+ label: config.labels[idx] ?? '',
117
+ }));
118
+ return (_jsxs("g", { className: cn('kpt-chart__series', dim(key) && 'kpt-chart__series--dim'), children: [config.area ? (_jsx("path", { className: "kpt-chart__area", d: areaPath(points, baseline, interpolation), style: { fill: color } })) : null, _jsx("path", { className: "kpt-chart__line", d: linePath(points, interpolation), style: { stroke: color }, pathLength: 1 }), points.map((p, idx) => (_jsxs("g", { children: [showPoints ? (_jsx("circle", { className: cn('kpt-chart__point', activeIndex === idx && 'kpt-chart__point--active'), cx: p.x, cy: p.y, r: 4, style: { fill: color, ['--kpt-chart-i']: idx } })) : null, _jsx("circle", { className: "kpt-chart__hit", cx: p.x, cy: p.y, r: 12, onPointerEnter: () => {
119
+ setActiveIndex(idx);
120
+ showTip(p.x, p.y, s.name, p.label, p.value, color);
121
+ }, onPointerLeave: () => {
122
+ setActiveIndex(null);
123
+ hideTip();
124
+ } })] }, idx)))] }, key));
125
+ })] }));
126
+ })();
127
+ // ── Wykres słupkowy ──
128
+ const barVm = (() => {
129
+ if (config.type !== 'bar')
130
+ return null;
131
+ const orientation = config.orientation ?? 'vertical';
132
+ const active = config.series.map((s, i) => ({ s, i })).filter(({ s }) => !hidden.has(`ser:${s.name}`));
133
+ const plot = plotArea(width, height, orientation === 'vertical' ? VERTICAL_INSETS : HORIZONTAL_INSETS);
134
+ const layout = barLayout(active.map(({ s }) => s.data), config.labels.length, plot, orientation, config.borderRadius ?? 4);
135
+ const colors = active.map(({ s, i }) => seriesColor(s.color, i));
136
+ const names = active.map(({ s }) => s.name);
137
+ const cat = orientation === 'vertical'
138
+ ? bandScale(config.labels.length, plot.x, plot.x + plot.width, 0.2)
139
+ : bandScale(config.labels.length, plot.y, plot.y + plot.height, 0.2);
140
+ const grid = orientation === 'vertical'
141
+ ? layout.ticks.map((t) => ({ x1: plot.x, y1: t.pos, x2: plot.x + plot.width, y2: t.pos }))
142
+ : layout.ticks.map((t) => ({ x1: t.pos, y1: plot.y, x2: t.pos, y2: plot.y + plot.height }));
143
+ const valueLabels = orientation === 'vertical'
144
+ ? layout.ticks.map((t) => ({ x: plot.x - 8, y: t.pos + 3, text: formatNumber(t.value), anchor: 'end' }))
145
+ : layout.ticks.map((t) => ({
146
+ x: t.pos,
147
+ y: plot.y + plot.height + 18,
148
+ text: formatNumber(t.value),
149
+ anchor: 'middle',
150
+ }));
151
+ const catLabels = orientation === 'vertical'
152
+ ? config.labels.map((l, i) => ({ x: cat.center(i), y: plot.y + plot.height + 18, text: l, anchor: 'middle' }))
153
+ : config.labels.map((l, i) => ({ x: plot.x - 8, y: cat.center(i) + 3, text: l, anchor: 'end' }));
154
+ return (_jsxs(_Fragment, { children: [_jsx("g", { className: "kpt-chart__grid", children: grid.map((g, i) => (_jsx("line", { className: "kpt-chart__gridline", x1: g.x1, y1: g.y1, x2: g.x2, y2: g.y2 }, i))) }), _jsx("g", { className: "kpt-chart__axis", children: [...valueLabels, ...catLabels].map((l, i) => (_jsx("text", { x: l.x, y: l.y, textAnchor: l.anchor, children: l.text }, i))) }), _jsx("g", { className: "kpt-chart__bars", "data-orientation": orientation, children: layout.bars.map((b, order) => {
155
+ const key = `ser:${names[b.seriesIndex]}`;
156
+ const color = colors[b.seriesIndex];
157
+ const tipX = orientation === 'vertical' ? b.rect.x + b.rect.width / 2 : b.rect.x + b.rect.width;
158
+ const tipY = orientation === 'vertical' ? b.rect.y : b.rect.y + b.rect.height / 2;
159
+ return (_jsx("path", { className: cn('kpt-chart__bar', dim(key) && 'kpt-chart__series--dim'), d: b.path, style: { fill: color, ['--kpt-chart-i']: order }, onPointerEnter: () => showTip(tipX, tipY, names[b.seriesIndex], config.labels[b.categoryIndex] ?? '', b.value, color), onPointerLeave: hideTip }, `${key}#${order}`));
160
+ }) })] }));
161
+ })();
162
+ // ── Pie / doughnut / polar area ──
163
+ const pieVm = (() => {
164
+ if (!isPieLike)
165
+ return null;
166
+ const first = config.series[0];
167
+ if (!first)
168
+ return null;
169
+ const { cx, cy, radius } = radialArea(width, height, 8);
170
+ const entries = config.labels
171
+ .map((label, i) => ({ label, i, value: first.data[i] ?? 0, color: seriesColor(first.color, i) }))
172
+ .filter((entry) => !hidden.has(`cat:${entry.i}`));
173
+ const values = entries.map((entry) => entry.value);
174
+ const slices = config.type === 'polarArea'
175
+ ? polarSlices(values, cx, cy, radius, Math.max(1, ...values.map((v) => Math.max(0, v))))
176
+ : pieSlices(values, cx, cy, radius, config.type === 'doughnut' ? radius * (config.innerRadius ?? 0.6) : 0);
177
+ const tipRadius = config.type === 'polarArea'
178
+ ? radius * 0.62
179
+ : (radius + (config.type === 'doughnut' ? radius * (config.innerRadius ?? 0.6) : 0)) / 2;
180
+ return (_jsx("g", { className: "kpt-chart__slices", children: slices.map((slice, k) => {
181
+ const entry = entries[k];
182
+ const tip = polarToCartesian(cx, cy, tipRadius, slice.midAngle);
183
+ const key = `cat:${entry.i}`;
184
+ return (_jsx("path", { className: cn('kpt-chart__slice', dim(key) && 'kpt-chart__series--dim'), d: slice.path, style: { fill: entry.color, ['--kpt-chart-i']: k }, onPointerEnter: () => showTip(tip.x, tip.y, entry.label, '', entry.value, entry.color), onPointerLeave: hideTip }, key));
185
+ }) }));
186
+ })();
187
+ // ── Radar ──
188
+ const radarVm = (() => {
189
+ if (config.type !== 'radar')
190
+ return null;
191
+ const { cx, cy, radius } = radialArea(width, height, 30);
192
+ const grid = radarGrid(config.labels.length, cx, cy, radius, 4);
193
+ const active = config.series.map((s, i) => ({ s, i })).filter(({ s }) => !hidden.has(`ser:${s.name}`));
194
+ let max = 1;
195
+ for (const { s } of active)
196
+ for (const v of s.data)
197
+ max = Math.max(max, v);
198
+ return (_jsxs(_Fragment, { children: [_jsxs("g", { className: "kpt-chart__grid", children: [grid.rings.map((ring, i) => (_jsx("path", { className: "kpt-chart__ring", d: ring }, i))), grid.axes.map((axis, i) => (_jsx("line", { className: "kpt-chart__gridline", x1: cx, y1: cy, x2: axis.end.x, y2: axis.end.y }, i)))] }), _jsx("g", { className: "kpt-chart__axis", children: grid.axes.map((axis, i) => {
199
+ const p = polarToCartesian(cx, cy, radius + 14, axis.angle);
200
+ const anchor = Math.abs(p.x - cx) < 1 ? 'middle' : p.x > cx ? 'start' : 'end';
201
+ return (_jsx("text", { x: p.x, y: p.y + 3, textAnchor: anchor, children: config.labels[axis.labelIndex] ?? '' }, i));
202
+ }) }), active.map(({ s, i }) => {
203
+ const key = `ser:${s.name}`;
204
+ const color = seriesColor(s.color, i);
205
+ const points = radarPoints(s.data, cx, cy, radius, max);
206
+ return (_jsxs("g", { className: cn('kpt-chart__series kpt-chart__radar', dim(key) && 'kpt-chart__series--dim'), children: [_jsx("path", { className: "kpt-chart__radar-area", d: polygonPath(points), style: { fill: color, stroke: color } }), points.map((p, idx) => (_jsx("circle", { className: "kpt-chart__point", cx: p.x, cy: p.y, r: 4, style: { fill: color, ['--kpt-chart-i']: idx }, onPointerEnter: () => showTip(p.x, p.y, s.name, config.labels[idx] ?? '', s.data[idx] ?? 0, color), onPointerLeave: hideTip }, idx)))] }, key));
207
+ })] }));
208
+ })();
209
+ return (_jsx("div", { className: cn('kpt-chart-host', !anim.enabled && 'kpt-chart--no-anim', className), style: {
210
+ ['--kpt-chart-duration']: `${anim.duration}ms`,
211
+ ['--kpt-chart-stagger']: `${anim.stagger}ms`,
212
+ ['--kpt-chart-delay']: `${anim.delay}ms`,
213
+ ...style,
214
+ }, ...rest, children: _jsxs("div", { className: "kpt-chart", "data-legend": legendOpts.display ? legendOpts.position : undefined, children: [config.title?.display && config.title.text ? (_jsx("div", { className: "kpt-chart__title", style: {
215
+ textAlign: styleFor(config.title.align),
216
+ color: config.title.color,
217
+ fontFamily: config.title.font?.family,
218
+ fontSize: config.title.font?.size,
219
+ fontWeight: config.title.font?.weight,
220
+ paddingTop: config.title.padding?.top,
221
+ paddingBottom: config.title.padding?.bottom,
222
+ }, children: config.title.text })) : null, config.subtitle?.display && config.subtitle.text ? (_jsx("div", { className: "kpt-chart__subtitle", style: {
223
+ textAlign: styleFor(config.subtitle.align),
224
+ color: config.subtitle.color,
225
+ fontFamily: config.subtitle.font?.family,
226
+ fontSize: config.subtitle.font?.size,
227
+ fontWeight: config.subtitle.font?.weight,
228
+ paddingTop: config.subtitle.padding?.top,
229
+ paddingBottom: config.subtitle.padding?.bottom,
230
+ }, children: config.subtitle.text })) : null, _jsxs("div", { className: "kpt-chart__body", children: [_jsxs("div", { className: "kpt-chart__canvas", children: [_jsxs("svg", { className: "kpt-chart__svg", viewBox: `0 0 ${width} ${height}`, role: "img", preserveAspectRatio: "xMidYMid meet", children: [lineVm, barVm, radarVm, pieVm] }), _jsx(KptChartTooltip, { state: tooltip })] }), legendOpts.display ? (_jsx(KptChartLegend, { items: legendItems, position: legendOpts.position, align: legendOpts.align, pointStyle: legendOpts.pointStyle, title: legendOpts.title, onToggle: toggle, onHighlight: setHighlighted })) : null] })] }) }));
231
+ }
@@ -0,0 +1,4 @@
1
+ export { KptChart } from '../charts/chart.tsx';
2
+ export type { KptChartProps } from '../charts/chart.tsx';
3
+ export type { KptChartConfig, KptChartSeries, KptChartType, KptLineInterpolation, KptBarOrientation, KptLegendOptions, KptLegendPosition, KptLegendTitle, KptAlign, KptPointStyle, KptTitleOptions, KptTooltipOptions, KptTooltipContext, KptAnimationOptions, KptFont, KptPadding, } from '@konce-pt/chart';
4
+ export { KPT_CHART_PALETTE, seriesColor, linePath, areaPath, pieSlices, polarSlices, barLayout, radarGrid, radarPoints, niceScale, } from '@konce-pt/chart';
@@ -0,0 +1,7 @@
1
+ /*
2
+ * @konce-pt/react/charts — wykresy SVG. Osobny subpath, bo geometria i style wykresów są
3
+ * ciężkie względem rdzenia biblioteki i nie każda aplikacja ich potrzebuje.
4
+ */
5
+ export { KptChart } from "../charts/chart.js";
6
+ // Rdzeń obliczeniowy — przydatny do własnych rozszerzeń i renderowania po stronie serwera.
7
+ export { KPT_CHART_PALETTE, seriesColor, linePath, areaPath, pieSlices, polarSlices, barLayout, radarGrid, radarPoints, niceScale, } from '@konce-pt/chart';
@@ -0,0 +1,33 @@
1
+ import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
+ import type { KptHostProps } from '../internal/types.ts';
3
+ export interface KptCheckboxProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'required'> {
4
+ /** Etykieta obok pola. Bogatszą treść podaj jako `children`. */
5
+ label?: string;
6
+ /** Oznacza pole jako wymagane atrybutem `aria-required`, a NIE natywnym `required`. */
7
+ required?: boolean;
8
+ /** Pole jest nieprawidłowe. Widoczne dopiero, gdy `touched` też jest prawdziwe. */
9
+ invalid?: boolean;
10
+ /** Czy pole było dotknięte; pominięty = stan błędu pokazuje się od razu po `invalid`. */
11
+ touched?: boolean;
12
+ /** Wygodniejszy odpowiednik `onChange` — dostaje samo zaznaczenie. */
13
+ onCheckedChange?: (checked: boolean) => void;
14
+ /** Wywoływane na `blur`. */
15
+ onTouch?: () => void;
16
+ /** Propsy wrappera hosta (`.kpt-checkbox-host`). */
17
+ hostProps?: KptHostProps<'span'>;
18
+ children?: ReactNode;
19
+ }
20
+ /**
21
+ * Pole wyboru (checkbox). Cały układ niesie `<label>`, więc kliknięcie w etykietę przełącza pole
22
+ * bez `htmlFor` — natywny `<input>` w środku odpowiada za semantykę i klawiaturę.
23
+ *
24
+ * Działa kontrolowane (`checked` + `onCheckedChange`) i niekontrolowane (`defaultChecked`).
25
+ *
26
+ * `className` trafia na blok `.kpt-checkbox`, a pozostałe propsy (`name`, `value`, `ref`,
27
+ * handlery) na natywny `<input>` — tam, gdzie oczekuje ich formularz.
28
+ *
29
+ * @example
30
+ * <KptCheckbox name="terms" label="Akceptuję regulamin" />
31
+ * <KptCheckbox checked={on} onCheckedChange={setOn} />
32
+ */
33
+ export declare function KptCheckbox({ label, required, invalid, touched, onCheckedChange, onTouch, hostProps, className, disabled, onChange, onBlur, children, 'aria-invalid': ariaInvalid, ...rest }: Readonly<KptCheckboxProps>): import("react").JSX.Element;