@epilot/spark-ui 1.0.0-alpha.2 → 1.0.0-alpha.3

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 (549) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +2 -0
  3. package/README.md +7 -1
  4. package/dist/chunk-aJGBMT86.cjs +29 -0
  5. package/dist/components/accordion.cjs +57 -0
  6. package/dist/components/accordion.cjs.map +1 -0
  7. package/dist/components/accordion.d.cts +45 -0
  8. package/dist/components/accordion.d.ts +45 -0
  9. package/dist/components/accordion.js +51 -0
  10. package/dist/components/accordion.js.map +1 -0
  11. package/dist/components/alert-dialog.cjs +137 -0
  12. package/dist/components/alert-dialog.cjs.map +1 -0
  13. package/dist/components/alert-dialog.d.cts +63 -0
  14. package/dist/components/alert-dialog.d.ts +63 -0
  15. package/dist/components/alert-dialog.js +123 -0
  16. package/dist/components/alert-dialog.js.map +1 -0
  17. package/dist/components/attachment.cjs +119 -0
  18. package/dist/components/attachment.cjs.map +1 -0
  19. package/dist/components/attachment.d.cts +67 -0
  20. package/dist/components/attachment.d.ts +67 -0
  21. package/dist/components/attachment.js +108 -0
  22. package/dist/components/attachment.js.map +1 -0
  23. package/dist/components/badge.cjs +20 -0
  24. package/dist/components/badge.cjs.map +1 -0
  25. package/dist/components/badge.d.cts +12 -0
  26. package/dist/components/badge.d.ts +12 -0
  27. package/dist/components/badge.js +17 -0
  28. package/dist/components/badge.js.map +1 -0
  29. package/dist/components/bar-chart.cjs +519 -0
  30. package/dist/components/bar-chart.cjs.map +1 -0
  31. package/dist/components/bar-chart.d.cts +83 -0
  32. package/dist/components/bar-chart.d.ts +83 -0
  33. package/dist/components/bar-chart.js +517 -0
  34. package/dist/components/bar-chart.js.map +1 -0
  35. package/dist/components/battery-progress-row.cjs +140 -0
  36. package/dist/components/battery-progress-row.cjs.map +1 -0
  37. package/dist/components/battery-progress-row.d.cts +78 -0
  38. package/dist/components/battery-progress-row.d.ts +78 -0
  39. package/dist/components/battery-progress-row.js +129 -0
  40. package/dist/components/battery-progress-row.js.map +1 -0
  41. package/dist/components/breadcrumbs.cjs +65 -0
  42. package/dist/components/breadcrumbs.cjs.map +1 -0
  43. package/dist/components/breadcrumbs.d.cts +44 -0
  44. package/dist/components/breadcrumbs.d.ts +44 -0
  45. package/dist/components/breadcrumbs.js +58 -0
  46. package/dist/components/breadcrumbs.js.map +1 -0
  47. package/dist/components/bubble.cjs +84 -0
  48. package/dist/components/bubble.cjs.map +1 -0
  49. package/dist/components/bubble.d.cts +41 -0
  50. package/dist/components/bubble.d.ts +41 -0
  51. package/dist/components/bubble.js +78 -0
  52. package/dist/components/bubble.js.map +1 -0
  53. package/dist/components/button.cjs +54 -0
  54. package/dist/components/button.cjs.map +1 -0
  55. package/dist/components/button.d.cts +34 -0
  56. package/dist/components/button.d.ts +34 -0
  57. package/dist/components/button.js +50 -0
  58. package/dist/components/button.js.map +1 -0
  59. package/dist/components/calendar.cjs +58 -0
  60. package/dist/components/calendar.cjs.map +1 -0
  61. package/dist/components/calendar.d.cts +17 -0
  62. package/dist/components/calendar.d.ts +17 -0
  63. package/dist/components/calendar.js +55 -0
  64. package/dist/components/calendar.js.map +1 -0
  65. package/dist/components/callout.cjs +95 -0
  66. package/dist/components/callout.cjs.map +1 -0
  67. package/dist/components/callout.d.cts +39 -0
  68. package/dist/components/callout.d.ts +39 -0
  69. package/dist/components/callout.js +88 -0
  70. package/dist/components/callout.js.map +1 -0
  71. package/dist/components/card.cjs +86 -0
  72. package/dist/components/card.cjs.map +1 -0
  73. package/dist/components/card.d.cts +28 -0
  74. package/dist/components/card.d.ts +28 -0
  75. package/dist/components/card.js +76 -0
  76. package/dist/components/card.js.map +1 -0
  77. package/dist/components/chart.cjs +93 -0
  78. package/dist/components/chart.cjs.map +1 -0
  79. package/dist/components/chart.d.cts +83 -0
  80. package/dist/components/chart.d.ts +83 -0
  81. package/dist/components/chart.js +88 -0
  82. package/dist/components/chart.js.map +1 -0
  83. package/dist/components/checkbox.cjs +37 -0
  84. package/dist/components/checkbox.cjs.map +1 -0
  85. package/dist/components/checkbox.d.cts +22 -0
  86. package/dist/components/checkbox.d.ts +22 -0
  87. package/dist/components/checkbox.js +34 -0
  88. package/dist/components/checkbox.js.map +1 -0
  89. package/dist/components/circular-gauge.cjs +74 -0
  90. package/dist/components/circular-gauge.cjs.map +1 -0
  91. package/dist/components/circular-gauge.d.cts +38 -0
  92. package/dist/components/circular-gauge.d.ts +38 -0
  93. package/dist/components/circular-gauge.js +71 -0
  94. package/dist/components/circular-gauge.js.map +1 -0
  95. package/dist/components/day-of-week-picker.cjs +123 -0
  96. package/dist/components/day-of-week-picker.cjs.map +1 -0
  97. package/dist/components/day-of-week-picker.d.cts +39 -0
  98. package/dist/components/day-of-week-picker.d.ts +39 -0
  99. package/dist/components/day-of-week-picker.js +119 -0
  100. package/dist/components/day-of-week-picker.js.map +1 -0
  101. package/dist/components/device-card.cjs +118 -0
  102. package/dist/components/device-card.cjs.map +1 -0
  103. package/dist/components/device-card.d.cts +71 -0
  104. package/dist/components/device-card.d.ts +71 -0
  105. package/dist/components/device-card.js +104 -0
  106. package/dist/components/device-card.js.map +1 -0
  107. package/dist/components/dialog.cjs +115 -0
  108. package/dist/components/dialog.cjs.map +1 -0
  109. package/dist/components/dialog.d.cts +45 -0
  110. package/dist/components/dialog.d.ts +45 -0
  111. package/dist/components/dialog.js +103 -0
  112. package/dist/components/dialog.js.map +1 -0
  113. package/dist/components/donut-chart.cjs +71 -0
  114. package/dist/components/donut-chart.cjs.map +1 -0
  115. package/dist/components/donut-chart.d.cts +22 -0
  116. package/dist/components/donut-chart.d.ts +22 -0
  117. package/dist/components/donut-chart.js +69 -0
  118. package/dist/components/donut-chart.js.map +1 -0
  119. package/dist/components/drawer.cjs +95 -0
  120. package/dist/components/drawer.cjs.map +1 -0
  121. package/dist/components/drawer.d.cts +46 -0
  122. package/dist/components/drawer.d.ts +46 -0
  123. package/dist/components/drawer.js +83 -0
  124. package/dist/components/drawer.js.map +1 -0
  125. package/dist/components/dropdown-menu.cjs +165 -0
  126. package/dist/components/dropdown-menu.cjs.map +1 -0
  127. package/dist/components/dropdown-menu.d.cts +93 -0
  128. package/dist/components/dropdown-menu.d.ts +93 -0
  129. package/dist/components/dropdown-menu.js +148 -0
  130. package/dist/components/dropdown-menu.js.map +1 -0
  131. package/dist/components/empty-state.cjs +35 -0
  132. package/dist/components/empty-state.cjs.map +1 -0
  133. package/dist/components/empty-state.d.cts +22 -0
  134. package/dist/components/empty-state.d.ts +22 -0
  135. package/dist/components/empty-state.js +33 -0
  136. package/dist/components/empty-state.js.map +1 -0
  137. package/dist/components/energy-bar-chart.cjs +23 -0
  138. package/dist/components/energy-bar-chart.cjs.map +1 -0
  139. package/dist/components/energy-bar-chart.d.cts +43 -0
  140. package/dist/components/energy-bar-chart.d.ts +43 -0
  141. package/dist/components/energy-bar-chart.js +21 -0
  142. package/dist/components/energy-bar-chart.js.map +1 -0
  143. package/dist/components/energy-breakdown.cjs +81 -0
  144. package/dist/components/energy-breakdown.cjs.map +1 -0
  145. package/dist/components/energy-breakdown.d.cts +26 -0
  146. package/dist/components/energy-breakdown.d.ts +26 -0
  147. package/dist/components/energy-breakdown.js +79 -0
  148. package/dist/components/energy-breakdown.js.map +1 -0
  149. package/dist/components/energy-history-chart.cjs +56 -0
  150. package/dist/components/energy-history-chart.cjs.map +1 -0
  151. package/dist/components/energy-history-chart.d.cts +58 -0
  152. package/dist/components/energy-history-chart.d.ts +58 -0
  153. package/dist/components/energy-history-chart.js +54 -0
  154. package/dist/components/energy-history-chart.js.map +1 -0
  155. package/dist/components/feed-in-hero.cjs +56 -0
  156. package/dist/components/feed-in-hero.cjs.map +1 -0
  157. package/dist/components/feed-in-hero.d.cts +33 -0
  158. package/dist/components/feed-in-hero.d.ts +33 -0
  159. package/dist/components/feed-in-hero.js +51 -0
  160. package/dist/components/feed-in-hero.js.map +1 -0
  161. package/dist/components/field.cjs +257 -0
  162. package/dist/components/field.cjs.map +1 -0
  163. package/dist/components/field.d.cts +104 -0
  164. package/dist/components/field.d.ts +104 -0
  165. package/dist/components/field.js +243 -0
  166. package/dist/components/field.js.map +1 -0
  167. package/dist/components/icon.cjs +35 -0
  168. package/dist/components/icon.cjs.map +1 -0
  169. package/dist/components/icon.d.cts +27 -0
  170. package/dist/components/icon.d.ts +27 -0
  171. package/dist/components/icon.js +32 -0
  172. package/dist/components/icon.js.map +1 -0
  173. package/dist/components/info-block.cjs +75 -0
  174. package/dist/components/info-block.cjs.map +1 -0
  175. package/dist/components/info-block.d.cts +20 -0
  176. package/dist/components/info-block.d.ts +20 -0
  177. package/dist/components/info-block.js +65 -0
  178. package/dist/components/info-block.js.map +1 -0
  179. package/dist/components/input-group.cjs +164 -0
  180. package/dist/components/input-group.cjs.map +1 -0
  181. package/dist/components/input-group.d.cts +32 -0
  182. package/dist/components/input-group.d.ts +32 -0
  183. package/dist/components/input-group.js +158 -0
  184. package/dist/components/input-group.js.map +1 -0
  185. package/dist/components/input-otp.cjs +113 -0
  186. package/dist/components/input-otp.cjs.map +1 -0
  187. package/dist/components/input-otp.d.cts +22 -0
  188. package/dist/components/input-otp.d.ts +22 -0
  189. package/dist/components/input-otp.js +111 -0
  190. package/dist/components/input-otp.js.map +1 -0
  191. package/dist/components/input.cjs +112 -0
  192. package/dist/components/input.cjs.map +1 -0
  193. package/dist/components/input.d.cts +21 -0
  194. package/dist/components/input.d.ts +21 -0
  195. package/dist/components/input.js +109 -0
  196. package/dist/components/input.js.map +1 -0
  197. package/dist/components/label.cjs +18 -0
  198. package/dist/components/label.cjs.map +1 -0
  199. package/dist/components/label.d.cts +10 -0
  200. package/dist/components/label.d.ts +10 -0
  201. package/dist/components/label.js +15 -0
  202. package/dist/components/label.js.map +1 -0
  203. package/dist/components/layout.cjs +15 -0
  204. package/dist/components/layout.cjs.map +1 -0
  205. package/dist/components/layout.d.cts +12 -0
  206. package/dist/components/layout.d.ts +13 -0
  207. package/dist/components/layout.js +14 -0
  208. package/dist/components/layout.js.map +1 -0
  209. package/dist/components/line-chart.cjs +310 -0
  210. package/dist/components/line-chart.cjs.map +1 -0
  211. package/dist/components/line-chart.d.cts +71 -0
  212. package/dist/components/line-chart.d.ts +71 -0
  213. package/dist/components/line-chart.js +307 -0
  214. package/dist/components/line-chart.js.map +1 -0
  215. package/dist/components/list.cjs +132 -0
  216. package/dist/components/list.cjs.map +1 -0
  217. package/dist/components/list.d.cts +72 -0
  218. package/dist/components/list.d.ts +72 -0
  219. package/dist/components/list.js +122 -0
  220. package/dist/components/list.js.map +1 -0
  221. package/dist/components/marker.cjs +52 -0
  222. package/dist/components/marker.cjs.map +1 -0
  223. package/dist/components/marker.d.cts +29 -0
  224. package/dist/components/marker.d.ts +29 -0
  225. package/dist/components/marker.js +46 -0
  226. package/dist/components/marker.js.map +1 -0
  227. package/dist/components/message-scroller.cjs +73 -0
  228. package/dist/components/message-scroller.cjs.map +1 -0
  229. package/dist/components/message-scroller.d.cts +39 -0
  230. package/dist/components/message-scroller.d.ts +39 -0
  231. package/dist/components/message-scroller.js +62 -0
  232. package/dist/components/message-scroller.js.map +1 -0
  233. package/dist/components/message.cjs +60 -0
  234. package/dist/components/message.cjs.map +1 -0
  235. package/dist/components/message.d.cts +36 -0
  236. package/dist/components/message.d.ts +36 -0
  237. package/dist/components/message.js +52 -0
  238. package/dist/components/message.js.map +1 -0
  239. package/dist/components/metering-row.cjs +43 -0
  240. package/dist/components/metering-row.cjs.map +1 -0
  241. package/dist/components/metering-row.d.cts +32 -0
  242. package/dist/components/metering-row.d.ts +32 -0
  243. package/dist/components/metering-row.js +38 -0
  244. package/dist/components/metering-row.js.map +1 -0
  245. package/dist/components/money-saved-block.cjs +87 -0
  246. package/dist/components/money-saved-block.cjs.map +1 -0
  247. package/dist/components/money-saved-block.d.cts +57 -0
  248. package/dist/components/money-saved-block.d.ts +57 -0
  249. package/dist/components/money-saved-block.js +79 -0
  250. package/dist/components/money-saved-block.js.map +1 -0
  251. package/dist/components/number-flow.cjs +44 -0
  252. package/dist/components/number-flow.cjs.map +1 -0
  253. package/dist/components/number-flow.d.cts +4 -0
  254. package/dist/components/number-flow.d.ts +4 -0
  255. package/dist/components/number-flow.js +42 -0
  256. package/dist/components/number-flow.js.map +1 -0
  257. package/dist/components/on-off-button.cjs +36 -0
  258. package/dist/components/on-off-button.cjs.map +1 -0
  259. package/dist/components/on-off-button.d.cts +20 -0
  260. package/dist/components/on-off-button.d.ts +20 -0
  261. package/dist/components/on-off-button.js +34 -0
  262. package/dist/components/on-off-button.js.map +1 -0
  263. package/dist/components/onboarding-layout.cjs +68 -0
  264. package/dist/components/onboarding-layout.cjs.map +1 -0
  265. package/dist/components/onboarding-layout.d.cts +46 -0
  266. package/dist/components/onboarding-layout.d.ts +46 -0
  267. package/dist/components/onboarding-layout.js +60 -0
  268. package/dist/components/onboarding-layout.js.map +1 -0
  269. package/dist/components/page-header.cjs +50 -0
  270. package/dist/components/page-header.cjs.map +1 -0
  271. package/dist/components/page-header.d.cts +26 -0
  272. package/dist/components/page-header.d.ts +26 -0
  273. package/dist/components/page-header.js +44 -0
  274. package/dist/components/page-header.js.map +1 -0
  275. package/dist/components/page-spinner.cjs +19 -0
  276. package/dist/components/page-spinner.cjs.map +1 -0
  277. package/dist/components/page-spinner.d.cts +14 -0
  278. package/dist/components/page-spinner.d.ts +14 -0
  279. package/dist/components/page-spinner.js +17 -0
  280. package/dist/components/page-spinner.js.map +1 -0
  281. package/dist/components/period-tabs.cjs +79 -0
  282. package/dist/components/period-tabs.cjs.map +1 -0
  283. package/dist/components/period-tabs.d.cts +51 -0
  284. package/dist/components/period-tabs.d.ts +51 -0
  285. package/dist/components/period-tabs.js +73 -0
  286. package/dist/components/period-tabs.js.map +1 -0
  287. package/dist/components/popover.cjs +62 -0
  288. package/dist/components/popover.cjs.map +1 -0
  289. package/dist/components/popover.d.cts +29 -0
  290. package/dist/components/popover.d.ts +29 -0
  291. package/dist/components/popover.js +56 -0
  292. package/dist/components/popover.js.map +1 -0
  293. package/dist/components/power-history-chart.cjs +358 -0
  294. package/dist/components/power-history-chart.cjs.map +1 -0
  295. package/dist/components/power-history-chart.d.cts +54 -0
  296. package/dist/components/power-history-chart.d.ts +54 -0
  297. package/dist/components/power-history-chart.js +355 -0
  298. package/dist/components/power-history-chart.js.map +1 -0
  299. package/dist/components/power-history.cjs +115 -0
  300. package/dist/components/power-history.cjs.map +1 -0
  301. package/dist/components/power-history.d.cts +42 -0
  302. package/dist/components/power-history.d.ts +43 -0
  303. package/dist/components/power-history.js +114 -0
  304. package/dist/components/power-history.js.map +1 -0
  305. package/dist/components/power-network.cjs +530 -0
  306. package/dist/components/power-network.cjs.map +1 -0
  307. package/dist/components/power-network.d.cts +77 -0
  308. package/dist/components/power-network.d.ts +77 -0
  309. package/dist/components/power-network.js +523 -0
  310. package/dist/components/power-network.js.map +1 -0
  311. package/dist/components/progress.cjs +34 -0
  312. package/dist/components/progress.cjs.map +1 -0
  313. package/dist/components/progress.d.cts +17 -0
  314. package/dist/components/progress.d.ts +17 -0
  315. package/dist/components/progress.js +31 -0
  316. package/dist/components/progress.js.map +1 -0
  317. package/dist/components/radio-card-group.cjs +69 -0
  318. package/dist/components/radio-card-group.cjs.map +1 -0
  319. package/dist/components/radio-card-group.d.cts +21 -0
  320. package/dist/components/radio-card-group.d.ts +21 -0
  321. package/dist/components/radio-card-group.js +65 -0
  322. package/dist/components/radio-card-group.js.map +1 -0
  323. package/dist/components/radio.cjs +34 -0
  324. package/dist/components/radio.cjs.map +1 -0
  325. package/dist/components/radio.d.cts +21 -0
  326. package/dist/components/radio.d.ts +21 -0
  327. package/dist/components/radio.js +30 -0
  328. package/dist/components/radio.js.map +1 -0
  329. package/dist/components/reparent.cjs +55 -0
  330. package/dist/components/reparent.cjs.map +1 -0
  331. package/dist/components/reparent.d.cts +29 -0
  332. package/dist/components/reparent.d.ts +29 -0
  333. package/dist/components/reparent.js +49 -0
  334. package/dist/components/reparent.js.map +1 -0
  335. package/dist/components/sankey-chart.cjs +221 -0
  336. package/dist/components/sankey-chart.cjs.map +1 -0
  337. package/dist/components/sankey-chart.d.cts +58 -0
  338. package/dist/components/sankey-chart.d.ts +58 -0
  339. package/dist/components/sankey-chart.js +218 -0
  340. package/dist/components/sankey-chart.js.map +1 -0
  341. package/dist/components/schedule-editor.cjs +82 -0
  342. package/dist/components/schedule-editor.cjs.map +1 -0
  343. package/dist/components/schedule-editor.d.cts +25 -0
  344. package/dist/components/schedule-editor.d.ts +25 -0
  345. package/dist/components/schedule-editor.js +72 -0
  346. package/dist/components/schedule-editor.js.map +1 -0
  347. package/dist/components/schedule-list.cjs +110 -0
  348. package/dist/components/schedule-list.cjs.map +1 -0
  349. package/dist/components/schedule-list.d.cts +29 -0
  350. package/dist/components/schedule-list.d.ts +29 -0
  351. package/dist/components/schedule-list.js +99 -0
  352. package/dist/components/schedule-list.js.map +1 -0
  353. package/dist/components/scroll-area.cjs +53 -0
  354. package/dist/components/scroll-area.cjs.map +1 -0
  355. package/dist/components/scroll-area.d.cts +26 -0
  356. package/dist/components/scroll-area.d.ts +26 -0
  357. package/dist/components/scroll-area.js +44 -0
  358. package/dist/components/scroll-area.js.map +1 -0
  359. package/dist/components/select.cjs +136 -0
  360. package/dist/components/select.cjs.map +1 -0
  361. package/dist/components/select.d.cts +63 -0
  362. package/dist/components/select.d.ts +63 -0
  363. package/dist/components/select.js +124 -0
  364. package/dist/components/select.js.map +1 -0
  365. package/dist/components/separator.cjs +38 -0
  366. package/dist/components/separator.cjs.map +1 -0
  367. package/dist/components/separator.d.cts +13 -0
  368. package/dist/components/separator.d.ts +13 -0
  369. package/dist/components/separator.js +35 -0
  370. package/dist/components/separator.js.map +1 -0
  371. package/dist/components/series-legend.cjs +39 -0
  372. package/dist/components/series-legend.cjs.map +1 -0
  373. package/dist/components/series-legend.d.cts +31 -0
  374. package/dist/components/series-legend.d.ts +31 -0
  375. package/dist/components/series-legend.js +37 -0
  376. package/dist/components/series-legend.js.map +1 -0
  377. package/dist/components/sheet.cjs +102 -0
  378. package/dist/components/sheet.cjs.map +1 -0
  379. package/dist/components/sheet.d.cts +46 -0
  380. package/dist/components/sheet.d.ts +46 -0
  381. package/dist/components/sheet.js +90 -0
  382. package/dist/components/sheet.js.map +1 -0
  383. package/dist/components/skeleton.cjs +24 -0
  384. package/dist/components/skeleton.cjs.map +1 -0
  385. package/dist/components/skeleton.d.cts +24 -0
  386. package/dist/components/skeleton.d.ts +24 -0
  387. package/dist/components/skeleton.js +21 -0
  388. package/dist/components/skeleton.js.map +1 -0
  389. package/dist/components/slider.cjs +276 -0
  390. package/dist/components/slider.cjs.map +1 -0
  391. package/dist/components/slider.d.cts +150 -0
  392. package/dist/components/slider.d.ts +150 -0
  393. package/dist/components/slider.js +266 -0
  394. package/dist/components/slider.js.map +1 -0
  395. package/dist/components/smart-toggle-button.cjs +28 -0
  396. package/dist/components/smart-toggle-button.cjs.map +1 -0
  397. package/dist/components/smart-toggle-button.d.cts +18 -0
  398. package/dist/components/smart-toggle-button.d.ts +18 -0
  399. package/dist/components/smart-toggle-button.js +26 -0
  400. package/dist/components/smart-toggle-button.js.map +1 -0
  401. package/dist/components/solar-forecast-chart.cjs +105 -0
  402. package/dist/components/solar-forecast-chart.cjs.map +1 -0
  403. package/dist/components/solar-forecast-chart.d.cts +66 -0
  404. package/dist/components/solar-forecast-chart.d.ts +66 -0
  405. package/dist/components/solar-forecast-chart.js +99 -0
  406. package/dist/components/solar-forecast-chart.js.map +1 -0
  407. package/dist/components/sortable-list.cjs +69 -0
  408. package/dist/components/sortable-list.cjs.map +1 -0
  409. package/dist/components/sortable-list.d.cts +46 -0
  410. package/dist/components/sortable-list.d.ts +46 -0
  411. package/dist/components/sortable-list.js +67 -0
  412. package/dist/components/sortable-list.js.map +1 -0
  413. package/dist/components/spinner.cjs +42 -0
  414. package/dist/components/spinner.cjs.map +1 -0
  415. package/dist/components/spinner.d.cts +15 -0
  416. package/dist/components/spinner.d.ts +15 -0
  417. package/dist/components/spinner.js +39 -0
  418. package/dist/components/spinner.js.map +1 -0
  419. package/dist/components/stat-card.cjs +58 -0
  420. package/dist/components/stat-card.cjs.map +1 -0
  421. package/dist/components/stat-card.d.cts +36 -0
  422. package/dist/components/stat-card.d.ts +36 -0
  423. package/dist/components/stat-card.js +50 -0
  424. package/dist/components/stat-card.js.map +1 -0
  425. package/dist/components/stepper.cjs +79 -0
  426. package/dist/components/stepper.cjs.map +1 -0
  427. package/dist/components/stepper.d.cts +33 -0
  428. package/dist/components/stepper.d.ts +33 -0
  429. package/dist/components/stepper.js +76 -0
  430. package/dist/components/stepper.js.map +1 -0
  431. package/dist/components/switch.cjs +22 -0
  432. package/dist/components/switch.cjs.map +1 -0
  433. package/dist/components/switch.d.cts +28 -0
  434. package/dist/components/switch.d.ts +28 -0
  435. package/dist/components/switch.js +20 -0
  436. package/dist/components/switch.js.map +1 -0
  437. package/dist/components/tabs.cjs +175 -0
  438. package/dist/components/tabs.cjs.map +1 -0
  439. package/dist/components/tabs.d.cts +45 -0
  440. package/dist/components/tabs.d.ts +45 -0
  441. package/dist/components/tabs.js +167 -0
  442. package/dist/components/tabs.js.map +1 -0
  443. package/dist/components/theme.cjs +6 -0
  444. package/dist/components/theme.d.cts +38 -0
  445. package/dist/components/theme.d.ts +38 -0
  446. package/dist/components/theme.js +4 -0
  447. package/dist/components/thumbnail.cjs +54 -0
  448. package/dist/components/thumbnail.cjs.map +1 -0
  449. package/dist/components/thumbnail.d.cts +34 -0
  450. package/dist/components/thumbnail.d.ts +34 -0
  451. package/dist/components/thumbnail.js +51 -0
  452. package/dist/components/thumbnail.js.map +1 -0
  453. package/dist/components/time-picker.cjs +55 -0
  454. package/dist/components/time-picker.cjs.map +1 -0
  455. package/dist/components/time-picker.d.cts +41 -0
  456. package/dist/components/time-picker.d.ts +41 -0
  457. package/dist/components/time-picker.js +51 -0
  458. package/dist/components/time-picker.js.map +1 -0
  459. package/dist/components/toast.cjs +99 -0
  460. package/dist/components/toast.cjs.map +1 -0
  461. package/dist/components/toast.d.cts +18 -0
  462. package/dist/components/toast.d.ts +18 -0
  463. package/dist/components/toast.js +95 -0
  464. package/dist/components/toast.js.map +1 -0
  465. package/dist/components/tooltip.cjs +75 -0
  466. package/dist/components/tooltip.cjs.map +1 -0
  467. package/dist/components/tooltip.d.cts +47 -0
  468. package/dist/components/tooltip.d.ts +47 -0
  469. package/dist/components/tooltip.js +67 -0
  470. package/dist/components/tooltip.js.map +1 -0
  471. package/dist/components/typography.cjs +52 -0
  472. package/dist/components/typography.cjs.map +1 -0
  473. package/dist/components/typography.d.cts +32 -0
  474. package/dist/components/typography.d.ts +32 -0
  475. package/dist/components/typography.js +45 -0
  476. package/dist/components/typography.js.map +1 -0
  477. package/dist/hooks/use-container-width.cjs +22 -0
  478. package/dist/hooks/use-container-width.cjs.map +1 -0
  479. package/dist/hooks/use-container-width.d.cts +7 -0
  480. package/dist/hooks/use-container-width.d.ts +7 -0
  481. package/dist/hooks/use-container-width.js +20 -0
  482. package/dist/hooks/use-container-width.js.map +1 -0
  483. package/dist/icons/index.cjs +7 -0
  484. package/dist/icons/index.d.cts +4 -0
  485. package/dist/icons/index.d.ts +4 -0
  486. package/dist/icons/index.js +3 -0
  487. package/dist/icons/material-symbol.cjs +105 -0
  488. package/dist/icons/material-symbol.cjs.map +1 -0
  489. package/dist/icons/material-symbol.d.cts +23 -0
  490. package/dist/icons/material-symbol.d.ts +23 -0
  491. package/dist/icons/material-symbol.js +100 -0
  492. package/dist/icons/material-symbol.js.map +1 -0
  493. package/dist/input-box-variants-BMDdwvqg.cjs +40 -0
  494. package/dist/input-box-variants-BMDdwvqg.cjs.map +1 -0
  495. package/dist/input-box-variants-Dr1K7uYE.js +28 -0
  496. package/dist/input-box-variants-Dr1K7uYE.js.map +1 -0
  497. package/dist/number-flow-DMJouddg.d.cts +15 -0
  498. package/dist/number-flow-DSbucQ_K.d.ts +15 -0
  499. package/dist/styles/index.css +223 -0
  500. package/dist/styles/internal.css +5 -0
  501. package/dist/styles/material-symbol.css +22 -0
  502. package/dist/styles/spark-default.css +883 -0
  503. package/dist/styles/theme.css +542 -0
  504. package/dist/styles/utilities.css +557 -0
  505. package/dist/theme-B3WtiByA.js +574 -0
  506. package/dist/theme-B3WtiByA.js.map +1 -0
  507. package/dist/theme-C9_OSe0S.cjs +592 -0
  508. package/dist/theme-C9_OSe0S.cjs.map +1 -0
  509. package/dist/theme-types-DoROIXpi.d.ts +30 -0
  510. package/dist/theme-types-r20EJfEC.d.cts +30 -0
  511. package/dist/tones-DjgKOX3s.d.cts +8 -0
  512. package/dist/tones-DyCkL71h.d.ts +8 -0
  513. package/dist/utils/build-sankey-nodes.cjs +59 -0
  514. package/dist/utils/build-sankey-nodes.cjs.map +1 -0
  515. package/dist/utils/build-sankey-nodes.d.cts +27 -0
  516. package/dist/utils/build-sankey-nodes.d.ts +27 -0
  517. package/dist/utils/build-sankey-nodes.js +58 -0
  518. package/dist/utils/build-sankey-nodes.js.map +1 -0
  519. package/dist/utils/chars.cjs +18 -0
  520. package/dist/utils/chars.cjs.map +1 -0
  521. package/dist/utils/chars.d.cts +10 -0
  522. package/dist/utils/chars.d.ts +10 -0
  523. package/dist/utils/chars.js +14 -0
  524. package/dist/utils/chars.js.map +1 -0
  525. package/dist/utils/cn.cjs +10 -0
  526. package/dist/utils/cn.d.cts +4 -0
  527. package/dist/utils/cn.d.ts +4 -0
  528. package/dist/utils/cn.js +3 -0
  529. package/dist/utils/date-mask.cjs +45 -0
  530. package/dist/utils/date-mask.cjs.map +1 -0
  531. package/dist/utils/date-mask.d.cts +17 -0
  532. package/dist/utils/date-mask.d.ts +17 -0
  533. package/dist/utils/date-mask.js +41 -0
  534. package/dist/utils/date-mask.js.map +1 -0
  535. package/dist/utils/format.cjs +57 -0
  536. package/dist/utils/format.cjs.map +1 -0
  537. package/dist/utils/format.d.cts +23 -0
  538. package/dist/utils/format.d.ts +23 -0
  539. package/dist/utils/format.js +47 -0
  540. package/dist/utils/format.js.map +1 -0
  541. package/package.json +78 -63
  542. package/dist/index.cjs +0 -1631
  543. package/dist/index.cjs.map +0 -1
  544. package/dist/index.css +0 -1
  545. package/dist/index.d.cts +0 -299
  546. package/dist/index.d.ts +0 -299
  547. package/dist/index.js +0 -1518
  548. package/dist/index.js.map +0 -1
  549. package/dist/styles.js +0 -1
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ //#region src/components/bar-chart.d.ts
4
+ type BarChartCategory = string | number;
5
+ interface BarChartSeries<TDatum> {
6
+ key: string;
7
+ label: string;
8
+ color: string;
9
+ hoverFill?: string;
10
+ getValue: (datum: TDatum) => number;
11
+ }
12
+ interface BarChartLineSeries<TDatum> {
13
+ key: string;
14
+ label: string;
15
+ color: string;
16
+ /** `null` gaps break the line (e.g. hours without a reading). */
17
+ getValue: (datum: TDatum) => number | null;
18
+ /** Own y-domain for this line (e.g. `[0, 100]` for a percentage). Defaults to the bar scale. */
19
+ domain?: [number, number];
20
+ /** Start hidden; the user can enable the line from the legend. */
21
+ hiddenByDefault?: boolean;
22
+ /** Formats this line's value in the hover tooltip. Defaults to `formatValue`. */
23
+ formatValue?: (value: number) => string;
24
+ strokeDasharray?: string;
25
+ }
26
+ interface BarChartProps<TDatum> {
27
+ data: TDatum[];
28
+ series: BarChartSeries<TDatum>[];
29
+ /** Line overlays drawn on top of the bars, toggleable from the legend. */
30
+ lines?: BarChartLineSeries<TDatum>[];
31
+ getCategory: (datum: TDatum) => BarChartCategory;
32
+ /** Full ordered set of categories on the x-axis. Defaults to `data.map(getCategory)`. */
33
+ categories?: BarChartCategory[];
34
+ /** Subset of categories that should render an x-axis label. Defaults to every category. */
35
+ categoryTicks?: BarChartCategory[];
36
+ formatCategory?: (category: BarChartCategory) => string;
37
+ /** Formats the hovered category in the tooltip header. Defaults to `formatCategory`. */
38
+ formatTooltipCategory?: (category: BarChartCategory) => string;
39
+ highlightedCategory?: BarChartCategory;
40
+ showHighlightLine?: boolean;
41
+ /**
42
+ * Horizontal reference line drawn across the plot at a given y-value.
43
+ * Useful for thresholds (e.g. price ceiling).
44
+ */
45
+ referenceLine?: {
46
+ value: number;
47
+ label?: string;
48
+ color?: string;
49
+ };
50
+ title?: string;
51
+ yAxisUnit?: string;
52
+ height?: number;
53
+ /** Override how the total value (sum of focused or all categories) is rendered. */
54
+ renderTotal?: (value: number) => React.ReactNode;
55
+ /** Format function used when `renderTotal` is not provided. */
56
+ formatTotal?: (value: number) => string;
57
+ /** Formats per-series values in the hover tooltip. Defaults to `formatTotal`. */
58
+ formatValue?: (value: number) => string;
59
+ className?: string;
60
+ }
61
+ declare function BarChart<TDatum>({
62
+ data,
63
+ series,
64
+ lines,
65
+ getCategory,
66
+ categories,
67
+ categoryTicks,
68
+ formatCategory,
69
+ formatTooltipCategory,
70
+ highlightedCategory,
71
+ showHighlightLine,
72
+ referenceLine,
73
+ title,
74
+ yAxisUnit,
75
+ height,
76
+ renderTotal,
77
+ formatTotal,
78
+ formatValue,
79
+ className
80
+ }: BarChartProps<TDatum>): React.ReactElement;
81
+ //#endregion
82
+ export { BarChart, BarChartCategory, BarChartLineSeries, BarChartProps, BarChartSeries };
83
+ //# sourceMappingURL=bar-chart.d.cts.map
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ //#region src/components/bar-chart.d.ts
4
+ type BarChartCategory = string | number;
5
+ interface BarChartSeries<TDatum> {
6
+ key: string;
7
+ label: string;
8
+ color: string;
9
+ hoverFill?: string;
10
+ getValue: (datum: TDatum) => number;
11
+ }
12
+ interface BarChartLineSeries<TDatum> {
13
+ key: string;
14
+ label: string;
15
+ color: string;
16
+ /** `null` gaps break the line (e.g. hours without a reading). */
17
+ getValue: (datum: TDatum) => number | null;
18
+ /** Own y-domain for this line (e.g. `[0, 100]` for a percentage). Defaults to the bar scale. */
19
+ domain?: [number, number];
20
+ /** Start hidden; the user can enable the line from the legend. */
21
+ hiddenByDefault?: boolean;
22
+ /** Formats this line's value in the hover tooltip. Defaults to `formatValue`. */
23
+ formatValue?: (value: number) => string;
24
+ strokeDasharray?: string;
25
+ }
26
+ interface BarChartProps<TDatum> {
27
+ data: TDatum[];
28
+ series: BarChartSeries<TDatum>[];
29
+ /** Line overlays drawn on top of the bars, toggleable from the legend. */
30
+ lines?: BarChartLineSeries<TDatum>[];
31
+ getCategory: (datum: TDatum) => BarChartCategory;
32
+ /** Full ordered set of categories on the x-axis. Defaults to `data.map(getCategory)`. */
33
+ categories?: BarChartCategory[];
34
+ /** Subset of categories that should render an x-axis label. Defaults to every category. */
35
+ categoryTicks?: BarChartCategory[];
36
+ formatCategory?: (category: BarChartCategory) => string;
37
+ /** Formats the hovered category in the tooltip header. Defaults to `formatCategory`. */
38
+ formatTooltipCategory?: (category: BarChartCategory) => string;
39
+ highlightedCategory?: BarChartCategory;
40
+ showHighlightLine?: boolean;
41
+ /**
42
+ * Horizontal reference line drawn across the plot at a given y-value.
43
+ * Useful for thresholds (e.g. price ceiling).
44
+ */
45
+ referenceLine?: {
46
+ value: number;
47
+ label?: string;
48
+ color?: string;
49
+ };
50
+ title?: string;
51
+ yAxisUnit?: string;
52
+ height?: number;
53
+ /** Override how the total value (sum of focused or all categories) is rendered. */
54
+ renderTotal?: (value: number) => React.ReactNode;
55
+ /** Format function used when `renderTotal` is not provided. */
56
+ formatTotal?: (value: number) => string;
57
+ /** Formats per-series values in the hover tooltip. Defaults to `formatTotal`. */
58
+ formatValue?: (value: number) => string;
59
+ className?: string;
60
+ }
61
+ declare function BarChart<TDatum>({
62
+ data,
63
+ series,
64
+ lines,
65
+ getCategory,
66
+ categories,
67
+ categoryTicks,
68
+ formatCategory,
69
+ formatTooltipCategory,
70
+ highlightedCategory,
71
+ showHighlightLine,
72
+ referenceLine,
73
+ title,
74
+ yAxisUnit,
75
+ height,
76
+ renderTotal,
77
+ formatTotal,
78
+ formatValue,
79
+ className
80
+ }: BarChartProps<TDatum>): React.ReactElement;
81
+ //#endregion
82
+ export { BarChart, BarChartCategory, BarChartLineSeries, BarChartProps, BarChartSeries };
83
+ //# sourceMappingURL=bar-chart.d.ts.map
@@ -0,0 +1,517 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { integerFormat, localeNumberFormat, oneDecimalFormat } from "../utils/format.js";
4
+ import { ChartTooltipCard, clampTooltipPosition, useMeasuredSize } from "./chart.js";
5
+ import { SeriesLegend } from "./series-legend.js";
6
+ import { SectionTitle } from "./typography.js";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { localPoint } from "@visx/event";
10
+ import { Group } from "@visx/group";
11
+ import { scaleBand, scaleLinear, scaleOrdinal } from "@visx/scale";
12
+ import { BarStack } from "@visx/shape";
13
+ //#region src/components/bar-chart.tsx
14
+ const defaultTotalFormat = localeNumberFormat();
15
+ const PADDING_TOP = 20;
16
+ const PADDING_BOTTOM = 28;
17
+ const HOVER_FADE_MS = 200;
18
+ const FOCUS_TRANSITION_MS = 180;
19
+ const DEFAULT_HEIGHT = 220;
20
+ const BAR_RADIUS = 2;
21
+ const Y_AXIS_GUTTER = 34;
22
+ function buildYAxisTicks(yMax) {
23
+ const rawStep = yMax / 4;
24
+ const normalized = rawStep === 0 ? 1 : rawStep;
25
+ const magnitude = Math.pow(10, Math.floor(Math.log10(normalized)));
26
+ const step = ([
27
+ 1,
28
+ 2,
29
+ 2.5,
30
+ 5,
31
+ 10
32
+ ].find((value) => value * magnitude >= normalized) ?? 10) * magnitude;
33
+ const upper = Math.ceil(yMax / step) * step;
34
+ const ticks = [];
35
+ for (let value = 0; value <= upper + step * .001; value += step) ticks.push(Number(value.toFixed(6)));
36
+ return ticks;
37
+ }
38
+ function formatYAxisTick(value) {
39
+ return value >= 10 ? integerFormat.format(value) : oneDecimalFormat.format(value);
40
+ }
41
+ function buildBarPath(x, y, width, height, radius, roundTop, roundBottom) {
42
+ const r = Math.max(0, Math.min(radius, width / 2, height / 2));
43
+ if (r === 0 || !roundTop && !roundBottom) return `M ${x} ${y} H ${x + width} V ${y + height} H ${x} Z`;
44
+ const tl = roundTop ? r : 0;
45
+ const tr = roundTop ? r : 0;
46
+ const br = roundBottom ? r : 0;
47
+ const bl = roundBottom ? r : 0;
48
+ return [
49
+ `M ${x + tl} ${y}`,
50
+ `H ${x + width - tr}`,
51
+ tr > 0 ? `Q ${x + width} ${y} ${x + width} ${y + tr}` : `L ${x + width} ${y}`,
52
+ `V ${y + height - br}`,
53
+ br > 0 ? `Q ${x + width} ${y + height} ${x + width - br} ${y + height}` : `L ${x + width} ${y + height}`,
54
+ `H ${x + bl}`,
55
+ bl > 0 ? `Q ${x} ${y + height} ${x} ${y + height - bl}` : `L ${x} ${y + height}`,
56
+ `V ${y + tl}`,
57
+ tl > 0 ? `Q ${x} ${y} ${x + tl} ${y}` : `L ${x} ${y}`,
58
+ "Z"
59
+ ].join(" ");
60
+ }
61
+ function BarStackLayer({ stackData, series, seriesByKey, xScale, yScale, colorScale }) {
62
+ return /* @__PURE__ */ jsx(BarStack, {
63
+ data: stackData,
64
+ keys: series.map((entry) => entry.key),
65
+ x: (record) => record.__category,
66
+ value: (record, key) => record.__values[key] ?? 0,
67
+ xScale,
68
+ yScale,
69
+ color: colorScale,
70
+ children: (barStacks) => barStacks.map((barStack) => barStack.bars.map((bar) => {
71
+ if ((bar.bar.data.__values[barStack.key] ?? 0) === 0) return null;
72
+ const strokeColor = seriesByKey.get(barStack.key)?.color ?? bar.color;
73
+ const fillColor = strokeColor;
74
+ const valueKeys = series.map((entry) => entry.key).filter((key) => (bar.bar.data.__values[key] ?? 0) > 0);
75
+ const isBottomSegment = valueKeys[0] === barStack.key;
76
+ const isTopSegment = valueKeys[valueKeys.length - 1] === barStack.key;
77
+ return /* @__PURE__ */ jsx("path", {
78
+ d: buildBarPath(bar.x, bar.y, bar.width, Math.max(0, bar.height), BAR_RADIUS, isTopSegment, isBottomSegment),
79
+ fill: fillColor,
80
+ stroke: strokeColor,
81
+ strokeWidth: 1,
82
+ style: { transition: "fill 180ms ease" }
83
+ }, `bar-${barStack.index}-${bar.index}`);
84
+ }))
85
+ });
86
+ }
87
+ function FocusBorder({ category, visible, stackData, series, xScale, yScale }) {
88
+ const x = xScale(category);
89
+ const datum = stackData.find((entry) => entry.__category === category);
90
+ if (x === void 0 || !datum) return null;
91
+ if (!series.some((entry) => (datum.__values[entry.key] ?? 0) > 0)) return null;
92
+ const topY = PADDING_TOP;
93
+ const baselineY = yScale(0);
94
+ const borderPaddingX = 4;
95
+ const borderPaddingY = 3;
96
+ const borderXRaw = x - borderPaddingX;
97
+ const borderY = topY - borderPaddingY;
98
+ const borderWidthRaw = xScale.bandwidth() + borderPaddingX * 2;
99
+ const [rangeStart, rangeEnd] = xScale.range();
100
+ const minX = Math.min(rangeStart, rangeEnd);
101
+ const maxX = Math.max(rangeStart, rangeEnd);
102
+ const borderX = Math.max(minX, borderXRaw);
103
+ const borderRight = Math.min(maxX, borderXRaw + borderWidthRaw);
104
+ const borderWidth = Math.max(0, borderRight - borderX);
105
+ const borderHeight = Math.max(1, baselineY - topY + borderPaddingY * 2);
106
+ if (borderWidth <= 0) return null;
107
+ return /* @__PURE__ */ jsx("rect", {
108
+ x: borderX,
109
+ y: borderY,
110
+ width: borderWidth,
111
+ height: borderHeight,
112
+ rx: 6,
113
+ fill: "var(--spark-a2)",
114
+ stroke: "var(--spark-a9)",
115
+ strokeWidth: 2,
116
+ pointerEvents: "none",
117
+ style: {
118
+ opacity: visible ? 1 : 0,
119
+ transition: `x ${FOCUS_TRANSITION_MS}ms ease, y ${FOCUS_TRANSITION_MS}ms ease, width ${FOCUS_TRANSITION_MS}ms ease, height ${FOCUS_TRANSITION_MS}ms ease, opacity ${FOCUS_TRANSITION_MS}ms ease`
120
+ }
121
+ });
122
+ }
123
+ function InteractionLayer({ xDomain, activeCategories, xScale, height, onHoverChange }) {
124
+ const bandwidth = xScale.bandwidth();
125
+ const [rangeStart, rangeEnd] = xScale.range();
126
+ const minX = Math.min(rangeStart, rangeEnd);
127
+ const maxX = Math.max(rangeStart, rangeEnd);
128
+ const handleMove = (event) => {
129
+ const point = localPoint(event);
130
+ if (!point) return;
131
+ let nearest = null;
132
+ let best = Infinity;
133
+ for (const category of xDomain) {
134
+ if (!activeCategories.has(category)) continue;
135
+ const x = xScale(category);
136
+ if (x === void 0) continue;
137
+ const distance = Math.abs(x + bandwidth / 2 - point.x);
138
+ if (distance < best) {
139
+ best = distance;
140
+ nearest = category;
141
+ }
142
+ }
143
+ if (nearest !== null) onHoverChange(nearest);
144
+ };
145
+ return /* @__PURE__ */ jsx("rect", {
146
+ x: minX,
147
+ y: PADDING_TOP,
148
+ width: Math.max(0, maxX - minX),
149
+ height: height - PADDING_TOP - PADDING_BOTTOM,
150
+ fill: "transparent",
151
+ onMouseMove: handleMove,
152
+ onMouseLeave: () => onHoverChange(null),
153
+ onTouchMove: handleMove,
154
+ onTouchEnd: () => onHoverChange(null)
155
+ });
156
+ }
157
+ function CategoryTicks({ ticks, xScale, height, formatCategory }) {
158
+ return /* @__PURE__ */ jsx(Fragment, { children: ticks.map((category) => {
159
+ const x = xScale(category);
160
+ if (x === void 0) return null;
161
+ return /* @__PURE__ */ jsx("text", {
162
+ x: x + xScale.bandwidth() / 2,
163
+ y: height - PADDING_BOTTOM + 16,
164
+ textAnchor: "middle",
165
+ fill: "var(--gray-a11)",
166
+ fontSize: 10,
167
+ children: formatCategory(category)
168
+ }, `tick-${String(category)}`);
169
+ }) });
170
+ }
171
+ function defaultFormatTotal(value) {
172
+ return defaultTotalFormat.format(value);
173
+ }
174
+ function BarChart({ data, series, lines, getCategory, categories, categoryTicks, formatCategory = (category) => String(category), formatTooltipCategory = formatCategory, highlightedCategory, showHighlightLine = false, referenceLine, title, yAxisUnit, height = DEFAULT_HEIGHT, renderTotal, formatTotal = defaultFormatTotal, formatValue, className }) {
175
+ const containerRef = useRef(null);
176
+ const [width, setWidth] = useState(0);
177
+ const [hoveredCategory, setHoveredCategory] = useState(null);
178
+ const [trailingHoverLabel, setTrailingHoverLabel] = useState(null);
179
+ const [hiddenSeries, setHiddenSeries] = useState(() => new Set((lines ?? []).filter((line) => line.hiddenByDefault).map((line) => line.key)));
180
+ const toggleSeries = useCallback((id) => {
181
+ setHiddenSeries((prev) => {
182
+ const next = new Set(prev);
183
+ if (next.has(id)) next.delete(id);
184
+ else next.add(id);
185
+ return next;
186
+ });
187
+ }, []);
188
+ useEffect(() => {
189
+ const element = containerRef.current;
190
+ if (!element) return;
191
+ const resizeObserver = new ResizeObserver((entries) => {
192
+ const entry = entries[0];
193
+ if (!entry) return;
194
+ setWidth(entry.contentRect.width);
195
+ });
196
+ resizeObserver.observe(element);
197
+ return () => {
198
+ resizeObserver.disconnect();
199
+ };
200
+ }, []);
201
+ const seriesByKey = useMemo(() => {
202
+ const map = /* @__PURE__ */ new Map();
203
+ for (const entry of series) map.set(entry.key, entry);
204
+ return map;
205
+ }, [series]);
206
+ const stackData = useMemo(() => data.map((datum) => {
207
+ const values = {};
208
+ for (const entry of series) values[entry.key] = hiddenSeries.has(entry.key) ? 0 : entry.getValue(datum);
209
+ return {
210
+ __category: getCategory(datum),
211
+ __values: values
212
+ };
213
+ }), [
214
+ data,
215
+ getCategory,
216
+ series,
217
+ hiddenSeries
218
+ ]);
219
+ const yMax = useMemo(() => Math.max(1, referenceLine?.value ?? 0, ...stackData.map((record) => series.reduce((sum, entry) => sum + (record.__values[entry.key] ?? 0), 0))), [
220
+ referenceLine,
221
+ series,
222
+ stackData
223
+ ]);
224
+ const xDomain = useMemo(() => categories ?? stackData.map((record) => record.__category), [categories, stackData]);
225
+ const xScale = useMemo(() => scaleBand({
226
+ domain: xDomain,
227
+ range: [Y_AXIS_GUTTER, Math.max(Y_AXIS_GUTTER, width)],
228
+ padding: .32
229
+ }), [xDomain, width]);
230
+ const yScale = useMemo(() => scaleLinear({
231
+ domain: [0, yMax],
232
+ range: [height - PADDING_BOTTOM, PADDING_TOP]
233
+ }), [height, yMax]);
234
+ const colorScale = useMemo(() => scaleOrdinal({
235
+ domain: series.map((entry) => entry.key),
236
+ range: series.map((entry) => entry.color)
237
+ }), [series]);
238
+ const linePaths = useMemo(() => {
239
+ if (!lines || width === 0) return [];
240
+ return lines.filter((line) => !hiddenSeries.has(line.key)).map((line) => {
241
+ const lineScale = line.domain ? scaleLinear({
242
+ domain: line.domain,
243
+ range: [height - PADDING_BOTTOM, PADDING_TOP]
244
+ }) : yScale;
245
+ const segments = [];
246
+ let previous = null;
247
+ for (const datum of data) {
248
+ const x = xScale(getCategory(datum));
249
+ const value = line.getValue(datum);
250
+ if (x === void 0 || value === null || !Number.isFinite(value)) {
251
+ previous = null;
252
+ continue;
253
+ }
254
+ const point = {
255
+ x: x + xScale.bandwidth() / 2,
256
+ y: lineScale(value)
257
+ };
258
+ segments.push(previous === null ? `M ${point.x} ${point.y}` : `L ${point.x} ${point.y}`);
259
+ previous = point;
260
+ }
261
+ return {
262
+ key: line.key,
263
+ d: segments.join(" "),
264
+ color: line.color,
265
+ strokeDasharray: line.strokeDasharray ?? "5 4"
266
+ };
267
+ }).filter((path) => path.d !== "");
268
+ }, [
269
+ lines,
270
+ hiddenSeries,
271
+ data,
272
+ getCategory,
273
+ xScale,
274
+ yScale,
275
+ height,
276
+ width
277
+ ]);
278
+ const stackCategorySet = useMemo(() => new Set(stackData.map((record) => record.__category)), [stackData]);
279
+ const lastFocusCategoryRef = useRef(null);
280
+ if (hoveredCategory !== null) lastFocusCategoryRef.current = hoveredCategory;
281
+ const focusCategory = lastFocusCategoryRef.current;
282
+ const focused = useMemo(() => hoveredCategory === null ? null : stackData.find((record) => record.__category === hoveredCategory) ?? null, [hoveredCategory, stackData]);
283
+ const totalValue = useMemo(() => {
284
+ if (focused) return series.reduce((sum, entry) => sum + (focused.__values[entry.key] ?? 0), 0);
285
+ return stackData.reduce((sum, record) => sum + series.reduce((s, entry) => s + (record.__values[entry.key] ?? 0), 0), 0);
286
+ }, [
287
+ focused,
288
+ series,
289
+ stackData
290
+ ]);
291
+ const hoverLabel = focused ? formatTooltipCategory(focused.__category) : null;
292
+ useEffect(() => {
293
+ if (hoverLabel) {
294
+ setTrailingHoverLabel(hoverLabel);
295
+ return;
296
+ }
297
+ const timeoutId = window.setTimeout(() => {
298
+ setTrailingHoverLabel(null);
299
+ }, HOVER_FADE_MS);
300
+ return () => {
301
+ window.clearTimeout(timeoutId);
302
+ };
303
+ }, [hoverLabel]);
304
+ const ticks = categoryTicks ?? xDomain;
305
+ const yTicks = useMemo(() => buildYAxisTicks(yMax), [yMax]);
306
+ const highlightX = useMemo(() => {
307
+ if (!showHighlightLine || highlightedCategory === void 0) return null;
308
+ const x = xScale(highlightedCategory);
309
+ if (x === void 0) return null;
310
+ return x + xScale.bandwidth() / 2;
311
+ }, [
312
+ highlightedCategory,
313
+ showHighlightLine,
314
+ xScale
315
+ ]);
316
+ const focusedDatum = useMemo(() => hoveredCategory === null ? null : data.find((datum) => getCategory(datum) === hoveredCategory) ?? null, [
317
+ hoveredCategory,
318
+ data,
319
+ getCategory
320
+ ]);
321
+ const fmtTooltipValue = formatValue ?? formatTotal;
322
+ const tooltipRows = focused ? [...series.filter((entry) => (focused.__values[entry.key] ?? 0) > 0).map((entry) => ({
323
+ key: entry.key,
324
+ label: entry.label,
325
+ color: entry.color,
326
+ value: fmtTooltipValue(focused.__values[entry.key] ?? 0)
327
+ })), ...(lines ?? []).filter((line) => !hiddenSeries.has(line.key)).flatMap((line) => {
328
+ const value = focusedDatum === null ? null : line.getValue(focusedDatum);
329
+ if (value === null || !Number.isFinite(value)) return [];
330
+ return [{
331
+ key: line.key,
332
+ label: line.label,
333
+ color: line.color,
334
+ value: (line.formatValue ?? fmtTooltipValue)(value)
335
+ }];
336
+ })] : [];
337
+ const tooltipActive = tooltipRows.length > 0;
338
+ const anchorX = focusCategory !== null ? (xScale(focusCategory) ?? 0) + xScale.bandwidth() / 2 : 0;
339
+ const anchorY = yScale(totalValue);
340
+ const [tooltipRef, tooltipSize] = useMeasuredSize();
341
+ const tooltipPos = clampTooltipPosition({
342
+ anchorX,
343
+ anchorY,
344
+ width,
345
+ height,
346
+ tipWidth: tooltipSize.width,
347
+ tipHeight: tooltipSize.height
348
+ });
349
+ return /* @__PURE__ */ jsxs("div", {
350
+ className: cn("flex w-full flex-col", className),
351
+ children: [
352
+ /* @__PURE__ */ jsxs("div", {
353
+ className: "flex items-baseline justify-between",
354
+ children: [title && /* @__PURE__ */ jsx(SectionTitle, { children: title }), /* @__PURE__ */ jsx("span", {
355
+ className: "tabular-nums",
356
+ children: renderTotal ? renderTotal(totalValue) : /* @__PURE__ */ jsx("span", {
357
+ className: "text-base font-bold text-gray tabular-nums",
358
+ children: formatTotal(totalValue)
359
+ })
360
+ })]
361
+ }),
362
+ /* @__PURE__ */ jsxs("div", {
363
+ className: "flex min-h-5 items-baseline justify-between gap-4",
364
+ children: [/* @__PURE__ */ jsx(SeriesLegend, {
365
+ items: [...series.map((entry) => ({
366
+ id: entry.key,
367
+ label: entry.label,
368
+ color: entry.color
369
+ })), ...(lines ?? []).map((line) => ({
370
+ id: line.key,
371
+ label: line.label,
372
+ color: line.color,
373
+ marker: "dashed-line"
374
+ }))],
375
+ hiddenIds: hiddenSeries,
376
+ onToggle: toggleSeries,
377
+ className: "gap-y-1"
378
+ }), /* @__PURE__ */ jsx("span", {
379
+ className: cn("text-xs text-gray-light transition-opacity duration-200", hoverLabel ? "opacity-100" : "opacity-0"),
380
+ children: trailingHoverLabel ?? " "
381
+ })]
382
+ }),
383
+ /* @__PURE__ */ jsxs("div", {
384
+ ref: containerRef,
385
+ className: "relative mt-2 w-full",
386
+ style: { height },
387
+ children: [/* @__PURE__ */ jsx("div", {
388
+ ref: tooltipRef,
389
+ className: "pointer-events-none absolute z-10",
390
+ style: {
391
+ left: tooltipPos.left,
392
+ top: tooltipPos.top,
393
+ opacity: tooltipActive ? 1 : 0,
394
+ transition: "left 140ms ease-out, top 140ms ease-out, opacity 140ms ease-out"
395
+ },
396
+ children: focusCategory !== null && /* @__PURE__ */ jsx(ChartTooltipCard, {
397
+ label: formatTooltipCategory(focusCategory),
398
+ rows: tooltipRows
399
+ })
400
+ }), width > 0 && /* @__PURE__ */ jsxs("svg", {
401
+ width,
402
+ height,
403
+ children: [
404
+ /* @__PURE__ */ jsx("line", {
405
+ x1: Y_AXIS_GUTTER,
406
+ x2: Y_AXIS_GUTTER,
407
+ y1: PADDING_TOP,
408
+ y2: yScale(0),
409
+ stroke: "var(--gray-a6)",
410
+ strokeWidth: 1
411
+ }),
412
+ yTicks.map((tick, index) => {
413
+ const y = yScale(tick);
414
+ const hideTickLabel = yAxisUnit !== void 0 && index === yTicks.length - 1;
415
+ return /* @__PURE__ */ jsxs("g", { children: [!hideTickLabel && /* @__PURE__ */ jsx("line", {
416
+ x1: Y_AXIS_GUTTER - 4,
417
+ x2: Y_AXIS_GUTTER,
418
+ y1: y,
419
+ y2: y,
420
+ stroke: "var(--gray-a8)",
421
+ strokeWidth: 1
422
+ }), !hideTickLabel && /* @__PURE__ */ jsx("text", {
423
+ x: Y_AXIS_GUTTER - 7,
424
+ y: y + 3,
425
+ textAnchor: "end",
426
+ fill: "var(--gray-a11)",
427
+ fontSize: 10,
428
+ children: formatYAxisTick(tick)
429
+ })] }, `y-tick-${tick}`);
430
+ }),
431
+ yAxisUnit && /* @__PURE__ */ jsx("text", {
432
+ x: 0,
433
+ y: PADDING_TOP - 6,
434
+ textAnchor: "start",
435
+ fill: "var(--gray-a11)",
436
+ fontSize: 10,
437
+ fontWeight: 600,
438
+ children: yAxisUnit
439
+ }),
440
+ highlightX !== null && /* @__PURE__ */ jsx("line", {
441
+ x1: highlightX,
442
+ x2: highlightX,
443
+ y1: PADDING_TOP,
444
+ y2: yScale(0),
445
+ stroke: "var(--spark-a9)",
446
+ strokeWidth: 1.5,
447
+ strokeDasharray: "5 4",
448
+ pointerEvents: "none"
449
+ }),
450
+ /* @__PURE__ */ jsx("line", {
451
+ x1: Y_AXIS_GUTTER,
452
+ x2: width,
453
+ y1: yScale(0),
454
+ y2: yScale(0),
455
+ stroke: "var(--gray-a5)",
456
+ strokeWidth: 1
457
+ }),
458
+ /* @__PURE__ */ jsxs(Group, { children: [
459
+ focusCategory !== null && /* @__PURE__ */ jsx(FocusBorder, {
460
+ category: focusCategory,
461
+ visible: hoveredCategory !== null,
462
+ stackData,
463
+ series,
464
+ xScale,
465
+ yScale
466
+ }),
467
+ /* @__PURE__ */ jsx(BarStackLayer, {
468
+ stackData,
469
+ series,
470
+ seriesByKey,
471
+ xScale,
472
+ yScale,
473
+ colorScale
474
+ }),
475
+ referenceLine && /* @__PURE__ */ jsx("line", {
476
+ x1: Y_AXIS_GUTTER,
477
+ x2: width,
478
+ y1: yScale(referenceLine.value),
479
+ y2: yScale(referenceLine.value),
480
+ stroke: referenceLine.color ?? "var(--gray-a11)",
481
+ strokeWidth: 1.5,
482
+ pointerEvents: "none"
483
+ }),
484
+ linePaths.map((path) => /* @__PURE__ */ jsx("path", {
485
+ d: path.d,
486
+ fill: "none",
487
+ stroke: path.color,
488
+ strokeWidth: 1.5,
489
+ strokeDasharray: path.strokeDasharray,
490
+ strokeLinecap: "round",
491
+ strokeLinejoin: "round",
492
+ pointerEvents: "none"
493
+ }, `line-${path.key}`))
494
+ ] }),
495
+ /* @__PURE__ */ jsx(InteractionLayer, {
496
+ xDomain,
497
+ activeCategories: stackCategorySet,
498
+ xScale,
499
+ height,
500
+ onHoverChange: setHoveredCategory
501
+ }),
502
+ /* @__PURE__ */ jsx(CategoryTicks, {
503
+ ticks,
504
+ xScale,
505
+ height,
506
+ formatCategory
507
+ })
508
+ ]
509
+ })]
510
+ })
511
+ ]
512
+ });
513
+ }
514
+ //#endregion
515
+ export { BarChart };
516
+
517
+ //# sourceMappingURL=bar-chart.js.map