@konce-pt/react 0.12.0 → 0.15.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 (378) hide show
  1. package/README.md +122 -64
  2. package/dist/accordion/accordion.d.ts +14 -6
  3. package/dist/accordion/accordion.js +14 -7
  4. package/dist/accordion/llms.txt +22 -10
  5. package/dist/alert/alert.d.ts +2 -2
  6. package/dist/alert/alert.js +2 -2
  7. package/dist/alert/llms.txt +10 -10
  8. package/dist/app-shell/app-shell.d.ts +14 -14
  9. package/dist/app-shell/app-shell.js +11 -11
  10. package/dist/app-shell/llms.txt +13 -13
  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 +7 -7
  14. package/dist/auth/llms.txt +9 -9
  15. package/dist/autocomplete/autocomplete.d.ts +19 -6
  16. package/dist/autocomplete/autocomplete.js +23 -10
  17. package/dist/autocomplete/llms.txt +16 -5
  18. package/dist/avatar/avatar.d.ts +6 -6
  19. package/dist/avatar/avatar.js +5 -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 +3 -3
  23. package/dist/avatar-group/llms.txt +8 -8
  24. package/dist/backdrop/backdrop.d.ts +7 -7
  25. package/dist/backdrop/backdrop.js +16 -16
  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 +4 -4
  31. package/dist/bottom-sheet/bottom-sheet.js +2 -2
  32. package/dist/bottom-sheet/llms.txt +9 -9
  33. package/dist/breadcrumb/breadcrumb.d.ts +2 -2
  34. package/dist/breadcrumb/breadcrumb.js +3 -3
  35. package/dist/breadcrumb/llms.txt +3 -3
  36. package/dist/button/button.d.ts +3 -3
  37. package/dist/button/button.js +8 -8
  38. package/dist/button/llms.txt +27 -19
  39. package/dist/button-group/button-group.d.ts +9 -9
  40. package/dist/button-group/button-group.js +30 -8
  41. package/dist/button-group/llms.txt +20 -14
  42. package/dist/card/card.d.ts +8 -8
  43. package/dist/card/card.js +6 -6
  44. package/dist/card/llms.txt +20 -20
  45. package/dist/carousel/carousel.d.ts +6 -6
  46. package/dist/carousel/carousel.js +4 -4
  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 +1 -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 +1 -1
  53. package/dist/charts/chart.js +8 -8
  54. package/dist/charts/llms.txt +6 -6
  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 +42 -18
  58. package/dist/chat/llms.txt +32 -17
  59. package/dist/chat-composer/chat-composer.d.ts +17 -7
  60. package/dist/chat-composer/chat-composer.js +21 -8
  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 +9 -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 +17 -7
  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 +3 -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 +26 -7
  74. package/dist/checkbox/llms.txt +24 -12
  75. package/dist/chip/chip.d.ts +4 -4
  76. package/dist/chip/chip.js +2 -2
  77. package/dist/chip/llms.txt +11 -11
  78. package/dist/chips-input/chips-input.d.ts +4 -4
  79. package/dist/chips-input/chips-input.js +35 -9
  80. package/dist/chips-input/llms.txt +15 -8
  81. package/dist/clock/clock.d.ts +4 -4
  82. package/dist/clock/clock.js +7 -7
  83. package/dist/clock/llms.txt +8 -8
  84. package/dist/color-picker/color-picker.d.ts +6 -6
  85. package/dist/color-picker/color-picker.js +3 -3
  86. package/dist/color-picker/llms.txt +5 -5
  87. package/dist/confirm/confirm-container.d.ts +3 -3
  88. package/dist/confirm/confirm-container.js +5 -5
  89. package/dist/confirm/confirm-store.d.ts +4 -4
  90. package/dist/confirm/confirm-store.js +7 -7
  91. package/dist/confirm/llms.txt +6 -6
  92. package/dist/context-menu/context-menu.d.ts +1 -1
  93. package/dist/context-menu/context-menu.js +5 -5
  94. package/dist/context-menu/llms.txt +7 -7
  95. package/dist/data-table/data-table-types.d.ts +5 -5
  96. package/dist/data-table/data-table.d.ts +29 -8
  97. package/dist/data-table/data-table.js +340 -95
  98. package/dist/data-table/export-csv.d.ts +3 -3
  99. package/dist/data-table/export-csv.js +4 -4
  100. package/dist/data-table/llms.txt +127 -94
  101. package/dist/data-view/data-view.d.ts +13 -5
  102. package/dist/data-view/data-view.js +67 -6
  103. package/dist/data-view/llms.txt +29 -10
  104. package/dist/date-range/date-range.d.ts +9 -9
  105. package/dist/date-range/date-range.js +24 -24
  106. package/dist/date-range/llms.txt +20 -20
  107. package/dist/datepicker/datepicker.d.ts +10 -10
  108. package/dist/datepicker/datepicker.js +29 -29
  109. package/dist/datepicker/llms.txt +24 -24
  110. package/dist/dialog/dialog.d.ts +12 -7
  111. package/dist/dialog/dialog.js +4 -4
  112. package/dist/dialog/llms.txt +14 -11
  113. package/dist/divider/divider.d.ts +1 -1
  114. package/dist/divider/llms.txt +4 -4
  115. package/dist/drawer/drawer.d.ts +5 -5
  116. package/dist/drawer/drawer.js +2 -2
  117. package/dist/drawer/llms.txt +11 -11
  118. package/dist/empty/empty.d.ts +2 -2
  119. package/dist/empty/empty.js +1 -1
  120. package/dist/empty/llms.txt +9 -9
  121. package/dist/fab/fab.d.ts +1 -1
  122. package/dist/fab/fab.js +1 -1
  123. package/dist/fab/llms.txt +10 -6
  124. package/dist/fieldset/fieldset.d.ts +18 -4
  125. package/dist/fieldset/fieldset.js +9 -6
  126. package/dist/fieldset/llms.txt +26 -9
  127. package/dist/file-upload/file-upload.d.ts +3 -3
  128. package/dist/file-upload/file-upload.js +7 -7
  129. package/dist/file-upload/llms.txt +7 -7
  130. package/dist/form-field/form-field-context.d.ts +4 -4
  131. package/dist/form-field/form-field.d.ts +12 -4
  132. package/dist/form-field/form-field.js +26 -6
  133. package/dist/form-field/llms.txt +25 -11
  134. package/dist/galleria/galleria.d.ts +3 -3
  135. package/dist/galleria/galleria.js +5 -5
  136. package/dist/galleria/llms.txt +7 -7
  137. package/dist/grid/col.d.ts +4 -4
  138. package/dist/grid/col.js +2 -2
  139. package/dist/grid/flex.d.ts +3 -3
  140. package/dist/grid/flex.js +1 -1
  141. package/dist/grid/grid.d.ts +7 -7
  142. package/dist/grid/grid.js +3 -3
  143. package/dist/grid/layout.d.ts +2 -2
  144. package/dist/grid/layout.js +2 -2
  145. package/dist/grid/llms.txt +15 -15
  146. package/dist/grid-entry/public-api.js +1 -1
  147. package/dist/i18n/i18n-context.d.ts +3 -3
  148. package/dist/i18n/i18n-context.js +7 -7
  149. package/dist/icon/icon-registry.d.ts +3 -3
  150. package/dist/icon/icon-registry.js +3 -3
  151. package/dist/icon/icon.d.ts +4 -4
  152. package/dist/icon/icon.js +6 -6
  153. package/dist/icon/llms.txt +13 -13
  154. package/dist/icon-button/icon-button.d.ts +2 -2
  155. package/dist/icon-button/icon-button.js +1 -1
  156. package/dist/icon-button/llms.txt +9 -5
  157. package/dist/icons-entry/public-api.d.ts +2 -2
  158. package/dist/icons-entry/public-api.js +3 -3
  159. package/dist/image/image.js +1 -1
  160. package/dist/image/llms.txt +13 -13
  161. package/dist/input/input.d.ts +18 -5
  162. package/dist/input/input.js +21 -6
  163. package/dist/input/llms.txt +25 -11
  164. package/dist/input-mask/input-mask.d.ts +1 -1
  165. package/dist/input-mask/input-mask.js +2 -2
  166. package/dist/input-mask/llms.txt +5 -5
  167. package/dist/input-number/input-number.d.ts +9 -9
  168. package/dist/input-number/input-number.js +11 -11
  169. package/dist/input-number/llms.txt +14 -14
  170. package/dist/input-otp/input-otp.d.ts +6 -6
  171. package/dist/input-otp/input-otp.js +10 -10
  172. package/dist/input-otp/llms.txt +9 -9
  173. package/dist/internal/calendar-focus.d.ts +1 -1
  174. package/dist/internal/calendar-focus.js +3 -3
  175. package/dist/internal/cn.d.ts +1 -1
  176. package/dist/internal/mask.d.ts +2 -2
  177. package/dist/internal/mask.js +4 -4
  178. package/dist/internal/option-key.d.ts +2 -2
  179. package/dist/internal/option-key.js +2 -2
  180. package/dist/internal/option-nav.d.ts +4 -4
  181. package/dist/internal/option-nav.js +5 -5
  182. package/dist/internal/overlay-container.js +1 -1
  183. package/dist/internal/overlay.d.ts +3 -3
  184. package/dist/internal/overlay.js +8 -8
  185. package/dist/internal/password-strength.d.ts +2 -2
  186. package/dist/internal/password-strength.js +6 -6
  187. package/dist/internal/roving.d.ts +2 -2
  188. package/dist/internal/roving.js +3 -3
  189. package/dist/internal/scroll-lock.d.ts +1 -1
  190. package/dist/internal/scroll-lock.js +2 -2
  191. package/dist/internal/slot-children.d.ts +3 -3
  192. package/dist/internal/slot-children.js +4 -4
  193. package/dist/internal/slot.d.ts +3 -3
  194. package/dist/internal/slot.js +2 -2
  195. package/dist/internal/step.d.ts +3 -3
  196. package/dist/internal/step.js +4 -4
  197. package/dist/internal/tween.d.ts +5 -5
  198. package/dist/internal/tween.js +5 -5
  199. package/dist/internal/types.d.ts +2 -2
  200. package/dist/internal/use-breakpoint.d.ts +2 -2
  201. package/dist/internal/use-breakpoint.js +4 -4
  202. package/dist/internal/use-controllable-state.d.ts +1 -1
  203. package/dist/internal/use-controllable-state.js +3 -3
  204. package/dist/internal/use-id.d.ts +2 -2
  205. package/dist/internal/use-id.js +2 -2
  206. package/dist/internal/use-modal-focus.d.ts +1 -1
  207. package/dist/internal/use-modal-focus.js +3 -3
  208. package/dist/knob/knob.d.ts +4 -4
  209. package/dist/knob/knob.js +14 -10
  210. package/dist/knob/llms.txt +17 -12
  211. package/dist/listbox/listbox.d.ts +6 -6
  212. package/dist/listbox/listbox.js +9 -9
  213. package/dist/listbox/llms.txt +10 -10
  214. package/dist/loader/llms.txt +56 -0
  215. package/dist/loader/loader.d.ts +49 -0
  216. package/dist/loader/loader.js +68 -0
  217. package/dist/map/llms.txt +25 -22
  218. package/dist/map/map-create-dialog.d.ts +4 -4
  219. package/dist/map/map-create-dialog.js +10 -10
  220. package/dist/map/map-hours-field.d.ts +4 -4
  221. package/dist/map/map-hours-field.js +7 -7
  222. package/dist/map/map-image-field.d.ts +2 -2
  223. package/dist/map/map-image-field.js +4 -4
  224. package/dist/map/map-legend.d.ts +4 -4
  225. package/dist/map/map-legend.js +2 -2
  226. package/dist/map/map-poi-card.d.ts +3 -3
  227. package/dist/map/map-poi-card.js +9 -9
  228. package/dist/map/map-search.d.ts +17 -6
  229. package/dist/map/map-search.js +21 -18
  230. package/dist/map/map.d.ts +21 -14
  231. package/dist/map/map.js +30 -29
  232. package/dist/map/ports.d.ts +9 -9
  233. package/dist/map/ports.js +6 -6
  234. package/dist/map-entry/public-api.js +2 -2
  235. package/dist/megamenu/llms.txt +9 -9
  236. package/dist/megamenu/megamenu.d.ts +6 -6
  237. package/dist/megamenu/megamenu.js +10 -10
  238. package/dist/mention/llms.txt +15 -15
  239. package/dist/mention/mention.d.ts +5 -5
  240. package/dist/mention/mention.js +2 -2
  241. package/dist/mention/mentions.d.ts +1 -1
  242. package/dist/mention/mentions.js +1 -1
  243. package/dist/menu/llms.txt +12 -12
  244. package/dist/menu/menu-item.d.ts +4 -4
  245. package/dist/menu/menu-keys.d.ts +2 -2
  246. package/dist/menu/menu-keys.js +5 -5
  247. package/dist/menu/menu.d.ts +2 -2
  248. package/dist/menu/menu.js +6 -6
  249. package/dist/menubar/llms.txt +10 -10
  250. package/dist/menubar/menubar.d.ts +5 -5
  251. package/dist/menubar/menubar.js +10 -10
  252. package/dist/meter-group/llms.txt +12 -12
  253. package/dist/meter-group/meter-group.d.ts +2 -2
  254. package/dist/meter-group/meter-group.js +1 -1
  255. package/dist/motion/motion-context.d.ts +22 -0
  256. package/dist/motion/motion-context.js +28 -0
  257. package/dist/order-list/llms.txt +22 -10
  258. package/dist/order-list/order-list.d.ts +12 -4
  259. package/dist/order-list/order-list.js +104 -21
  260. package/dist/paginator/llms.txt +8 -8
  261. package/dist/paginator/paginator.js +1 -1
  262. package/dist/panel/llms.txt +25 -13
  263. package/dist/panel/panel.d.ts +11 -3
  264. package/dist/panel/panel.js +7 -4
  265. package/dist/password/llms.txt +16 -8
  266. package/dist/password/password.d.ts +2 -2
  267. package/dist/password/password.js +24 -3
  268. package/dist/peek/llms.txt +10 -10
  269. package/dist/peek/peek.d.ts +6 -6
  270. package/dist/peek/peek.js +7 -7
  271. package/dist/pick-list/llms.txt +33 -13
  272. package/dist/pick-list/pick-list.d.ts +12 -4
  273. package/dist/pick-list/pick-list.js +111 -23
  274. package/dist/popover/llms.txt +11 -11
  275. package/dist/popover/popover.d.ts +4 -4
  276. package/dist/popover/popover.js +5 -5
  277. package/dist/progress/llms.txt +17 -17
  278. package/dist/progress/progress.d.ts +7 -7
  279. package/dist/progress/progress.js +6 -6
  280. package/dist/public-api.d.ts +15 -3
  281. package/dist/public-api.js +13 -7
  282. package/dist/radio-group/llms.txt +13 -6
  283. package/dist/radio-group/radio-group.d.ts +11 -4
  284. package/dist/radio-group/radio-group.js +15 -7
  285. package/dist/rating/llms.txt +20 -13
  286. package/dist/rating/rating-pointer.d.ts +16 -0
  287. package/dist/rating/rating-pointer.js +26 -0
  288. package/dist/rating/rating.d.ts +6 -6
  289. package/dist/rating/rating.js +76 -12
  290. package/dist/rich-text/lists.d.ts +2 -2
  291. package/dist/rich-text/lists.js +7 -7
  292. package/dist/rich-text/llms.txt +26 -17
  293. package/dist/rich-text/rich-text.d.ts +12 -7
  294. package/dist/rich-text/rich-text.js +78 -54
  295. package/dist/rich-text/sanitize.d.ts +3 -3
  296. package/dist/rich-text/sanitize.js +12 -12
  297. package/dist/rich-text/tables.d.ts +3 -3
  298. package/dist/rich-text/tables.js +3 -3
  299. package/dist/roadmap/llms.txt +15 -15
  300. package/dist/roadmap/roadmap.d.ts +6 -6
  301. package/dist/roadmap/roadmap.js +19 -19
  302. package/dist/roadmap-entry/public-api.js +2 -2
  303. package/dist/scroll-top/llms.txt +6 -6
  304. package/dist/scroll-top/scroll-top.d.ts +1 -1
  305. package/dist/scroll-top/scroll-top.js +1 -1
  306. package/dist/select/llms.txt +19 -12
  307. package/dist/select/select.d.ts +8 -8
  308. package/dist/select/select.js +47 -21
  309. package/dist/shared/types.d.ts +5 -5
  310. package/dist/shared/types.js +1 -1
  311. package/dist/sidenav/llms.txt +9 -9
  312. package/dist/sidenav/sidenav.d.ts +1 -1
  313. package/dist/sidenav/sidenav.js +1 -1
  314. package/dist/skeleton/llms.txt +3 -3
  315. package/dist/skeleton/skeleton.d.ts +1 -1
  316. package/dist/skeleton/skeleton.js +1 -1
  317. package/dist/slider/llms.txt +32 -13
  318. package/dist/slider/slider-drag.d.ts +26 -0
  319. package/dist/slider/slider-drag.js +79 -0
  320. package/dist/slider/slider.d.ts +6 -5
  321. package/dist/slider/slider.js +27 -8
  322. package/dist/speech/llms.txt +97 -0
  323. package/dist/speech/speech-button.d.ts +44 -0
  324. package/dist/speech/speech-button.js +86 -0
  325. package/dist/speech/speech-wave.d.ts +19 -0
  326. package/dist/speech/speech-wave.js +16 -0
  327. package/dist/speech/use-speech-recognition.d.ts +81 -0
  328. package/dist/speech/use-speech-recognition.js +179 -0
  329. package/dist/speed-dial/llms.txt +14 -8
  330. package/dist/speed-dial/speed-dial.d.ts +1 -1
  331. package/dist/speed-dial/speed-dial.js +1 -1
  332. package/dist/spinner/llms.txt +7 -7
  333. package/dist/spinner/spinner.d.ts +1 -1
  334. package/dist/spinner/spinner.js +1 -1
  335. package/dist/split-button/llms.txt +21 -15
  336. package/dist/split-button/split-button.d.ts +2 -2
  337. package/dist/split-button/split-button.js +4 -4
  338. package/dist/splitter/llms.txt +11 -11
  339. package/dist/splitter/splitter.d.ts +3 -3
  340. package/dist/splitter/splitter.js +5 -5
  341. package/dist/stepper/llms.txt +33 -14
  342. package/dist/stepper/stepper.d.ts +6 -6
  343. package/dist/stepper/stepper.js +53 -10
  344. package/dist/switch/llms.txt +12 -5
  345. package/dist/switch/switch.d.ts +10 -3
  346. package/dist/switch/switch.js +12 -5
  347. package/dist/switch-group/llms.txt +9 -9
  348. package/dist/switch-group/switch-group.d.ts +4 -4
  349. package/dist/switch-group/switch-group.js +4 -4
  350. package/dist/tabs/llms.txt +10 -10
  351. package/dist/tabs/tabs.d.ts +5 -5
  352. package/dist/tabs/tabs.js +8 -8
  353. package/dist/textarea/llms.txt +23 -12
  354. package/dist/textarea/textarea.d.ts +19 -6
  355. package/dist/textarea/textarea.js +21 -7
  356. package/dist/timeline/llms.txt +4 -4
  357. package/dist/timeline/timeline.d.ts +1 -1
  358. package/dist/timeline/timeline.js +1 -1
  359. package/dist/toast/llms.txt +47 -17
  360. package/dist/toast/toast-container.d.ts +9 -3
  361. package/dist/toast/toast-container.js +17 -9
  362. package/dist/toast/toast-store.d.ts +40 -4
  363. package/dist/toast/toast-store.js +36 -1
  364. package/dist/toolbar/llms.txt +7 -7
  365. package/dist/toolbar/toolbar.d.ts +3 -3
  366. package/dist/toolbar/toolbar.js +2 -2
  367. package/dist/tooltip/llms.txt +10 -10
  368. package/dist/tooltip/tooltip.d.ts +3 -3
  369. package/dist/tooltip/tooltip.js +18 -18
  370. package/dist/tree/llms.txt +25 -12
  371. package/dist/tree/tree-keys.d.ts +5 -5
  372. package/dist/tree/tree-keys.js +7 -7
  373. package/dist/tree/tree.d.ts +14 -7
  374. package/dist/tree/tree.js +53 -18
  375. package/dist/update/llms.txt +54 -0
  376. package/dist/update/update.d.ts +49 -0
  377. package/dist/update/update.js +82 -0
  378. package/package.json +15 -13
