@kumix/ui 0.4.0 → 0.4.2

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 (402) hide show
  1. package/README.md +52 -45
  2. package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
  3. package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
  4. package/dist/components/agents/agent-code.js +1 -1
  5. package/dist/components/agents/approval-card/index.d.ts +2 -0
  6. package/dist/components/agents/approval-card/index.d.ts.map +1 -1
  7. package/dist/components/agents/approval-card/index.js +2 -0
  8. package/dist/components/agents/approval-card/index.js.map +1 -1
  9. package/dist/components/agents/citations.d.ts +14 -2
  10. package/dist/components/agents/citations.d.ts.map +1 -1
  11. package/dist/components/agents/citations.js +11 -7
  12. package/dist/components/agents/citations.js.map +1 -1
  13. package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
  14. package/dist/components/agents/loading-states/reasoning-text.js +3 -0
  15. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  16. package/dist/components/charts/bump-chart/context.js +1 -2
  17. package/dist/components/charts/bump-chart/plot.js +1 -2
  18. package/dist/components/charts/bump-chart/point.js +1 -1
  19. package/dist/components/charts/bump-chart/series.d.ts +1 -0
  20. package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
  21. package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
  22. package/dist/components/charts/candlestick-chart/context.js +69 -0
  23. package/dist/components/charts/candlestick-chart/context.js.map +1 -0
  24. package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
  25. package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
  26. package/dist/components/charts/candlestick-chart/legend.js +56 -0
  27. package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
  28. package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
  29. package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
  30. package/dist/components/charts/candlestick-chart/plot.js +218 -0
  31. package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
  32. package/dist/components/charts/candlestick-chart.d.ts +18 -0
  33. package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
  34. package/dist/components/charts/candlestick-chart.js +34 -0
  35. package/dist/components/charts/candlestick-chart.js.map +1 -0
  36. package/dist/components/charts/composition-chart/context.js +1 -2
  37. package/dist/components/charts/composition-chart/plot.js +1 -1
  38. package/dist/components/charts/donut-chart/center.d.ts +16 -0
  39. package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
  40. package/dist/components/charts/donut-chart/center.js +78 -0
  41. package/dist/components/charts/donut-chart/center.js.map +1 -0
  42. package/dist/components/charts/donut-chart/context.d.ts +68 -0
  43. package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
  44. package/dist/components/charts/donut-chart/context.js +2 -0
  45. package/dist/components/charts/donut-chart/legend.d.ts +17 -0
  46. package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
  47. package/dist/components/charts/donut-chart/legend.js +85 -0
  48. package/dist/components/charts/donut-chart/legend.js.map +1 -0
  49. package/dist/components/charts/donut-chart/plot.d.ts +10 -0
  50. package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
  51. package/dist/components/charts/donut-chart/plot.js +108 -0
  52. package/dist/components/charts/donut-chart/plot.js.map +1 -0
  53. package/dist/components/charts/donut-chart.d.ts +22 -0
  54. package/dist/components/charts/donut-chart.d.ts.map +1 -0
  55. package/dist/components/charts/donut-chart.js +37 -0
  56. package/dist/components/charts/donut-chart.js.map +1 -0
  57. package/dist/components/charts/funnel-chart.d.ts.map +1 -1
  58. package/dist/components/charts/funnel-chart.js +1 -2
  59. package/dist/components/charts/funnel-chart.js.map +1 -1
  60. package/dist/components/charts/heat-calendar/tooltip.js +1 -1
  61. package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
  62. package/dist/components/charts/liquidity-heatmap.js +1 -1
  63. package/dist/components/charts/order-book/depth-row.d.ts +8 -2
  64. package/dist/components/charts/order-book/depth-row.d.ts.map +1 -1
  65. package/dist/components/charts/order-book/depth-row.js +11 -3
  66. package/dist/components/charts/order-book/depth-row.js.map +1 -1
  67. package/dist/components/charts/order-book.d.ts +33 -1
  68. package/dist/components/charts/order-book.d.ts.map +1 -1
  69. package/dist/components/charts/order-book.js +92 -17
  70. package/dist/components/charts/order-book.js.map +1 -1
  71. package/dist/components/charts/price-target-fan/tooltip.js +1 -1
  72. package/dist/components/charts/returns-calendar/tooltip.js +1 -1
  73. package/dist/components/charts/status-bar/tooltip.js +1 -1
  74. package/dist/components/charts/treemap/tooltip.js +1 -1
  75. package/dist/components/charts/treemap.d.ts.map +1 -1
  76. package/dist/components/charts/volume-profile/tooltip.js +1 -1
  77. package/dist/components/charts/volume-profile.d.ts.map +1 -1
  78. package/dist/components/custom/confirm-dialog.d.ts +1 -0
  79. package/dist/components/custom/toast.d.ts +1 -0
  80. package/dist/components/motion/action-swap.d.ts +1 -1
  81. package/dist/components/motion/action-swap.d.ts.map +1 -1
  82. package/dist/components/motion/action-swap.js +46 -20
  83. package/dist/components/motion/action-swap.js.map +1 -1
  84. package/dist/components/motion/animated-badge.d.ts +1 -1
  85. package/dist/components/motion/animated-badge.d.ts.map +1 -1
  86. package/dist/components/motion/animated-badge.js +60 -101
  87. package/dist/components/motion/animated-badge.js.map +1 -1
  88. package/dist/components/motion/animated-sidebar.d.ts +1 -0
  89. package/dist/components/motion/animated-sidebar.js +1 -1
  90. package/dist/components/motion/animated-toast-stack.js +1 -1
  91. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  92. package/dist/components/motion/attachment-upload.js +2 -3
  93. package/dist/components/motion/attachment-upload.js.map +1 -1
  94. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
  95. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  96. package/dist/components/motion/availability-scheduler/index.js +1 -1
  97. package/dist/components/motion/bloom-menu.d.ts +1 -0
  98. package/dist/components/motion/bloom-menu.d.ts.map +1 -1
  99. package/dist/components/motion/bloom-menu.js +73 -8
  100. package/dist/components/motion/bloom-menu.js.map +1 -1
  101. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  102. package/dist/components/motion/bottom-sheet.js +6 -10
  103. package/dist/components/motion/bottom-sheet.js.map +1 -1
  104. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  105. package/dist/components/motion/bounce-sidebar.js +34 -42
  106. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  107. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
  108. package/dist/components/motion/bouncy-accordion.js +35 -22
  109. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  110. package/dist/components/motion/button/stateful.d.ts.map +1 -1
  111. package/dist/components/motion/button/stateful.js +3 -0
  112. package/dist/components/motion/button/stateful.js.map +1 -1
  113. package/dist/components/motion/card.d.ts +44 -0
  114. package/dist/components/motion/card.d.ts.map +1 -0
  115. package/dist/components/motion/card.js +122 -0
  116. package/dist/components/motion/card.js.map +1 -0
  117. package/dist/components/motion/center-morph-modal.js +1 -1
  118. package/dist/components/motion/checkbox.d.ts +3 -1
  119. package/dist/components/motion/checkbox.d.ts.map +1 -1
  120. package/dist/components/motion/checkbox.js +18 -6
  121. package/dist/components/motion/checkbox.js.map +1 -1
  122. package/dist/components/motion/color-picker.d.ts +110 -0
  123. package/dist/components/motion/color-picker.d.ts.map +1 -0
  124. package/dist/components/motion/color-picker.js +1053 -0
  125. package/dist/components/motion/color-picker.js.map +1 -0
  126. package/dist/components/motion/color-selector.d.ts.map +1 -1
  127. package/dist/components/motion/color-selector.js +9 -2
  128. package/dist/components/motion/color-selector.js.map +1 -1
  129. package/dist/components/motion/combobox/content.d.ts +1 -0
  130. package/dist/components/motion/command-palette.js +3 -3
  131. package/dist/components/motion/command-palette.js.map +1 -1
  132. package/dist/components/motion/context-menu.d.ts +1 -0
  133. package/dist/components/motion/context-menu.js +1 -1
  134. package/dist/components/motion/date-range-picker.d.ts.map +1 -1
  135. package/dist/components/motion/digit-swap.d.ts +9 -1
  136. package/dist/components/motion/digit-swap.d.ts.map +1 -1
  137. package/dist/components/motion/digit-swap.js +18 -7
  138. package/dist/components/motion/digit-swap.js.map +1 -1
  139. package/dist/components/motion/drawer.d.ts +1 -1
  140. package/dist/components/motion/drawer.d.ts.map +1 -1
  141. package/dist/components/motion/drawer.js +10 -10
  142. package/dist/components/motion/drawer.js.map +1 -1
  143. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  144. package/dist/components/motion/expandable-control.d.ts +1 -0
  145. package/dist/components/motion/feedback-widget.js +4 -1
  146. package/dist/components/motion/feedback-widget.js.map +1 -1
  147. package/dist/components/motion/knockout-wheel.d.ts.map +1 -1
  148. package/dist/components/motion/knockout-wheel.js +1 -2
  149. package/dist/components/motion/knockout-wheel.js.map +1 -1
  150. package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
  151. package/dist/components/motion/morphing-lightbox.js +1 -1
  152. package/dist/components/motion/morphing-modal.d.ts +6 -1
  153. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  154. package/dist/components/motion/morphing-modal.js +37 -5
  155. package/dist/components/motion/morphing-modal.js.map +1 -1
  156. package/dist/components/motion/morphing-search-chips.d.ts +54 -0
  157. package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
  158. package/dist/components/motion/morphing-search-chips.js +599 -0
  159. package/dist/components/motion/morphing-search-chips.js.map +1 -0
  160. package/dist/components/motion/morphing-search.js +1 -1
  161. package/dist/components/motion/morphing-tabs.js +1 -1
  162. package/dist/components/motion/multi-select/content.d.ts +1 -0
  163. package/dist/components/motion/not-found/shared.d.ts +1 -0
  164. package/dist/components/motion/number-ticker.d.ts +6 -1
  165. package/dist/components/motion/number-ticker.d.ts.map +1 -1
  166. package/dist/components/motion/number-ticker.js +19 -9
  167. package/dist/components/motion/number-ticker.js.map +1 -1
  168. package/dist/components/motion/otp-input.js +19 -11
  169. package/dist/components/motion/otp-input.js.map +1 -1
  170. package/dist/components/motion/parallax.js.map +1 -1
  171. package/dist/components/motion/popover-morph.d.ts +5 -3
  172. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  173. package/dist/components/motion/popover-morph.js +47 -52
  174. package/dist/components/motion/popover-morph.js.map +1 -1
  175. package/dist/components/motion/popover.d.ts +1 -0
  176. package/dist/components/motion/popover.js +7 -1
  177. package/dist/components/motion/popover.js.map +1 -1
  178. package/dist/components/motion/prediction-market-card.js +2 -3
  179. package/dist/components/motion/prediction-market-card.js.map +1 -1
  180. package/dist/components/motion/prediction-market.js +1 -1
  181. package/dist/components/motion/project-folder.js +1 -1
  182. package/dist/components/motion/radio.d.ts +8 -2
  183. package/dist/components/motion/radio.d.ts.map +1 -1
  184. package/dist/components/motion/radio.js +70 -10
  185. package/dist/components/motion/radio.js.map +1 -1
  186. package/dist/components/motion/scroll-progress.d.ts +1 -0
  187. package/dist/components/motion/select-morph.d.ts +1 -1
  188. package/dist/components/motion/select-morph.d.ts.map +1 -1
  189. package/dist/components/motion/select-morph.js +89 -21
  190. package/dist/components/motion/select-morph.js.map +1 -1
  191. package/dist/components/motion/select.d.ts.map +1 -1
  192. package/dist/components/motion/select.js +153 -135
  193. package/dist/components/motion/select.js.map +1 -1
  194. package/dist/components/motion/shader-background.d.ts +4 -2
  195. package/dist/components/motion/shader-background.d.ts.map +1 -1
  196. package/dist/components/motion/shader-background.js +9 -3
  197. package/dist/components/motion/shader-background.js.map +1 -1
  198. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
  199. package/dist/components/motion/shared-layout-bg.js +17 -3
  200. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  201. package/dist/components/motion/sortable-list.d.ts +1 -0
  202. package/dist/components/motion/sortable-stack.js +1 -2
  203. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  204. package/dist/components/motion/swipeable-list.js +61 -4
  205. package/dist/components/motion/swipeable-list.js.map +1 -1
  206. package/dist/components/motion/table/row-handle.js +1 -1
  207. package/dist/components/motion/table/table-header.js +1 -1
  208. package/dist/components/motion/tabs.d.ts +13 -3
  209. package/dist/components/motion/tabs.d.ts.map +1 -1
  210. package/dist/components/motion/tabs.js +248 -26
  211. package/dist/components/motion/tabs.js.map +1 -1
  212. package/dist/components/motion/text-reveal.d.ts +1 -0
  213. package/dist/components/motion/theme-toggle.js +1 -1
  214. package/dist/components/motion/tooltip/positioner.d.ts +8 -26
  215. package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
  216. package/dist/components/motion/tooltip/positioner.js +1 -2
  217. package/dist/components/motion/tooltip.d.ts +62 -20
  218. package/dist/components/motion/tooltip.d.ts.map +1 -1
  219. package/dist/components/motion/tooltip.js +1 -135
  220. package/dist/components/motion/wallet-card/account-avatar.js +1 -2
  221. package/dist/components/reui/alert.d.ts +1 -1
  222. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  223. package/dist/components/reui/autocomplete.js +1 -1
  224. package/dist/components/reui/autocomplete.js.map +1 -1
  225. package/dist/components/reui/badge.d.ts +1 -1
  226. package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
  227. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
  228. package/dist/components/reui/cascader/cascader-async.js +61 -34
  229. package/dist/components/reui/cascader/cascader-async.js.map +1 -1
  230. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
  231. package/dist/components/reui/cascader/cascader-columns.js +5 -2
  232. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  233. package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
  234. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  235. package/dist/components/reui/cascader/cascader-context.js.map +1 -1
  236. package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
  237. package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
  238. package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
  239. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
  240. package/dist/components/reui/cascader/cascader-lib.js +145 -29
  241. package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
  242. package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
  243. package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
  244. package/dist/components/reui/cascader/cascader.d.ts +13 -8
  245. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  246. package/dist/components/reui/cascader/cascader.js +31 -16
  247. package/dist/components/reui/cascader/cascader.js.map +1 -1
  248. package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
  249. package/dist/components/reui/color-picker.d.ts +280 -0
  250. package/dist/components/reui/color-picker.d.ts.map +1 -0
  251. package/dist/components/reui/color-picker.js +2013 -0
  252. package/dist/components/reui/color-picker.js.map +1 -0
  253. package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
  254. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
  255. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  256. package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
  257. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
  258. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  259. package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
  260. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  261. package/dist/components/reui/data-grid/data-grid-column-header.js +50 -29
  262. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  263. package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
  264. package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
  265. package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
  266. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  267. package/dist/components/reui/data-grid/data-grid-pagination.js +2 -1
  268. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  269. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  270. package/dist/components/reui/data-grid/data-grid-scroll-area.js +10 -3
  271. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  272. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  273. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +15 -10
  274. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  275. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
  276. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  277. package/dist/components/reui/data-grid/data-grid-table-dnd.js +54 -14
  278. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  279. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
  280. package/dist/components/reui/data-grid/data-grid-table-virtual.js +37 -42
  281. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  282. package/dist/components/reui/data-grid/data-grid-table.d.ts +174 -16
  283. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  284. package/dist/components/reui/data-grid/data-grid-table.js +223 -89
  285. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  286. package/dist/components/reui/data-grid/data-grid.d.ts +55 -1
  287. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  288. package/dist/components/reui/data-grid/data-grid.js +112 -22
  289. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  290. package/dist/components/reui/date-selector.d.ts +1 -0
  291. package/dist/components/reui/date-selector.d.ts.map +1 -1
  292. package/dist/components/reui/date-selector.js +22 -16
  293. package/dist/components/reui/date-selector.js.map +1 -1
  294. package/dist/components/reui/emoji-picker.d.ts +367 -0
  295. package/dist/components/reui/emoji-picker.d.ts.map +1 -0
  296. package/dist/components/reui/emoji-picker.js +1768 -0
  297. package/dist/components/reui/emoji-picker.js.map +1 -0
  298. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
  299. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  300. package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
  301. package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
  302. package/dist/components/reui/event-calendar/event-calendar-nav.js +4 -4
  303. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  304. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  305. package/dist/components/reui/event-calendar/event-calendar.js +34 -31
  306. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  307. package/dist/components/reui/file-type.d.ts +792 -0
  308. package/dist/components/reui/file-type.d.ts.map +1 -0
  309. package/dist/components/reui/file-type.js +1367 -0
  310. package/dist/components/reui/file-type.js.map +1 -0
  311. package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
  312. package/dist/components/reui/filters/filters-advanced.js +1 -1
  313. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  314. package/dist/components/reui/filters/filters-builder.d.ts +1 -1
  315. package/dist/components/reui/filters/filters-chip.d.ts +5 -1
  316. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
  317. package/dist/components/reui/filters/filters-chip.js +1 -1
  318. package/dist/components/reui/filters/filters-lib.d.ts +1 -1
  319. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
  320. package/dist/components/reui/frame.d.ts.map +1 -1
  321. package/dist/components/reui/frame.js.map +1 -1
  322. package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
  323. package/dist/components/reui/gantt/gantt-nav.js +4 -4
  324. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  325. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  326. package/dist/components/reui/gantt/gantt.js +5 -2
  327. package/dist/components/reui/gantt/gantt.js.map +1 -1
  328. package/dist/components/reui/icon-tile.d.ts +1 -1
  329. package/dist/components/reui/icon-tile.js +8 -7
  330. package/dist/components/reui/icon-tile.js.map +1 -1
  331. package/dist/components/reui/kanban.d.ts.map +1 -1
  332. package/dist/components/reui/kanban.js +1 -1
  333. package/dist/components/reui/kanban.js.map +1 -1
  334. package/dist/components/reui/number-field.d.ts.map +1 -1
  335. package/dist/components/reui/number-field.js.map +1 -1
  336. package/dist/components/reui/phone-input.js +30 -27
  337. package/dist/components/reui/phone-input.js.map +1 -1
  338. package/dist/components/reui/scrollspy.d.ts +1 -0
  339. package/dist/components/reui/time-picker.js +1 -1
  340. package/dist/components/reui/time-picker.js.map +1 -1
  341. package/dist/components/ui/attachment.d.ts +1 -1
  342. package/dist/components/ui/button-group.d.ts +1 -1
  343. package/dist/components/ui/button.d.ts +1 -1
  344. package/dist/components/ui/chart.d.ts.map +1 -1
  345. package/dist/components/ui/code-block.d.ts +29 -0
  346. package/dist/components/ui/code-block.d.ts.map +1 -0
  347. package/dist/components/ui/code-block.js +124 -0
  348. package/dist/components/ui/code-block.js.map +1 -0
  349. package/dist/components/ui/command.d.ts.map +1 -1
  350. package/dist/components/ui/direction.js +1 -2
  351. package/dist/components/ui/field.d.ts +1 -1
  352. package/dist/components/ui/field.js +1 -1
  353. package/dist/components/ui/input-group.d.ts +1 -1
  354. package/dist/components/ui/marker.d.ts +1 -1
  355. package/dist/components/ui/message-scroller.d.ts.map +1 -1
  356. package/dist/components/ui/questionnaire.d.ts.map +1 -1
  357. package/dist/components/ui/sidebar.js +1 -1
  358. package/dist/components/ui/trace.d.ts +21 -0
  359. package/dist/components/ui/trace.d.ts.map +1 -0
  360. package/dist/components/ui/trace.js +77 -0
  361. package/dist/components/ui/trace.js.map +1 -0
  362. package/dist/context-BYXeJQnz.d.ts.map +1 -1
  363. package/dist/context-tTdLKYNf.js +99 -0
  364. package/dist/context-tTdLKYNf.js.map +1 -0
  365. package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-DOg9Jh-U.js} +2 -2
  366. package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
  367. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
  368. package/dist/hooks/use-focus-trap.d.ts +22 -0
  369. package/dist/hooks/use-focus-trap.d.ts.map +1 -0
  370. package/dist/hooks/use-focus-trap.js +80 -0
  371. package/dist/hooks/use-focus-trap.js.map +1 -0
  372. package/dist/hooks/use-highlighted-code.d.ts +5 -0
  373. package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
  374. package/dist/hooks/use-highlighted-code.js +128 -0
  375. package/dist/hooks/use-highlighted-code.js.map +1 -0
  376. package/dist/hooks/use-hover-gesture.d.ts +1 -0
  377. package/dist/hooks/use-intersection-observer.d.ts +1 -0
  378. package/dist/hooks/use-listbox.d.ts +29 -0
  379. package/dist/hooks/use-listbox.d.ts.map +1 -0
  380. package/dist/hooks/use-listbox.js +75 -0
  381. package/dist/hooks/use-listbox.js.map +1 -0
  382. package/dist/hooks/use-scroll-position.d.ts +1 -0
  383. package/dist/hooks/use-slider-input.d.ts +1 -0
  384. package/dist/hooks/use-viewport.d.ts +1 -0
  385. package/dist/lib/tick-sound.d.ts +1 -0
  386. package/dist/model-NSIg2p7a.d.ts +20 -0
  387. package/dist/model-NSIg2p7a.d.ts.map +1 -0
  388. package/dist/model-_mRyI6V9.d.ts +18 -0
  389. package/dist/model-_mRyI6V9.d.ts.map +1 -0
  390. package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
  391. package/dist/positioner-3r3cfkqT.js.map +1 -0
  392. package/dist/tooltip-Bam5KeYe.js +535 -0
  393. package/dist/tooltip-Bam5KeYe.js.map +1 -0
  394. package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
  395. package/dist/use-position-DOi1gVL0.d.ts +32 -0
  396. package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
  397. package/package.json +11 -11
  398. package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
  399. package/dist/components/motion/tooltip.js.map +0 -1
  400. package/dist/model-DfeFradZ.d.ts +0 -9
  401. package/dist/model-DfeFradZ.d.ts.map +0 -1
  402. package/dist/positioner-3mCqiebN.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"funnel-chart.js","names":[],"sources":["../../../src/components/charts/funnel-chart/model.ts","../../../src/components/charts/funnel-chart.tsx"],"sourcesContent":["export interface FunnelStage {\n /** Keep IDs stable when updating counts. */\n id: string;\n label: string;\n value: number;\n color?: string;\n}\n\n/** Preserve stage order; omit invalid counts and repeated identities. */\nexport function buildFunnel(stages: readonly FunnelStage[]) {\n const seen = new Set<string>();\n const valid = stages.filter((stage) => {\n if (seen.has(stage.id) || !Number.isFinite(stage.value) || stage.value < 0) return false;\n seen.add(stage.id);\n return true;\n });\n const first = valid[0]?.value ?? 0;\n const last = valid.at(-1)?.value ?? 0;\n const maximum = valid.reduce((max, stage) => Math.max(max, stage.value), 0);\n const rows = valid.map((stage, index) => {\n const previous = valid[index - 1]?.value;\n return {\n ...stage,\n proportion: maximum > 0 ? stage.value / maximum : 0,\n conversion: first > 0 ? (stage.value / first) * 100 : null,\n stepConversion:\n previous !== undefined && previous > 0 ? (stage.value / previous) * 100 : null,\n change: previous === undefined ? null : stage.value - previous,\n };\n });\n return { rows, first, last, conversion: first > 0 ? (last / first) * 100 : null };\n}\n\n/** Each stage's center width encodes its value; shared boundaries join without gaps. */\nexport function funnelPath(\n proportions: readonly number[],\n index: number,\n direction: \"vertical\" | \"horizontal\",\n) {\n const value = proportions[index];\n const top = index === 0 ? value : (proportions[index - 1] + value) / 2;\n const bottom = index === proportions.length - 1 ? value : (value + proportions[index + 1]) / 2;\n const start = index / proportions.length;\n const end = (index + 1) / proportions.length;\n const middle = (start + end) / 2;\n const quarter = (end - start) / 4;\n const point = (cross: number, along: number) =>\n direction === \"vertical\" ? `${cross * 1000},${along * 500}` : `${along * 1000},${cross * 500}`;\n const left = (width: number) => 0.5 - width * 0.46;\n const right = (width: number) => 0.5 + width * 0.46;\n return `M${point(left(top), start)} L${point(right(top), start)} C${point(right(top), start + quarter)} ${point(right(value), middle - quarter)} ${point(right(value), middle)} C${point(right(value), middle + quarter)} ${point(right(bottom), end - quarter)} ${point(right(bottom), end)} L${point(left(bottom), end)} C${point(left(bottom), end - quarter)} ${point(left(value), middle + quarter)} ${point(left(value), middle)} C${point(left(value), middle - quarter)} ${point(left(top), start + quarter)} ${point(left(top), start)} Z`;\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { NumberTicker } from \"../motion/number-ticker\";\nimport { Tooltip } from \"../motion/tooltip\";\nimport { buildFunnel, type FunnelStage, funnelPath } from \"./funnel-chart/model\";\n\nconst defaultFormat = (value: number) =>\n value.toLocaleString(\"en-US\", { maximumFractionDigits: 2 });\nconst percentage = (value: number | null) => (value === null ? \"—\" : `${value.toFixed(1)}%`);\nconst colors = [\"#8b5cf6\", \"#7774ef\", \"#548ee4\", \"#2ca6bc\", \"#14b8a6\"];\nexport interface FunnelChartProps {\n /** Ordered stages with finite, nonnegative counts; duplicate IDs are omitted. */\n stages: readonly FunnelStage[];\n direction?: \"vertical\" | \"horizontal\";\n unit?: string;\n label?: string;\n formatValue?: (value: number) => string;\n className?: string;\n children?: ReactNode;\n}\nconst Context = createContext<\n | (ReturnType<typeof buildFunnel> & {\n direction: \"vertical\" | \"horizontal\";\n unit: string;\n formatValue: (value: number) => string;\n })\n | null\n>(null);\nexport function useFunnelChart() {\n const context = useContext(Context);\n if (!context) throw new Error(\"Funnel chart parts must be inside FunnelChart\");\n return context;\n}\nexport function FunnelChart({\n stages,\n direction = \"vertical\",\n unit = \"people\",\n label = \"Conversion funnel\",\n formatValue = defaultFormat,\n className,\n children,\n}: FunnelChartProps) {\n const model = useMemo(() => buildFunnel(stages), [stages]);\n return (\n <Context.Provider value={{ ...model, direction, unit, formatValue }}>\n <section aria-label={label} className={cn(\"w-full space-y-6\", className)}>\n {children === undefined ? (\n <>\n <FunnelChartPlot />\n <FunnelChartSummary />\n </>\n ) : (\n children\n )}\n </section>\n </Context.Provider>\n );\n}\nexport function FunnelChartPlot({ className }: { className?: string }) {\n const { rows, direction, unit, formatValue } = useFunnelChart();\n const reduced = useReducedMotion();\n if (!rows.length)\n return (\n <p className={cn(\"py-16 text-center text-muted-foreground text-sm\", className)}>\n No funnel data\n </p>\n );\n const horizontal = direction === \"horizontal\";\n const proportions = rows.map((stage) => stage.proportion);\n return (\n <div className={cn(\"space-y-5\", className)}>\n <div className=\"overflow-x-auto\">\n <div\n className=\"relative\"\n style={{\n height: horizontal ? 300 : Math.max(320, rows.length * 72),\n minWidth: horizontal ? rows.length * 110 : 240,\n }}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 1000 500\"\n preserveAspectRatio=\"none\"\n className=\"absolute inset-0 h-full w-full\"\n >\n {rows.map((stage, index) => (\n <motion.path\n key={stage.id}\n fill={stage.color ?? colors[index % colors.length]}\n initial={false}\n // A shared path interpolation keeps adjacent curved boundaries connected.\n animate={{ d: funnelPath(proportions, index, direction) }}\n transition={{ duration: reduced ? 0 : 0.28, ease: EASE_OUT }}\n />\n ))}\n </svg>\n <ol\n aria-label=\"Funnel stages\"\n className=\"absolute inset-0 grid\"\n style={\n horizontal\n ? { gridTemplateColumns: `repeat(${rows.length}, 1fr)` }\n : { gridTemplateRows: `repeat(${rows.length}, 1fr)` }\n }\n >\n {rows.map((stage, index) => (\n <li key={stage.id} className=\"min-h-0 min-w-0\">\n <Tooltip\n wrapperClassName=\"block h-full w-full\"\n content={\n <span className=\"flex flex-col gap-1.5 text-xs\">\n <span className=\"text-muted-foreground\">{stage.label}</span>\n <NumberTicker\n value={stage.value}\n format={() => formatValue(stage.value)}\n suffix={` ${unit}`}\n duration={0.35}\n startOnView={false}\n className=\"font-mono\"\n />\n {index > 0 && (\n <>\n <span>{percentage(stage.stepConversion)} from previous stage</span>\n <span className=\"text-muted-foreground\">\n {formatValue(Math.abs(stage.change ?? 0))}{\" \"}\n {(stage.change ?? 0) > 0 ? \"gained\" : \"dropped\"}\n </span>\n </>\n )}\n <span className=\"text-muted-foreground\">\n {percentage(stage.conversion)} of starting total\n </span>\n </span>\n }\n >\n <button\n type=\"button\"\n className=\"flex h-full w-full items-center justify-center outline-none transition-colors hover:bg-foreground/5 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\"\n aria-label={`${stage.label}: ${formatValue(stage.value)} ${unit}, ${percentage(stage.conversion)} of starting total`}\n >\n <span className=\"rounded bg-background/85 px-2 py-1 font-medium font-mono text-xs tabular-nums\">\n {formatValue(stage.value)}\n </span>\n </button>\n </Tooltip>\n </li>\n ))}\n </ol>\n </div>\n </div>\n <div className=\"flex flex-wrap justify-center gap-x-6 gap-y-3\">\n {rows.map((stage, index) => (\n <span key={stage.id} className=\"inline-flex items-center gap-2 text-xs\">\n <span\n aria-hidden=\"true\"\n className=\"size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: stage.color ?? colors[index % colors.length] }}\n />\n <span>{stage.label}</span>\n <span className=\"font-mono text-[10px] text-muted-foreground\">\n {percentage(stage.conversion)}\n </span>\n </span>\n ))}\n </div>\n </div>\n );\n}\nexport function FunnelChartSummary({ className }: { className?: string }) {\n const { rows, first, last, conversion, formatValue, unit } = useFunnelChart();\n if (!rows.length) return null;\n return (\n <div\n className={cn(\n \"flex flex-wrap items-center justify-between gap-3 border-border border-t pt-4 text-xs\",\n className,\n )}\n >\n <span className=\"text-muted-foreground\">\n {formatValue(first)} → {formatValue(last)} {unit}\n </span>\n <span className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Overall conversion</span>\n <span className=\"font-medium font-mono tabular-nums\">{percentage(conversion)}</span>\n </span>\n </div>\n );\n}\nexport type { FunnelStage };\n"],"mappings":";;;;;;;;;;AASA,SAAgB,YAAY,QAAgC;CAC1D,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,QAAQ,OAAO,QAAQ,UAAU;EACrC,IAAI,KAAK,IAAI,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,MAAM,KAAK,KAAK,MAAM,QAAQ,GAAG,OAA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,SAAS,OAAO,QAAQ,OAAO,QAAQ;KACxE,CAAA;KACD,oBAAC,QAAD,EAAA,UAAO,MAAM,MAAY,CAAA;KACzB,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,WAAW,MAAM,UAAU;KACxB,CAAA;IACF;GAVK,GAAA,MAAM,EAUX,CACP;EACE,CAAA,CACF;;AAET;AACA,SAAgB,mBAAmB,EAAE,aAAqC;CACxE,MAAM,EAAE,MAAM,OAAO,MAAM,YAAY,aAAa,SAAS,eAAe;CAC5E,IAAI,CAAC,KAAK,QAAQ,OAAO;CACzB,OACE,qBAAC,OAAD;EACE,WAAW,GACT,yFACA,SACF;EAJF,UAAA,CAME,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IACG,YAAY,KAAK;IAAE;IAAI,YAAY,IAAI;IAAE;IAAE;GACxC;EACN,CAAA,GAAA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA;GAAwB,CAAA,GAChE,oBAAC,QAAD;IAAM,WAAU;IAAsC,UAAA,WAAW,UAAU;GAAQ,CAAA,CAC/E;EACH,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"funnel-chart.js","names":[],"sources":["../../../src/components/charts/funnel-chart/model.ts","../../../src/components/charts/funnel-chart.tsx"],"sourcesContent":["export interface FunnelStage {\n /** Keep IDs stable when updating counts. */\n id: string;\n label: string;\n value: number;\n color?: string;\n}\n\n/** Preserve stage order; omit invalid counts and repeated identities. */\nexport function buildFunnel(stages: readonly FunnelStage[]) {\n const seen = new Set<string>();\n const valid = stages.filter((stage) => {\n if (seen.has(stage.id) || !Number.isFinite(stage.value) || stage.value < 0) return false;\n seen.add(stage.id);\n return true;\n });\n const first = valid[0]?.value ?? 0;\n const last = valid.at(-1)?.value ?? 0;\n const maximum = valid.reduce((max, stage) => Math.max(max, stage.value), 0);\n const rows = valid.map((stage, index) => {\n const previous = valid[index - 1]?.value;\n return {\n ...stage,\n proportion: maximum > 0 ? stage.value / maximum : 0,\n conversion: first > 0 ? (stage.value / first) * 100 : null,\n stepConversion:\n previous !== undefined && previous > 0 ? (stage.value / previous) * 100 : null,\n change: previous === undefined ? null : stage.value - previous,\n };\n });\n return { rows, first, last, conversion: first > 0 ? (last / first) * 100 : null };\n}\n\n/** Each stage's center width encodes its value; shared boundaries join without gaps. */\nexport function funnelPath(\n proportions: readonly number[],\n index: number,\n direction: \"vertical\" | \"horizontal\",\n) {\n const value = proportions[index];\n const top = index === 0 ? value : (proportions[index - 1] + value) / 2;\n const bottom = index === proportions.length - 1 ? value : (value + proportions[index + 1]) / 2;\n const start = index / proportions.length;\n const end = (index + 1) / proportions.length;\n const middle = (start + end) / 2;\n const quarter = (end - start) / 4;\n const point = (cross: number, along: number) =>\n direction === \"vertical\" ? `${cross * 1000},${along * 500}` : `${along * 1000},${cross * 500}`;\n const left = (width: number) => 0.5 - width * 0.46;\n const right = (width: number) => 0.5 + width * 0.46;\n return `M${point(left(top), start)} L${point(right(top), start)} C${point(right(top), start + quarter)} ${point(right(value), middle - quarter)} ${point(right(value), middle)} C${point(right(value), middle + quarter)} ${point(right(bottom), end - quarter)} ${point(right(bottom), end)} L${point(left(bottom), end)} C${point(left(bottom), end - quarter)} ${point(left(value), middle + quarter)} ${point(left(value), middle)} C${point(left(value), middle - quarter)} ${point(left(top), start + quarter)} ${point(left(top), start)} Z`;\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { NumberTicker } from \"../motion/number-ticker\";\nimport { Tooltip } from \"../motion/tooltip\";\nimport { buildFunnel, type FunnelStage, funnelPath } from \"./funnel-chart/model\";\n\nconst defaultFormat = (value: number) =>\n value.toLocaleString(\"en-US\", { maximumFractionDigits: 2 });\nconst percentage = (value: number | null) => (value === null ? \"—\" : `${value.toFixed(1)}%`);\nconst colors = [\"#8b5cf6\", \"#7774ef\", \"#548ee4\", \"#2ca6bc\", \"#14b8a6\"];\nexport interface FunnelChartProps {\n /** Ordered stages with finite, nonnegative counts; duplicate IDs are omitted. */\n stages: readonly FunnelStage[];\n direction?: \"vertical\" | \"horizontal\";\n unit?: string;\n label?: string;\n formatValue?: (value: number) => string;\n className?: string;\n children?: ReactNode;\n}\nconst Context = createContext<\n | (ReturnType<typeof buildFunnel> & {\n direction: \"vertical\" | \"horizontal\";\n unit: string;\n formatValue: (value: number) => string;\n })\n | null\n>(null);\nexport function useFunnelChart() {\n const context = useContext(Context);\n if (!context) throw new Error(\"Funnel chart parts must be inside FunnelChart\");\n return context;\n}\nexport function FunnelChart({\n stages,\n direction = \"vertical\",\n unit = \"people\",\n label = \"Conversion funnel\",\n formatValue = defaultFormat,\n className,\n children,\n}: FunnelChartProps) {\n const model = useMemo(() => buildFunnel(stages), [stages]);\n return (\n <Context.Provider value={{ ...model, direction, unit, formatValue }}>\n <section aria-label={label} className={cn(\"w-full space-y-6\", className)}>\n {children === undefined ? (\n <>\n <FunnelChartPlot />\n <FunnelChartSummary />\n </>\n ) : (\n children\n )}\n </section>\n </Context.Provider>\n );\n}\nexport function FunnelChartPlot({ className }: { className?: string }) {\n const { rows, direction, unit, formatValue } = useFunnelChart();\n const reduced = useReducedMotion();\n if (!rows.length)\n return (\n <p className={cn(\"py-16 text-center text-muted-foreground text-sm\", className)}>\n No funnel data\n </p>\n );\n const horizontal = direction === \"horizontal\";\n const proportions = rows.map((stage) => stage.proportion);\n return (\n <div className={cn(\"space-y-5\", className)}>\n <div className=\"overflow-x-auto\">\n <div\n className=\"relative\"\n style={{\n height: horizontal ? 300 : Math.max(320, rows.length * 72),\n minWidth: horizontal ? rows.length * 110 : 240,\n }}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 1000 500\"\n preserveAspectRatio=\"none\"\n className=\"absolute inset-0 h-full w-full\"\n >\n {rows.map((stage, index) => (\n <motion.path\n key={stage.id}\n fill={stage.color ?? colors[index % colors.length]}\n initial={false}\n // A shared path interpolation keeps adjacent curved boundaries connected.\n animate={{ d: funnelPath(proportions, index, direction) }}\n transition={{ duration: reduced ? 0 : 0.28, ease: EASE_OUT }}\n />\n ))}\n </svg>\n <ol\n aria-label=\"Funnel stages\"\n className=\"absolute inset-0 grid\"\n style={\n horizontal\n ? { gridTemplateColumns: `repeat(${rows.length}, 1fr)` }\n : { gridTemplateRows: `repeat(${rows.length}, 1fr)` }\n }\n >\n {rows.map((stage, index) => (\n <li key={stage.id} className=\"min-h-0 min-w-0\">\n <Tooltip\n content={\n <span className=\"flex flex-col gap-1.5 text-xs\">\n <span className=\"text-muted-foreground\">{stage.label}</span>\n <NumberTicker\n value={stage.value}\n format={() => formatValue(stage.value)}\n suffix={` ${unit}`}\n duration={0.35}\n startOnView={false}\n className=\"font-mono\"\n />\n {index > 0 && (\n <>\n <span>{percentage(stage.stepConversion)} from previous stage</span>\n <span className=\"text-muted-foreground\">\n {formatValue(Math.abs(stage.change ?? 0))}{\" \"}\n {(stage.change ?? 0) > 0 ? \"gained\" : \"dropped\"}\n </span>\n </>\n )}\n <span className=\"text-muted-foreground\">\n {percentage(stage.conversion)} of starting total\n </span>\n </span>\n }\n >\n <button\n type=\"button\"\n className=\"flex h-full w-full items-center justify-center outline-none transition-colors hover:bg-foreground/5 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\"\n aria-label={`${stage.label}: ${formatValue(stage.value)} ${unit}, ${percentage(stage.conversion)} of starting total`}\n >\n <span className=\"rounded bg-background/85 px-2 py-1 font-medium font-mono text-xs tabular-nums\">\n {formatValue(stage.value)}\n </span>\n </button>\n </Tooltip>\n </li>\n ))}\n </ol>\n </div>\n </div>\n <div className=\"flex flex-wrap justify-center gap-x-6 gap-y-3\">\n {rows.map((stage, index) => (\n <span key={stage.id} className=\"inline-flex items-center gap-2 text-xs\">\n <span\n aria-hidden=\"true\"\n className=\"size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: stage.color ?? colors[index % colors.length] }}\n />\n <span>{stage.label}</span>\n <span className=\"font-mono text-[10px] text-muted-foreground\">\n {percentage(stage.conversion)}\n </span>\n </span>\n ))}\n </div>\n </div>\n );\n}\nexport function FunnelChartSummary({ className }: { className?: string }) {\n const { rows, first, last, conversion, formatValue, unit } = useFunnelChart();\n if (!rows.length) return null;\n return (\n <div\n className={cn(\n \"flex flex-wrap items-center justify-between gap-3 border-border border-t pt-4 text-xs\",\n className,\n )}\n >\n <span className=\"text-muted-foreground\">\n {formatValue(first)} → {formatValue(last)} {unit}\n </span>\n <span className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Overall conversion</span>\n <span className=\"font-medium font-mono tabular-nums\">{percentage(conversion)}</span>\n </span>\n </div>\n );\n}\nexport type { FunnelStage };\n"],"mappings":";;;;;;;;;;AASA,SAAgB,YAAY,QAAgC;CAC1D,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,QAAQ,OAAO,QAAQ,UAAU;EACrC,IAAI,KAAK,IAAI,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,MAAM,KAAK,KAAK,MAAM,QAAQ,GAAG,OAAO;EACnF,KAAK,IAAI,MAAM,EAAE;EACjB,OAAO;CACT,CAAC;CACD,MAAM,QAAQ,MAAM,EAAE,EAAE,SAAS;CACjC,MAAM,OAAO,MAAM,GAAG,EAAE,CAAC,EAAE,SAAS;CACpC,MAAM,UAAU,MAAM,QAAQ,KAAK,UAAU,KAAK,IAAI,KAAK,MAAM,KAAK,GAAG,CAAC;CAY1E,OAAO;EAAE,MAXI,MAAM,KAAK,OAAO,UAAU;GACvC,MAAM,WAAW,MAAM,QAAQ,EAAE,EAAE;GACnC,OAAO;IACL,GAAG;IACH,YAAY,UAAU,IAAI,MAAM,QAAQ,UAAU;IAClD,YAAY,QAAQ,IAAK,MAAM,QAAQ,QAAS,MAAM;IACtD,gBACE,aAAa,KAAA,KAAa,WAAW,IAAK,MAAM,QAAQ,WAAY,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N,CAAA,GAAA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA;GAAwB,CAAA,GAChE,oBAAC,QAAD;IAAM,WAAU;IAAsC,UAAA,WAAW,UAAU;GAAQ,CAAA,CAC/E;EACH,CAAA,CAAA;;AAET"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { NumberTicker } from "../../motion/number-ticker.js";
