@konce-pt/react 0.11.2 → 0.14.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 (382) hide show
  1. package/README.md +128 -64
  2. package/dist/accordion/accordion.d.ts +14 -6
  3. package/dist/accordion/accordion.js +25 -17
  4. package/dist/accordion/llms.txt +22 -10
  5. package/dist/alert/alert.d.ts +2 -2
  6. package/dist/alert/alert.js +3 -2
  7. package/dist/alert/llms.txt +10 -9
  8. package/dist/app-shell/app-shell.d.ts +14 -14
  9. package/dist/app-shell/app-shell.js +22 -15
  10. package/dist/app-shell/llms.txt +16 -15
  11. package/dist/auth/auth-types.d.ts +6 -6
  12. package/dist/auth/auth.d.ts +2 -2
  13. package/dist/auth/auth.js +24 -15
  14. package/dist/auth/llms.txt +12 -11
  15. package/dist/autocomplete/autocomplete.d.ts +19 -6
  16. package/dist/autocomplete/autocomplete.js +32 -11
  17. package/dist/autocomplete/llms.txt +19 -5
  18. package/dist/avatar/avatar.d.ts +6 -6
  19. package/dist/avatar/avatar.js +6 -5
  20. package/dist/avatar/llms.txt +10 -10
  21. package/dist/avatar-group/avatar-group.d.ts +4 -4
  22. package/dist/avatar-group/avatar-group.js +4 -3
  23. package/dist/avatar-group/llms.txt +8 -8
  24. package/dist/backdrop/backdrop.d.ts +7 -26
  25. package/dist/backdrop/backdrop.js +32 -27
  26. package/dist/backdrop/llms.txt +27 -27
  27. package/dist/badge/badge.d.ts +3 -3
  28. package/dist/badge/badge.js +1 -1
  29. package/dist/badge/llms.txt +11 -11
  30. package/dist/bottom-sheet/bottom-sheet.d.ts +8 -3
  31. package/dist/bottom-sheet/bottom-sheet.js +5 -4
  32. package/dist/bottom-sheet/llms.txt +11 -8
  33. package/dist/breadcrumb/breadcrumb.d.ts +8 -2
  34. package/dist/breadcrumb/breadcrumb.js +11 -3
  35. package/dist/breadcrumb/llms.txt +10 -2
  36. package/dist/button/button.d.ts +3 -3
  37. package/dist/button/button.js +10 -9
  38. package/dist/button/llms.txt +27 -19
  39. package/dist/button-group/button-group.d.ts +18 -5
  40. package/dist/button-group/button-group.js +54 -6
  41. package/dist/button-group/llms.txt +27 -18
  42. package/dist/card/card.d.ts +8 -8
  43. package/dist/card/card.js +10 -9
  44. package/dist/card/llms.txt +20 -20
  45. package/dist/carousel/carousel.d.ts +6 -6
  46. package/dist/carousel/carousel.js +8 -5
  47. package/dist/carousel/llms.txt +10 -10
  48. package/dist/charts/chart-legend.d.ts +3 -3
  49. package/dist/charts/chart-legend.js +2 -1
  50. package/dist/charts/chart-tooltip.d.ts +3 -3
  51. package/dist/charts/chart-tooltip.js +1 -1
  52. package/dist/charts/chart.d.ts +4 -3
  53. package/dist/charts/chart.js +18 -10
  54. package/dist/charts/llms.txt +10 -7
  55. package/dist/charts-entry/public-api.js +2 -2
  56. package/dist/chat/chat.d.ts +17 -10
  57. package/dist/chat/chat.js +77 -23
  58. package/dist/chat/llms.txt +39 -15
  59. package/dist/chat-composer/chat-composer.d.ts +20 -7
  60. package/dist/chat-composer/chat-composer.js +29 -7
  61. package/dist/chat-composer/llms.txt +20 -11
  62. package/dist/chat-dock/chat-dock.d.ts +11 -4
  63. package/dist/chat-dock/chat-dock.js +10 -6
  64. package/dist/chat-dock/llms.txt +15 -14
  65. package/dist/chat-entry/public-api.js +1 -1
  66. package/dist/chat-message/chat-message.d.ts +12 -5
  67. package/dist/chat-message/chat-message.js +19 -8
  68. package/dist/chat-message/llms.txt +16 -15
  69. package/dist/chat-typing/chat-typing.d.ts +2 -2
  70. package/dist/chat-typing/chat-typing.js +4 -3
  71. package/dist/chat-typing/llms.txt +6 -6
  72. package/dist/checkbox/checkbox.d.ts +13 -6
  73. package/dist/checkbox/checkbox.js +31 -5
  74. package/dist/checkbox/llms.txt +26 -11
  75. package/dist/chip/chip.d.ts +4 -4
  76. package/dist/chip/chip.js +3 -2
  77. package/dist/chip/llms.txt +11 -11
  78. package/dist/chips-input/chips-input.d.ts +6 -4
  79. package/dist/chips-input/chips-input.js +47 -12
  80. package/dist/chips-input/llms.txt +18 -8
  81. package/dist/clock/clock.d.ts +11 -6
  82. package/dist/clock/clock.js +38 -8
  83. package/dist/clock/llms.txt +12 -8
  84. package/dist/color-picker/color-picker.d.ts +9 -5
  85. package/dist/color-picker/color-picker.js +37 -18
  86. package/dist/color-picker/llms.txt +8 -5
  87. package/dist/confirm/confirm-container.d.ts +3 -3
  88. package/dist/confirm/confirm-container.js +6 -5
  89. package/dist/confirm/confirm-store.d.ts +4 -4
  90. package/dist/confirm/confirm-store.js +11 -5
  91. package/dist/confirm/llms.txt +8 -7
  92. package/dist/context-menu/context-menu.d.ts +1 -1
  93. package/dist/context-menu/context-menu.js +37 -14
  94. package/dist/context-menu/llms.txt +10 -7
  95. package/dist/data-table/data-table-types.d.ts +5 -5
  96. package/dist/data-table/data-table.d.ts +37 -5
  97. package/dist/data-table/data-table.js +426 -119
  98. package/dist/data-table/export-csv.d.ts +3 -3
  99. package/dist/data-table/export-csv.js +8 -10
  100. package/dist/data-table/llms.txt +127 -79
  101. package/dist/data-view/data-view.d.ts +13 -5
  102. package/dist/data-view/data-view.js +68 -6
  103. package/dist/data-view/llms.txt +29 -10
  104. package/dist/date-range/date-range.d.ts +20 -8
  105. package/dist/date-range/date-range.js +86 -63
  106. package/dist/date-range/llms.txt +32 -18
  107. package/dist/datepicker/datepicker.d.ts +22 -8
  108. package/dist/datepicker/datepicker.js +103 -71
  109. package/dist/datepicker/llms.txt +36 -22
  110. package/dist/dialog/dialog.d.ts +4 -4
  111. package/dist/dialog/dialog.js +32 -11
  112. package/dist/dialog/llms.txt +13 -10
  113. package/dist/divider/divider.d.ts +7 -1
  114. package/dist/divider/divider.js +3 -2
  115. package/dist/divider/llms.txt +4 -3
  116. package/dist/drawer/drawer.d.ts +9 -4
  117. package/dist/drawer/drawer.js +5 -4
  118. package/dist/drawer/llms.txt +13 -10
  119. package/dist/empty/empty.d.ts +2 -2
  120. package/dist/empty/empty.js +1 -1
  121. package/dist/empty/llms.txt +9 -9
  122. package/dist/fab/fab.d.ts +1 -1
  123. package/dist/fab/fab.js +1 -1
  124. package/dist/fab/llms.txt +10 -6
  125. package/dist/fieldset/fieldset.d.ts +18 -4
  126. package/dist/fieldset/fieldset.js +12 -6
  127. package/dist/fieldset/llms.txt +26 -9
  128. package/dist/file-upload/file-upload.d.ts +8 -2
  129. package/dist/file-upload/file-upload.js +22 -11
  130. package/dist/file-upload/llms.txt +12 -9
  131. package/dist/form-field/form-field-context.d.ts +4 -4
  132. package/dist/form-field/form-field.d.ts +12 -4
  133. package/dist/form-field/form-field.js +27 -6
  134. package/dist/form-field/llms.txt +25 -11
  135. package/dist/galleria/galleria.d.ts +3 -3
  136. package/dist/galleria/galleria.js +9 -6
  137. package/dist/galleria/llms.txt +7 -7
  138. package/dist/grid/col.d.ts +4 -4
  139. package/dist/grid/col.js +2 -2
  140. package/dist/grid/flex.d.ts +3 -3
  141. package/dist/grid/flex.js +1 -1
  142. package/dist/grid/grid.d.ts +7 -7
  143. package/dist/grid/grid.js +3 -3
  144. package/dist/grid/layout.d.ts +2 -2
  145. package/dist/grid/layout.js +2 -2
  146. package/dist/grid/llms.txt +15 -15
  147. package/dist/grid-entry/public-api.js +1 -1
  148. package/dist/i18n/i18n-context.d.ts +6 -6
  149. package/dist/i18n/i18n-context.js +27 -5
  150. package/dist/icon/icon-registry.d.ts +3 -3
  151. package/dist/icon/icon-registry.js +3 -3
  152. package/dist/icon/icon.d.ts +4 -4
  153. package/dist/icon/icon.js +10 -7
  154. package/dist/icon/llms.txt +13 -13
  155. package/dist/icon-button/icon-button.d.ts +2 -2
  156. package/dist/icon-button/icon-button.js +1 -1
  157. package/dist/icon-button/llms.txt +9 -5
  158. package/dist/icons-entry/public-api.d.ts +2 -2
  159. package/dist/icons-entry/public-api.js +3 -3
  160. package/dist/image/image.js +5 -5
  161. package/dist/image/llms.txt +13 -13
  162. package/dist/input/input.d.ts +18 -5
  163. package/dist/input/input.js +22 -6
  164. package/dist/input/llms.txt +25 -11
  165. package/dist/input-mask/input-mask.d.ts +7 -2
  166. package/dist/input-mask/input-mask.js +17 -43
  167. package/dist/input-mask/llms.txt +8 -5
  168. package/dist/input-number/input-number.d.ts +11 -9
  169. package/dist/input-number/input-number.js +25 -21
  170. package/dist/input-number/llms.txt +17 -14
  171. package/dist/input-otp/input-otp.d.ts +18 -5
  172. package/dist/input-otp/input-otp.js +48 -24
  173. package/dist/input-otp/llms.txt +18 -7
  174. package/dist/internal/calendar-focus.d.ts +1 -1
  175. package/dist/internal/calendar-focus.js +3 -3
  176. package/dist/internal/cn.d.ts +1 -1
  177. package/dist/internal/mask.d.ts +14 -0
  178. package/dist/internal/mask.js +62 -0
  179. package/dist/internal/number-group.d.ts +22 -0
  180. package/dist/internal/number-group.js +53 -0
  181. package/dist/internal/option-key.d.ts +6 -0
  182. package/dist/internal/option-key.js +8 -0
  183. package/dist/internal/option-nav.d.ts +4 -4
  184. package/dist/internal/option-nav.js +5 -5
  185. package/dist/internal/overlay-container.js +1 -1
  186. package/dist/internal/overlay.d.ts +3 -3
  187. package/dist/internal/overlay.js +40 -10
  188. package/dist/internal/password-strength.d.ts +6 -0
  189. package/dist/internal/password-strength.js +74 -0
  190. package/dist/internal/roving.d.ts +2 -2
  191. package/dist/internal/roving.js +3 -3
  192. package/dist/internal/scroll-lock.d.ts +6 -0
  193. package/dist/internal/scroll-lock.js +35 -0
  194. package/dist/internal/slot-children.d.ts +13 -0
  195. package/dist/internal/slot-children.js +31 -0
  196. package/dist/internal/slot.d.ts +3 -3
  197. package/dist/internal/slot.js +2 -2
  198. package/dist/internal/step.d.ts +12 -0
  199. package/dist/internal/step.js +31 -0
  200. package/dist/internal/tween.d.ts +5 -5
  201. package/dist/internal/tween.js +7 -8
  202. package/dist/internal/types.d.ts +2 -2
  203. package/dist/internal/use-breakpoint.d.ts +2 -2
  204. package/dist/internal/use-breakpoint.js +4 -4
  205. package/dist/internal/use-controllable-state.d.ts +5 -0
  206. package/dist/internal/use-controllable-state.js +25 -4
  207. package/dist/internal/use-id.d.ts +2 -2
  208. package/dist/internal/use-id.js +2 -2
  209. package/dist/internal/use-modal-focus.d.ts +2 -1
  210. package/dist/internal/use-modal-focus.js +14 -3
  211. package/dist/knob/knob.d.ts +7 -4
  212. package/dist/knob/knob.js +27 -22
  213. package/dist/knob/llms.txt +18 -11
  214. package/dist/listbox/listbox.d.ts +8 -6
  215. package/dist/listbox/listbox.js +37 -17
  216. package/dist/listbox/llms.txt +12 -9
  217. package/dist/loader/llms.txt +56 -0
  218. package/dist/loader/loader.d.ts +49 -0
  219. package/dist/loader/loader.js +68 -0
  220. package/dist/map/llms.txt +30 -23
  221. package/dist/map/map-create-dialog.d.ts +4 -4
  222. package/dist/map/map-create-dialog.js +36 -28
  223. package/dist/map/map-hours-field.d.ts +4 -4
  224. package/dist/map/map-hours-field.js +8 -7
  225. package/dist/map/map-image-field.d.ts +2 -2
  226. package/dist/map/map-image-field.js +6 -5
  227. package/dist/map/map-legend.d.ts +4 -4
  228. package/dist/map/map-legend.js +3 -2
  229. package/dist/map/map-poi-card.d.ts +3 -3
  230. package/dist/map/map-poi-card.js +10 -9
  231. package/dist/map/map-search.d.ts +17 -6
  232. package/dist/map/map-search.js +70 -43
  233. package/dist/map/map.d.ts +25 -13
  234. package/dist/map/map.js +86 -57
  235. package/dist/map/ports.d.ts +9 -9
  236. package/dist/map/ports.js +6 -6
  237. package/dist/map-entry/public-api.js +2 -2
  238. package/dist/megamenu/llms.txt +18 -7
  239. package/dist/megamenu/megamenu.d.ts +12 -6
  240. package/dist/megamenu/megamenu.js +23 -14
  241. package/dist/mention/llms.txt +15 -15
  242. package/dist/mention/mention.d.ts +5 -5
  243. package/dist/mention/mention.js +2 -2
  244. package/dist/mention/mentions.d.ts +1 -1
  245. package/dist/mention/mentions.js +1 -1
  246. package/dist/menu/llms.txt +12 -12
  247. package/dist/menu/menu-item.d.ts +4 -4
  248. package/dist/menu/menu-keys.d.ts +2 -2
  249. package/dist/menu/menu-keys.js +5 -5
  250. package/dist/menu/menu-rows.js +1 -0
  251. package/dist/menu/menu.d.ts +2 -2
  252. package/dist/menu/menu.js +15 -8
  253. package/dist/menubar/llms.txt +19 -8
  254. package/dist/menubar/menubar.d.ts +11 -5
  255. package/dist/menubar/menubar.js +23 -11
  256. package/dist/meter-group/llms.txt +12 -12
  257. package/dist/meter-group/meter-group.d.ts +2 -2
  258. package/dist/meter-group/meter-group.js +2 -1
  259. package/dist/motion/motion-context.d.ts +22 -0
  260. package/dist/motion/motion-context.js +28 -0
  261. package/dist/order-list/llms.txt +24 -9
  262. package/dist/order-list/order-list.d.ts +12 -4
  263. package/dist/order-list/order-list.js +123 -25
  264. package/dist/paginator/llms.txt +8 -8
  265. package/dist/paginator/paginator.js +7 -4
  266. package/dist/panel/llms.txt +25 -13
  267. package/dist/panel/panel.d.ts +11 -3
  268. package/dist/panel/panel.js +12 -7
  269. package/dist/password/llms.txt +19 -7
  270. package/dist/password/password.d.ts +2 -2
  271. package/dist/password/password.js +27 -16
  272. package/dist/peek/llms.txt +11 -11
  273. package/dist/peek/peek.d.ts +6 -6
  274. package/dist/peek/peek.js +41 -19
  275. package/dist/pick-list/llms.txt +35 -12
  276. package/dist/pick-list/pick-list.d.ts +12 -4
  277. package/dist/pick-list/pick-list.js +128 -24
  278. package/dist/popover/llms.txt +13 -10
  279. package/dist/popover/popover.d.ts +6 -4
  280. package/dist/popover/popover.js +14 -7
  281. package/dist/progress/llms.txt +17 -17
  282. package/dist/progress/progress.d.ts +7 -7
  283. package/dist/progress/progress.js +7 -6
  284. package/dist/public-api.d.ts +16 -4
  285. package/dist/public-api.js +13 -7
  286. package/dist/radio-group/llms.txt +16 -6
  287. package/dist/radio-group/radio-group.d.ts +12 -3
  288. package/dist/radio-group/radio-group.js +23 -4
  289. package/dist/rating/llms.txt +20 -13
  290. package/dist/rating/rating-pointer.d.ts +16 -0
  291. package/dist/rating/rating-pointer.js +26 -0
  292. package/dist/rating/rating.d.ts +6 -6
  293. package/dist/rating/rating.js +77 -12
  294. package/dist/rich-text/lists.d.ts +2 -2
  295. package/dist/rich-text/lists.js +7 -7
  296. package/dist/rich-text/llms.txt +35 -12
  297. package/dist/rich-text/rich-text.d.ts +13 -14
  298. package/dist/rich-text/rich-text.js +311 -142
  299. package/dist/rich-text/sanitize.d.ts +11 -2
  300. package/dist/rich-text/sanitize.js +80 -32
  301. package/dist/rich-text/tables.d.ts +3 -3
  302. package/dist/rich-text/tables.js +3 -3
  303. package/dist/roadmap/llms.txt +23 -17
  304. package/dist/roadmap/roadmap.d.ts +6 -6
  305. package/dist/roadmap/roadmap.js +102 -25
  306. package/dist/roadmap-entry/public-api.js +2 -2
  307. package/dist/scroll-top/llms.txt +6 -6
  308. package/dist/scroll-top/scroll-top.d.ts +1 -1
  309. package/dist/scroll-top/scroll-top.js +2 -1
  310. package/dist/select/llms.txt +22 -12
  311. package/dist/select/select.d.ts +10 -8
  312. package/dist/select/select.js +87 -47
  313. package/dist/shared/types.d.ts +22 -1
  314. package/dist/shared/types.js +9 -1
  315. package/dist/sidenav/llms.txt +9 -9
  316. package/dist/sidenav/sidenav.d.ts +2 -3
  317. package/dist/sidenav/sidenav.js +5 -4
  318. package/dist/skeleton/llms.txt +3 -3
  319. package/dist/skeleton/skeleton.d.ts +1 -1
  320. package/dist/skeleton/skeleton.js +1 -1
  321. package/dist/slider/llms.txt +34 -12
  322. package/dist/slider/slider-drag.d.ts +26 -0
  323. package/dist/slider/slider-drag.js +79 -0
  324. package/dist/slider/slider.d.ts +8 -5
  325. package/dist/slider/slider.js +38 -8
  326. package/dist/speech/llms.txt +97 -0
  327. package/dist/speech/speech-button.d.ts +44 -0
  328. package/dist/speech/speech-button.js +86 -0
  329. package/dist/speech/speech-wave.d.ts +19 -0
  330. package/dist/speech/speech-wave.js +16 -0
  331. package/dist/speech/use-speech-recognition.d.ts +81 -0
  332. package/dist/speech/use-speech-recognition.js +179 -0
  333. package/dist/speed-dial/llms.txt +14 -8
  334. package/dist/speed-dial/speed-dial.d.ts +1 -1
  335. package/dist/speed-dial/speed-dial.js +3 -2
  336. package/dist/spinner/llms.txt +7 -7
  337. package/dist/spinner/spinner.d.ts +1 -1
  338. package/dist/spinner/spinner.js +2 -1
  339. package/dist/split-button/llms.txt +21 -15
  340. package/dist/split-button/split-button.d.ts +2 -2
  341. package/dist/split-button/split-button.js +13 -6
  342. package/dist/splitter/llms.txt +11 -11
  343. package/dist/splitter/splitter.d.ts +3 -3
  344. package/dist/splitter/splitter.js +25 -10
  345. package/dist/stepper/llms.txt +35 -13
  346. package/dist/stepper/stepper.d.ts +6 -6
  347. package/dist/stepper/stepper.js +60 -13
  348. package/dist/switch/llms.txt +15 -5
  349. package/dist/switch/switch.d.ts +10 -3
  350. package/dist/switch/switch.js +18 -4
  351. package/dist/switch-group/llms.txt +11 -8
  352. package/dist/switch-group/switch-group.d.ts +6 -4
  353. package/dist/switch-group/switch-group.js +9 -7
  354. package/dist/tabs/llms.txt +12 -9
  355. package/dist/tabs/tabs.d.ts +5 -5
  356. package/dist/tabs/tabs.js +36 -20
  357. package/dist/textarea/llms.txt +23 -12
  358. package/dist/textarea/textarea.d.ts +19 -6
  359. package/dist/textarea/textarea.js +22 -7
  360. package/dist/timeline/llms.txt +4 -4
  361. package/dist/timeline/timeline.d.ts +1 -1
  362. package/dist/timeline/timeline.js +1 -1
  363. package/dist/toast/llms.txt +50 -17
  364. package/dist/toast/toast-container.d.ts +9 -3
  365. package/dist/toast/toast-container.js +18 -9
  366. package/dist/toast/toast-store.d.ts +42 -2
  367. package/dist/toast/toast-store.js +36 -1
  368. package/dist/toolbar/llms.txt +7 -7
  369. package/dist/toolbar/toolbar.d.ts +3 -3
  370. package/dist/toolbar/toolbar.js +2 -2
  371. package/dist/tooltip/llms.txt +14 -12
  372. package/dist/tooltip/tooltip.d.ts +5 -4
  373. package/dist/tooltip/tooltip.js +100 -41
  374. package/dist/tree/llms.txt +25 -11
  375. package/dist/tree/tree-keys.d.ts +5 -5
  376. package/dist/tree/tree-keys.js +7 -7
  377. package/dist/tree/tree.d.ts +17 -5
  378. package/dist/tree/tree.js +62 -20
  379. package/dist/update/llms.txt +54 -0
  380. package/dist/update/update.d.ts +49 -0
  381. package/dist/update/update.js +82 -0
  382. package/package.json +18 -15