@@ -25,7 +25,7 @@ export function KptMeterGroup({ values = [], max, showLegend = true, label = '',
25
25
  const color = (item, index) => item.color || PALETTE[index % PALETTE.length];
26
26
  const withUnit = (value) => (unit ? `${value} ${unit}` : String(value));
27
27
  const legendText = (item) => legendValue === 'value' ? withUnit(item.value) : `${Math.round(percent(item))}%`;
28
- // Podział dla czytnika („Zdjęcia 42 GB, Filmy 28 GB…”) — sam `aria-valuenow` mówi tylko sumę.
28
+ // Podział dla czytnika ("Zdjęcia 42 GB, Filmy 28 GB...") - sam `aria-valuenow` mówi tylko sumę.
29
29
  const valueText = values.map((item) => `${item.label} ${withUnit(item.value)}`).join(', ');
30
30
  return (_jsx("div", { className: cn('kpt-meter-group-host', className), ...rest, children: _jsxs("div", { className: "kpt-meter-group", children: [_jsx("div", { className: "kpt-meter-group__track", role: "meter", "aria-valuemin": 0, "aria-valuenow": sum, "aria-valuemax": total, "aria-valuetext": valueText, "aria-label": label || t('meterGroup.label'), children: values.map((item, index) => (_jsx("span", { className: "kpt-meter-group__segment", style: { width: `${percent(item)}%`, backgroundColor: color(item, index) }, title: item.label }, index))) }), showLegend ? (_jsx("ul", { className: "kpt-meter-group__legend", children: values.map((item, index) => (_jsxs("li", { className: "kpt-meter-group__legend-item", children: [_jsx("span", { className: "kpt-meter-group__dot", style: { backgroundColor: color(item, index) } }), _jsx("span", { children: item.label }), _jsx("span", { className: "kpt-meter-group__val", children: legendText(item) })] }, index))) })) : null] }) }));
31
31
  }
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type KptLayoutMotion, type KptMotionConfig } from '@konce-pt/motion';
3
+ export interface KptMotionProviderProps extends KptMotionConfig {
4
+ children?: ReactNode;
5
+ }
6
+ /**
7
+ * Globalne ustawienie ruchu Koncept UI: czy ruch jest włączony i jaki rodzaj ruchu dostają
8
+ * komponenty, które pozwalają go wybrać. Bez providera ruch jest włączony z domyślnymi
9
+ * wartościami; systemowe "ogranicz ruch" jest respektowane zawsze.
10
+ *
11
+ * `enabled={false}` gasi przejścia CSS wszystkich komponentów (atrybut `data-kpt-motion="off"`
12
+ * i zmienne na `:root` - nakładki w portalach też) oraz ruch sterowany z kodu; wskaźniki
13
+ * ładowania zwalniają zamiast stanąć.
14
+ *
15
+ * @example
16
+ * <KptMotionProvider layout="arc" collapse="fade"><App /></KptMotionProvider>
17
+ * <KptMotionProvider enabled={false}><App /></KptMotionProvider>
18
+ */
19
+ export declare function KptMotionProvider({ enabled, layout, collapse, enter, toggle, children }: Readonly<KptMotionProviderProps>): import("react").JSX.Element;
20
+ /** Konfiguracja ruchu z najbliższego providera; poza providerem `null` (wartości domyślne). */
21
+ export declare function useKptMotion(): KptMotionConfig | null;
22
+ export type { KptLayoutMotion, KptMotionConfig };
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useLayoutEffect, useMemo } from 'react';
4
+ import { applyMotionConfig } from '@konce-pt/motion';
5
+ const KptMotionContext = createContext(null);
6
+ /**
7
+ * Globalne ustawienie ruchu Koncept UI: czy ruch jest włączony i jaki rodzaj ruchu dostają
8
+ * komponenty, które pozwalają go wybrać. Bez providera ruch jest włączony z domyślnymi
9
+ * wartościami; systemowe "ogranicz ruch" jest respektowane zawsze.
10
+ *
11
+ * `enabled={false}` gasi przejścia CSS wszystkich komponentów (atrybut `data-kpt-motion="off"`
12
+ * i zmienne na `:root` - nakładki w portalach też) oraz ruch sterowany z kodu; wskaźniki
13
+ * ładowania zwalniają zamiast stanąć.
14
+ *
15
+ * @example
16
+ * <KptMotionProvider layout="arc" collapse="fade"><App /></KptMotionProvider>
17
+ * <KptMotionProvider enabled={false}><App /></KptMotionProvider>
18
+ */
19
+ export function KptMotionProvider({ enabled, layout, collapse, enter, toggle, children }) {
20
+ const config = useMemo(() => ({ enabled, layout, collapse, enter, toggle }), [enabled, layout, collapse, enter, toggle]);
21
+ // Korzeń dokumentu, nie wrapper: przejścia w portalach (dialog, drawer) też muszą zgasnąć.
22
+ useLayoutEffect(() => applyMotionConfig(document.documentElement, config), [config]);
23
+ return _jsx(KptMotionContext.Provider, { value: config, children: children });
24
+ }
25
+ /** Konfiguracja ruchu z najbliższego providera; poza providerem `null` (wartości domyślne). */
26
+ export function useKptMotion() {
27
+ return useContext(KptMotionContext);
28
+ }
@@ -7,26 +7,27 @@ Import: `import { KptOrderList } from '@konce-pt/react';`
7
7
  ## DOM