4
4
  import { c as fmtRange, n as useHeatCalendar, s as fmtDay } from "../../../context-CZfRKkcZ.js";
5
5
  import { useMemo, useState } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"liquidity-heatmap.d.ts","names":[],"sources":["../../../src/components/charts/liquidity-heatmap/model.ts","../../../src/components/charts/liquidity-heatmap.tsx"],"mappings":";;UAAiB;;EAEf;EACA;EACA;IAAmB;IAAe;;EAClC;;;;UCmBQ;;EAER,oBAAoB;;EAEpB;EACA;EACA;EACA,eAAe;EACf,cAAc;EACd,WAAW;EACX;;wBAWc;;YAAA;;;;;;;;EAPD;EACH;EACO,cAAC;EACF,aAAC;;wBASH,mBACd,WACA,SACA,MACA,OACA,aAAa,gBACb,YAAY,eACZ,UACA,aACC,wCAAqB,IAAA;wBAoBR,uBAAuB;EAAe;oBAAoB,IAAA;wBA6O1D,yBAAyB;EAAe;oBAAoB,IAAA"}
1
+ {"version":3,"file":"liquidity-heatmap.d.ts","names":[],"sources":["../../../src/components/charts/liquidity-heatmap/model.ts","../../../src/components/charts/liquidity-heatmap.tsx"],"mappings":";;UAAiB;;EAEf;EACA;EACA;IAAmB;IAAe;;EAClC;;;;UCmBQ;;EAER,oBAAoB;;EAEpB;EACA;EACA;EACA,eAAe;EACf,cAAc;EACd,WAAW;EACX;;wBAWc;;;;;;;;;;EAPD;EACH;EACO,cAAC;EACF,aAAC;;wBASH,mBACd,WACA,SACA,MACA,OACA,aAAa,gBACb,YAAY,eACZ,UACA,aACC,wCAAqB,IAAA;wBAoBR,uBAAuB;EAAe;oBAAoB,IAAA;wBA6O1D,yBAAyB;EAAe;oBAAoB,IAAA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
- import { Tooltip } from "../motion/tooltip.js";
3
+ import { t as Tooltip } from "../../tooltip-Bam5KeYe.js";
4
4
  import { NumberTicker } from "../motion/number-ticker.js";
5
5
  import { createContext, useContext, useId, useMemo, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
@@ -1,6 +1,6 @@
1
- import { t as DepthLevel } from "../../../model-DfeFradZ.js";
1
+ import { t as DepthLevel } from "../../../model-NSIg2p7a.js";
2
2
  //#region src/components/charts/order-book/depth-row.d.ts
3
- export declare function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, formatSize, reduce }: {
3
+ export declare function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, formatSize, reduce, inRange, onInspect, onSelect }: {
4
4
  row: DepthLevel;
5
5
  fraction: number;
6
6
  entranceIndex: number;
@@ -8,6 +8,12 @@ export declare function OrderBookDepthRow({ row, fraction, entranceIndex, color,
8
8
  formatPrice: (value: number) => string;
9
9
  formatSize: (value: number) => string;
10
10
  reduce: boolean;
11
+ /** True when this level is inside the inspected depth range. */
12
+ inRange?: boolean;
13
+ /** Called with true when the row is hovered or its price focused, false on blur. */
14
+ onInspect?: (inspect: boolean) => void;
15
+ /** Renders the price as a button. */
16
+ onSelect?: () => void;
11
17
  }): import("react").JSX.Element;
12
18
  //#endregion
13
19
  //# sourceMappingURL=depth-row.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"depth-row.d.ts","names":[],"sources":["../../../../src/components/charts/order-book/depth-row.tsx"],"mappings":";;wBASgB,oBACd,KACA,UACA,eACA,OACA,aACA,YACA;EAEA,KAAK;EACL;EACA;EACA;EACA,cAAc;EACd,aAAa;EACb;oBACD,IAAA"}
1
+ {"version":3,"file":"depth-row.d.ts","names":[],"sources":["../../../../src/components/charts/order-book/depth-row.tsx"],"mappings":";;wBASgB,oBACd,KACA,UACA,eACA,OACA,aACA,YACA,QACA,SACA,WACA;EAEA,KAAK;EACL;EACA;EACA;EACA,cAAc;EACd,aAAa;EACb;;EAEA;;EAEA,aAAa;;EAEb;oBACD,IAAA"}
@@ -5,7 +5,7 @@ import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { animate, motion, useMotionValue } from "motion/react";
7
7
  //#region src/components/charts/order-book/depth-row.tsx
8
- function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, formatSize, reduce }) {
8
+ function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, formatSize, reduce, inRange = false, onInspect, onSelect }) {
9
9
  const highlight = useMotionValue(0);
10
10
  const previousSize = useRef(row.size);
11
11
  const entered = useRef(false);
@@ -47,6 +47,7 @@ function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, f
47
47
  ease: EASE_OUT,
48
48
  delay: reduce || entered.current ? 0 : Math.min(entranceIndex, 8) * .025
49
49
  },