@@ -1,18 +1,19 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { cn } from "../internal/cn.js";
3
4
  import { useKptMessages } from "../i18n/i18n-context.js";
4
- /** Promień okręgu w viewBox 0 0 40 40 — obwód liczymy z niego, nie ze średnicy w pikselach. */
5
+ /** Promień okręgu w viewBox 0 0 40 40 - obwód liczymy z niego, nie ze średnicy w pikselach. */
5
6
  const RADIUS = 16;
6
7
  const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
7
8
  /**
8
- * Wskaźnik postępu — liniowy lub kołowy, określony (`min`–`max`) albo nieokreślony (`value` = null).
9
+ * Wskaźnik postępu - liniowy lub kołowy, określony (`min`-`max`) albo nieokreślony (`value` = null).
9
10
  *
10
11
  * Etykietę wartości włącza `showValue`; `children` zastępuje sformatowaną wartość,
11
12
  * więc w środku koła można pokazać cokolwiek.
12
13
  *
13
14
  * @example
14
15
  * <KptProgress value={60} />
15
- * <KptProgress value={80} label="Ładowanie…" showValue />
16
+ * <KptProgress value={80} label="Ładowanie..." showValue />
16
17
  * <KptProgress value={152} max={160} showValue valueFormat="fraction" labelPosition="bottom" />
17
18
  * <KptProgress value={38} bufferValue={62} />
18
19
  * <KptProgress type="circular" value={75} variant="success" showValue />
@@ -21,7 +22,7 @@ const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
21
22
  export function KptProgress({ value = null, min = 0, max = 100, variant = 'primary', type = 'linear', size = 'md', diameter = 40, bufferValue = null, showValue = false, valueFormat = 'percent', label, labelPosition = 'top', locale, dictionary, className, children, ...rest }) {
22
23
  const { t } = useKptMessages({ locale, dictionary });
23
24
  const indeterminate = value == null;
24
- /** Ułamek 0–1. Odporny na `max` ≤ `min` i na wartości spoza zakresu. */
25
+ /** Ułamek 0-1. Odporny na `max` <= `min` i na wartości spoza zakresu. */
25
26
  const toRatio = (v) => {
26
27
  if (v == null)
27
28
  return 0;
@@ -32,7 +33,7 @@ export function KptProgress({ value = null, min = 0, max = 100, variant = 'prima
32
33
  };
33
34
  const ratio = toRatio(value);
34
35
  const percent = Math.round(ratio * 100);
35
- // Bufor nigdy nie cofa się za pasek główny — inaczej wyglądałby jak błąd renderowania.
36
+ // Bufor nigdy nie cofa się za pasek główny - inaczej wyglądałby jak błąd renderowania.
36
37
  const bufferRatio = Math.max(ratio, toRatio(bufferValue));
37
38
  const offset = CIRCUMFERENCE * (1 - ratio);
38
39
  const fractionText = () => t('progress.fraction', { value: value ?? 0, max });
@@ -41,7 +42,7 @@ export function KptProgress({ value = null, min = 0, max = 100, variant = 'prima
41
42
  valueText = valueFormat === 'fraction' ? fractionText() : t('progress.percent', { value: percent });
42
43
  }
43
44
  /**
44
- * Czytnik ekranu domyślnie odczytuje `aria-valuenow` jako procent, więc przy formacie „ile z ilu"
45
+ * Czytnik ekranu domyślnie odczytuje `aria-valuenow` jako procent, więc przy formacie "ile z ilu"
45
46
  * podajemy mu ten sam napis, który widzi użytkownik.
46
47
  */
47
48
  const ariaValueText = indeterminate || valueFormat !== 'fraction' ? undefined : fractionText();
@@ -13,7 +13,7 @@ export type { KptPanelProps } from './panel/panel.tsx';
13
13
  export { KptStepper, KptStep, useKptStepper } from './stepper/stepper.tsx';
14
14
  export type { KptStepProps, KptStepperContextValue, KptStepperProps } from './stepper/stepper.tsx';
15
15
  export { KptFieldset } from './fieldset/fieldset.tsx';
16
- export type { KptFieldsetProps } from './fieldset/fieldset.tsx';
16
+ export type { KptFieldsetProps, KptFieldsetVariant } from './fieldset/fieldset.tsx';
17
17
  export { KptTimeline } from './timeline/timeline.tsx';
18
18
  export type { KptTimelineItem, KptTimelineProps } from './timeline/timeline.tsx';
19
19
  export { KptAlert } from './alert/alert.tsx';
@@ -26,6 +26,10 @@ export { KptProgress } from './progress/progress.tsx';
26
26
  export type { KptProgressProps, KptProgressVariant, KptProgressType, KptProgressSize, KptProgressValueFormat, KptProgressLabelPosition, } from './progress/progress.tsx';
27
27
  export { KptSpinner } from './spinner/spinner.tsx';
28
28
  export type { KptSpinnerProps } from './spinner/spinner.tsx';
29
+ export { KptLoader } from './loader/loader.tsx';
30
+ export type { KptLoaderProps, KptLoaderColor, KptLoaderResult, KptLoaderStatus, KptLoaderVariant } from './loader/loader.tsx';
31
+ export { KptUpdate } from './update/update.tsx';
32
+ export type { KptUpdateProps, KptUpdateAction, KptUpdateStatus } from './update/update.tsx';
29
33
  export { KptSkeleton } from './skeleton/skeleton.tsx';
30
34
  export type { KptSkeletonProps, KptSkeletonVariant } from './skeleton/skeleton.tsx';
31
35
  export { KptIcon } from './icon/icon.tsx';
@@ -89,8 +93,8 @@ export { kptConfirm, useKptConfirmRequest } from './confirm/confirm-store.ts';
89
93
  export type { KptConfirmOptions, KptConfirmRequest } from './confirm/confirm-store.ts';
90
94
  export { KptToastContainer } from './toast/toast-container.tsx';
91
95
  export type { KptToastContainerProps } from './toast/toast-container.tsx';
92
- export { kptToast, useKptToasts } from './toast/toast-store.ts';
93
- export type { KptToast, KptToastAction, KptToastOptions } from './toast/toast-store.ts';
96
+ export { kptToast, useKptToasts, useKptToastsPaused, resolveKptToast, KPT_TOAST_FALLBACK_DURATION } from './toast/toast-store.ts';
97
+ export type { KptToast, KptToastAction, KptToastAppearance, KptToastConfig, KptToastOptions, KptToastPosition, } from './toast/toast-store.ts';
94
98
  export { KptMenu } from './menu/menu.tsx';
95
99
  export { KptMenubar } from './menubar/menubar.tsx';
96
100
  export type { KptMenubarProps } from './menubar/menubar.tsx';
@@ -120,7 +124,7 @@ export { KptButtonGroup } from './button-group/button-group.tsx';
120
124
  export type { KptButtonGroupProps } from './button-group/button-group.tsx';
121
125
  export { KptSelect } from './select/select.tsx';
122
126
  export type { KptSelectProps } from './select/select.tsx';
123
- export type { KptAlertVariant, KptOption } from './shared/types.ts';
127
+ export type { KptAlertVariant, KptNavigateEvent, KptOption } from './shared/types.ts';
124
128
  export { KptFormField } from './form-field/form-field.tsx';
125
129
  export type { KptFormFieldLabelType, KptFormFieldProps } from './form-field/form-field.tsx';
126
130
  export { useKptFieldA11y, useKptFormFieldContext, useKptFormFieldFilled } from './form-field/form-field-context.ts';
@@ -172,6 +176,14 @@ export type { KptPaginatorProps } from './paginator/paginator.tsx';
172
176
  export { KptButton } from './button/button.tsx';
173
177
  export { KptIconButton } from './icon-button/icon-button.tsx';
174
178
  export type { KptIconButtonProps } from './icon-button/icon-button.tsx';
179
+ export { KptSpeechButton } from './speech/speech-button.tsx';
180
+ export type { KptSpeechButtonProps, KptSpeechColor, KptSpeechUnsupported } from './speech/speech-button.tsx';
181
+ export { KptSpeechWave } from './speech/speech-wave.tsx';
182
+ export type { KptSpeechWaveProps } from './speech/speech-wave.tsx';
183
+ export { useKptSpeechRecognition } from './speech/use-speech-recognition.ts';
184
+ export type { KptSpeechRecognition, KptSpeechRecognitionOptions, KptSpeechTargetRef, } from './speech/use-speech-recognition.ts';
185
+ export type { KptSpeechEndReason, KptSpeechErrorCode, KptSpeechInterimDisplay, KptSpeechMode, KptSpeechSnapshot, KptSpeechStatus, KptSpeechSupport, KptSpeechTarget, KptSpeechTargetInput, KptSpeechWaveMode, } from '@konce-pt/speech';
186
+ export { defaultSpeechLang, resolveSpeechTarget, speechSupport } from '@konce-pt/speech';
175
187
  export { KptFab } from './fab/fab.tsx';
176
188
  export type { KptFabProps } from './fab/fab.tsx';
177
189
  export { KptSplitButton } from './split-button/split-button.tsx';
@@ -1,27 +1,29 @@
1
1
  /*
2
- * @konce-pt/react — publiczne API.
2
+ * @konce-pt/react - publiczne API.
3
3
  *
4
4
  * Komponenty renderują te same klasy `kpt-*` i te same tokeny `--kpt-*`, co port
5
5
  * Angulara; warstwa CSS (`@konce-pt/styles`, `@konce-pt/grid`, `@konce-pt/tokens`)
6
6
  * jest wspólna i nie ma tu własnych stylów.
7
7
  */
8
- // Komponenty — układ
8
+ // Komponenty - układ
9
9
  export { KptAppShell, KptNavLabel, KptNavSection, useKptAppShell, useKptShellNavToggle } from "./app-shell/app-shell.js";
10
10
  export { KptToolbar, KptToolbarSpacer } from "./toolbar/toolbar.js";
11
11
  export { KptSidenav, KptSidenavFooter } from "./sidenav/sidenav.js";
12
- // Komponenty — panele
12
+ // Komponenty - panele
13
13
  export { KptTabs, KptTab } from "./tabs/tabs.js";
14
14
  export { KptAccordion, KptAccordionPanel } from "./accordion/accordion.js";
15
15
  export { KptPanel, KptPanelActions } from "./panel/panel.js";
16
16
  export { KptStepper, KptStep, useKptStepper } from "./stepper/stepper.js";
17
17
  export { KptFieldset } from "./fieldset/fieldset.js";
18
18
  export { KptTimeline } from "./timeline/timeline.js";
19
- // Komponenty — prezentacja
19
+ // Komponenty - prezentacja
20
20
  export { KptAlert } from "./alert/alert.js";
21
21
  export { KptDivider } from "./divider/divider.js";
22
22
  export { KptEmpty } from "./empty/empty.js";
23
23
  export { KptProgress } from "./progress/progress.js";
24
24
  export { KptSpinner } from "./spinner/spinner.js";
25
+ export { KptLoader } from "./loader/loader.js";
26
+ export { KptUpdate } from "./update/update.js";
25
27
  export { KptSkeleton } from "./skeleton/skeleton.js";
26
28
  export { KptIcon } from "./icon/icon.js";
27
29
  export { getKptIcon, hasKptIcon, registerKptIcons } from "./icon/icon-registry.js";
@@ -30,7 +32,7 @@ export { KptBadge } from "./badge/badge.js";
30
32
  export { KptBackdrop } from "./backdrop/backdrop.js";
31
33
  export { KPT_SIGNAL_GRID_CELL, KPT_SIGNAL_GRID_DENSITY, KPT_SIGNAL_GRID_FALLOFF, KPT_SIGNAL_GRID_GAP, KPT_WAVE_AMPLITUDE, KPT_WAVE_BAND, KPT_WAVE_RESOLUTION, KPT_WAVE_ROTATION, buildSignalGrid, createBackdropRenderer, mixOklch, readCssColor, resolveWave, shiftHue, signalGridAlpha, signalGridDensity, waveIntensity, waveRamp, } from '@konce-pt/backdrop';
32
34
  export { KptChip } from "./chip/chip.js";
33
- // Komponenty — nakładki
35
+ // Komponenty - nakładki
34
36
  export { KptDialog, KptDialogFooter } from "./dialog/dialog.js";
35
37
  export { KptDrawer } from "./drawer/drawer.js";
36
38
  export { KptBottomSheet } from "./bottom-sheet/bottom-sheet.js";
@@ -54,7 +56,7 @@ export { KPT_AUTH_MIN_PASSWORD } from "./auth/auth-types.js";
54
56
  export { KptConfirmContainer } from "./confirm/confirm-container.js";
55
57
  export { kptConfirm, useKptConfirmRequest } from "./confirm/confirm-store.js";
56
58
  export { KptToastContainer } from "./toast/toast-container.js";
57
- export { kptToast, useKptToasts } from "./toast/toast-store.js";
59
+ export { kptToast, useKptToasts, useKptToastsPaused, resolveKptToast, KPT_TOAST_FALLBACK_DURATION } from "./toast/toast-store.js";
58
60
  export { KptMenu } from "./menu/menu.js";
59
61
  export { KptMenubar } from "./menubar/menubar.js";
60
62
  export { KptMegamenu } from "./megamenu/megamenu.js";
@@ -67,7 +69,7 @@ export { KptMention } from "./mention/mention.js";
67
69
  export { KptMentions } from "./mention/mentions.js";
68
70
  export { KPT_MENTION_LIMIT, applyMention, collectMentions, filterMentions, foldMentionText, mentionQuery, mentionToken, parseMentionText, } from '@konce-pt/mention';
69
71
  export { KptOverlay } from "./internal/overlay.js";
70
- // Komponenty — formularze
72
+ // Komponenty - formularze
71
73
  export { KptButtonGroup } from "./button-group/button-group.js";
72
74
  export { KptSelect } from "./select/select.js";
73
75
  export { KptFormField } from "./form-field/form-field.js";
@@ -97,6 +99,10 @@ export { KptPaginator } from "./paginator/paginator.js";
97
99
  // Komponenty
98
100
  export { KptButton } from "./button/button.js";
99
101
  export { KptIconButton } from "./icon-button/icon-button.js";
102
+ export { KptSpeechButton } from "./speech/speech-button.js";
103
+ export { KptSpeechWave } from "./speech/speech-wave.js";
104
+ export { useKptSpeechRecognition } from "./speech/use-speech-recognition.js";
105
+ export { defaultSpeechLang, resolveSpeechTarget, speechSupport } from '@konce-pt/speech';
100
106
  export { KptFab } from "./fab/fab.js";
101
107
  export { KptSplitButton } from "./split-button/split-button.js";
102
108
  export { KptCard, KptCardActions, KptCardFooter, KptCardHeader, KptCardLead, KptCardMedia, KptCardMeta, KptCardSection, KptCardSubtitle, KptCardTags, KptCardTitle, } from "./card/card.js";
@@ -15,14 +15,15 @@ Import: `import { KptRadioGroup } from '@konce-pt/react';`
15
15
  </div>
16
16
 
17
17
  ## Props
18
- - `options`: `KptOption<T>[]` — `{ label, value, disabled? }`
19
- - `value` / `defaultValue` / `onValueChange` — controlled or uncontrolled
20
- - `name`: string — the form group name; omitted means one is generated
18
+ - `options`: `KptOption<T>[]` - `{ label, value, disabled? }`
19
+ - `value` / `defaultValue` / `onValueChange` - controlled or uncontrolled
20
+ - `name`: string - the form group name; omitted means one is generated
21
21
  - `disabled`, `invalid`, `touched`, `onTouch()`
22
+ - `toggleMotion`: 'spring' | 'fade' | 'none' (default from `KptMotionProvider`, else `spring`) - see "Toggle motion"
22
23
  - `className`, `ref` and every other `<div>` prop go to the host
23
24
 
24
25
  ## The shared name does the work
25
- All inputs share one `name`, and that — not any code in the component — is what makes the browser
26
+ All inputs share one `name`, and that - not any code in the component - is what makes the browser
26
27
  treat them as one group: arrow keys move between them, only one can be checked, and a native form
27
28
  submits a single value. The generated name is unique per instance, so two groups on one page never
28
29
  interfere.
@@ -32,16 +33,22 @@ interfere.
32
33
  <KptRadioGroup name="plan" options={plans} defaultValue="pro" />
33
34
 
34
35
  ## Screen reader and keyboard
35
- `orientation`: 'vertical' (default) | 'horizontal' — options in a column or in a wrapping row; also
36
+ `orientation`: 'vertical' (default) | 'horizontal' - options in a column or in a wrapping row; also
36
37
  sets `aria-orientation`.
37
38
 
38
39
  ## Label and description
39
40
  `id` goes to the focusable element, not the host; without one it comes from `KptFormField` or is
40
41
  generated. A `div` with a role is not named by `label[for]`, so inside `KptFormField` it gets
41
42
  `aria-labelledby` pointing at the wrapper's label (unless `ariaLabel` is set), and the hint or error
42
- is added to `aria-describedby`. New: `id`, `ariaLabel` and `required` (→ `aria-required`) on the
43
+ is added to `aria-describedby`. New: `id`, `ariaLabel` and `required` (-> `aria-required`) on the
43
44
  `radiogroup`.
44
45
 
46
+ ## Toggle motion
47
+ `toggleMotion`: `spring` - the dot pops in on a spring and the circle bounces; `fade` - a calm colour and mark transition; `none` - no
48
+ motion. The bounce is started by the change handler, so a control that is checked on load does not
49
+ move. With no value it takes `toggle` from `KptMotionProvider` (default `spring`); `enabled: false` and the
50
+ system "reduce motion" setting always win.
51
+
45
52
  ## Tokens
46
53
  `--kpt-color-primary` (the checked dot), `--kpt-form-field-border`,
47
54
  `--kpt-form-field-border-error`.
@@ -49,3 +56,6 @@ is added to `aria-describedby`. New: `id`, `ariaLabel` and `required` (→ `aria
49
56
  ## Accessibility
50
57
  The container is `role="radiogroup"` with `aria-invalid` when the error shows; every option is a
51
58
  native radio inside a `<label>`, so the label text is clickable and is the accessible name.
59
+
60
+ ## Read-only and required
61
+ `readOnly` blocks the click and the arrow keys (natively they move the selection); the group gets `aria-readonly`.
@@ -1,13 +1,20 @@
1
1
  import type { ComponentPropsWithRef } from 'react';
2
2
  import type { KptOption } from '../shared/types.ts';
3
+ import { type KptToggleMotion } from '@konce-pt/motion';
3
4
  export interface KptRadioGroupProps<T> extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'defaultValue'> {
5
+ /**
6
+ * Ruch przełączania: `spring` - kropka wskakuje na sprężynie, a pole odbija; `fade` - spokojne przejście koloru i znaku; `none` - bez ruchu.
7
+ * Bez wartości bierze `toggle` z `KptMotionProvider` (domyślnie `spring`); `enabled={false}` i systemowe
8
+ * "ogranicz ruch" wyłączają go zawsze.
9
+ */
10
+ toggleMotion?: KptToggleMotion;
4
11
  options?: readonly KptOption<T>[];
5
12
  value?: T;
6
13
  defaultValue?: T;
7
14
  onValueChange?: (value: T) => void;
8
15
  /** Nazwa grupy w formularzu; pominięta = generowana. */
9
16
  name?: string;
10
- /** Id elementu fokusowalnego (nie hosta); bez niego generowane, w `KptFormField` — z wrappera. */
17
+ /** Id elementu fokusowalnego (nie hosta); bez niego generowane, w `KptFormField` - z wrappera. */
11
18
  id?: string;
12
19
  /** Nazwa dostępna, gdy kontrolki nie opisuje etykieta (`<label for>` albo `KptFormField`). */
13
20
  ariaLabel?: string | null;
@@ -16,6 +23,8 @@ export interface KptRadioGroupProps<T> extends Omit<ComponentPropsWithRef<'div'>
16
23
  /** Układ opcji: pod sobą (domyślnie) albo w rzędzie, z zawijaniem. */
17
24
  orientation?: 'vertical' | 'horizontal';
18
25
  disabled?: boolean;
26
+ /** Tylko do odczytu - wybór widać, nie da się go zmienić (`aria-readonly`). */
27
+ readOnly?: boolean;
19
28
  invalid?: boolean;
20
29
  touched?: boolean;
21
30
  onTouch?: () => void;
@@ -23,10 +32,10 @@ export interface KptRadioGroupProps<T> extends Omit<ComponentPropsWithRef<'div'>
23
32
  /**
24
33
  * Grupa przycisków opcji (radio). Opcje przez `options`.
25
34
  *
26
- * Wszystkie pola dzielą jedną nazwę `name` — to ona, a nie kod komponentu, sprawia, że
35
+ * Wszystkie pola dzielą jedną nazwę `name` - to ona, a nie kod komponentu, sprawia, że
27
36
  * przeglądarka traktuje je jako jedną grupę i pozwala chodzić po niej strzałkami.
28
37
  *
29
38
  * @example
30
39
  * <KptRadioGroup options={plans} value={plan} onValueChange={setPlan} />
31
40
  */
32
- export declare function KptRadioGroup<T>({ options, value, defaultValue, onValueChange, name, id, ariaLabel, required, orientation, disabled, invalid, touched, onTouch, className, ...rest }: Readonly<KptRadioGroupProps<T>>): import("react").JSX.Element;
41
+ export declare function KptRadioGroup<T>({ options, value, defaultValue, onValueChange, name, id, ariaLabel, required, orientation, disabled, readOnly, invalid, touched, onTouch, toggleMotion, className, ...rest }: Readonly<KptRadioGroupProps<T>>): import("react").JSX.Element;
@@ -1,19 +1,24 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { cn } from "../internal/cn.js";
4
+ import { optionKey } from "../internal/option-key.js";
3
5
  import { useControllableState } from "../internal/use-controllable-state.js";
4
6
  import { useKptId } from "../internal/use-id.js";
5
7
  import { useKptFieldA11y } from "../form-field/form-field-context.js";
8
+ import { playPopMotion, resolveToggleMotion } from '@konce-pt/motion';
9
+ import { useKptMotion } from "../motion/motion-context.js";
6
10
  /**
7
11
  * Grupa przycisków opcji (radio). Opcje przez `options`.
8
12
  *
9
- * Wszystkie pola dzielą jedną nazwę `name` — to ona, a nie kod komponentu, sprawia, że
13
+ * Wszystkie pola dzielą jedną nazwę `name` - to ona, a nie kod komponentu, sprawia, że
10
14
  * przeglądarka traktuje je jako jedną grupę i pozwala chodzić po niej strzałkami.
11
15
  *
12
16
  * @example
13
17
  * <KptRadioGroup options={plans} value={plan} onValueChange={setPlan} />
14
18
  */
15
- export function KptRadioGroup({ options = [], value, defaultValue, onValueChange, name, id, ariaLabel = null, required = false, orientation = 'vertical', disabled = false, invalid = false, touched, onTouch, className, ...rest }) {
16
- /** Grupa nie dostaje nazwy z `label[for]` — stąd `aria-labelledby` na etykietę wrappera. */
19
+ export function KptRadioGroup({ options = [], value, defaultValue, onValueChange, name, id, ariaLabel = null, required = false, orientation = 'vertical', disabled = false, readOnly = false, invalid = false, touched, onTouch, toggleMotion, className, ...rest }) {
20
+ const motion = resolveToggleMotion(toggleMotion, useKptMotion());
21
+ /** Grupa nie dostaje nazwy z `label[for]` - stąd `aria-labelledby` na etykietę wrappera. */
17
22
  const field = useKptFieldA11y(id, 'kpt-radio-group');
18
23
  const groupName = useKptId(name, 'kpt-radio');
19
24
  const [current, setCurrent] = useControllableState({
@@ -22,5 +27,19 @@ export function KptRadioGroup({ options = [], value, defaultValue, onValueChange
22
27
  onChange: onValueChange,
23
28
  });
24
29
  const showInvalid = invalid && (touched ?? true);
25
- return (_jsx("div", { className: cn('kpt-radio-group-host', className), ...rest, children: _jsx("div", { className: cn('kpt-radio-group', orientation === 'horizontal' && 'kpt-radio-group--horizontal'), role: "radiogroup", "aria-orientation": orientation, "aria-invalid": showInvalid || undefined, id: field.id, "aria-label": ariaLabel ?? undefined, "aria-labelledby": ariaLabel ? undefined : field.labelledBy, "aria-describedby": field.describedBy, "aria-required": required || undefined, children: options.map((option) => (_jsxs("label", { className: cn('kpt-radio', (disabled || option.disabled) && 'kpt-radio--disabled'), children: [_jsx("input", { type: "radio", className: "kpt-radio__input", name: groupName, checked: option.value === current, disabled: disabled || option.disabled, onChange: () => setCurrent(option.value), onBlur: () => onTouch?.() }), _jsx("span", { className: "kpt-radio__dot", "aria-hidden": "true" }), _jsx("span", { className: "kpt-radio__label", children: option.label })] }, String(option.value)))) }) }));
30
+ return (_jsx("div", { className: cn('kpt-radio-group-host', className), ...rest, children: _jsx("div", { className: cn('kpt-radio-group', orientation === 'horizontal' && 'kpt-radio-group--horizontal'), "data-motion": motion, role: "radiogroup", "aria-orientation": orientation, "aria-invalid": showInvalid || undefined, id: field.id, "aria-label": ariaLabel ?? undefined, "aria-labelledby": ariaLabel ? undefined : field.labelledBy, "aria-describedby": field.describedBy, "aria-required": required || undefined, "aria-readonly": readOnly || undefined,
31
+ // Tylko do odczytu: strzałki natywnie przestawiałyby zaznaczenie.
32
+ onKeyDown: (event) => {
33
+ if (readOnly && ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key))
34
+ event.preventDefault();
35
+ }, children: options.map((option, index) => (_jsxs("label", { className: cn('kpt-radio', (disabled || option.disabled) && 'kpt-radio--disabled'), children: [_jsx("input", { type: "radio", className: "kpt-radio__input", name: groupName, checked: option.value === current, disabled: disabled || option.disabled, onChange: (event) => {
36
+ // Pole kontrolowane: bez zmiany stanu React przywraca poprzednie zaznaczenie.
37
+ if (readOnly)
38
+ return;
39
+ setCurrent(option.value);
40
+ // Wskoczenie po zmianie z ręki - z handlera, nie z CSS, bo reguła na `:checked` grałaby przy starcie.
41
+ const dot = event.currentTarget.nextElementSibling;
42
+ if (motion === 'spring' && dot instanceof HTMLElement)
43
+ playPopMotion(dot);
44
+ }, onBlur: () => onTouch?.() }), _jsx("span", { className: "kpt-radio__dot", "aria-hidden": "true" }), _jsx("span", { className: "kpt-radio__label", children: option.label })] }, optionKey(option.value, index)))) }) }));
26
45
  }
@@ -5,32 +5,32 @@ Import: `import { KptRating } from '@konce-pt/react';`
5
5
 
6
6
  ## DOM
7
7
  <div class="kpt-rating-host">
8
- <div class="kpt-rating" role="radiogroup" aria-label="…">
9
- <button class="kpt-rating__star is-filled" role="radio" aria-checked="false" tabindex="-1" aria-label="1 of 5">…</button>
10
- …count buttons…
8
+ <div class="kpt-rating" role="radiogroup" aria-label="...">
9
+ <button class="kpt-rating__star is-filled" role="radio" aria-checked="false" tabindex="-1" aria-label="1 of 5">...</button>
10
+ ...count buttons...
11
11
  </div>
12
12
  </div>
13
13
 
14
14
  ## Props
15
- - `value` / `defaultValue` / `onValueChange` — the score as a number, `0` means unrated
15
+ - `value` / `defaultValue` / `onValueChange` - the score as a number, `0` means unrated
16
16
  - `count`: number (default 5)
17
- - `allowHalf`: boolean — half stars, the value goes in steps of 0.5
18
- - `readOnly`: boolean — display only, no clicking and no hover preview
17
+ - `allowHalf`: boolean - half stars, the value goes in steps of 0.5
18
+ - `readOnly`: boolean - display only, no clicking and no hover preview
19
19
  - `disabled`: boolean
20
- - `onTouch()` — when focus leaves the group
20
+ - `onTouch()` - when focus leaves the group
21
21
  - `id`, `ariaLabel`, `required`, `invalid`, `touched`
22
22
  - `className`, `ref` and every other `<div>` prop go to the host
23
23
 
24
24
  ## Clicking a lit star clears the score
25
25
  Picking the star that already holds the value writes `0`, so a rating can be taken back without a
26
- separate "clear" button — the same contract as the Angular port.
26
+ separate "clear" button - the same contract as the Angular port.
27
27
 
28
28
  ## Hover beats the value, but only while the pointer is there
29
29
  The lit count comes from `hover || value`, so the row previews the score under the cursor and
30
30
  falls back to the real value on `mouseleave`. `readOnly` and `disabled` freeze both.
31
31
 
32
32
  ## i18n
33
- Each star is labelled from `rating.star` (`{value}`, `{max}`) — EN `1 of 5`, PL `1 z 5`. Override
33
+ Each star is labelled from `rating.star` (`{value}`, `{max}`) - EN `1 of 5`, PL `1 z 5`. Override
34
34
  per instance with the `locale` / `dictionary` props.
35
35
 
36
36
  ## Examples
@@ -38,19 +38,26 @@ per instance with the `locale` / `dictionary` props.
38
38
  <KptRating value={4} readOnly />
39
39
 
40
40
  ## Half stars
41
- `allowHalf` splits every star into two halves, each its own `role="radio"` ("3.5 of 5" — the number
41
+ `allowHalf` splits every star into two halves, each its own `role="radio"` ("3.5 of 5" - the number
42
42
  follows the page language, PL "3,5 z 5"), so the group keeps the radio pattern: clicking the left half
43
- gives x.5, and the arrows step by 0.5. Read-only stars show the value rounded to a half (4.3 → four
43
+ gives x.5, and the arrows step by 0.5. Read-only stars show the value rounded to a half (4.3 -> four
44
44
  and a half stars) while the name carries the exact score ("4.3 of 5"), so an average can be shown
45
45
  as it is.
46
46
 
47
+ ## Pointer
48
+ Dragging across the stars (mouse or touch) picks a score: the preview follows the pointer and releasing
49
+ commits it - with `allowHalf` to the nearest half, in RTL mirrored; dragging past the first star clears
50
+ the score. A short press without movement stays a click (including a second click that clears the
51
+ score). Stars that light up pop in one after another - the motion follows `toggle` from `KptMotionProvider`
52
+ (`spring` only); `enabled: false` and the system "reduce motion" setting always win.
53
+
47
54
  ## Tokens
48
55
  Lit stars `--kpt-color-warning`, empty ones `--kpt-color-border-strong`.
49
56
 
50
57
  ## Accessibility
51
58
  `role="radiogroup"` named by `ariaLabel` or the `KptFormField` label; each star is
52
- `role="radio"` with `aria-checked`, labelled from `rating.star` (`{value}`, `{max}`) — EN `1 of 5`,
53
- PL `1 z 5`. One Tab stop: `→`/`↑` raise the score by one, `←`/`↓` lower it (mirrored in RTL),
59
+ `role="radio"` with `aria-checked`, labelled from `rating.star` (`{value}`, `{max}`) - EN `1 of 5`,
60
+ PL `1 z 5`. One Tab stop: `ArrowRight`/`ArrowUp` raise the score by one, `ArrowLeft`/`ArrowDown` lower it (mirrored in RTL),
54
61
  `Home`/`End` set the extremes, `Delete`/`Backspace` clear it; clicking the chosen star also clears it.
55
62
  `readOnly` renders `role="img"` named "4 of 5" with no buttons, so a screen reader does not announce
56
63
  a row of disabled controls. `touch` fires when focus leaves the group.
@@ -0,0 +1,16 @@
1
+ interface StarRect {
2
+ left: number;
3
+ right: number;
4
+ width: number;
5
+ }
6
+ /**
7
+ * Ocena pod wskaźnikiem - z prostokątów gwiazdek w kolejności DOM. Lewa połowa gwiazdki to połówka
8
+ * oceny (z `allowHalf`), w RTL prawa. Przed pierwszą gwiazdką - 0 (przeciągnięcie wstecz kasuje
9
+ * ocenę), za ostatnią - maksimum. Przerwa między gwiazdkami należy do gwiazdki przed nią.
10
+ * Ta sama funkcja jest w porcie Angulara (`rating/rating-pointer.ts`).
11
+ */
12
+ export declare function ratingValueAt(x: number, stars: readonly StarRect[], options: {
13
+ allowHalf: boolean;
14
+ rtl: boolean;
15
+ }): number;
16
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Ocena pod wskaźnikiem - z prostokątów gwiazdek w kolejności DOM. Lewa połowa gwiazdki to połówka
3
+ * oceny (z `allowHalf`), w RTL prawa. Przed pierwszą gwiazdką - 0 (przeciągnięcie wstecz kasuje
4
+ * ocenę), za ostatnią - maksimum. Przerwa między gwiazdkami należy do gwiazdki przed nią.
5
+ * Ta sama funkcja jest w porcie Angulara (`rating/rating-pointer.ts`).
6
+ */
7
+ export function ratingValueAt(x, stars, options) {
8
+ if (!stars.length)
9
+ return 0;
10
+ // W RTL lustrzane odbicie osi - wtedy liczy się tak samo jak w LTR.
11
+ const flip = (r) => (options.rtl ? { left: -r.right, right: -r.left, width: r.width } : r);
12
+ const px = options.rtl ? -x : x;
13
+ const rects = stars.map(flip);
14
+ if (px < rects[0].left)
15
+ return 0;
16
+ for (let i = 0; i < rects.length; i++) {
17
+ const r = rects[i];
18
+ const end = i + 1 < rects.length ? rects[i + 1].left : r.right;
19
+ if (px >= end)
20
+ continue;
21
+ if (!options.allowHalf)
22
+ return i + 1;
23
+ return (px - r.left) / r.width < 0.5 ? i + 0.5 : i + 1;
24
+ }
25
+ return rects.length;
26
+ }
@@ -8,9 +8,9 @@ export interface KptRatingProps extends Omit<ComponentPropsWithRef<'div'>, 'onCh
8
8
  count?: number;
9
9
  /** Połówki gwiazdek: wartość co 0,5, każda połówka to osobne `radio`. */
10
10
  allowHalf?: boolean;
11
- /** Ocena tylko do odczytu — bez klikania i bez podglądu pod kursorem. */
11
+ /** Ocena tylko do odczytu - bez klikania i bez podglądu pod kursorem. */
12
12
  readOnly?: boolean;
13
- /** Id grupy (nie hosta); bez niego generowane, w `KptFormField` — z wrappera. */
13
+ /** Id grupy (nie hosta); bez niego generowane, w `KptFormField` - z wrappera. */
14
14
  id?: string;
15
15
  /** Nazwa dostępna grupy, gdy nie opisuje jej etykieta (`KptFormField`). */
16
16
  ariaLabel?: string | null;
@@ -23,13 +23,13 @@ export interface KptRatingProps extends Omit<ComponentPropsWithRef<'div'>, 'onCh
23
23
  }
24
24
  /**
25
25
  * Ocena gwiazdkami. Kliknięcie zapalonej gwiazdki zeruje ocenę, więc wystawioną można cofnąć
26
- * bez osobnego przycisku „wyczyść".
26
+ * bez osobnego przycisku "wyczyść".
27
27
  *
28
28
  * Do edycji to grupa radiowa (`role="radiogroup"`, gwiazdki jako `role="radio"`): jeden przystanek
29
29
  * Tab, strzałki zmieniają ocenę o krok (w RTL odwrócone w poziomie), `Home`/`End` ustawiają
30
- * skrajne, `Delete`/`Backspace` zeruje. Z `allowHalf` każda gwiazdka ma dwie połówki — dwa osobne
31
- * `radio` („3,5 z 5”), a krok strzałek to 0,5. Tylko do odczytu (`readOnly`) to obrazek z nazwą
32
- * „4,3 z 5” — bez przycisków, które czytnik ogłaszałby jako wyłączone; gwiazdki pokazują wartość
30
+ * skrajne, `Delete`/`Backspace` zeruje. Z `allowHalf` każda gwiazdka ma dwie połówki - dwa osobne
31
+ * `radio` ("3,5 z 5"), a krok strzałek to 0,5. Tylko do odczytu (`readOnly`) to obrazek z nazwą
32
+ * "4,3 z 5" - bez przycisków, które czytnik ogłaszałby jako wyłączone; gwiazdki pokazują wartość
33
33
  * zaokrągloną do połówki.
34
34
  *
35
35
  * @example