8
8
  <div class="kpt-order-list-host">
9
9
  <div class="kpt-order-list">
10
- <div class="kpt-order-list__controls">…up, down…</div>
10
+ <div class="kpt-order-list__controls">...up, down...</div>
11
11
  <div class="kpt-order-list__panel">
12
12
  <div class="kpt-order-list__header">Order</div>
13
13
  <ul class="kpt-order-list__items">
14
- <li class="kpt-order-list__item is-selected">…</li>…
14
+ <li class="kpt-order-list__item is-selected">...</li>...
15
15
  </ul>
16
16
  </div>
17
17
  </div>
18
18
  </div>
19
19
 
20
20
  ## Props
21
- - `items` / `defaultItems` / `onItemsChange` — the list; the callback receives the new order
21
+ - `items` / `defaultItems` / `onItemsChange` - the list; the callback receives the new order
22
22
  - `header`: string
23
- - `dragdrop` — `false` by default; enables dragging (opt-in, nothing changes without it)
24
- - `renderItem(item, index)` — required; the equivalent of `<ng-template let-item>`
23
+ - `dragdrop` - `false` by default; enables dragging (opt-in, nothing changes without it)
24
+ - `layoutMotion` - `'spring' | 'arc' | 'morph' | 'none'` (default from `KptMotionProvider`, else `spring`) - see below
25
+ - `renderItem(item, index)` - required; the equivalent of `<ng-template let-item>`
25
26
  - `className`, `ref` and every other `<div>` prop go to the host