50
+ onPointerEnter: onInspect ? () => onInspect(true) : void 0,
50
51
  className: cn("group", color),
51
52
  children: [
52
53
  /* @__PURE__ */ jsxs("td", {
@@ -75,9 +76,16 @@ function OrderBookDepthRow({ row, fraction, entranceIndex, color, formatPrice, f
75
76
  style: { opacity: highlight },
76
77
  className: "absolute inset-0 bg-current"
77
78
  }),
78
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-current opacity-0 transition-opacity duration-150 group-hover:opacity-[0.05]" })
79
+ /* @__PURE__ */ jsx("div", { className: cn("absolute inset-0 bg-current transition-opacity duration-150", inRange ? "opacity-[0.08]" : "opacity-0 group-hover:opacity-[0.05]") })
79
80
  ]
80
- }), /* @__PURE__ */ jsx("span", {
81
+ }), onSelect ? /* @__PURE__ */ jsx("button", {
82
+ type: "button",
83
+ onClick: onSelect,
84
+ onFocus: () => onInspect?.(true),
85
+ onBlur: () => onInspect?.(false),
86
+ className: "relative rounded-sm outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",
87
+ children: formatPrice(row.price)
88
+ }) : /* @__PURE__ */ jsx("span", {
81
89
  className: "relative",
82
90
  children: formatPrice(row.price)
83
91
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"depth-row.js","names":[],"sources":["../../../../src/components/charts/order-book/depth-row.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { animate, motion, useMotionValue } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../../lib/ease\";\nimport type { DepthLevel } from \"./model\";\n\nexport function OrderBookDepthRow({\n row,\n fraction,\n entranceIndex,\n color,\n formatPrice,\n formatSize,\n reduce,\n}: {\n row: DepthLevel;\n fraction: number;\n entranceIndex: number;\n color: string;\n formatPrice: (value: number) => string;\n formatSize: (value: number) => string;\n reduce: boolean;\n}) {\n const highlight = useMotionValue(0);\n const previousSize = useRef(row.size);\n const entered = useRef(false);\n useEffect(() => {\n entered.current = true;\n }, []);\n\n useEffect(() => {\n const changed = previousSize.current !== row.size;\n previousSize.current = row.size;\n if (!changed || reduce) {\n highlight.set(0);\n return;\n }\n\n // A soft full-row tint identifies changed quantities. Retarget from\n // the current opacity when another snapshot interrupts the fade.\n let fade: ReturnType<typeof animate> | undefined;\n const rise = animate(highlight, 0.1, {\n duration: 0.08,\n ease: EASE_OUT,\n onComplete: () => {\n fade = animate(highlight, 0, { duration: 0.2, ease: EASE_OUT });\n },\n });\n return () => {\n rise.stop();\n fade?.stop();\n };\n }, [row.size, reduce, highlight]);\n\n return (\n <motion.tr\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{\n duration: 0.18,\n ease: EASE_OUT,\n delay: reduce || entered.current ? 0 : Math.min(entranceIndex, 8) * 0.025,\n }}\n className={cn(\"group\", color)}\n >\n <td className=\"relative h-8 px-4 py-0\">\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-y-px left-1 w-[calc(300%-8px)] overflow-hidden rounded-sm\"\n >\n <motion.div\n initial={reduce ? false : { transform: `scaleX(${fraction * 0.85})`, opacity: 0 }}\n animate={{ transform: `scaleX(${fraction})`, opacity: 1 }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n ...SPRING_PANEL,\n delay: entered.current ? 0 : Math.min(entranceIndex, 8) * 0.025,\n }\n }\n className=\"absolute inset-0 origin-right overflow-hidden rounded-sm\"\n >\n <div className=\"absolute inset-0 bg-current opacity-[0.12]\" />\n </motion.div>\n <motion.div style={{ opacity: highlight }} className=\"absolute inset-0 bg-current\" />\n <div className=\"absolute inset-0 bg-current opacity-0 transition-opacity duration-150 group-hover:opacity-[0.05]\" />\n </div>\n <span className=\"relative\">{formatPrice(row.price)}</span>\n </td>\n <td className=\"relative px-4 py-0 text-right text-foreground\">{formatSize(row.size)}</td>\n <td className=\"relative px-4 py-0 text-right text-muted-foreground\">\n {formatSize(row.total)}\n </td>\n </motion.tr>\n );\n}\n"],"mappings":";;;;;;;AASA,SAAgB,kBAAkB,EAChC,KACA,UACA,eACA,OACA,aACA,YACA,UASC;CACD,MAAM,YAAY,eAAe,CAAC;CAClC,MAAM,eAAe,OAAO,IAAI,IAAI;CACpC,MAAM,UAAU,OAAO,KAAK;CAC5B,gBAAgB;EACd,QAAQ,UAAU;CACpB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,UAAU,aAAa,YAAY,IAAI;EAC7C,aAAa,UAAU,IAAI;EAC3B,IAAI,CAAC,WAAW,QAAQ;GACtB,UAAU,IAAI,CAAC;GACf;EACF;EAIA,IAAI;EACJ,MAAM,OAAO,QAAQ,WAAW,IAAK;GACnC,UAAU;GACV,MAAM;GACN,kBAAkB;IAChB,OAAO,QAAQ,WAAW,GAAG;KAAE,UAAU;KAAK,MAAM;IAAS,CAAC;GAChE;EACF,CAAC;EAC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esContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { animate, motion, useMotionValue } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../../lib/ease\";\nimport type { DepthLevel } from \"./model\";\n\nexport function OrderBookDepthRow({\n row,\n fraction,\n entranceIndex,\n color,\n formatPrice,\n formatSize,\n reduce,\n inRange = false,\n onInspect,\n onSelect,\n}: {\n row: DepthLevel;\n fraction: number;\n entranceIndex: number;\n color: string;\n formatPrice: (value: number) => string;\n formatSize: (value: number) => string;\n reduce: boolean;\n /** True when this level is inside the inspected depth range. */\n inRange?: boolean;\n /** Called with true when the row is hovered or its price focused, false on blur. */\n onInspect?: (inspect: boolean) => void;\n /** Renders the price as a button. */\n onSelect?: () => void;\n}) {\n const highlight = useMotionValue(0);\n const previousSize = useRef(row.size);\n const entered = useRef(false);\n useEffect(() => {\n entered.current = true;\n }, []);\n\n useEffect(() => {\n const changed = previousSize.current !== row.size;\n previousSize.current = row.size;\n if (!changed || reduce) {\n highlight.set(0);\n return;\n }\n\n // A soft full-row tint identifies changed quantities. Retarget from\n // the current opacity when another snapshot interrupts the fade.\n let fade: ReturnType<typeof animate> | undefined;\n const rise = animate(highlight, 0.1, {\n duration: 0.08,\n ease: EASE_OUT,\n onComplete: () => {\n fade = animate(highlight, 0, { duration: 0.2, ease: EASE_OUT });\n },\n });\n return () => {\n rise.stop();\n fade?.stop();\n };\n }, [row.size, reduce, highlight]);\n\n return (\n <motion.tr\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{\n duration: 0.18,\n ease: EASE_OUT,\n delay: reduce || entered.current ? 0 : Math.min(entranceIndex, 8) * 0.025,\n }}\n onPointerEnter={onInspect ? () => onInspect(true) : undefined}\n className={cn(\"group\", color)}\n >\n <td className=\"relative h-8 px-4 py-0\">\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-y-px left-1 w-[calc(300%-8px)] overflow-hidden rounded-sm\"\n >\n <motion.div\n initial={reduce ? false : { transform: `scaleX(${fraction * 0.85})`, opacity: 0 }}\n animate={{ transform: `scaleX(${fraction})`, opacity: 1 }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n ...SPRING_PANEL,\n delay: entered.current ? 0 : Math.min(entranceIndex, 8) * 0.025,\n }\n }\n className=\"absolute inset-0 origin-right overflow-hidden rounded-sm\"\n >\n <div className=\"absolute inset-0 bg-current opacity-[0.12]\" />\n </motion.div>\n <motion.div style={{ opacity: highlight }} className=\"absolute inset-0 bg-current\" />\n <div\n className={cn(\n \"absolute inset-0 bg-current transition-opacity duration-150\",\n inRange ? \"opacity-[0.08]\" : \"opacity-0 group-hover:opacity-[0.05]\",\n )}\n />\n </div>\n {onSelect ? (\n <button\n type=\"button\"\n onClick={onSelect}\n onFocus={() => onInspect?.(true)}\n onBlur={() => onInspect?.(false)}\n className=\"relative rounded-sm outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {formatPrice(row.price)}\n </button>\n ) : (\n <span className=\"relative\">{formatPrice(row.price)}</span>\n )}\n </td>\n <td className=\"relative px-4 py-0 text-right text-foreground\">{formatSize(row.size)}</td>\n <td className=\"relative px-4 py-0 text-right text-muted-foreground\">\n {formatSize(row.total)}\n </td>\n </motion.tr>\n );\n}\n"],"mappings":";;;;;;;AASA,SAAgB,kBAAkB,EAChC,KACA,UACA,eACA,OACA,aACA,YACA,QACA,UAAU,OACV,WACA,YAeC;CACD,MAAM,YAAY,eAAe,CAAC;CAClC,MAAM,eAAe,OAAO,IAAI,IAAI;CACpC,MAAM,UAAU,OAAO,KAAK;CAC5B,gBAAgB;EACd,QAAQ,UAAU;CACpB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,UAAU,aAAa,YAAY,IAAI;EAC7C,aAAa,UAAU,IAAI;EAC3B,IAAI,CAAC,WAAW,QAAQ;GACtB,UAAU,IAAI,CAAC;GACf;EACF;EAIA,IAAI;EACJ,MAAM,OAAO,QA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B,WAAU;KAET,UAAA,YAAY,IAAI,KAAK;IAChB,CAAA,IAER,oBAAC,QAAD;KAAM,WAAU;KAAY,UAAA,YAAY,IAAI,KAAK;IAAQ,CAAA,CAEzD;;GACJ,oBAAC,MAAD;IAAI,WAAU;IAAiD,UAAA,WAAW,IAAI,IAAI;GAAM,CAAA;GACxF,oBAAC,MAAD;IAAI,WAAU;IACX,UAAA,WAAW,IAAI,KAAK;GACnB,CAAA;EACK;;AAEf"}
@@ -1,10 +1,15 @@
1
- import { t as DepthLevel } from "../../model-DfeFradZ.js";
1
+ import { n as DepthSummary, t as DepthLevel } from "../../model-NSIg2p7a.js";
2
2
  import { ReactNode } from "react";
3
3
  //#region src/components/charts/order-book.d.ts
4
4
  export type OrderBookLevel = {
5
5
  price: number;
6
6
  size: number;
7
7
  };
8
+ /** A level identified by its side and price, so it survives snapshot updates. */
9
+ export type OrderBookActiveLevel = {
10
+ side: "bid" | "ask";
11
+ price: number;
12
+ } | null;
8
13
  export interface OrderBookProps {
9
14
  /** Snapshot of buy levels. Equal prices are combined; invalid and zero sizes are omitted. */
10
15
  bids: readonly OrderBookLevel[];
@@ -19,10 +24,26 @@ export interface OrderBookProps {
19
24
  quoteSymbol?: string;
20
25
  formatPrice?: (value: number) => string;
21
26
  formatSize?: (value: number) => string;
27
+ /**
28
+ * The level whose depth is inspected: it and every better level on its side
29
+ * are highlighted, and `OrderBookDepthSummary` totals them. Controlled.
30
+ */
31
+ activeLevel?: OrderBookActiveLevel;
32
+ defaultActiveLevel?: OrderBookActiveLevel;
33
+ onActiveLevelChange?: (level: OrderBookActiveLevel) => void;
34
+ /** Makes each price a button, for example to fill an order ticket. */
35
+ onLevelSelect?: (level: DepthLevel, side: "bid" | "ask") => void;
22
36
  children?: ReactNode;
23
37
  className?: string;
24
38
  }
25
39
  export declare function useOrderBook(): {
40
+ active: {
41
+ side: "bid" | "ask";
42
+ index: number;
43
+ } | null;
44
+ summary: DepthSummary | null;
45
+ setActiveLevel: (level: OrderBookActiveLevel) => void;
46
+ onLevelSelect: ((level: DepthLevel, side: "bid" | "ask") => void) | undefined;
26
47
  price: number | null;
27
48
  baseSymbol: string;
28
49
  quoteSymbol: string;
@@ -53,5 +74,16 @@ export declare function OrderBookSpread({ className }: {
53
74
  export declare function OrderBookBalance({ className }: {
54
75
  className?: string;
55
76
  }): import("react").JSX.Element;
77
+ /**
78
+ * Totals the inspected levels: the hovered or focused level and every better
79
+ * level on its side, as the cost of filling an order up to that price.
80
+ */
81
+ export declare function OrderBookDepthSummary({ placeholder, children, className }: {
82
+ placeholder?: ReactNode;
83
+ /** Custom readout for the inspected levels. */
84
+ children?: (summary: NonNullable<ReturnType<typeof useOrderBook>["summary"]>) => ReactNode;
85
+ className?: string;
86
+ }): import("react").JSX.Element;
56
87
  //#endregion
88
+ export type { DepthLevel as OrderBookDepthLevel, DepthSummary as OrderBookDepthSummaryData };
57
89
  //# sourceMappingURL=order-book.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-book.d.ts","names":["_$__order_book_model0.DepthLevel"],"sources":["../../../src/components/charts/order-book.tsx"],"mappings":";;;YAUY;EAAmB;EAAe;;iBAE7B;;EAEf,eAAe;;EAEf,eAAe;;EAEf;;EAEA;EACA;EACA;EACA;EACA,eAAe;EACf,cAAc;EACd,WAAW;EACX;;wBAsCc;;;;EAzCQ,cAAA;EACD,aAAA;;QAwCPA;QAAAA;;;;;;;;wBAOA,YAAY,UAAU,WAAW,UAAyB,SAAS,iCAAc,IAAA;wBA2BjF,kBAAkB;EAAe;oBAAoB,IAAA;wBAiBrD,gBAAgB,MAAM;EAAe;EAAqB;oBAAoB,IAAA;wBA4C9E,kBAAkB;EAAe;oBAAoB,IAAA;;wBAyBrD,mBAAmB;EAAe;oBAAoB,IAAA"}
1
+ {"version":3,"file":"order-book.d.ts","names":["_$__order_book0.OrderBookDepthSummaryData"],"sources":["../../../src/components/charts/order-book.tsx"],"mappings":";;;YAkBY;EAAmB;EAAe;;;YAOlC;EAAyB;EAAqB;;iBAEzC;;EAEf,eAAe;;EAEf,eAAe;;EAEf;;EAEA;EACA;EACA;EACA;EACA,eAAe;EACf,cAAc;;;;;EAKd,cAAc;EACd,qBAAqB;EACrB,uBAAuB,OAAO;;EAE9B,iBAAiB,OAAO,YAAY;EACpC,WAAW;EACX;;wBAyEc;;;;;E,SAAAA;EA3B6B,iBAAA,OAAA;EAhDnB,iBAAA,OAAA,YAAU;;;;EAVZ,cAAA;EACD,aAAA;;;;;;;;;;;wBA2FP,YAAY,UAAU,WAAW,UAAyB,SAAS,iCAAc,IAAA;wBA2BjF,kBAAkB;EAAe;oBAAoB,IAAA;wBAiBrD,gBAAgB,MAAM;EAAe;EAAqB;oBAAoB,IAAA;wBA6D9E,kBAAkB;EAAe;oBAAoB,IAAA;;wBAyBrD,mBAAmB;EAAe;oBAAoB,IAAA;;;;;wBA+BtD,wBACd,aACA,UACA;EAEA,cAAc;;EAEd,YAAY,SAAS,YAAY,kBAAkB,8BAA8B;EACjF;oBACD,IAAA"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { SPRING_PANEL } from "../../lib/ease.js";
3
3
  import { OrderBookDepthRow } from "./order-book/depth-row.js";
4
- import { createContext, useContext } from "react";
4
+ import { createContext, useCallback, useContext, useLayoutEffect, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { motion, useReducedMotion } from "motion/react";
@@ -22,6 +22,18 @@ function prepare(levels, side, limit) {
22
22
  };
23
23
  });
24
24
  }
25
+ /** Totals levels ordered from the best price outward. */
26
+ function summarizeDepth(levels, side) {
27
+ const size = levels.reduce((sum, level) => sum + level.size, 0);
28
+ const quote = levels.reduce((sum, level) => sum + level.size * level.price, 0);
29
+ return {
30
+ side,
31
+ levels: levels.length,
32
+ size,
33
+ quote,
34
+ averagePrice: size ? quote / size : 0
35
+ };
36
+ }
25
37
  /** Accumulate from the best quote outward before reversing asks for display. */
26
38
  function buildOrderBook(bids, asks, levels) {
27
39
  const limit = Number.isFinite(levels) ? Math.max(0, Math.floor(levels)) : 9;
@@ -55,10 +67,35 @@ const sizeFormatter = new Intl.NumberFormat("en-US", {
55
67
  });
56
68
  const defaultPrice = (value) => priceFormatter.format(value);
57
69
  const defaultSize = (value) => sizeFormatter.format(value);
58
- function useOrderBookModel({ bids, asks, levels = 9, lastPrice, baseSymbol = "", quoteSymbol = "USD", formatPrice = defaultPrice, formatSize = defaultSize }) {
70
+ function useOrderBookModel({ bids, asks, levels = 9, lastPrice, baseSymbol = "", quoteSymbol = "USD", formatPrice = defaultPrice, formatSize = defaultSize, activeLevel, defaultActiveLevel = null, onActiveLevelChange, onLevelSelect }) {
59
71
  const book = buildOrderBook(bids, asks, levels);
72
+ const [internalActive, setInternalActive] = useState(defaultActiveLevel);
73
+ const rawActive = activeLevel === void 0 ? internalActive : activeLevel;
74
+ const activeIndex = rawActive ? (rawActive.side === "bid" ? book.bids : book.asks).findIndex((level) => level.price === rawActive.price) : -1;
75
+ const active = rawActive && activeIndex >= 0 ? {
76
+ side: rawActive.side,
77
+ index: activeIndex
78
+ } : null;
79
+ const latest = useRef({
80
+ controlled: activeLevel !== void 0,
81
+ onActiveLevelChange
82
+ });
83
+ useLayoutEffect(() => {
84
+ latest.current = {
85
+ controlled: activeLevel !== void 0,
86
+ onActiveLevelChange
87
+ };
88
+ });
89
+ const setActiveLevel = useCallback((level) => {
90
+ if (!latest.current.controlled) setInternalActive(level);
91
+ latest.current.onActiveLevelChange?.(level);
92
+ }, []);
60
93
  return {
61
94
  ...book,
95
+ active,
96
+ summary: active ? summarizeDepth((active.side === "bid" ? book.bids : book.asks).slice(0, active.index + 1), active.side) : null,
97
+ setActiveLevel,
98
+ onLevelSelect,
62
99
  price: lastPrice != null && Number.isFinite(lastPrice) && lastPrice > 0 ? lastPrice : book.midpoint,
63
100
  baseSymbol,
64
101
  quoteSymbol,
@@ -113,7 +150,7 @@ function OrderBookHeader({ className }) {
113
150
  });
114
151
  }
115
152
  function OrderBookSide({ side, className }) {
116
- const { bids, asks, maxTotal, formatPrice, formatSize, reduce, baseSymbol, quoteSymbol } = useOrderBook();
153
+ const { bids, asks, maxTotal, formatPrice, formatSize, reduce, baseSymbol, quoteSymbol, active, setActiveLevel, onLevelSelect } = useOrderBook();
117
154
  const rows = side === "ask" ? [...asks].reverse() : bids;
118
155
  const color = side === "ask" ? "text-rose-600 dark:text-rose-400" : "text-emerald-700 dark:text-emerald-400";
119
156
  return /* @__PURE__ */ jsxs("table", {
@@ -135,19 +172,31 @@ function OrderBookSide({ side, className }) {
135
172
  children: ["Cumulative total ", baseSymbol]
136
173
  })
137
174
  ] })
138
- }), /* @__PURE__ */ jsx("tbody", { children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", {
139
- colSpan: 3,
140
- className: "px-4 py-6 text-center text-muted-foreground",
141
- children: ["No ", side === "ask" ? "asks" : "bids"]
142
- }) }) : rows.map((row, index) => /* @__PURE__ */ jsx(OrderBookDepthRow, {
143
- row,
144
- fraction: maxTotal ? row.total / maxTotal : 0,
145
- entranceIndex: side === "ask" ? rows.length - 1 - index : index,
146
- color,
147
- formatPrice,
148
- formatSize,
149
- reduce: !!reduce
150
- }, row.price)) })]
175
+ }), /* @__PURE__ */ jsx("tbody", {
176
+ onPointerLeave: () => setActiveLevel(null),
177
+ children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", {
178
+ colSpan: 3,
179
+ className: "px-4 py-6 text-center text-muted-foreground",
180
+ children: ["No ", side === "ask" ? "asks" : "bids"]
181
+ }) }) : rows.map((row, index) => {
182
+ const depthIndex = side === "ask" ? rows.length - 1 - index : index;
183
+ return /* @__PURE__ */ jsx(OrderBookDepthRow, {
184
+ row,
185
+ inRange: active?.side === side && depthIndex <= active.index,
186
+ onInspect: (inspect) => setActiveLevel(inspect ? {
187
+ side,
188
+ price: row.price
189
+ } : null),
190
+ onSelect: onLevelSelect ? () => onLevelSelect(row, side) : void 0,
191
+ fraction: maxTotal ? row.total / maxTotal : 0,
192
+ entranceIndex: side === "ask" ? rows.length - 1 - index : index,
193
+ color,
194
+ formatPrice,
195
+ formatSize,
196
+ reduce: !!reduce
197
+ }, row.price);
198
+ })
199
+ })]
151
200
  });