26
27
 
27
28
  ## The selection follows the item
28
29
  After a move the selection jumps to the new index, so pressing the button again moves the same
29
- entry — with the selection pinned to a position, the second press would move its neighbour. A drop
30
+ entry - with the selection pinned to a position, the second press would move its neighbour. A drop
30
31
  does the same.
31
32
 
32
33
  ## Where a dragged item lands
@@ -43,21 +44,32 @@ dragged one `is-dragging`.
43
44
  The buttons use `orderList.up` and `orderList.down`. Dragging carries no visible label, so it adds
44
45
  no dictionary keys.
45
46
 
47
+ ## Reorder motion
48
+ `layoutMotion` animates a reorder made by the user (buttons, `Alt`+ArrowUp/ArrowDown, dragging):
49
+ - `spring` - the moved item glides to its new place on a spring;
50
+ - `arc` - the moved item lifts (shadow) and lands, above its neighbours;
51
+ - `morph` - the browser's own morph (View Transitions); without support the change is instant;
52
+ - `none` - no motion.
53
+
54
+ Neighbours always make room with a calm spring, and the list scrolls to keep the moved item in
55
+ view. With no value it takes `layout` from `KptMotionProvider` (default `spring`); `enabled: false` and the
56
+ system "reduce motion" setting always win. A list replaced from outside (`items`) switches instantly.
57
+
46
58
  ## Tokens
47
59
  The selection `--kpt-color-primary`, the buttons `--kpt-color-surface-raised`.
48
60
 
49
61
  ## Keyboard
50
62
  The list is a `listbox` with a single Tab stop (roving tabindex), and the selection follows focus:
51
- - `↓` / `↑` select the next / previous item (wrapping), `Home` / `End` the first / last;
52
- - `Alt`+`↑` / `Alt`+`↓` move the selected item one place up / down — focus travels with it, so
63
+ - `ArrowDown` / `ArrowUp` select the next / previous item (wrapping), `Home` / `End` the first / last;
64
+ - `Alt`+`ArrowUp` / `Alt`+`ArrowDown` move the selected item one place up / down - focus travels with it, so
53
65
  repeated presses keep moving the same entry.
54
66
  The up / down buttons stay and act on the same selection.
55
67
 
56
68
  ## Accessibility
57
69
  The list is named after `header` (`aria-label`) and the selected item carries `aria-selected`.
58
70
  Both buttons are labelled from the dictionary and go disabled while nothing is selected. Native
59
- HTML5 drag and drop has no keyboard equivalent — `Alt`+arrows and the buttons cover it, and
71
+ HTML5 drag and drop has no keyboard equivalent - `Alt`+arrows and the buttons cover it, and
60
72
  `dragdrop` adds to them, it never replaces them.
61
73
 
62
74
  ## Announcements
63
- Every reorder (buttons, Alt+↑/↓, drag and drop) is announced in a polite live region: `orderList.moved` with `{position}` and `{total}` — focus does not move, so a screen reader would not hear the new place otherwise.
75
+ Every reorder (buttons, Alt+ArrowUp/ArrowDown, drag and drop) is announced in a polite live region: `orderList.moved` with `{position}` and `{total}` - focus does not move, so a screen reader would not hear the new place otherwise.
@@ -1,4 +1,5 @@
1
1
  import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
+ import { type KptLayoutMotion } from '@konce-pt/motion';
2
3
  import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
3
4
  export interface KptOrderListProps<T> extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'children'>, KptI18nOverrides {
4
5
  items?: T[];
@@ -7,18 +8,25 @@ export interface KptOrderListProps<T> extends Omit<ComponentPropsWithRef<'div'>,
7
8
  header?: string;
8
9
  /** Włącza przestawianie pozycji metodą przeciągnij-i-upuść. */
9
10
  dragdrop?: boolean;
10
- /** Szablon elementu — odpowiednik `<ng-template let-item>` z Angulara. */
11
+ /**
12
+ * Ruch przestawiania: `spring` - pozycja płynie na nowe miejsce na sprężynie, `arc` - unosi się
13
+ * z cieniem i ląduje, `morph` - natywny morf przeglądarki (View Transitions), `none` - bez ruchu.
14
+ * Sąsiedzi zawsze robią miejsce spokojną sprężyną. Bez wartości bierze `layout` z `KptMotionProvider`
15
+ * (domyślnie `spring`); `enabled={false}` i systemowe "ogranicz ruch" wyłączają go zawsze.
16
+ */
17
+ layoutMotion?: KptLayoutMotion;
18
+ /** Szablon elementu - odpowiednik `<ng-template let-item>` z Angulara. */
11
19
  renderItem: (item: T, index: number) => ReactNode;
12
20
  }