152
201
  }
153
202
  function OrderBookSpread({ className }) {
@@ -201,7 +250,33 @@ function OrderBookBalance({ className }) {
201
250
  })]
202
251
  });
203
252
  }
253
+ /**
254
+ * Totals the inspected levels: the hovered or focused level and every better
255
+ * level on its side, as the cost of filling an order up to that price.
256
+ */
257
+ function OrderBookDepthSummary({ placeholder = "Hover a level to see the cost of filling up to it", children, className }) {
258
+ const { summary, formatPrice, formatSize, baseSymbol, quoteSymbol } = useOrderBook();
259
+ return /* @__PURE__ */ jsx("p", {
260
+ "aria-live": "polite",
261
+ className: cn("flex min-h-10 flex-wrap items-center justify-between gap-x-4 gap-y-1 border-border border-t px-4 py-2 text-muted-foreground", className),
262
+ children: !summary ? /* @__PURE__ */ jsx("span", {
263
+ className: "font-sans",
264
+ children: placeholder
265
+ }) : children ? children(summary) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", { children: ["Avg ", /* @__PURE__ */ jsx("span", {
266
+ className: "text-foreground",
267
+ children: formatPrice(summary.averagePrice)
268
+ })] }), /* @__PURE__ */ jsxs("span", { children: [
269
+ /* @__PURE__ */ jsxs("span", {
270
+ className: "text-foreground",
271
+ children: [formatSize(summary.size), baseSymbol && ` ${baseSymbol}`]
272
+ }),
273
+ " · ",
274
+ formatPrice(summary.quote),
275
+ quoteSymbol && ` ${quoteSymbol}`
276
+ ] })] })
277
+ });
278
+ }
204
279
  //#endregion
205
- export { OrderBook, OrderBookBalance, OrderBookHeader, OrderBookSide, OrderBookSpread, useOrderBook };
280
+ export { OrderBook, OrderBookBalance, OrderBookDepthSummary, OrderBookHeader, OrderBookSide, OrderBookSpread, useOrderBook };
206
281
 
207
282
  //# sourceMappingURL=order-book.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-book.js","names":[],"sources":["../../../src/components/charts/order-book/model.ts","../../../src/components/charts/order-book.tsx"],"sourcesContent":["export type DepthLevel = { price: number; size: number; total: number };\ntype Level = { price: number; size: number };\n\nfunction prepare(levels: readonly Level[], side: \"bid\" | \"ask\", limit: number): DepthLevel[] {\n const prices = new Map<number, number>();\n for (const { price, size } of levels) {\n if (!Number.isFinite(price) || !Number.isFinite(size) || price <= 0 || size <= 0) continue;\n prices.set(price, (prices.get(price) ?? 0) + size);\n }\n let total = 0;\n return [...prices]\n .sort(([a], [b]) => (side === \"bid\" ? b - a : a - b))\n .slice(0, limit)\n .map(([price, size]) => {\n total += size;\n return { price, size, total };\n });\n}\n\n/** Accumulate from the best quote outward before reversing asks for display. */\nexport function buildOrderBook(bids: readonly Level[], asks: readonly Level[], levels: number) {\n const limit = Number.isFinite(levels) ? Math.max(0, Math.floor(levels)) : 9;\n const buy = prepare(bids, \"bid\", limit);\n const sell = prepare(asks, \"ask\", limit);\n const bidTotal = buy.at(-1)?.total ?? 0;\n const askTotal = sell.at(-1)?.total ?? 0;\n const bestBid = buy[0]?.price;\n const bestAsk = sell[0]?.price;\n const midpoint = bestBid == null || bestAsk == null ? null : (bestBid + bestAsk) / 2;\n const spread = bestBid == null || bestAsk == null ? null : bestAsk - bestBid;\n return {\n bids: buy,\n asks: sell,\n bidTotal,\n askTotal,\n maxTotal: Math.max(bidTotal, askTotal),\n midpoint,\n spread,\n };\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { SPRING_PANEL } from \"../../lib/ease\";\nimport { OrderBookDepthRow } from \"./order-book/depth-row\";\nimport { buildOrderBook } from \"./order-book/model\";\n\nexport type OrderBookLevel = { price: number; size: number };\n\nexport interface OrderBookProps {\n /** Snapshot of buy levels. Equal prices are combined; invalid and zero sizes are omitted. */\n bids: readonly OrderBookLevel[];\n /** Snapshot of sell levels. Supply new arrays when the book changes. */\n asks: readonly OrderBookLevel[];\n /** Number of nearest levels to show on each side. */\n levels?: number;\n /** Last traded price. Omit to show the midpoint of the best bid and ask. */\n lastPrice?: number;\n label?: string;\n baseSymbol?: string;\n quoteSymbol?: string;\n formatPrice?: (value: number) => string;\n formatSize?: (value: number) => string;\n children?: ReactNode;\n className?: string;\n}\n\nconst priceFormatter = new Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n});\nconst sizeFormatter = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\nconst defaultPrice = (value: number) => priceFormatter.format(value);\nconst defaultSize = (value: number) => sizeFormatter.format(value);\n\nfunction useOrderBookModel({\n bids,\n asks,\n levels = 9,\n lastPrice,\n baseSymbol = \"\",\n quoteSymbol = \"USD\",\n formatPrice = defaultPrice,\n formatSize = defaultSize,\n}: OrderBookProps) {\n const book = buildOrderBook(bids, asks, levels);\n return {\n ...book,\n price:\n lastPrice != null && Number.isFinite(lastPrice) && lastPrice > 0 ? lastPrice : book.midpoint,\n baseSymbol,\n quoteSymbol,\n formatPrice,\n formatSize,\n reduce: useReducedMotion(),\n };\n}\nconst OrderBookContext = createContext<ReturnType<typeof useOrderBookModel> | null>(null);\n\nexport function useOrderBook() {\n const context = useContext(OrderBookContext);\n if (!context) throw new Error(\"Order book parts must be rendered inside OrderBook.\");\n return context;\n}\n\n/** A snapshot-driven depth ladder. No timers or invented market data live in the chart. */\nexport function OrderBook({ children, className, label = \"Order book\", ...props }: OrderBookProps) {\n const model = useOrderBookModel(props);\n return (\n <OrderBookContext.Provider value={model}>\n <section\n aria-label={label}\n className={cn(\n \"w-full max-w-[560px] overflow-hidden rounded-2xl border border-border bg-background font-mono text-xs tabular-nums\",\n className,\n )}\n >\n {children === undefined ? (\n <>\n <OrderBookHeader />\n <OrderBookSide side=\"ask\" />\n <OrderBookSpread />\n <OrderBookSide side=\"bid\" />\n <OrderBookBalance />\n </>\n ) : (\n children\n )}\n </section>\n </OrderBookContext.Provider>\n );\n}\n\nexport function OrderBookHeader({ className }: { className?: string }) {\n const { baseSymbol, quoteSymbol } = useOrderBook();\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"grid grid-cols-3 py-3 text-[10px] text-muted-foreground uppercase tracking-wider\",\n className,\n )}\n >\n <span className=\"px-4\">Price{quoteSymbol && ` (${quoteSymbol})`}</span>\n <span className=\"px-4 text-right\">Size{baseSymbol && ` (${baseSymbol})`}</span>\n <span className=\"px-4 text-right\">Total</span>\n </div>\n );\n}\n\nexport function OrderBookSide({ side, className }: { side: \"bid\" | \"ask\"; className?: string }) {\n const { bids, asks, maxTotal, formatPrice, formatSize, reduce, baseSymbol, quoteSymbol } =\n useOrderBook();\n const rows = side === \"ask\" ? [...asks].reverse() : bids;\n const color =\n side === \"ask\" ? \"text-rose-600 dark:text-rose-400\" : \"text-emerald-700 dark:text-emerald-400\";\n return (\n <table\n aria-label={side === \"ask\" ? \"Asks · sell orders\" : \"Bids · buy orders\"}\n className={cn(\"w-full table-fixed border-separate border-spacing-0\", className)}\n >\n <thead className=\"sr-only\">\n <tr>\n <th scope=\"col\">Price {quoteSymbol}</th>\n <th scope=\"col\">Size {baseSymbol}</th>\n <th scope=\"col\">Cumulative total {baseSymbol}</th>\n </tr>\n </thead>\n <tbody>\n {rows.length === 0 ? (\n <tr>\n <td colSpan={3} className=\"px-4 py-6 text-center text-muted-foreground\">\n No {side === \"ask\" ? \"asks\" : \"bids\"}\n </td>\n </tr>\n ) : (\n rows.map((row, index) => (\n <OrderBookDepthRow\n key={row.price}\n row={row}\n fraction={maxTotal ? row.total / maxTotal : 0}\n entranceIndex={side === \"ask\" ? rows.length - 1 - index : index}\n color={color}\n formatPrice={formatPrice}\n formatSize={formatSize}\n reduce={!!reduce}\n />\n ))\n )}\n </tbody>\n </table>\n );\n}\n\nexport function OrderBookSpread({ className }: { className?: string }) {\n const { price, spread, midpoint, formatPrice } = useOrderBook();\n return (\n <div\n className={cn(\n \"my-1 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 border-border border-y bg-muted/40 px-4 py-3\",\n className,\n )}\n >\n <span className=\"font-medium text-base tracking-tight\">\n <span className=\"sr-only\">Reference price: </span>\n {price == null ? \"—\" : formatPrice(price)}\n </span>\n <span className=\"text-[10px] text-muted-foreground\">\n {spread == null || midpoint == null\n ? \"Spread unavailable\"\n : spread < 0\n ? \"Crossed book\"\n : `Spread ${formatPrice(spread)} · ${((spread / midpoint) * 100).toFixed(3)}%`}\n </span>\n </div>\n );\n}\n\n/** Balance of the displayed depth, not the entire exchange order book. */\nexport function OrderBookBalance({ className }: { className?: string }) {\n const { bidTotal, askTotal, reduce } = useOrderBook();\n const total = bidTotal + askTotal;\n const ratio = total ? bidTotal / total : 0.5;\n return (\n <div className={cn(\"space-y-2 border-border border-t px-4 pt-3 pb-3\", className)}>\n <div className=\"flex justify-between text-[10px]\">\n <span className=\"text-emerald-700 dark:text-emerald-400\">\n Bids {total ? `${(ratio * 100).toFixed(1)}%` : \"—\"}\n </span>\n <span className=\"text-muted-foreground\">Visible depth</span>\n <span className=\"text-rose-600 dark:text-rose-400\">\n Asks {total ? `${((1 - ratio) * 100).toFixed(1)}%` : \"—\"}\n </span>\n </div>\n <div aria-hidden=\"true\" className=\"relative h-1 overflow-hidden rounded-full bg-rose-500/25\">\n <motion.div\n initial={false}\n animate={{ transform: `scaleX(${ratio})` }}\n transition={reduce ? { duration: 0 } : SPRING_PANEL}\n className=\"absolute inset-0 origin-left bg-emerald-500/60\"\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,QAAQ,QAA0B,MAAqB,OAA6B;CAC3F,MAAM,yBAAS,IAAI,IAAoB;CACvC,KAAK,MAAM,EAAE,OAAO,UAAU,QAAQ;EACpC,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,CAAC,OAAO,SAA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["../../../src/components/charts/order-book/model.ts","../../../src/components/charts/order-book.tsx"],"sourcesContent":["export type DepthLevel = { price: number; size: number; total: number };\ntype Level = { price: number; size: number };\n\nfunction prepare(levels: readonly Level[], side: \"bid\" | \"ask\", limit: number): DepthLevel[] {\n const prices = new Map<number, number>();\n for (const { price, size } of levels) {\n if (!Number.isFinite(price) || !Number.isFinite(size) || price <= 0 || size <= 0) continue;\n prices.set(price, (prices.get(price) ?? 0) + size);\n }\n let total = 0;\n return [...prices]\n .sort(([a], [b]) => (side === \"bid\" ? b - a : a - b))\n .slice(0, limit)\n .map(([price, size]) => {\n total += size;\n return { price, size, total };\n });\n}\n\nexport type DepthSummary = {\n side: \"bid\" | \"ask\";\n /** Number of levels from the best price out to the inspected one. */\n levels: number;\n /** Total base size across those levels. */\n size: number;\n /** Total quote value across those levels. */\n quote: number;\n /** Size-weighted average fill price. */\n averagePrice: number;\n};\n\n/** Totals levels ordered from the best price outward. */\nexport function summarizeDepth(levels: readonly DepthLevel[], side: \"bid\" | \"ask\"): DepthSummary {\n const size = levels.reduce((sum, level) => sum + level.size, 0);\n const quote = levels.reduce((sum, level) => sum + level.size * level.price, 0);\n return { side, levels: levels.length, size, quote, averagePrice: size ? quote / size : 0 };\n}\n\n/** Accumulate from the best quote outward before reversing asks for display. */\nexport function buildOrderBook(bids: readonly Level[], asks: readonly Level[], levels: number) {\n const limit = Number.isFinite(levels) ? Math.max(0, Math.floor(levels)) : 9;\n const buy = prepare(bids, \"bid\", limit);\n const sell = prepare(asks, \"ask\", limit);\n const bidTotal = buy.at(-1)?.total ?? 0;\n const askTotal = sell.at(-1)?.total ?? 0;\n const bestBid = buy[0]?.price;\n const bestAsk = sell[0]?.price;\n const midpoint = bestBid == null || bestAsk == null ? null : (bestBid + bestAsk) / 2;\n const spread = bestBid == null || bestAsk == null ? null : bestAsk - bestBid;\n return {\n bids: buy,\n asks: sell,\n bidTotal,\n askTotal,\n maxTotal: Math.max(bidTotal, askTotal),\n midpoint,\n spread,\n };\n}\n","\"use client\";\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { SPRING_PANEL } from \"../../lib/ease\";\nimport { OrderBookDepthRow } from \"./order-book/depth-row\";\nimport { buildOrderBook, type DepthLevel, summarizeDepth } from \"./order-book/model\";\n\nexport type OrderBookLevel = { price: number; size: number };\nexport type {\n DepthLevel as OrderBookDepthLevel,\n DepthSummary as OrderBookDepthSummaryData,\n} from \"./order-book/model\";\n\n/** A level identified by its side and price, so it survives snapshot updates. */\nexport type OrderBookActiveLevel = { side: \"bid\" | \"ask\"; price: number } | null;\n\nexport interface OrderBookProps {\n /** Snapshot of buy levels. Equal prices are combined; invalid and zero sizes are omitted. */\n bids: readonly OrderBookLevel[];\n /** Snapshot of sell levels. Supply new arrays when the book changes. */\n asks: readonly OrderBookLevel[];\n /** Number of nearest levels to show on each side. */\n levels?: number;\n /** Last traded price. Omit to show the midpoint of the best bid and ask. */\n lastPrice?: number;\n label?: string;\n baseSymbol?: string;\n quoteSymbol?: string;\n formatPrice?: (value: number) => string;\n formatSize?: (value: number) => string;\n /**\n * The level whose depth is inspected: it and every better level on its side\n * are highlighted, and `OrderBookDepthSummary` totals them. Controlled.\n */\n activeLevel?: OrderBookActiveLevel;\n defaultActiveLevel?: OrderBookActiveLevel;\n onActiveLevelChange?: (level: OrderBookActiveLevel) => void;\n /** Makes each price a button, for example to fill an order ticket. */\n onLevelSelect?: (level: DepthLevel, side: \"bid\" | \"ask\") => void;\n children?: ReactNode;\n className?: string;\n}\n\nconst priceFormatter = new Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n});\nconst sizeFormatter = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\nconst defaultPrice = (value: number) => priceFormatter.format(value);\nconst defaultSize = (value: number) => sizeFormatter.format(value);\n\nfunction useOrderBookModel({\n bids,\n asks,\n levels = 9,\n lastPrice,\n baseSymbol = \"\",\n quoteSymbol = \"USD\",\n formatPrice = defaultPrice,\n formatSize = defaultSize,\n activeLevel,\n defaultActiveLevel = null,\n onActiveLevelChange,\n onLevelSelect,\n}: OrderBookProps) {\n const book = buildOrderBook(bids, asks, levels);\n const [internalActive, setInternalActive] = useState(defaultActiveLevel);\n const rawActive = activeLevel === undefined ? internalActive : activeLevel;\n // Resolve the inspected level during render by price; a level that left the\n // book clears the inspection instead of pointing at a different row.\n const activeIndex = rawActive\n ? (rawActive.side === \"bid\" ? book.bids : book.asks).findIndex(\n (level) => level.price === rawActive.price,\n )\n : -1;\n const active =\n rawActive && activeIndex >= 0 ? { side: rawActive.side, index: activeIndex } : null;\n\n // Stable setter: it reads the latest controlled flag and callback from refs.\n const latest = useRef({ controlled: activeLevel !== undefined, onActiveLevelChange });\n useLayoutEffect(() => {\n latest.current = { controlled: activeLevel !== undefined, onActiveLevelChange };\n });\n const setActiveLevel = useCallback((level: OrderBookActiveLevel) => {\n if (!latest.current.controlled) setInternalActive(level);\n latest.current.onActiveLevelChange?.(level);\n }, []);\n\n return {\n ...book,\n active,\n summary: active\n ? summarizeDepth(\n (active.side === \"bid\" ? book.bids : book.asks).slice(0, active.index + 1),\n active.side,\n )\n : null,\n setActiveLevel,\n onLevelSelect,\n price:\n lastPrice != null && Number.isFinite(lastPrice) && lastPrice > 0 ? lastPrice : book.midpoint,\n baseSymbol,\n quoteSymbol,\n formatPrice,\n formatSize,\n reduce: useReducedMotion(),\n };\n}\nconst OrderBookContext = createContext<ReturnType<typeof useOrderBookModel> | null>(null);\n\nexport function useOrderBook() {\n const context = useContext(OrderBookContext);\n if (!context) throw new Error(\"Order book parts must be rendered inside OrderBook.\");\n return context;\n}\n\n/** A snapshot-driven depth ladder. No timers or invented market data live in the chart. */\nexport function OrderBook({ children, className, label = \"Order book\", ...props }: OrderBookProps) {\n const model = useOrderBookModel(props);\n return (\n <OrderBookContext.Provider value={model}>\n <section\n aria-label={label}\n className={cn(\n \"w-full max-w-[560px] overflow-hidden rounded-2xl border border-border bg-background font-mono text-xs tabular-nums\",\n className,\n )}\n >\n {children === undefined ? (\n <>\n <OrderBookHeader />\n <OrderBookSide side=\"ask\" />\n <OrderBookSpread />\n <OrderBookSide side=\"bid\" />\n <OrderBookBalance />\n </>\n ) : (\n children\n )}\n </section>\n </OrderBookContext.Provider>\n );\n}\n\nexport function OrderBookHeader({ className }: { className?: string }) {\n const { baseSymbol, quoteSymbol } = useOrderBook();\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"grid grid-cols-3 py-3 text-[10px] text-muted-foreground uppercase tracking-wider\",\n className,\n )}\n >\n <span className=\"px-4\">Price{quoteSymbol && ` (${quoteSymbol})`}</span>\n <span className=\"px-4 text-right\">Size{baseSymbol && ` (${baseSymbol})`}</span>\n <span className=\"px-4 text-right\">Total</span>\n </div>\n );\n}\n\nexport function OrderBookSide({ side, className }: { side: \"bid\" | \"ask\"; className?: string }) {\n const {\n bids,\n asks,\n maxTotal,\n formatPrice,\n formatSize,\n reduce,\n baseSymbol,\n quoteSymbol,\n active,\n setActiveLevel,\n onLevelSelect,\n } = useOrderBook();\n const rows = side === \"ask\" ? [...asks].reverse() : bids;\n const color =\n side === \"ask\" ? \"text-rose-600 dark:text-rose-400\" : \"text-emerald-700 dark:text-emerald-400\";\n return (\n <table\n aria-label={side === \"ask\" ? \"Asks · sell orders\" : \"Bids · buy orders\"}\n className={cn(\"w-full table-fixed border-separate border-spacing-0\", className)}\n >\n <thead className=\"sr-only\">\n <tr>\n <th scope=\"col\">Price {quoteSymbol}</th>\n <th scope=\"col\">Size {baseSymbol}</th>\n <th scope=\"col\">Cumulative total {baseSymbol}</th>\n </tr>\n </thead>\n <tbody onPointerLeave={() => setActiveLevel(null)}>\n {rows.length === 0 ? (\n <tr>\n <td colSpan={3} className=\"px-4 py-6 text-center text-muted-foreground\">\n No {side === \"ask\" ? \"asks\" : \"bids\"}\n </td>\n </tr>\n ) : (\n rows.map((row, index) => {\n const depthIndex = side === \"ask\" ? rows.length - 1 - index : index;\n return (\n <OrderBookDepthRow\n key={row.price}\n row={row}\n inRange={active?.side === side && depthIndex <= active.index}\n onInspect={(inspect) => setActiveLevel(inspect ? { side, price: row.price } : null)}\n onSelect={onLevelSelect ? () => onLevelSelect(row, side) : undefined}\n fraction={maxTotal ? row.total / maxTotal : 0}\n entranceIndex={side === \"ask\" ? rows.length - 1 - index : index}\n color={color}\n formatPrice={formatPrice}\n formatSize={formatSize}\n reduce={!!reduce}\n />\n );\n })\n )}\n </tbody>\n </table>\n );\n}\n\nexport function OrderBookSpread({ className }: { className?: string }) {\n const { price, spread, midpoint, formatPrice } = useOrderBook();\n return (\n <div\n className={cn(\n \"my-1 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 border-border border-y bg-muted/40 px-4 py-3\",\n className,\n )}\n >\n <span className=\"font-medium text-base tracking-tight\">\n <span className=\"sr-only\">Reference price: </span>\n {price == null ? \"—\" : formatPrice(price)}\n </span>\n <span className=\"text-[10px] text-muted-foreground\">\n {spread == null || midpoint == null\n ? \"Spread unavailable\"\n : spread < 0\n ? \"Crossed book\"\n : `Spread ${formatPrice(spread)} · ${((spread / midpoint) * 100).toFixed(3)}%`}\n </span>\n </div>\n );\n}\n\n/** Balance of the displayed depth, not the entire exchange order book. */\nexport function OrderBookBalance({ className }: { className?: string }) {\n const { bidTotal, askTotal, reduce } = useOrderBook();\n const total = bidTotal + askTotal;\n const ratio = total ? bidTotal / total : 0.5;\n return (\n <div className={cn(\"space-y-2 border-border border-t px-4 pt-3 pb-3\", className)}>\n <div className=\"flex justify-between text-[10px]\">\n <span className=\"text-emerald-700 dark:text-emerald-400\">\n Bids {total ? `${(ratio * 100).toFixed(1)}%` : \"—\"}\n </span>\n <span className=\"text-muted-foreground\">Visible depth</span>\n <span className=\"text-rose-600 dark:text-rose-400\">\n Asks {total ? `${((1 - ratio) * 100).toFixed(1)}%` : \"—\"}\n </span>\n </div>\n <div aria-hidden=\"true\" className=\"relative h-1 overflow-hidden rounded-full bg-rose-500/25\">\n <motion.div\n initial={false}\n animate={{ transform: `scaleX(${ratio})` }}\n transition={reduce ? { duration: 0 } : SPRING_PANEL}\n className=\"absolute inset-0 origin-left bg-emerald-500/60\"\n />\n </div>\n </div>\n );\n}\n\n/**\n * Totals the inspected levels: the hovered or focused level and every better\n * level on its side, as the cost of filling an order up to that price.\n */\nexport function OrderBookDepthSummary({\n placeholder = \"Hover a level to see the cost of filling up to it\",\n children,\n className,\n}: {\n placeholder?: ReactNode;\n /** Custom readout for the inspected levels. */\n children?: (summary: NonNullable<ReturnType<typeof useOrderBook>[\"summary\"]>) => ReactNode;\n className?: string;\n}) {\n const { summary, formatPrice, formatSize, baseSymbol, quoteSymbol } = useOrderBook();\n return (\n <p\n aria-live=\"polite\"\n className={cn(\n \"flex min-h-10 flex-wrap items-center justify-between gap-x-4 gap-y-1 border-border border-t px-4 py-2 text-muted-foreground\",\n className,\n )}\n >\n {!summary ? (\n <span className=\"font-sans\">{placeholder}</span>\n ) : children ? (\n children(summary)\n ) : (\n <>\n <span>\n Avg <span className=\"text-foreground\">{formatPrice(summary.averagePrice)}</span>\n </span>\n <span>\n <span className=\"text-foreground\">\n {formatSize(summary.size)}\n {baseSymbol && ` ${baseSymbol}`}\n </span>\n {\" · \"}\n {formatPrice(summary.quote)}\n {quoteSymbol && ` ${quoteSymbol}`}\n </span>\n </>\n )}\n </p>\n );\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,QAAQ,QAA0B,MAAqB,OAA6B;CAC3F,MAAM,yBAAS,IAAI,IAAoB;CACvC,KAAK,MAAM,EAAE,OAAO,UAAU,QAAQ;EACpC,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,CAAC,OAAO,SAAS,IAAI,KAAK,SAAS,KAAK,QAAQ,GAAG;EAClF,OAAO,IAAI,QAAQ,OAAO,IAAI,KAAK,KAAK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AAc,qDACd,UACA,aAMC;CACD,MAAM,EAAE,SAAS,aAAa,YAAY,YAAY,gBAAgB,aAAa;CACnF,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GACT,+HACA,SACF;EAEC,UAAA,CAAC,UACA,oBAAC,QAAD;GAAM,WAAU;GAAa,UAAA;EAAkB,CAAA,IAC7C,WACF,SAAS,OAAO,IAEhB,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,QAAD,EAAA,UAAA,CAAM,QACA,oBAAC,QAAD;GAAM,WAAU;GAAmB,UAAA,YAAY,QAAQ,YAAY;EAAQ,CAAA,CAC3E,EAAA,CAAA,GACN,qBAAC,QAAD,EAAA,UAAA;GACE,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACG,WAAW,QAAQ,IAAI,GACvB,cAAc,IAAI,YACf;;GACL;GACA,YAAY,QAAQ,KAAK;GACzB,eAAe,IAAI;EAChB,EAAA,CAAA,CACN,EAAA,CAAA;CAEH,CAAA;AAEP"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { c as ink, n as usePriceTargetFan } from "../../../context-Rl5VCYA8.js";