13
21
  /**
14
- * OrderList — lista z ręcznym porządkowaniem. Klik zaznacza element, przyciski przesuwają go
22
+ * OrderList - lista z ręcznym porządkowaniem. Klik zaznacza element, przyciski przesuwają go
15
23
  * w górę i w dół. Z `dragdrop` pozycje przestawia się także przeciąganiem.
16
24
  *
17
25
  * Lista to `listbox` z jednym przystankiem Tab (roving tabindex), w którym zaznaczenie idzie
18
- * za fokusem: strzałki / `Home` / `End` wybierają pozycję, `Alt`+↑/↓ przestawia ją o jedno
26
+ * za fokusem: strzałki / `Home` / `End` wybierają pozycję, `Alt`+ArrowUp/ArrowDown przestawia ją o jedno
19
27
  * miejsce (fokus jedzie razem z nią).
20
28
  *
21
29
  * @example
22
30
  * <KptOrderList items={tasks} onItemsChange={setTasks} header="Kolejność" dragdrop renderItem={(t) => t.name} />
23
31
  */
24
- export declare function KptOrderList<T>({ items, defaultItems, onItemsChange, header, dragdrop, renderItem, locale, dictionary, className, ref, ...rest }: Readonly<KptOrderListProps<T>>): import("react").JSX.Element;
32
+ export declare function KptOrderList<T>({ items, defaultItems, onItemsChange, header, dragdrop, layoutMotion, renderItem, locale, dictionary, className, ref, ...rest }: Readonly<KptOrderListProps<T>>): import("react").JSX.Element;
@@ -1,25 +1,40 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
3
+ import { useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState, } from 'react';
4
+ import { flushSync } from 'react-dom';
5
+ import { isVisibleInScroller, layoutMotionAllowed, morphKeyed, playKeyedMotion, resolveLayoutMotion, revealInScroller, snapshotKeyed, stopKeyedMotion, } from '@konce-pt/motion';
4
6
  import { cn } from "../internal/cn.js";
5
7
  import { composeRefs } from "../internal/compose-refs.js";
6
8
  import { useControllableState } from "../internal/use-controllable-state.js";
7
9
  import { useKptMessages } from "../i18n/i18n-context.js";
8
10
  import { KptIcon } from "../icon/icon.js";
9
11
  import { nextMenuIndex } from "../menu/menu-keys.js";
12
+ import { useKptMotion } from "../motion/motion-context.js";
13
+ /** Klasy ruchu przestawiania - reguły we wspólnym CSS komponentu (duchów tu nie ma: jedna lista). */
14
+ const MOTION_CLASSES = {
15
+ ghostClass: 'kpt-order-list__ghost',
16
+ hiddenClass: 'kpt-order-list__item--waiting',
17
+ movingClass: 'kpt-order-list__item--moving',
18
+ };
19
+ /** Klasa View Transitions dla morfu. */
20
+ const MORPH_CLASS = 'kpt-order-list-morph';
21
+ /** Przewijany pojemnik wiersza. */
22
+ function scrollerOf(element) {
23
+ return element.closest('.kpt-order-list__items');
24
+ }
10
25
  const EMPTY = [];
11
26
  /**
12
- * OrderList — lista z ręcznym porządkowaniem. Klik zaznacza element, przyciski przesuwają go
27
+ * OrderList - lista z ręcznym porządkowaniem. Klik zaznacza element, przyciski przesuwają go
13
28
  * w górę i w dół. Z `dragdrop` pozycje przestawia się także przeciąganiem.
14
29
  *
15
30
  * Lista to `listbox` z jednym przystankiem Tab (roving tabindex), w którym zaznaczenie idzie
16
- * za fokusem: strzałki / `Home` / `End` wybierają pozycję, `Alt`+↑/↓ przestawia ją o jedno
31
+ * za fokusem: strzałki / `Home` / `End` wybierają pozycję, `Alt`+ArrowUp/ArrowDown przestawia ją o jedno
17
32
  * miejsce (fokus jedzie razem z nią).
18
33
  *
19
34
  * @example
20
35
  * <KptOrderList items={tasks} onItemsChange={setTasks} header="Kolejność" dragdrop renderItem={(t) => t.name} />
21
36
  */