4
4
  import { useState } from "react";
5
5
  import { cn } from "@kumix/utils";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { NumberTicker } from "../../motion/number-ticker.js";
4
4
  import { l as ink, n as useReturnsCalendar } from "../../../context-Cn-00gfW.js";
5
5
  import { useMemo, useState } from "react";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { r as useStatusBar } from "../../../context-BE60udRT.js";
4
4
  import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { NumberTicker } from "../../motion/number-ticker.js";
4
4
  import { n as useTreemap } from "../../../context-Bc6VC1HA.js";
5
5
  import { cn } from "@kumix/utils";
@@ -1 +1 @@
1
- {"version":3,"file":"treemap.d.ts","names":["_$__model0.TreemapTile","_$__model0.ResolvedNode","_$__model0.TreemapItem"],"sources":["../../../src/components/charts/treemap/context.ts","../../../src/components/charts/treemap.tsx"],"mappings":";;;;;;UAsBiB,qBAAqB;;EAEpC,eAAe;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,kBAAkB;;wBAgEJ;SAAAA;;;;;;;;;;EAtEQ,cAAA;;EAsCa,YAAA;;;;;;;;;;EAKK,iBAAA,YAAM,MAAQ;;;;SAAAC;;;;;;;wBC5DxC,UACd,MACA,OACA,aACA,QACA,WACA,UACA,iBACA,gBACA,WACA,aACG,SACF,+BAAY,IAAA"}
1
+ {"version":3,"file":"treemap.d.ts","names":["_$__model0.TreemapTile","_$__model0.ResolvedNode","_$__model0.TreemapItem"],"sources":["../../../src/components/charts/treemap/context.ts","../../../src/components/charts/treemap.tsx"],"mappings":";;;;;;UAsBiB,qBAAqB;;EAEpC,eAAe;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,kBAAkB;;wBAgEJ;E,OAAAA;;;;;;;;;;EAtEQ,cAAA;;EAsCa,YAAA;;;;;;;;;;EAKK,iBAAA,YAAM,MAAQ;;;;E,OAAAC;;;;;;;wBC5DxC,UACd,MACA,OACA,aACA,QACA,WACA,UACA,iBACA,gBACA,WACA,aACG,SACF,+BAAY,IAAA"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Tooltip } from "../../motion/tooltip.js";
2
+ import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
3
3
  import { NumberTicker } from "../../motion/number-ticker.js";