22
- export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, header = '', dragdrop = false, renderItem, locale, dictionary, className, ref, ...rest }) {
37
+ export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, header = '', dragdrop = false, layoutMotion, renderItem, locale, dictionary, className, ref, ...rest }) {
23
38
  const { t } = useKptMessages({ locale, dictionary });
24
39
  const [list, setList] = useControllableState({
25
40
  value: items,
@@ -29,13 +44,71 @@ export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, heade
29
44
  const [selected, setSelected] = useState(null);
30
45
  /** Indeks przeciąganej pozycji; `null` gdy nic nie jest przeciągane. */
31
46
  const [dragIndex, setDragIndex] = useState(null);
32
- /** Indeks pozycji pod kursorem — rysuje wskaźnik miejsca upuszczenia. */
47
+ /** Indeks pozycji pod kursorem - rysuje wskaźnik miejsca upuszczenia. */
33
48
  const [overIndex, setOverIndex] = useState(null);
34
- /** Kursor nad pustym obszarem listy — upuszczenie tam dopina na koniec. */
49
+ /** Kursor nad pustym obszarem listy - upuszczenie tam dopina na koniec. */
35
50
  const [listOver, setListOver] = useState(false);
36
51
  /** Pozycja, na którą po renderze trzeba przenieść fokus DOM (klawiatura). */
37
52
  const [focusRequest, setFocusRequest] = useState(null);
38
53
  const rootRef = useRef(null);
54
+ const motionConfig = useKptMotion();
55
+ // `view-transition-name` musi być poprawnym identyfikatorem CSS - `useId` daje dwukropki.
56
+ const morphPrefix = `kpt-order-list-${useId().replaceAll(/[^a-zA-Z0-9-]/g, '')}`;
57
+ /** Który element danych pokazuje każdy wiersz - wiersze mają klucz po indeksie, więc go zmieniają. */
58
+ const keyOf = useRef(new WeakMap());
59
+ /** Stan sprzed zmiany, czekający na commit nowej kolejności. */
60
+ const pending = useRef(null);
61
+ /** Indeks przestawionej pozycji - lista przewija się do niej po zmianie. */
62
+ const revealIndex = useRef(null);
63
+ const stage = () => rootRef.current?.querySelector('.kpt-order-list') ?? null;
64
+ const nodes = () => {
65
+ const root = stage();
66
+ if (!root)
67
+ return [];
68
+ return Array.from(root.querySelectorAll('.kpt-order-list__items > .kpt-order-list__item')).flatMap((element) => keyOf.current.has(element) ? [{ key: keyOf.current.get(element), element }] : []);
69
+ };
70
+ const reveal = () => {
71
+ const row = revealIndex.current === null ? undefined : nodes()[revealIndex.current];
72
+ if (row)
73
+ revealInScroller(row.element, scrollerOf(row.element));
74
+ };
75
+ /**
76
+ * Przestawienie z ruchem. Stan sprzed zmiany mierzymy, zanim React zmieni DOM - dlatego animujemy
77
+ * zmiany z interakcji (przyciski, `Alt`+strzałki, przeciąganie), a lista podmieniona z zewnątrz
78
+ * przełącza się od razu.
79
+ */
80
+ const withMotion = (apply, lead, target, origin) => {
81
+ const motion = resolveLayoutMotion(layoutMotion, motionConfig);
82
+ revealIndex.current = target;
83
+ const root = stage();
84
+ if (motion === 'none' || !root || !layoutMotionAllowed()) {
85
+ apply();
86
+ return;
87
+ }
88
+ if (motion === 'morph') {
89
+ morphKeyed(nodes(), nodes, morphPrefix, MORPH_CLASS, () => {
90
+ flushSync(apply);
91
+ reveal();
92
+ }, (el) => isVisibleInScroller(el, scrollerOf(el)));
93
+ return;
94
+ }
95
+ pending.current = { first: snapshotKeyed(root, nodes(), scrollerOf), motion, lead, origin };
96
+ stopKeyedMotion(root, MOTION_CLASSES);
97
+ apply();
98
+ };
99
+ // Nowa kolejność jest już w DOM (a `keyOf` zaktualizowany refami) - gramy loty od zapamiętanego stanu.
100
+ const playPending = useEffectEvent(() => {
101
+ const job = pending.current;
102
+ pending.current = null;
103
+ const root = stage();
104
+ if (!job || !root)
105
+ return;
106
+ reveal();
107
+ playKeyedMotion(root, job.first, nodes(), { motion: job.motion, scrollerOf, ...MOTION_CLASSES, lead: new Set([job.lead]) }, job.origin);
108
+ });
109
+ useLayoutEffect(() => {
110
+ playPending();
111
+ }, [list]);
39
112
  // Żądanie nie jest zerowane w efekcie (setState w efekcie = dodatkowy przebieg renderu): każde jest
40
113
  // nowym obiektem, więc efekt rusza raz na żądanie, także o ten sam indeks.
41
114
  useEffect(() => {
@@ -57,30 +130,33 @@ export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, heade
57
130
  const text = t('orderList.moved', { position: index + 1, total });
58
131
  setAnnouncement((current) => (current === text ? text + '\u00a0' : text));
59
132
  };
60
- const moveFrom = (index, dir) => {
133
+ const moveFrom = (index, dir, origin) => {
61
134
  const target = index + dir;
62
135
  if (target < 0 || target >= list.length)
63
136
  return index;
64
137
  const next = [...list];
138
+ const moved = next[index];
65
139
  [next[index], next[target]] = [next[target], next[index]];
66
- setList(next);
67
- // Zaznaczenie wędruje za elementem, nie zostaje na pozycji — inaczej kolejne kliknięcie
68
- // przesuwałoby sąsiada zamiast tego samego wpisu.
69
- setSelected(target);
140
+ withMotion(() => {
141
+ setList(next);
142
+ // Zaznaczenie wędruje za elementem, nie zostaje na pozycji - inaczej kolejne kliknięcie
143
+ // przesuwałoby sąsiada zamiast tego samego wpisu.
144
+ setSelected(target);
145
+ }, moved, target, origin);
70
146
  announce(target, next.length);
71
147
  return target;
72
148
  };
73
- const move = (dir) => {
149
+ const move = (dir, origin) => {
74
150
  if (selected !== null)
75
- moveFrom(selected, dir);
151
+ moveFrom(selected, dir, origin);
76
152
  };
77
153
  /** Przystanek Tab: zaznaczona pozycja albo pierwsza. */
78
154
  const tabStop = selected !== null && selected < list.length ? selected : 0;
79
- // Strzałki wybierają pozycję (zaznaczenie idzie za fokusem), `Alt`+↑/↓ ją przestawia.
155
+ // Strzałki wybierają pozycję (zaznaczenie idzie za fokusem), `Alt`+ArrowUp/ArrowDown ją przestawia.
80
156
  const onItemKeyDown = (index, event) => {
81
157
  if (event.altKey && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
82
158
  event.preventDefault();
83
- setFocusRequest({ index: moveFrom(index, event.key === 'ArrowUp' ? -1 : 1) });
159
+ setFocusRequest({ index: moveFrom(index, event.key === 'ArrowUp' ? -1 : 1, event.currentTarget) });
84
160
  return;
85
161
  }
86
162
  const next = nextMenuIndex(list.length, index, event.key);
@@ -118,15 +194,17 @@ export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, heade
118
194
  clearDrag();
119
195
  if (from === null || from === index)
120
196
  return;
121
- // Indeks celu liczony na tablicy sprzed usunięcia — element ląduje na pozycji tego,
197
+ // Indeks celu liczony na tablicy sprzed usunięcia - element ląduje na pozycji tego,
122
198
  // na który go upuszczono (ten sam wzór co przestawianie kolumn w KptDataTable).
123
199
  const next = [...list];
124
200
  const [moved] = next.splice(from, 1);
125
201
  if (moved === undefined)
126
202
  return;
127
203
  next.splice(index, 0, moved);
128
- setList(next);
129
- setSelected(index);
204
+ withMotion(() => {
205
+ setList(next);
206
+ setSelected(index);
207
+ }, moved, index, event.currentTarget);
130
208
  announce(index, next.length);
131
209
  };
132
210
  const onListDragOver = (event) => {
@@ -147,9 +225,14 @@ export function KptOrderList({ items, defaultItems = EMPTY, onItemsChange, heade
147
225
  if (moved === undefined)
148
226
  return;
149
227
  next.push(moved);
150
- setList(next);
151
- setSelected(next.length - 1);
228
+ withMotion(() => {
229
+ setList(next);
230
+ setSelected(next.length - 1);
231
+ }, moved, next.length - 1, event.currentTarget);
152
232
  announce(next.length - 1, next.length);
153
233
  };
154
- return (_jsxs("div", { ref: composeRefs(rootRef, ref), className: cn('kpt-order-list-host', className), ...rest, children: [_jsxs("div", { className: "kpt-order-list", children: [_jsxs("div", { className: "kpt-order-list__controls", children: [_jsx("button", { type: "button", disabled: selected === null, "aria-label": t('orderList.up'), onClick: () => move(-1), children: _jsx(KptIcon, { name: "arrow-up" }) }), _jsx("button", { type: "button", disabled: selected === null, "aria-label": t('orderList.down'), onClick: () => move(1), children: _jsx(KptIcon, { name: "arrow-down" }) })] }), _jsxs("div", { className: "kpt-order-list__panel", children: [header ? _jsx("div", { className: "kpt-order-list__header", children: header }) : null, _jsx("ul", { className: cn('kpt-order-list__items', listOver && 'is-dragover'), role: "listbox", "aria-label": header || undefined, onDragOver: onListDragOver, onDragLeave: () => setListOver(false), onDrop: onListDrop, children: list.map((item, index) => (_jsx("li", { className: cn('kpt-order-list__item', selected === index && 'is-selected', dragIndex === index && 'is-dragging', dragdrop && 'kpt-order-list__item--draggable', overIndex === index && dragIndex !== index && 'kpt-order-list__item--dragover'), role: "option", "aria-selected": selected === index, tabIndex: index === tabStop ? 0 : -1, onFocus: () => setSelected(index), onKeyDown: (event) => onItemKeyDown(index, event), draggable: dragdrop || undefined, onClick: () => setSelected(index), onDragStart: (event) => onDragStart(index, event), onDragOver: (event) => onDragOver(index, event), onDragLeave: () => setOverIndex(null), onDrop: (event) => onDrop(index, event), onDragEnd: clearDrag, children: renderItem(item, index) }, index))) })] })] }), _jsx("p", { className: "kpt-visually-hidden", "aria-live": "polite", children: announcement })] }));
234
+ return (_jsxs("div", { ref: composeRefs(rootRef, ref), className: cn('kpt-order-list-host', className), ...rest, children: [_jsxs("div", { className: "kpt-order-list", children: [_jsxs("div", { className: "kpt-order-list__controls", children: [_jsx("button", { type: "button", disabled: selected === null, "aria-label": t('orderList.up'), onClick: (event) => move(-1, event.currentTarget), children: _jsx(KptIcon, { name: "arrow-up" }) }), _jsx("button", { type: "button", disabled: selected === null, "aria-label": t('orderList.down'), onClick: (event) => move(1, event.currentTarget), children: _jsx(KptIcon, { name: "arrow-down" }) })] }), _jsxs("div", { className: "kpt-order-list__panel", children: [header ? _jsx("div", { className: "kpt-order-list__header", children: header }) : null, _jsx("ul", { className: cn('kpt-order-list__items', listOver && 'is-dragover'), role: "listbox", "aria-label": header || undefined, onDragOver: onListDragOver, onDragLeave: () => setListOver(false), onDrop: onListDrop, children: list.map((item, index) => (_jsx("li", { ref: (element) => {
235
+ if (element)
236
+ keyOf.current.set(element, item);
237
+ }, className: cn('kpt-order-list__item', selected === index && 'is-selected', dragIndex === index && 'is-dragging', dragdrop && 'kpt-order-list__item--draggable', overIndex === index && dragIndex !== index && 'kpt-order-list__item--dragover'), role: "option", "aria-selected": selected === index, tabIndex: index === tabStop ? 0 : -1, onFocus: () => setSelected(index), onKeyDown: (event) => onItemKeyDown(index, event), draggable: dragdrop || undefined, onClick: () => setSelected(index), onDragStart: (event) => onDragStart(index, event), onDragOver: (event) => onDragOver(index, event), onDragLeave: () => setOverIndex(null), onDrop: (event) => onDrop(index, event), onDragEnd: clearDrag, children: renderItem(item, index) }, index))) })] })] }), _jsx("p", { className: "kpt-visually-hidden", "aria-live": "polite", children: announcement })] }));
155
238
  }
@@ -5,22 +5,22 @@ Import: `import { KptPaginator } from '@konce-pt/react';`
5
5
 
6
6
  ## DOM
7
7
  <div class="kpt-paginator">
8
- <div class="kpt-paginator__size"><label>Rows: <select class="kpt-paginator__select">…</select></label></div>
9
- <span class="kpt-paginator__range">1–10 of 120</span>
10
- <div class="kpt-paginator__nav">…two KptButton…</div>
8
+ <div class="kpt-paginator__size"><label>Rows: <select class="kpt-paginator__select">...</select></label></div>
9
+ <span class="kpt-paginator__range">1-10 of 120</span>
10
+ <div class="kpt-paginator__nav">...two KptButton...</div>
11
11
  </div>
12
12
 
13
13
  ## Props
14
- - `length`: number — the total number of items (required)
15
- - `pageIndex` / `defaultPageIndex` / `onPageIndexChange` — the 0-based page
16
- - `pageSize` / `defaultPageSize` / `onPageSizeChange` — the page size (default 10)
14
+ - `length`: number - the total number of items (required)
15
+ - `pageIndex` / `defaultPageIndex` / `onPageIndexChange` - the 0-based page
16
+ - `pageSize` / `defaultPageSize` / `onPageSizeChange` - the page size (default 10)
17
17
  - `pageSizeOptions`: readonly number[] (default [5, 10, 20, 50])
18
18
 
19
19
  The select always offers the current `pageSize` even when it is absent from this list: without
20
20
  that, `pageSize={8}` against the defaults left no matching option, so the control displayed the
21
21
  first entry while the table paged by eight.
22
- - `prevIcon`, `nextIcon`: ReactNode — the navigation button content
23
- - `locale`, `dictionary` — i18n overrides for this component only
22
+ - `prevIcon`, `nextIcon`: ReactNode - the navigation button content
23
+ - `locale`, `dictionary` - i18n overrides for this component only
24
24
  - `className`, `ref` and every other `<div>` prop go to the paginator root
25
25
 
26
26
  ## Behaviour
@@ -27,7 +27,7 @@ export function KptPaginator({ length, pageSize, defaultPageSize = 10, onPageSiz
27
27
  defaultValue: defaultPageIndex,
28
28
  onChange: onPageIndexChange,
29
29
  });
30
- // Rozmiar strony do rachunków — `0` albo ujemny dawałby `Infinity` stron i wieczne „dalej”.
30
+ // Rozmiar strony do rachunków - `0` albo ujemny dawałby `Infinity` stron i wieczne "dalej".
31
31
  const step = Math.max(1, size);
32
32
  const totalPages = Math.max(1, Math.ceil(length / step));
33
33
  const rangeStart = length === 0 ? 0 : index * step + 1;
@@ -8,13 +8,13 @@ Import: `import { KptPanel } from '@konce-pt/react';`
8
8
  <div class="kpt-panel">
9
9
  <div class="kpt-panel__header">
10
10
  <span class="kpt-panel__title">Settings</span>
11
- <span class="kpt-panel__actions">…actions…</span>
11
+ <span class="kpt-panel__actions">...actions...</span>
12
12
  <button class="kpt-panel__toggle" aria-expanded="true" aria-controls="kpt-panel-body-r1"
13
- aria-label="Collapse / expand Settings">…</button>
13
+ aria-label="Collapse / expand Settings">...</button>
14
14
  </div>
15
15
  <div class="kpt-panel__collapse is-open" id="kpt-panel-body-r1">
16
16
  <div class="kpt-panel__collapse-inner">
17
- <div class="kpt-panel__body">…children…</div>
17
+ <div class="kpt-panel__body">...children...</div>
18
18
  </div>
19
19
  </div>
20
20
  </div>
@@ -22,37 +22,49 @@ Import: `import { KptPanel } from '@konce-pt/react';`
22
22
 
23
23
  ## Props
24
24
  - `header`: string
25
- - `toggleable`: boolean — adds the collapse button to the header
26
- - `collapsed` / `defaultCollapsed` / `onCollapsedChange` — controlled or uncontrolled
25
+ - `toggleable`: boolean - adds the collapse button to the header
26
+ - `collapsed` / `defaultCollapsed` / `onCollapsedChange` - controlled or uncontrolled
27
27
  - `animated`: boolean (default true), `animationDuration`: number (ms, default 500)
28
- - `locale`, `dictionary` — i18n overrides for this component only
28
+ - `collapseMotion`: `'spring' | 'fade' | 'none'` (default from `KptMotionProvider`, else `spring`) - see "Collapse motion"
29
+ - `locale`, `dictionary` - i18n overrides for this component only
29
30
  - `className`, `ref` and every other `<div>` prop go to the host
30
31
 
31
32
  ## Sub-components
32
- - `KptPanel.Actions` — lifted into the header, next to the title, before the collapse button.
33
+ - `KptPanel.Actions` - lifted into the header, next to the title, before the collapse button.
33
34
 
34
35
  ## Collapsed content stays mounted
35
36
  It gets `inert` and `aria-hidden` rather than being removed, so the height is animatable while
36
37
  nothing inside can take focus or be read out. That is also why a collapsed panel keeps the state of
37
- whatever lives in it — a half-filled form inside survives a collapse.
38
+ whatever lives in it - a half-filled form inside survives a collapse.
38
39
 
39
40
  ## i18n
40
41
  The toggle's label comes from `panel.toggleNamed` (with `{header}`) or `panel.toggle` in the dictionary.
41
42
 
42
43
  ## Examples
43
- <KptPanel header="Settings" toggleable>Panel content…</KptPanel>
44
+ <KptPanel header="Settings" toggleable>Panel content...</KptPanel>
44
45
 
45
46
  <KptPanel header="Filters" toggleable collapsed={collapsed} onCollapsedChange={setCollapsed}>
46
47
  <KptPanel.Actions><KptIconButton aria-label="Reset"><KptIcon name="x" /></KptIconButton></KptPanel.Actions>
47
- …
48
+ ...
48
49
  </KptPanel>
49
50
 
51
+ ## Collapse motion
52
+ - `spring` - the height opens on a soft spring, the content slides in from above and sharpens out
53
+ of a blur; when collapsing, the content fades first and only then the section closes. The chevron
54
+ turns on a spring.
55
+ - `fade` - the height on the standard curve, the content cross-fades.
56
+ - `none` - the state changes without motion.
57
+
58
+ With no value it takes `collapse` from `KptMotionProvider` (default `spring`). `animated={false}`, `enabled: false`
59
+ in the config and the system "reduce motion" setting always turn it off. `animationDuration` sets
60
+ the time of every kind. Pure CSS: the kind sits in `data-motion` on the component root.
61
+
50
62
  ## Tokens
51
63
  `--kpt-color-surface`, `--kpt-color-border`, `--kpt-radius-lg`, `--kpt-motion-easing-standard`.
52
64
 
53
65
  ## Accessibility
54
66
  The toggle is a native button with `aria-expanded` and `aria-controls` pointing at the body. Its
55
- name says which panel it collapses — `panel.toggleNamed` (“Collapse / expand Settings”) when there
56
- is a `header`, `panel.toggle` otherwise — so several panels on one page are told apart. A collapsed
57
- body is `inert` and `aria-hidden`. The header title is not a heading — add your own when the panel
67
+ name says which panel it collapses - `panel.toggleNamed` ("Collapse / expand Settings") when there
68
+ is a `header`, `panel.toggle` otherwise - so several panels on one page are told apart. A collapsed
69
+ body is `inert` and `aria-hidden`. The header title is not a heading - add your own when the panel
58
70
  should appear in the document outline.
@@ -1,5 +1,6 @@
1
1
  import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
2
  import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
3
+ import { type KptCollapseMotion } from '@konce-pt/motion';
3
4
  export interface KptPanelProps extends ComponentPropsWithRef<'div'>, KptI18nOverrides {
4
5
  header?: string;
5
6
  /** Dokłada przycisk zwijania w nagłówku. */
@@ -9,18 +10,25 @@ export interface KptPanelProps extends ComponentPropsWithRef<'div'>, KptI18nOver
9
10
  onCollapsedChange?: (collapsed: boolean) => void;
10
11
  animated?: boolean;
11
12
  animationDuration?: number;
13
+ /**
14
+ * Ruch zwijania: `spring` - wysokość na sprężynie, treść wjeżdża i wyostrza się, przy zwijaniu
15
+ * najpierw gaśnie; `fade` - treść się przenika; `none` - bez ruchu. Bez wartości bierze `collapse`
16
+ * z `KptMotionProvider` (domyślnie `spring`); `animated={false}`, `enabled={false}` i systemowe
17
+ * "ogranicz ruch" wyłączają go zawsze.
18
+ */
19
+ collapseMotion?: KptCollapseMotion;
12
20
  children?: ReactNode;
13
21
  }
14
22
  /**
15
23
  * Panel z nagłówkiem i opcjonalnym zwijaniem. Akcje nagłówka wstaw przez `<KptPanel.Actions>`.
16
24
  *
17
- * Zwinięta treść zostaje w DOM, ale dostaje `inert` i `aria-hidden` — dzięki temu wysokość da się
25
+ * Zwinięta treść zostaje w DOM, ale dostaje `inert` i `aria-hidden` - dzięki temu wysokość da się
18
26
  * animować, a mimo to nic z jej wnętrza nie łapie fokusu ani nie trafia do czytnika ekranu.
19
27
  *
20
28
  * @example
21
- * <KptPanel header="Ustawienia" toggleable>Treść…</KptPanel>
29
+ * <KptPanel header="Ustawienia" toggleable>Treść...</KptPanel>
22
30
  */
23
- export declare function KptPanel({ header, toggleable, collapsed, defaultCollapsed, onCollapsedChange, animated, animationDuration, locale, dictionary, className, style, children, ...rest }: Readonly<KptPanelProps>): import("react").JSX.Element;
31
+ export declare function KptPanel({ header, toggleable, collapsed, defaultCollapsed, onCollapsedChange, animated, animationDuration, collapseMotion, locale, dictionary, className, style, children, ...rest }: Readonly<KptPanelProps>): import("react").JSX.Element;
24
32
  export declare namespace KptPanel {
25
33
  var Actions: typeof KptPanelActions;
26
34
  }
@@ -7,18 +7,21 @@ import { useControllableState } from "../internal/use-controllable-state.js";
7
7
  import { useKptId } from "../internal/use-id.js";
8
8
  import { useKptMessages } from "../i18n/i18n-context.js";
9
9
  import { KptIcon } from "../icon/icon.js";
10
+ import { resolveCollapseMotion } from '@konce-pt/motion';
11
+ import { useKptMotion } from "../motion/motion-context.js";
10
12
  /**
11
13
  * Panel z nagłówkiem i opcjonalnym zwijaniem. Akcje nagłówka wstaw przez `<KptPanel.Actions>`.
12
14
  *
13
- * Zwinięta treść zostaje w DOM, ale dostaje `inert` i `aria-hidden` — dzięki temu wysokość da się
15
+ * Zwinięta treść zostaje w DOM, ale dostaje `inert` i `aria-hidden` - dzięki temu wysokość da się
14
16
  * animować, a mimo to nic z jej wnętrza nie łapie fokusu ani nie trafia do czytnika ekranu.
15
17
  *
16
18
  * @example
17
- * <KptPanel header="Ustawienia" toggleable>Treść…</KptPanel>
19
+ * <KptPanel header="Ustawienia" toggleable>Treść...</KptPanel>
18
20
  */
19
- export function KptPanel({ header = '', toggleable = false, collapsed, defaultCollapsed = false, onCollapsedChange, animated = true, animationDuration = 500, locale, dictionary, className, style, children, ...rest }) {
21
+ export function KptPanel({ header = '', toggleable = false, collapsed, defaultCollapsed = false, onCollapsedChange, animated = true, animationDuration = 500, collapseMotion, locale, dictionary, className, style, children, ...rest }) {
20
22
  const { t } = useKptMessages({ locale, dictionary });
21
23
  const bodyId = useKptId(undefined, 'kpt-panel-body');
24
+ const motion = resolveCollapseMotion(collapseMotion, useKptMotion(), animated);
22
25
  const [isCollapsed, setCollapsed] = useControllableState({
23
26
  value: collapsed,
24
27
  defaultValue: defaultCollapsed,
@@ -30,7 +33,7 @@ export function KptPanel({ header = '', toggleable = false, collapsed, defaultCo
30
33
  const isActions = isValidElement(child) && child.type?.kptPanelSlot === 'actions';
31
34
  (isActions ? actions : body).push(child);
32
35
  }
33
- return (_jsx("div", { className: cn('kpt-panel-host', className), style: { ['--kpt-anim-duration']: `${animated ? animationDuration : 0}ms`, ...style }, ...rest, children: _jsxs("div", { className: "kpt-panel", children: [_jsxs("div", { className: "kpt-panel__header", children: [_jsx("span", { className: "kpt-panel__title", children: header }), _jsx("span", { className: "kpt-panel__actions", children: actions }), toggleable ? (_jsx("button", { type: "button", className: "kpt-panel__toggle", onClick: () => setCollapsed(!isCollapsed), "aria-expanded": !isCollapsed, "aria-controls": bodyId, "aria-label": header ? t('panel.toggleNamed', { header }) : t('panel.toggle'), children: _jsx(KptIcon, { name: isCollapsed ? 'chevron-down' : 'chevron-up' }) })) : null] }), _jsx("div", { className: cn('kpt-panel__collapse', !isCollapsed && 'is-open'), id: bodyId, inert: isCollapsed, "aria-hidden": isCollapsed, children: _jsx("div", { className: "kpt-panel__collapse-inner", children: _jsx("div", { className: "kpt-panel__body", children: body }) }) })] }) }));
36
+ return (_jsx("div", { className: cn('kpt-panel-host', className), style: { ['--kpt-anim-duration']: `${animated ? animationDuration : 0}ms`, ...style }, ...rest, children: _jsxs("div", { className: "kpt-panel", "data-motion": motion, children: [_jsxs("div", { className: "kpt-panel__header", children: [_jsx("span", { className: "kpt-panel__title", children: header }), _jsx("span", { className: "kpt-panel__actions", children: actions }), toggleable ? (_jsx("button", { type: "button", className: "kpt-panel__toggle", onClick: () => setCollapsed(!isCollapsed), "aria-expanded": !isCollapsed, "aria-controls": bodyId, "aria-label": header ? t('panel.toggleNamed', { header }) : t('panel.toggle'), children: _jsx(KptIcon, { name: "chevron-down", className: cn('kpt-panel__chevron', !isCollapsed && 'is-open') }) })) : null] }), _jsx("div", { className: cn('kpt-panel__collapse', !isCollapsed && 'is-open'), id: bodyId, inert: isCollapsed, "aria-hidden": isCollapsed, children: _jsx("div", { className: "kpt-panel__collapse-inner", children: _jsx("div", { className: "kpt-panel__body", children: body }) }) })] }) }));
34
37
  }
35
38
  /** Akcje w nagłówku panelu, obok tytułu. */
36
39
  export function KptPanelActions({ className, ...rest }) {