4
4
  import { n as useVolumeProfile } from "../../../context-3_vY1jbv.js";
5
5
  import { cn } from "@kumix/utils";
@@ -1 +1 @@
1
- {"version":3,"file":"volume-profile.d.ts","names":[],"sources":["../../../src/components/charts/volume-profile/context.ts","../../../src/components/charts/volume-profile.tsx"],"mappings":";;;;;UAoBiB,2BAA2B;;EAE1C,eAAe;EACf;EACA;EACA,eAAe;EACf,gBAAgB;;;EAGhB;EACA;EACA;EACA;EACA;EACA,kBAAkB;;wBAoEJ;;;EA7EQ,cAAA;EACE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCW,YAAA;qCAuCrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCzFA,gBACd,MACA,OACA,MACA,aACA,cACA,WACA,OACA,UACA,UACA,iBACA,gBACA,WACA,aACG,SACF,qCAAkB,IAAA"}
1
+ {"version":3,"file":"volume-profile.d.ts","names":[],"sources":["../../../src/components/charts/volume-profile/context.ts","../../../src/components/charts/volume-profile.tsx"],"mappings":";;;;;UAoBiB,2BAA2B;;EAE1C,eAAe;EACf;EACA;EACA,eAAe;EACf,gBAAgB;;;EAGhB;EACA;EACA;EACA;EACA;EACA,kBAAkB;;wBAoEJ;;;EA7EQ,cAAA;EACE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCW,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBClDrB,gBACd,MACA,OACA,MACA,aACA,cACA,WACA,OACA,UACA,UACA,iBACA,gBACA,WACA,aACG,SACF,qCAAkB,IAAA"}
@@ -12,4 +12,5 @@ interface ConfirmDialogProps {
12
12
  export declare function ConfirmDialog({ open, onOpenChange, onConfirm, title, description, confirmText, cancelText, loading }: ConfirmDialogProps): import("react").JSX.Element;
13
13
  export declare function ConfirmSignOut({ open, onOpenChange, onConfirm, title, description, confirmText, cancelText, loading }: ConfirmDialogProps): import("react").JSX.Element;
14
14
  //#endregion
15
+ export {};
15
16
  //# sourceMappingURL=confirm-dialog.d.ts.map
@@ -16,4 +16,5 @@ export declare function ToastContainer({ position, maxVisible, defaultDuration,
16
16
  limit?: number;
17
17
  }): import("react").JSX.Element;
18
18
  //#endregion
19
+ export {};
19
20
  //# sourceMappingURL=toast.d.ts.map
@@ -35,6 +35,6 @@ export interface ActionSwapIconProps {
35
35
  }
36
36
  export declare function ActionSwapText({ value, children, animation, className }: ActionSwapTextProps): import("react").JSX.Element;
37
37
  export declare function ActionSwapIcon({ value, children, animation, className }: ActionSwapIconProps): import("react").JSX.Element;
38
- export declare function ActionSwapButton({ items, value, defaultValue, onValueChange, variant, size, animation, iconOnly, cycle, className, disabled, onClick, ...rest }: ActionSwapButtonProps): import("react").JSX.Element | null;
38
+ export declare function ActionSwapButton({ items, value, defaultValue, onValueChange, variant, size, animation, iconOnly, cycle, className, disabled, onClick, style, ...rest }: ActionSwapButtonProps): import("react").JSX.Element | null;
39
39
  //#endregion
40
40
  //# sourceMappingURL=action-swap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;YAeY;EACV;EACA,OAAO;EACP,OAAO;EACP;;YAGU;YACA;YACA;iBAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;wBA+Gc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBA2EN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,YACG,QACF,wCAAqB,IAAA"}
1
+ {"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;YAeY;EACV;EACA,OAAO;EACP,OAAO;EACP;;YAGU;YACA;YACA;iBAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;wBAoHc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBAgFN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,SACA,UACG,QACF,wCAAqB,IAAA"}