@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 @@
1
+ {"version":3,"file":"bar-chart.js","names":[],"sources":["../../src/components/bar-chart.tsx"],"sourcesContent":["import { localPoint } from '@visx/event'\nimport { Group } from '@visx/group'\nimport { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale'\nimport { BarStack } from '@visx/shape'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '../utils/cn'\nimport {\n integerFormat,\n localeNumberFormat,\n oneDecimalFormat,\n} from '../utils/format'\nimport {\n ChartTooltipCard,\n type ChartTooltipRow,\n clampTooltipPosition,\n useMeasuredSize,\n} from './chart'\nimport { SeriesLegend } from './series-legend'\nimport { SectionTitle } from './typography'\n\nconst defaultTotalFormat = localeNumberFormat()\n\nexport type BarChartCategory = string | number\n\nexport interface BarChartSeries<TDatum> {\n key: string\n label: string\n color: string\n hoverFill?: string\n getValue: (datum: TDatum) => number\n}\n\nexport interface BarChartLineSeries<TDatum> {\n key: string\n label: string\n color: string\n /** `null` gaps break the line (e.g. hours without a reading). */\n getValue: (datum: TDatum) => number | null\n /** Own y-domain for this line (e.g. `[0, 100]` for a percentage). Defaults to the bar scale. */\n domain?: [number, number]\n /** Start hidden; the user can enable the line from the legend. */\n hiddenByDefault?: boolean\n /** Formats this line's value in the hover tooltip. Defaults to `formatValue`. */\n formatValue?: (value: number) => string\n strokeDasharray?: string\n}\n\nexport interface BarChartProps<TDatum> {\n data: TDatum[]\n series: BarChartSeries<TDatum>[]\n /** Line overlays drawn on top of the bars, toggleable from the legend. */\n lines?: BarChartLineSeries<TDatum>[]\n getCategory: (datum: TDatum) => BarChartCategory\n /** Full ordered set of categories on the x-axis. Defaults to `data.map(getCategory)`. */\n categories?: BarChartCategory[]\n /** Subset of categories that should render an x-axis label. Defaults to every category. */\n categoryTicks?: BarChartCategory[]\n formatCategory?: (category: BarChartCategory) => string\n /** Formats the hovered category in the tooltip header. Defaults to `formatCategory`. */\n formatTooltipCategory?: (category: BarChartCategory) => string\n highlightedCategory?: BarChartCategory\n showHighlightLine?: boolean\n /**\n * Horizontal reference line drawn across the plot at a given y-value.\n * Useful for thresholds (e.g. price ceiling).\n */\n referenceLine?: { value: number; label?: string; color?: string }\n title?: string\n yAxisUnit?: string\n height?: number\n /** Override how the total value (sum of focused or all categories) is rendered. */\n renderTotal?: (value: number) => React.ReactNode\n /** Format function used when `renderTotal` is not provided. */\n formatTotal?: (value: number) => string\n /** Formats per-series values in the hover tooltip. Defaults to `formatTotal`. */\n formatValue?: (value: number) => string\n className?: string\n}\n\ninterface StackDatum {\n __category: BarChartCategory\n __values: Record<string, number>\n}\n\ninterface BarStackLayerProps<TDatum> {\n stackData: StackDatum[]\n series: BarChartSeries<TDatum>[]\n seriesByKey: Map<string, BarChartSeries<TDatum>>\n xScale: ReturnType<typeof scaleBand<BarChartCategory>>\n yScale: ReturnType<typeof scaleLinear<number>>\n colorScale: ReturnType<typeof scaleOrdinal<string, string>>\n}\n\ninterface CategoryTicksProps {\n ticks: BarChartCategory[]\n xScale: ReturnType<typeof scaleBand<BarChartCategory>>\n height: number\n formatCategory: (category: BarChartCategory) => string\n}\n\nconst PADDING_TOP = 20\nconst PADDING_BOTTOM = 28\nconst HOVER_FADE_MS = 200\nconst FOCUS_TRANSITION_MS = 180\nconst DEFAULT_HEIGHT = 220\nconst BAR_RADIUS = 2\nconst Y_AXIS_GUTTER = 34\n\nfunction buildYAxisTicks(yMax: number) {\n const steps = 4\n const rawStep = yMax / steps\n const normalized = rawStep === 0 ? 1 : rawStep\n const magnitude = Math.pow(10, Math.floor(Math.log10(normalized)))\n const niceSteps = [1, 2, 2.5, 5, 10]\n const step =\n (niceSteps.find((value) => value * magnitude >= normalized) ?? 10) *\n magnitude\n const upper = Math.ceil(yMax / step) * step\n const ticks: number[] = []\n\n for (let value = 0; value <= upper + step * 0.001; value += step) {\n ticks.push(Number(value.toFixed(6)))\n }\n\n return ticks\n}\n\nfunction formatYAxisTick(value: number) {\n return value >= 10\n ? integerFormat.format(value)\n : oneDecimalFormat.format(value)\n}\n\nfunction buildBarPath(\n x: number,\n y: number,\n width: number,\n height: number,\n radius: number,\n roundTop: boolean,\n roundBottom: boolean,\n) {\n const r = Math.max(0, Math.min(radius, width / 2, height / 2))\n\n if (r === 0 || (!roundTop && !roundBottom)) {\n return `M ${x} ${y} H ${x + width} V ${y + height} H ${x} Z`\n }\n\n const tl = roundTop ? r : 0\n const tr = roundTop ? r : 0\n const br = roundBottom ? r : 0\n const bl = roundBottom ? r : 0\n\n return [\n `M ${x + tl} ${y}`,\n `H ${x + width - tr}`,\n tr > 0\n ? `Q ${x + width} ${y} ${x + width} ${y + tr}`\n : `L ${x + width} ${y}`,\n `V ${y + height - br}`,\n br > 0\n ? `Q ${x + width} ${y + height} ${x + width - br} ${y + height}`\n : `L ${x + width} ${y + height}`,\n `H ${x + bl}`,\n bl > 0\n ? `Q ${x} ${y + height} ${x} ${y + height - bl}`\n : `L ${x} ${y + height}`,\n `V ${y + tl}`,\n tl > 0 ? `Q ${x} ${y} ${x + tl} ${y}` : `L ${x} ${y}`,\n 'Z',\n ].join(' ')\n}\n\nfunction BarStackLayer<TDatum>({\n stackData,\n series,\n seriesByKey,\n xScale,\n yScale,\n colorScale,\n}: BarStackLayerProps<TDatum>) {\n return (\n <BarStack<StackDatum, string>\n data={stackData}\n keys={series.map((entry) => entry.key)}\n x={(record) => record.__category}\n value={(record, key) => record.__values[key] ?? 0}\n xScale={xScale}\n yScale={yScale}\n color={colorScale}\n >\n {(barStacks) =>\n barStacks.map((barStack) =>\n barStack.bars.map((bar) => {\n const segmentValue = bar.bar.data.__values[barStack.key] ?? 0\n\n if (segmentValue === 0) {\n return null\n }\n\n const seriesEntry = seriesByKey.get(barStack.key)\n const strokeColor = seriesEntry?.color ?? bar.color\n const fillColor = strokeColor\n const valueKeys = series\n .map((entry) => entry.key)\n .filter((key) => (bar.bar.data.__values[key] ?? 0) > 0)\n const isBottomSegment = valueKeys[0] === barStack.key\n const isTopSegment =\n valueKeys[valueKeys.length - 1] === barStack.key\n\n return (\n <path\n key={`bar-${barStack.index}-${bar.index}`}\n d={buildBarPath(\n bar.x,\n bar.y,\n bar.width,\n Math.max(0, bar.height),\n BAR_RADIUS,\n isTopSegment,\n isBottomSegment,\n )}\n fill={fillColor}\n stroke={strokeColor}\n strokeWidth={1}\n style={{ transition: 'fill 180ms ease' }}\n />\n )\n }),\n )\n }\n </BarStack>\n )\n}\n\ninterface FocusBorderProps<TDatum> {\n category: BarChartCategory\n visible: boolean\n stackData: StackDatum[]\n series: BarChartSeries<TDatum>[]\n xScale: ReturnType<typeof scaleBand<BarChartCategory>>\n yScale: ReturnType<typeof scaleLinear<number>>\n}\n\nfunction FocusBorder<TDatum>({\n category,\n visible,\n stackData,\n series,\n xScale,\n yScale,\n}: FocusBorderProps<TDatum>) {\n const x = xScale(category)\n const datum = stackData.find((entry) => entry.__category === category)\n\n if (x === undefined || !datum) {\n return null\n }\n\n const hasAnyValue = series.some(\n (entry) => (datum.__values[entry.key] ?? 0) > 0,\n )\n\n if (!hasAnyValue) {\n return null\n }\n\n const topY = PADDING_TOP\n const baselineY = yScale(0)\n const borderPaddingX = 4\n const borderPaddingY = 3\n const borderXRaw = x - borderPaddingX\n const borderY = topY - borderPaddingY\n const borderWidthRaw = xScale.bandwidth() + borderPaddingX * 2\n const [rangeStart, rangeEnd] = xScale.range()\n const minX = Math.min(rangeStart, rangeEnd)\n const maxX = Math.max(rangeStart, rangeEnd)\n const borderX = Math.max(minX, borderXRaw)\n const borderRight = Math.min(maxX, borderXRaw + borderWidthRaw)\n const borderWidth = Math.max(0, borderRight - borderX)\n const borderHeight = Math.max(1, baselineY - topY + borderPaddingY * 2)\n\n if (borderWidth <= 0) {\n return null\n }\n\n return (\n <rect\n x={borderX}\n y={borderY}\n width={borderWidth}\n height={borderHeight}\n rx={6}\n fill=\"var(--spark-a2)\"\n stroke=\"var(--spark-a9)\"\n strokeWidth={2}\n pointerEvents=\"none\"\n style={{\n opacity: visible ? 1 : 0,\n 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`,\n }}\n />\n )\n}\n\ninterface InteractionLayerProps {\n xDomain: BarChartCategory[]\n activeCategories: Set<BarChartCategory>\n xScale: ReturnType<typeof scaleBand<BarChartCategory>>\n height: number\n onHoverChange: (category: BarChartCategory | null) => void\n}\n\nfunction InteractionLayer({\n xDomain,\n activeCategories,\n xScale,\n height,\n onHoverChange,\n}: InteractionLayerProps) {\n const bandwidth = xScale.bandwidth()\n const [rangeStart, rangeEnd] = xScale.range()\n const minX = Math.min(rangeStart, rangeEnd)\n const maxX = Math.max(rangeStart, rangeEnd)\n\n // A single overlay that maps the pointer to the nearest category with data,\n // so there are no dead zones between/around bars to break the hover.\n const handleMove = (\n event: React.MouseEvent<SVGRectElement> | React.TouchEvent<SVGRectElement>,\n ) => {\n const point = localPoint(event)\n if (!point) return\n\n let nearest: BarChartCategory | null = null\n let best = Infinity\n for (const category of xDomain) {\n if (!activeCategories.has(category)) continue\n const x = xScale(category)\n if (x === undefined) continue\n const distance = Math.abs(x + bandwidth / 2 - point.x)\n if (distance < best) {\n best = distance\n nearest = category\n }\n }\n\n if (nearest !== null) onHoverChange(nearest)\n }\n\n return (\n <rect\n x={minX}\n y={PADDING_TOP}\n width={Math.max(0, maxX - minX)}\n height={height - PADDING_TOP - PADDING_BOTTOM}\n fill=\"transparent\"\n onMouseMove={handleMove}\n onMouseLeave={() => onHoverChange(null)}\n onTouchMove={handleMove}\n onTouchEnd={() => onHoverChange(null)}\n />\n )\n}\n\nfunction CategoryTicks({\n ticks,\n xScale,\n height,\n formatCategory,\n}: CategoryTicksProps) {\n return (\n <>\n {ticks.map((category) => {\n const x = xScale(category)\n\n if (x === undefined) {\n return null\n }\n\n return (\n <text\n key={`tick-${String(category)}`}\n x={x + xScale.bandwidth() / 2}\n y={height - PADDING_BOTTOM + 16}\n textAnchor=\"middle\"\n fill=\"var(--gray-a11)\"\n fontSize={10}\n >\n {formatCategory(category)}\n </text>\n )\n })}\n </>\n )\n}\n\nfunction defaultFormatTotal(value: number) {\n return defaultTotalFormat.format(value)\n}\n\nexport function BarChart<TDatum>({\n data,\n series,\n lines,\n getCategory,\n categories,\n categoryTicks,\n formatCategory = (category) => String(category),\n formatTooltipCategory = formatCategory,\n highlightedCategory,\n showHighlightLine = false,\n referenceLine,\n title,\n yAxisUnit,\n height = DEFAULT_HEIGHT,\n renderTotal,\n formatTotal = defaultFormatTotal,\n formatValue,\n className,\n}: BarChartProps<TDatum>): React.ReactElement {\n const containerRef = useRef<HTMLDivElement>(null)\n const [width, setWidth] = useState(0)\n const [hoveredCategory, setHoveredCategory] =\n useState<BarChartCategory | null>(null)\n const [trailingHoverLabel, setTrailingHoverLabel] = useState<string | null>(\n null,\n )\n const [hiddenSeries, setHiddenSeries] = useState<ReadonlySet<string>>(\n () =>\n new Set(\n (lines ?? [])\n .filter((line) => line.hiddenByDefault)\n .map((line) => line.key),\n ),\n )\n\n const toggleSeries = useCallback((id: string) => {\n setHiddenSeries((prev) => {\n const next = new Set(prev)\n if (next.has(id)) {\n next.delete(id)\n } else {\n next.add(id)\n }\n return next\n })\n }, [])\n\n useEffect(() => {\n const element = containerRef.current\n\n if (!element) {\n return\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0]\n\n if (!entry) {\n return\n }\n\n setWidth(entry.contentRect.width)\n })\n\n resizeObserver.observe(element)\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [])\n\n const seriesByKey = useMemo(() => {\n const map = new Map<string, BarChartSeries<TDatum>>()\n\n for (const entry of series) {\n map.set(entry.key, entry)\n }\n\n return map\n }, [series])\n\n const stackData = useMemo<StackDatum[]>(\n () =>\n data.map((datum) => {\n const values: Record<string, number> = {}\n\n for (const entry of series) {\n values[entry.key] = hiddenSeries.has(entry.key)\n ? 0\n : entry.getValue(datum)\n }\n\n return { __category: getCategory(datum), __values: values }\n }),\n [data, getCategory, series, hiddenSeries],\n )\n\n const yMax = useMemo(\n () =>\n Math.max(\n 1,\n referenceLine?.value ?? 0,\n ...stackData.map((record) =>\n series.reduce(\n (sum, entry) => sum + (record.__values[entry.key] ?? 0),\n 0,\n ),\n ),\n ),\n [referenceLine, series, stackData],\n )\n\n const xDomain = useMemo(\n () => categories ?? stackData.map((record) => record.__category),\n [categories, stackData],\n )\n\n const xScale = useMemo(\n () =>\n scaleBand<BarChartCategory>({\n domain: xDomain,\n range: [Y_AXIS_GUTTER, Math.max(Y_AXIS_GUTTER, width)],\n padding: 0.32,\n }),\n [xDomain, width],\n )\n\n const yScale = useMemo(\n () =>\n scaleLinear<number>({\n domain: [0, yMax],\n range: [height - PADDING_BOTTOM, PADDING_TOP],\n }),\n [height, yMax],\n )\n\n const colorScale = useMemo(\n () =>\n scaleOrdinal<string, string>({\n domain: series.map((entry) => entry.key),\n range: series.map((entry) => entry.color),\n }),\n [series],\n )\n\n const linePaths = useMemo(() => {\n if (!lines || width === 0) {\n return []\n }\n\n return lines\n .filter((line) => !hiddenSeries.has(line.key))\n .map((line) => {\n const lineScale = line.domain\n ? scaleLinear<number>({\n domain: line.domain,\n range: [height - PADDING_BOTTOM, PADDING_TOP],\n })\n : yScale\n const segments: string[] = []\n let previous: { x: number; y: number } | null = null\n\n for (const datum of data) {\n const x = xScale(getCategory(datum))\n const value = line.getValue(datum)\n\n if (x === undefined || value === null || !Number.isFinite(value)) {\n previous = null\n continue\n }\n\n const point = {\n x: x + xScale.bandwidth() / 2,\n y: lineScale(value),\n }\n segments.push(\n previous === null\n ? `M ${point.x} ${point.y}`\n : `L ${point.x} ${point.y}`,\n )\n previous = point\n }\n\n return {\n key: line.key,\n d: segments.join(' '),\n color: line.color,\n strokeDasharray: line.strokeDasharray ?? '5 4',\n }\n })\n .filter((path) => path.d !== '')\n }, [lines, hiddenSeries, data, getCategory, xScale, yScale, height, width])\n\n const stackCategorySet = useMemo(\n () => new Set(stackData.map((record) => record.__category)),\n [stackData],\n )\n\n const lastFocusCategoryRef = useRef<BarChartCategory | null>(null)\n if (hoveredCategory !== null) {\n lastFocusCategoryRef.current = hoveredCategory\n }\n const focusCategory = lastFocusCategoryRef.current\n\n const focused = useMemo(\n () =>\n hoveredCategory === null\n ? null\n : (stackData.find((record) => record.__category === hoveredCategory) ??\n null),\n [hoveredCategory, stackData],\n )\n\n const totalValue = useMemo(() => {\n if (focused) {\n return series.reduce(\n (sum, entry) => sum + (focused.__values[entry.key] ?? 0),\n 0,\n )\n }\n\n return stackData.reduce(\n (sum, record) =>\n sum +\n series.reduce((s, entry) => s + (record.__values[entry.key] ?? 0), 0),\n 0,\n )\n }, [focused, series, stackData])\n\n const hoverLabel = focused ? formatTooltipCategory(focused.__category) : null\n\n useEffect(() => {\n if (hoverLabel) {\n setTrailingHoverLabel(hoverLabel)\n return\n }\n\n const timeoutId = window.setTimeout(() => {\n setTrailingHoverLabel(null)\n }, HOVER_FADE_MS)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [hoverLabel])\n\n const ticks = categoryTicks ?? xDomain\n const yTicks = useMemo(() => buildYAxisTicks(yMax), [yMax])\n const highlightX = useMemo(() => {\n if (!showHighlightLine || highlightedCategory === undefined) {\n return null\n }\n\n const x = xScale(highlightedCategory)\n\n if (x === undefined) {\n return null\n }\n\n return x + xScale.bandwidth() / 2\n }, [highlightedCategory, showHighlightLine, xScale])\n\n const focusedDatum = useMemo(\n () =>\n hoveredCategory === null\n ? null\n : (data.find((datum) => getCategory(datum) === hoveredCategory) ??\n null),\n [hoveredCategory, data, getCategory],\n )\n\n const fmtTooltipValue = formatValue ?? formatTotal\n const tooltipRows: ChartTooltipRow[] = focused\n ? [\n ...series\n .filter((entry) => (focused.__values[entry.key] ?? 0) > 0)\n .map((entry) => ({\n key: entry.key,\n label: entry.label,\n color: entry.color,\n value: fmtTooltipValue(focused.__values[entry.key] ?? 0),\n })),\n ...(lines ?? [])\n .filter((line) => !hiddenSeries.has(line.key))\n .flatMap((line) => {\n const value =\n focusedDatum === null ? null : line.getValue(focusedDatum)\n\n if (value === null || !Number.isFinite(value)) {\n return []\n }\n\n return [\n {\n key: line.key,\n label: line.label,\n color: line.color,\n value: (line.formatValue ?? fmtTooltipValue)(value),\n },\n ]\n }),\n ]\n : []\n const tooltipActive = tooltipRows.length > 0\n const anchorX =\n focusCategory !== null\n ? (xScale(focusCategory) ?? 0) + xScale.bandwidth() / 2\n : 0\n const anchorY = yScale(totalValue)\n const [tooltipRef, tooltipSize] = useMeasuredSize<HTMLDivElement>()\n const tooltipPos = clampTooltipPosition({\n anchorX,\n anchorY,\n width,\n height,\n tipWidth: tooltipSize.width,\n tipHeight: tooltipSize.height,\n })\n\n return (\n <div className={cn('flex w-full flex-col', className)}>\n <div className=\"flex items-baseline justify-between\">\n {title && <SectionTitle>{title}</SectionTitle>}\n <span className=\"tabular-nums\">\n {renderTotal ? (\n renderTotal(totalValue)\n ) : (\n <span className=\"text-base font-bold text-gray tabular-nums\">\n {formatTotal(totalValue)}\n </span>\n )}\n </span>\n </div>\n\n <div className=\"flex min-h-5 items-baseline justify-between gap-4\">\n <SeriesLegend\n items={[\n ...series.map((entry) => ({\n id: entry.key,\n label: entry.label,\n color: entry.color,\n })),\n ...(lines ?? []).map((line) => ({\n id: line.key,\n label: line.label,\n color: line.color,\n marker: 'dashed-line' as const,\n })),\n ]}\n hiddenIds={hiddenSeries}\n onToggle={toggleSeries}\n className=\"gap-y-1\"\n />\n <span\n className={cn(\n 'text-xs text-gray-light transition-opacity duration-200',\n hoverLabel ? 'opacity-100' : 'opacity-0',\n )}\n >\n {trailingHoverLabel ?? ' '}\n </span>\n </div>\n\n <div\n ref={containerRef}\n className=\"relative mt-2 w-full\"\n style={{ height }}\n >\n <div\n ref={tooltipRef}\n className=\"pointer-events-none absolute z-10\"\n style={{\n left: tooltipPos.left,\n top: tooltipPos.top,\n opacity: tooltipActive ? 1 : 0,\n transition:\n 'left 140ms ease-out, top 140ms ease-out, opacity 140ms ease-out',\n }}\n >\n {focusCategory !== null && (\n <ChartTooltipCard\n label={formatTooltipCategory(focusCategory)}\n rows={tooltipRows}\n />\n )}\n </div>\n {width > 0 && (\n <svg width={width} height={height}>\n <line\n x1={Y_AXIS_GUTTER}\n x2={Y_AXIS_GUTTER}\n y1={PADDING_TOP}\n y2={yScale(0)}\n stroke=\"var(--gray-a6)\"\n strokeWidth={1}\n />\n\n {yTicks.map((tick, index) => {\n const y = yScale(tick)\n const hideTickLabel =\n yAxisUnit !== undefined && index === yTicks.length - 1\n\n return (\n <g key={`y-tick-${tick}`}>\n {!hideTickLabel && (\n <line\n x1={Y_AXIS_GUTTER - 4}\n x2={Y_AXIS_GUTTER}\n y1={y}\n y2={y}\n stroke=\"var(--gray-a8)\"\n strokeWidth={1}\n />\n )}\n {!hideTickLabel && (\n <text\n x={Y_AXIS_GUTTER - 7}\n y={y + 3}\n textAnchor=\"end\"\n fill=\"var(--gray-a11)\"\n fontSize={10}\n >\n {formatYAxisTick(tick)}\n </text>\n )}\n </g>\n )\n })}\n\n {yAxisUnit && (\n <text\n x={0}\n y={PADDING_TOP - 6}\n textAnchor=\"start\"\n fill=\"var(--gray-a11)\"\n fontSize={10}\n fontWeight={600}\n >\n {yAxisUnit}\n </text>\n )}\n\n {highlightX !== null && (\n <line\n x1={highlightX}\n x2={highlightX}\n y1={PADDING_TOP}\n y2={yScale(0)}\n stroke=\"var(--spark-a9)\"\n strokeWidth={1.5}\n strokeDasharray=\"5 4\"\n pointerEvents=\"none\"\n />\n )}\n\n <line\n x1={Y_AXIS_GUTTER}\n x2={width}\n y1={yScale(0)}\n y2={yScale(0)}\n stroke=\"var(--gray-a5)\"\n strokeWidth={1}\n />\n\n <Group>\n {focusCategory !== null && (\n <FocusBorder\n category={focusCategory}\n visible={hoveredCategory !== null}\n stackData={stackData}\n series={series}\n xScale={xScale}\n yScale={yScale}\n />\n )}\n <BarStackLayer\n stackData={stackData}\n series={series}\n seriesByKey={seriesByKey}\n xScale={xScale}\n yScale={yScale}\n colorScale={colorScale}\n />\n\n {referenceLine && (\n <line\n x1={Y_AXIS_GUTTER}\n x2={width}\n y1={yScale(referenceLine.value)}\n y2={yScale(referenceLine.value)}\n stroke={referenceLine.color ?? 'var(--gray-a11)'}\n strokeWidth={1.5}\n pointerEvents=\"none\"\n />\n )}\n\n {linePaths.map((path) => (\n <path\n key={`line-${path.key}`}\n d={path.d}\n fill=\"none\"\n stroke={path.color}\n strokeWidth={1.5}\n strokeDasharray={path.strokeDasharray}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n pointerEvents=\"none\"\n />\n ))}\n </Group>\n\n <InteractionLayer\n xDomain={xDomain}\n activeCategories={stackCategorySet}\n xScale={xScale}\n height={height}\n onHoverChange={setHoveredCategory}\n />\n\n <CategoryTicks\n ticks={ticks}\n xScale={xScale}\n height={height}\n formatCategory={formatCategory}\n />\n </svg>\n )}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,qBAAqB,oBAAoB;AAgF/C,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AACvB,MAAM,aAAa;AACnB,MAAM,gBAAgB;AAEtB,SAAS,gBAAgB,MAAc;CAErC,MAAM,UAAU,OAAO;CACvB,MAAM,aAAa,YAAY,IAAI,IAAI;CACvC,MAAM,YAAY,KAAK,IAAI,IAAI,KAAK,MAAM,KAAK,MAAM,WAAW,CAAC,CAAC;CAElE,MAAM,QACH;EAFgB;EAAG;EAAG;EAAK;EAAG;EAErB,CAAC,MAAM,UAAU,QAAQ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oBAAC,kBAAD;OACW;OACT,kBAAkB;OACV;OACA;OACR,eAAe;OACf,CAAA;MAEF,oBAAC,eAAD;OACS;OACC;OACA;OACQ;OAChB,CAAA;MACE;OAEJ;;GACF"}
@@ -0,0 +1,140 @@
1
+ "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("../chunk-aJGBMT86.cjs");
4
+ const require_icons_material_symbol = require("../icons/material-symbol.cjs");
5
+ const require_components_badge = require("./badge.cjs");
6
+ const require_components_progress = require("./progress.cjs");
7
+ let react = require("react");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let class_variance_authority = require("class-variance-authority");
10
+ let cnfast = require("cnfast");
11
+ //#region src/components/battery-progress-row.tsx
12
+ const BatteryProgressRowContext = (0, react.createContext)(null);
13
+ function useBatteryProgressRowContext() {
14
+ const context = (0, react.useContext)(BatteryProgressRowContext);
15
+ if (!context) throw new Error("BatteryProgressRow.* must be rendered inside <BatteryProgressRow>");
16
+ return context;
17
+ }
18
+ const BatteryProgressRow = ({ className, soc, children, ...rest }) => {
19
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BatteryProgressRowContext.Provider, {
20
+ value: { soc },
21
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
22
+ className: (0, cnfast.cn)("flex items-center gap-3", className),
23
+ ...rest,
24
+ children
25
+ })
26
+ });
27
+ };
28
+ /**
29
+ * Battery icon. Auto-selects its variant from the row's `soc`.
30
+ *
31
+ * @param className - Optional className to apply to the icon to further style it
32
+ * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
33
+ * @param ...rest - Additional props to pass to the span
34
+ * @returns A React component that renders a battery icon
35
+ */
36
+ const BatteryProgressRowIcon = ({ className, icon: overrideIcon, ...rest }) => {
37
+ const { soc } = useBatteryProgressRowContext();
38
+ const clampedSoc = Math.min(Math.max(soc, 0), 100);
39
+ const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6);
40
+ const iconName = clampedSoc === 100 ? "battery_full" : `battery_${batteryLevel}_bar`;
41
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
42
+ className: (0, cnfast.cn)("flex size-10 shrink-0 items-center justify-center rounded-xl bg-base-success-soft text-success", className),
43
+ ...rest,
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_material_symbol.MaterialSymbol, {
45
+ className: "text-[18px]",
46
+ name: overrideIcon ?? iconName
47
+ })
48
+ });
49
+ };
50
+ const BatteryProgressRowContent = ({ className, ...rest }) => {
51
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
52
+ className: (0, cnfast.cn)("flex min-w-0 flex-1 flex-col gap-1.5", className),
53
+ ...rest
54
+ });
55
+ };
56
+ const BatteryProgressRowHeader = ({ className, ...rest }) => {
57
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
58
+ className: (0, cnfast.cn)("flex items-center justify-between gap-2", className),
59
+ ...rest
60
+ });
61
+ };
62
+ const stateBadgeToneVariants = (0, class_variance_authority.cva)("w-fit", {
63
+ variants: { tone: {
64
+ success: "bg-base-success-soft text-success",
65
+ warning: "bg-base-warning-soft text-warning",
66
+ error: "bg-base-error-soft text-error",
67
+ accent: "bg-base-accent-soft text-accent",
68
+ neutral: "bg-base-gray-soft text-gray-light"
69
+ } },
70
+ defaultVariants: { tone: "neutral" }
71
+ });
72
+ const BatteryProgressRowStateBadge = ({ className, children, tone, ...rest }) => {
73
+ if (children === null || children === void 0) return null;
74
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_badge.Badge, {
75
+ className: stateBadgeToneVariants({
76
+ tone,
77
+ className
78
+ }),
79
+ ...rest,
80
+ children
81
+ });
82
+ };
83
+ const BatteryProgressRowChargingPower = ({ className, children, ...rest }) => {
84
+ if (children === null || children === void 0) return null;
85
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
86
+ className: (0, cnfast.cn)("ml-auto text-lg leading-tight font-bold text-gray tabular-nums", className),
87
+ ...rest,
88
+ children
89
+ });
90
+ };
91
+ /**
92
+ * Linear progress bar bound to the row's `soc`.
93
+ */
94
+ const BatteryProgressRowProgressBar = ({ className, ...rest }) => {
95
+ const { soc } = useBatteryProgressRowContext();
96
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_progress.Progress, {
97
+ className,
98
+ max: 100,
99
+ value: soc,
100
+ ...rest
101
+ });
102
+ };
103
+ const BatteryProgressRowFooter = ({ className, ...rest }) => {
104
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
105
+ className: (0, cnfast.cn)("flex justify-between text-xs text-gray-light tabular-nums", className),
106
+ ...rest
107
+ });
108
+ };
109
+ const BatteryProgressRowMinSoc = ({ className, children, ...rest }) => {
110
+ if (children === null || children === void 0) return null;
111
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
112
+ className: (0, cnfast.cn)(className),
113
+ ...rest,
114
+ children
115
+ });
116
+ };
117
+ /**
118
+ * Current state-of-charge label, rendered as `{soc}%`. Reads from context.
119
+ */
120
+ const BatteryProgressRowSoc = ({ className, ...rest }) => {
121
+ const { soc } = useBatteryProgressRowContext();
122
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
123
+ className: (0, cnfast.cn)(className),
124
+ ...rest,
125
+ children: `${soc}%`
126
+ });
127
+ };
128
+ //#endregion
129
+ exports.BatteryProgressRow = BatteryProgressRow;
130
+ exports.BatteryProgressRowChargingPower = BatteryProgressRowChargingPower;
131
+ exports.BatteryProgressRowContent = BatteryProgressRowContent;
132
+ exports.BatteryProgressRowFooter = BatteryProgressRowFooter;
133
+ exports.BatteryProgressRowHeader = BatteryProgressRowHeader;
134
+ exports.BatteryProgressRowIcon = BatteryProgressRowIcon;
135
+ exports.BatteryProgressRowMinSoc = BatteryProgressRowMinSoc;
136
+ exports.BatteryProgressRowProgressBar = BatteryProgressRowProgressBar;
137
+ exports.BatteryProgressRowSoc = BatteryProgressRowSoc;
138
+ exports.BatteryProgressRowStateBadge = BatteryProgressRowStateBadge;
139
+
140
+ //# sourceMappingURL=battery-progress-row.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"battery-progress-row.cjs","names":["MaterialSymbol","Badge","Progress"],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport { createContext, useContext } from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Badge } from './badge'\nimport { Progress } from './progress'\n\ninterface BatteryProgressRowContextValue {\n soc: number\n}\n\nconst BatteryProgressRowContext =\n createContext<BatteryProgressRowContextValue | null>(null)\n\nfunction useBatteryProgressRowContext() {\n const context = useContext(BatteryProgressRowContext)\n if (!context) {\n throw new Error(\n 'BatteryProgressRow.* must be rendered inside <BatteryProgressRow>',\n )\n }\n return context\n}\n\nconst BatteryProgressRow = ({\n className,\n soc,\n children,\n ...rest\n}: React.ComponentProps<'div'> & { soc: number }) => {\n return (\n <BatteryProgressRowContext.Provider value={{ soc }}>\n <div className={cn('flex items-center gap-3', className)} {...rest}>\n {children}\n </div>\n </BatteryProgressRowContext.Provider>\n )\n}\n\n/**\n * Battery icon. Auto-selects its variant from the row's `soc`.\n *\n * @param className - Optional className to apply to the icon to further style it\n * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)\n * @param ...rest - Additional props to pass to the span\n * @returns A React component that renders a battery icon\n */\nconst BatteryProgressRowIcon = ({\n className,\n icon: overrideIcon,\n ...rest\n}: React.ComponentProps<'span'> & { icon?: MaterialSymbolIconName }) => {\n const { soc } = useBatteryProgressRowContext()\n const clampedSoc = Math.min(Math.max(soc, 0), 100)\n const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6)\n const iconName: MaterialSymbolIconName =\n clampedSoc === 100\n ? 'battery_full'\n : (`battery_${batteryLevel}_bar` as MaterialSymbolIconName)\n\n return (\n <span\n className={cn(\n 'flex size-10 shrink-0 items-center justify-center rounded-xl bg-base-success-soft text-success',\n className,\n )}\n {...rest}\n >\n <MaterialSymbol className=\"text-[18px]\" name={overrideIcon ?? iconName} />\n </span>\n )\n}\n\nconst BatteryProgressRowContent = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1.5', className)}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n {...rest}\n />\n )\n}\n\nconst stateBadgeToneVariants = cva('w-fit', {\n variants: {\n tone: {\n success: 'bg-base-success-soft text-success',\n warning: 'bg-base-warning-soft text-warning',\n error: 'bg-base-error-soft text-error',\n accent: 'bg-base-accent-soft text-accent',\n neutral: 'bg-base-gray-soft text-gray-light',\n },\n },\n defaultVariants: {\n tone: 'neutral',\n },\n})\n\nconst BatteryProgressRowStateBadge = ({\n className,\n children,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => {\n if (children === null || children === undefined) return null\n return (\n <Badge className={stateBadgeToneVariants({ tone, className })} {...rest}>\n {children}\n </Badge>\n )\n}\n\nconst BatteryProgressRowChargingPower = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span\n className={cn(\n 'ml-auto text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n >\n {children}\n </span>\n )\n}\n\n/**\n * Linear progress bar bound to the row's `soc`.\n */\nconst BatteryProgressRowProgressBar = ({\n className,\n ...rest\n}: Omit<React.ComponentProps<typeof Progress>, 'value' | 'max'>) => {\n const { soc } = useBatteryProgressRowContext()\n return <Progress className={className} max={100} value={soc} {...rest} />\n}\n\nconst BatteryProgressRowFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex justify-between text-xs text-gray-light tabular-nums',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowMinSoc = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span className={cn(className)} {...rest}>\n {children}\n </span>\n )\n}\n\n/**\n * Current state-of-charge label, rendered as `{soc}%`. Reads from context.\n */\nconst BatteryProgressRowSoc = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n const { soc } = useBatteryProgressRowContext()\n return (\n <span className={cn(className)} {...rest}>\n {`${soc}%`}\n </span>\n )\n}\n\nexport {\n BatteryProgressRow,\n BatteryProgressRowIcon,\n BatteryProgressRowContent,\n BatteryProgressRowHeader,\n BatteryProgressRowStateBadge,\n BatteryProgressRowChargingPower,\n BatteryProgressRowProgressBar,\n BatteryProgressRowFooter,\n BatteryProgressRowMinSoc,\n BatteryProgressRowSoc,\n}\n"],"mappings":";;;;;;;;;;;AAeA,MAAM,6BAAA,GAAA,MAAA,eACiD,KAAK;AAE5D,SAAS,+BAA+B;CACtC,MAAM,WAAA,GAAA,MAAA,YAAqB,0BAA0B;AACrD,KAAI,CAAC,QACH,OAAM,IAAI,MACR,oEACD;AAEH,QAAO;;AAGT,MAAM,sBAAsB,EAC1B,WACA,KACA,UACA,GAAG,WACgD;AACnD,QACE,iBAAA,GAAA,kBAAA,KAAC,0BAA0B,UAA3B;EAAoC,OAAO,EAAE,KAAK;YAChD,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,YAAA,GAAA,OAAA,IAAc,2BAA2B,UAAU;GAAE,GAAI;GAC3D;GACG,CAAA;EAC6B,CAAA;;;;;;;;;;AAYzC,MAAM,0BAA0B,EAC9B,WACA,MAAM,cACN,GAAG,WACmE;CACtE,MAAM,EAAE,QAAQ,8BAA8B;CAC9C,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,EAAE,IAAI;CAClD,MAAM,eAAe,KAAK,IAAI,KA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iCAAiC,EACrC,WACA,GAAG,WAC+D;CAClE,MAAM,EAAE,QAAQ,8BAA8B;AAC9C,QAAO,iBAAA,GAAA,kBAAA,KAACC,4BAAAA,UAAD;EAAqB;EAAW,KAAK;EAAK,OAAO;EAAK,GAAI;EAAQ,CAAA;;AAG3E,MAAM,4BAA4B,EAChC,WACA,GAAG,WAC8B;AACjC,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,YAAA,GAAA,OAAA,IACE,6DACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,4BAA4B,EAChC,WACA,UACA,GAAG,WAC+B;AAClC,KAAI,aAAa,QAAQ,aAAa,KAAA,EAAW,QAAO;AACxD,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;EACjC;EACI,CAAA;;;;;AAOX,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC+B;CAClC,MAAM,EAAE,QAAQ,8BAA8B;AAC9C,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;YACjC,GAAG,IAAI;EACH,CAAA"}
@@ -0,0 +1,78 @@
1
+ "use client";
2
+
3
+ import { MaterialSymbolIconName } from "../icons/material-symbol.cjs";
4
+ import { t as Tone } from "../tones-DjgKOX3s.cjs";
5
+ import { Progress } from "./progress.cjs";
6
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
+
8
+ //#region src/components/battery-progress-row.d.ts
9
+ declare const BatteryProgressRow: ({
10
+ className,
11
+ soc,
12
+ children,
13
+ ...rest
14
+ }: React.ComponentProps<"div"> & {
15
+ soc: number;
16
+ }) => _$react_jsx_runtime0.JSX.Element;
17
+ /**
18
+ * Battery icon. Auto-selects its variant from the row's `soc`.
19
+ *
20
+ * @param className - Optional className to apply to the icon to further style it
21
+ * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
22
+ * @param ...rest - Additional props to pass to the span
23
+ * @returns A React component that renders a battery icon
24
+ */
25
+ declare const BatteryProgressRowIcon: ({
26
+ className,
27
+ icon: overrideIcon,
28
+ ...rest
29
+ }: React.ComponentProps<"span"> & {
30
+ icon?: MaterialSymbolIconName;
31
+ }) => _$react_jsx_runtime0.JSX.Element;
32
+ declare const BatteryProgressRowContent: ({
33
+ className,
34
+ ...rest
35
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
36
+ declare const BatteryProgressRowHeader: ({
37
+ className,
38
+ ...rest
39
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
40
+ declare const BatteryProgressRowStateBadge: ({
41
+ className,
42
+ children,
43
+ tone,
44
+ ...rest
45
+ }: React.ComponentProps<"span"> & {
46
+ tone?: Tone;
47
+ }) => _$react_jsx_runtime0.JSX.Element | null;
48
+ declare const BatteryProgressRowChargingPower: ({
49
+ className,
50
+ children,
51
+ ...rest
52
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element | null;
53
+ /**
54
+ * Linear progress bar bound to the row's `soc`.
55
+ */
56
+ declare const BatteryProgressRowProgressBar: ({
57
+ className,
58
+ ...rest
59
+ }: Omit<React.ComponentProps<typeof Progress>, "value" | "max">) => _$react_jsx_runtime0.JSX.Element;
60
+ declare const BatteryProgressRowFooter: ({
61
+ className,
62
+ ...rest
63
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
64
+ declare const BatteryProgressRowMinSoc: ({
65
+ className,
66
+ children,
67
+ ...rest
68
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element | null;
69
+ /**
70
+ * Current state-of-charge label, rendered as `{soc}%`. Reads from context.
71
+ */
72
+ declare const BatteryProgressRowSoc: ({
73
+ className,
74
+ ...rest
75
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element;
76
+ //#endregion
77
+ export { BatteryProgressRow, BatteryProgressRowChargingPower, BatteryProgressRowContent, BatteryProgressRowFooter, BatteryProgressRowHeader, BatteryProgressRowIcon, BatteryProgressRowMinSoc, BatteryProgressRowProgressBar, BatteryProgressRowSoc, BatteryProgressRowStateBadge };
78
+ //# sourceMappingURL=battery-progress-row.d.cts.map
@@ -0,0 +1,78 @@
1
+ "use client";
2
+
3
+ import { MaterialSymbolIconName } from "../icons/material-symbol.js";
4
+ import { t as Tone } from "../tones-DyCkL71h.js";
5
+ import { Progress } from "./progress.js";
6
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
+
8
+ //#region src/components/battery-progress-row.d.ts
9
+ declare const BatteryProgressRow: ({
10
+ className,
11
+ soc,
12
+ children,
13
+ ...rest
14
+ }: React.ComponentProps<"div"> & {
15
+ soc: number;
16
+ }) => _$react_jsx_runtime0.JSX.Element;
17
+ /**
18
+ * Battery icon. Auto-selects its variant from the row's `soc`.
19
+ *
20
+ * @param className - Optional className to apply to the icon to further style it
21
+ * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
22
+ * @param ...rest - Additional props to pass to the span
23
+ * @returns A React component that renders a battery icon
24
+ */
25
+ declare const BatteryProgressRowIcon: ({
26
+ className,
27
+ icon: overrideIcon,
28
+ ...rest
29
+ }: React.ComponentProps<"span"> & {
30
+ icon?: MaterialSymbolIconName;
31
+ }) => _$react_jsx_runtime0.JSX.Element;
32
+ declare const BatteryProgressRowContent: ({
33
+ className,
34
+ ...rest
35
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
36
+ declare const BatteryProgressRowHeader: ({
37
+ className,
38
+ ...rest
39
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
40
+ declare const BatteryProgressRowStateBadge: ({
41
+ className,
42
+ children,
43
+ tone,
44
+ ...rest
45
+ }: React.ComponentProps<"span"> & {
46
+ tone?: Tone;
47
+ }) => _$react_jsx_runtime0.JSX.Element | null;
48
+ declare const BatteryProgressRowChargingPower: ({
49
+ className,
50
+ children,
51
+ ...rest
52
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element | null;
53
+ /**
54
+ * Linear progress bar bound to the row's `soc`.
55
+ */
56
+ declare const BatteryProgressRowProgressBar: ({
57
+ className,
58
+ ...rest
59
+ }: Omit<React.ComponentProps<typeof Progress>, "value" | "max">) => _$react_jsx_runtime0.JSX.Element;
60
+ declare const BatteryProgressRowFooter: ({
61
+ className,
62
+ ...rest
63
+ }: React.ComponentProps<"div">) => _$react_jsx_runtime0.JSX.Element;
64
+ declare const BatteryProgressRowMinSoc: ({
65
+ className,
66
+ children,
67
+ ...rest
68
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element | null;
69
+ /**
70
+ * Current state-of-charge label, rendered as `{soc}%`. Reads from context.
71
+ */
72
+ declare const BatteryProgressRowSoc: ({
73
+ className,
74
+ ...rest
75
+ }: React.ComponentProps<"span">) => _$react_jsx_runtime0.JSX.Element;
76
+ //#endregion
77
+ export { BatteryProgressRow, BatteryProgressRowChargingPower, BatteryProgressRowContent, BatteryProgressRowFooter, BatteryProgressRowHeader, BatteryProgressRowIcon, BatteryProgressRowMinSoc, BatteryProgressRowProgressBar, BatteryProgressRowSoc, BatteryProgressRowStateBadge };
78
+ //# sourceMappingURL=battery-progress-row.d.ts.map
@@ -0,0 +1,129 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { MaterialSymbol } from "../icons/material-symbol.js";
4
+ import { Badge } from "./badge.js";
5
+ import { Progress } from "./progress.js";
6
+ import { createContext, useContext } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { cva } from "class-variance-authority";
9
+ //#region src/components/battery-progress-row.tsx
10
+ const BatteryProgressRowContext = createContext(null);
11
+ function useBatteryProgressRowContext() {
12
+ const context = useContext(BatteryProgressRowContext);
13
+ if (!context) throw new Error("BatteryProgressRow.* must be rendered inside <BatteryProgressRow>");
14
+ return context;
15
+ }
16
+ const BatteryProgressRow = ({ className, soc, children, ...rest }) => {
17
+ return /* @__PURE__ */ jsx(BatteryProgressRowContext.Provider, {
18
+ value: { soc },
19
+ children: /* @__PURE__ */ jsx("div", {
20
+ className: cn("flex items-center gap-3", className),
21
+ ...rest,
22
+ children
23
+ })
24
+ });
25
+ };
26
+ /**
27
+ * Battery icon. Auto-selects its variant from the row's `soc`.
28
+ *
29
+ * @param className - Optional className to apply to the icon to further style it
30
+ * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)
31
+ * @param ...rest - Additional props to pass to the span
32
+ * @returns A React component that renders a battery icon
33
+ */
34
+ const BatteryProgressRowIcon = ({ className, icon: overrideIcon, ...rest }) => {
35
+ const { soc } = useBatteryProgressRowContext();
36
+ const clampedSoc = Math.min(Math.max(soc, 0), 100);
37
+ const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6);
38
+ const iconName = clampedSoc === 100 ? "battery_full" : `battery_${batteryLevel}_bar`;
39
+ return /* @__PURE__ */ jsx("span", {
40
+ className: cn("flex size-10 shrink-0 items-center justify-center rounded-xl bg-base-success-soft text-success", className),
41
+ ...rest,
42
+ children: /* @__PURE__ */ jsx(MaterialSymbol, {
43
+ className: "text-[18px]",
44
+ name: overrideIcon ?? iconName
45
+ })
46
+ });
47
+ };
48
+ const BatteryProgressRowContent = ({ className, ...rest }) => {
49
+ return /* @__PURE__ */ jsx("div", {
50
+ className: cn("flex min-w-0 flex-1 flex-col gap-1.5", className),
51
+ ...rest
52
+ });
53
+ };
54
+ const BatteryProgressRowHeader = ({ className, ...rest }) => {
55
+ return /* @__PURE__ */ jsx("div", {
56
+ className: cn("flex items-center justify-between gap-2", className),
57
+ ...rest
58
+ });
59
+ };
60
+ const stateBadgeToneVariants = cva("w-fit", {
61
+ variants: { tone: {
62
+ success: "bg-base-success-soft text-success",
63
+ warning: "bg-base-warning-soft text-warning",
64
+ error: "bg-base-error-soft text-error",
65
+ accent: "bg-base-accent-soft text-accent",
66
+ neutral: "bg-base-gray-soft text-gray-light"
67
+ } },
68
+ defaultVariants: { tone: "neutral" }
69
+ });
70
+ const BatteryProgressRowStateBadge = ({ className, children, tone, ...rest }) => {
71
+ if (children === null || children === void 0) return null;
72
+ return /* @__PURE__ */ jsx(Badge, {
73
+ className: stateBadgeToneVariants({
74
+ tone,
75
+ className
76
+ }),
77
+ ...rest,
78
+ children
79
+ });
80
+ };
81
+ const BatteryProgressRowChargingPower = ({ className, children, ...rest }) => {
82
+ if (children === null || children === void 0) return null;
83
+ return /* @__PURE__ */ jsx("span", {
84
+ className: cn("ml-auto text-lg leading-tight font-bold text-gray tabular-nums", className),
85
+ ...rest,
86
+ children
87
+ });
88
+ };
89
+ /**
90
+ * Linear progress bar bound to the row's `soc`.
91
+ */
92
+ const BatteryProgressRowProgressBar = ({ className, ...rest }) => {
93
+ const { soc } = useBatteryProgressRowContext();
94
+ return /* @__PURE__ */ jsx(Progress, {
95
+ className,
96
+ max: 100,
97
+ value: soc,
98
+ ...rest
99
+ });
100
+ };
101
+ const BatteryProgressRowFooter = ({ className, ...rest }) => {
102
+ return /* @__PURE__ */ jsx("div", {
103
+ className: cn("flex justify-between text-xs text-gray-light tabular-nums", className),
104
+ ...rest
105
+ });
106
+ };
107
+ const BatteryProgressRowMinSoc = ({ className, children, ...rest }) => {
108
+ if (children === null || children === void 0) return null;
109
+ return /* @__PURE__ */ jsx("span", {
110
+ className: cn(className),
111
+ ...rest,
112
+ children
113
+ });
114
+ };
115
+ /**
116
+ * Current state-of-charge label, rendered as `{soc}%`. Reads from context.
117
+ */
118
+ const BatteryProgressRowSoc = ({ className, ...rest }) => {
119
+ const { soc } = useBatteryProgressRowContext();
120
+ return /* @__PURE__ */ jsx("span", {
121
+ className: cn(className),
122
+ ...rest,
123
+ children: `${soc}%`
124
+ });
125
+ };
126
+ //#endregion
127
+ export { BatteryProgressRow, BatteryProgressRowChargingPower, BatteryProgressRowContent, BatteryProgressRowFooter, BatteryProgressRowHeader, BatteryProgressRowIcon, BatteryProgressRowMinSoc, BatteryProgressRowProgressBar, BatteryProgressRowSoc, BatteryProgressRowStateBadge };
128
+
129
+ //# sourceMappingURL=battery-progress-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"battery-progress-row.js","names":[],"sources":["../../src/components/battery-progress-row.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport { createContext, useContext } from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Badge } from './badge'\nimport { Progress } from './progress'\n\ninterface BatteryProgressRowContextValue {\n soc: number\n}\n\nconst BatteryProgressRowContext =\n createContext<BatteryProgressRowContextValue | null>(null)\n\nfunction useBatteryProgressRowContext() {\n const context = useContext(BatteryProgressRowContext)\n if (!context) {\n throw new Error(\n 'BatteryProgressRow.* must be rendered inside <BatteryProgressRow>',\n )\n }\n return context\n}\n\nconst BatteryProgressRow = ({\n className,\n soc,\n children,\n ...rest\n}: React.ComponentProps<'div'> & { soc: number }) => {\n return (\n <BatteryProgressRowContext.Provider value={{ soc }}>\n <div className={cn('flex items-center gap-3', className)} {...rest}>\n {children}\n </div>\n </BatteryProgressRowContext.Provider>\n )\n}\n\n/**\n * Battery icon. Auto-selects its variant from the row's `soc`.\n *\n * @param className - Optional className to apply to the icon to further style it\n * @param icon - The icon to render (defaults to auto-selecting based on the row's `soc`)\n * @param ...rest - Additional props to pass to the span\n * @returns A React component that renders a battery icon\n */\nconst BatteryProgressRowIcon = ({\n className,\n icon: overrideIcon,\n ...rest\n}: React.ComponentProps<'span'> & { icon?: MaterialSymbolIconName }) => {\n const { soc } = useBatteryProgressRowContext()\n const clampedSoc = Math.min(Math.max(soc, 0), 100)\n const batteryLevel = Math.min(Math.floor(clampedSoc / (100 / 7)), 6)\n const iconName: MaterialSymbolIconName =\n clampedSoc === 100\n ? 'battery_full'\n : (`battery_${batteryLevel}_bar` as MaterialSymbolIconName)\n\n return (\n <span\n className={cn(\n 'flex size-10 shrink-0 items-center justify-center rounded-xl bg-base-success-soft text-success',\n className,\n )}\n {...rest}\n >\n <MaterialSymbol className=\"text-[18px]\" name={overrideIcon ?? iconName} />\n </span>\n )\n}\n\nconst BatteryProgressRowContent = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-1.5', className)}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n {...rest}\n />\n )\n}\n\nconst stateBadgeToneVariants = cva('w-fit', {\n variants: {\n tone: {\n success: 'bg-base-success-soft text-success',\n warning: 'bg-base-warning-soft text-warning',\n error: 'bg-base-error-soft text-error',\n accent: 'bg-base-accent-soft text-accent',\n neutral: 'bg-base-gray-soft text-gray-light',\n },\n },\n defaultVariants: {\n tone: 'neutral',\n },\n})\n\nconst BatteryProgressRowStateBadge = ({\n className,\n children,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => {\n if (children === null || children === undefined) return null\n return (\n <Badge className={stateBadgeToneVariants({ tone, className })} {...rest}>\n {children}\n </Badge>\n )\n}\n\nconst BatteryProgressRowChargingPower = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span\n className={cn(\n 'ml-auto text-lg leading-tight font-bold text-gray tabular-nums',\n className,\n )}\n {...rest}\n >\n {children}\n </span>\n )\n}\n\n/**\n * Linear progress bar bound to the row's `soc`.\n */\nconst BatteryProgressRowProgressBar = ({\n className,\n ...rest\n}: Omit<React.ComponentProps<typeof Progress>, 'value' | 'max'>) => {\n const { soc } = useBatteryProgressRowContext()\n return <Progress className={className} max={100} value={soc} {...rest} />\n}\n\nconst BatteryProgressRowFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex justify-between text-xs text-gray-light tabular-nums',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BatteryProgressRowMinSoc = ({\n className,\n children,\n ...rest\n}: React.ComponentProps<'span'>) => {\n if (children === null || children === undefined) return null\n return (\n <span className={cn(className)} {...rest}>\n {children}\n </span>\n )\n}\n\n/**\n * Current state-of-charge label, rendered as `{soc}%`. Reads from context.\n */\nconst BatteryProgressRowSoc = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n const { soc } = useBatteryProgressRowContext()\n return (\n <span className={cn(className)} {...rest}>\n {`${soc}%`}\n </span>\n )\n}\n\nexport {\n BatteryProgressRow,\n BatteryProgressRowIcon,\n BatteryProgressRowContent,\n BatteryProgressRowHeader,\n BatteryProgressRowStateBadge,\n BatteryProgressRowChargingPower,\n BatteryProgressRowProgressBar,\n BatteryProgressRowFooter,\n BatteryProgressRowMinSoc,\n BatteryProgressRowSoc,\n}\n"],"mappings":";;;;;;;;;AAeA,MAAM,4BACJ,cAAqD,KAAK;AAE5D,SAAS,+BAA+B;CACtC,MAAM,UAAU,WAAW,0BAA0B;AACrD,KAAI,CAAC,QACH,OAAM,IAAI,MACR,oEACD;AAEH,QAAO;;AAGT,MAAM,sBAAsB,EAC1B,WACA,KACA,UACA,GAAG,WACgD;AACnD,QACE,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO,EAAE,KAAK;YAChD,oBAAC,OAAD;GAAK,WAAW,GAAG,2BAA2B,UAAU;GAAE,GAAI;GAC3D;GACG,CAAA;EAC6B,CAAA;;;;;;;;;;AAYzC,MAAM,0BAA0B,EAC9B,WACA,MAAM,cACN,GAAG,WACmE;CACtE,MAAM,EAAE,QAAQ,8BAA8B;CAC9C,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,EAAE,IAAI;CAClD,MAAM,eAAe,KAAK,IAAI,KAAK,MAAM,cAAc,MAAM,GAAG,EAAE,EAAE;CACpE,MAAM,WACJ,eAAe,MACX,iBACC,WAAW,aAAa;AAE/B,QACE,oBAAC,QAAD;EACE,WAAW,GACT,kGACA,UACD;EACD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a,QAAQ,aAAa,KAAA,EAAW,QAAO;AACxD,QACE,oBAAC,QAAD;EAAM,WAAW,GAAG,UAAU;EAAE,GAAI;EACjC;EACI,CAAA;;;;;AAOX,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC+B;CAClC,MAAM,EAAE,QAAQ,8BAA8B;AAC9C,QACE,oBAAC,QAAD;EAAM,WAAW,GAAG,UAAU;EAAE,GAAI;YACjC,GAAG,IAAI;EACH,CAAA"}
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("../chunk-aJGBMT86.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ let _base_ui_react_merge_props = require("@base-ui/react/merge-props");
6
+ let _base_ui_react_use_render = require("@base-ui/react/use-render");
7
+ let cnfast = require("cnfast");
8
+ //#region src/components/breadcrumbs.tsx
9
+ const Breadcrumbs = ({ className, "aria-label": ariaLabel = "Breadcrumb", ...rest }) => {
10
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
11
+ "aria-label": ariaLabel,
12
+ className: (0, cnfast.cn)(className),
13
+ ...rest
14
+ });
15
+ };
16
+ const BreadcrumbsList = ({ className, ...rest }) => {
17
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
18
+ className: (0, cnfast.cn)("flex flex-wrap items-center gap-1.5 text-sm text-gray-light", className),
19
+ ...rest
20
+ });
21
+ };
22
+ const BreadcrumbsItem = ({ className, ...rest }) => {
23
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
24
+ className: (0, cnfast.cn)("flex items-center gap-1.5", className),
25
+ ...rest
26
+ });
27
+ };
28
+ /**
29
+ * Link inside a breadcrumb. Pass `render` to render any router-specific link
30
+ * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the
31
+ * breadcrumb link styling. Without `render` it renders as a plain anchor.
32
+ */
33
+ const BreadcrumbsLink = ({ className, render, ...rest }) => {
34
+ return (0, _base_ui_react_use_render.useRender)({
35
+ defaultTagName: "a",
36
+ render,
37
+ props: (0, _base_ui_react_merge_props.mergeProps)({ className: (0, cnfast.cn)("transition-colors hover:text-gray", className) }, rest)
38
+ });
39
+ };
40
+ /** Current page marker — the trailing breadcrumb the user is on. */
41
+ const BreadcrumbsPage = ({ className, ...rest }) => {
42
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
43
+ "aria-current": "page",
44
+ className: (0, cnfast.cn)("font-medium text-gray", className),
45
+ ...rest
46
+ });
47
+ };
48
+ /** Visual separator between breadcrumb items. Defaults to "/". */
49
+ const BreadcrumbsSeparator = ({ children, className, ...rest }) => {
50
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
51
+ "aria-hidden": "true",
52
+ className: (0, cnfast.cn)(className),
53
+ ...rest,
54
+ children: children ?? "/"
55
+ });
56
+ };
57
+ //#endregion
58
+ exports.Breadcrumbs = Breadcrumbs;
59
+ exports.BreadcrumbsItem = BreadcrumbsItem;
60
+ exports.BreadcrumbsLink = BreadcrumbsLink;
61
+ exports.BreadcrumbsList = BreadcrumbsList;
62
+ exports.BreadcrumbsPage = BreadcrumbsPage;
63
+ exports.BreadcrumbsSeparator = BreadcrumbsSeparator;
64
+
65
+ //# sourceMappingURL=breadcrumbs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumbs.cjs","names":[],"sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '../utils/cn'\n\nconst Breadcrumbs = ({\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: React.ComponentProps<'nav'>) => {\n return <nav aria-label={ariaLabel} className={cn(className)} {...rest} />\n}\n\nconst BreadcrumbsList = ({\n className,\n ...rest\n}: React.ComponentProps<'ol'>) => {\n return (\n <ol\n className={cn(\n 'flex flex-wrap items-center gap-1.5 text-sm text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst BreadcrumbsItem = ({\n className,\n ...rest\n}: React.ComponentProps<'li'>) => {\n return <li className={cn('flex items-center gap-1.5', className)} {...rest} />\n}\n\n/**\n * Link inside a breadcrumb. Pass `render` to render any router-specific link\n * component (TanStack `Link`, Next `Link`, plain `<a>`, …) and inherit the\n * breadcrumb link styling. Without `render` it renders as a plain anchor.\n */\nconst BreadcrumbsLink = ({\n className,\n render,\n ...rest\n}: useRender.ComponentProps<'a'>) => {\n return useRender({\n defaultTagName: 'a',\n render,\n props: mergeProps<'a'>(\n { className: cn('transition-colors hover:text-gray', className) },\n rest,\n ),\n })\n}\n\n/** Current page marker — the trailing breadcrumb the user is on. */\nconst BreadcrumbsPage = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span\n aria-current=\"page\"\n className={cn('font-medium text-gray', className)}\n {...rest}\n />\n )\n}\n\n/** Visual separator between breadcrumb items. Defaults to \"/\". */\nconst BreadcrumbsSeparator = ({\n children,\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span aria-hidden=\"true\" className={cn(className)} {...rest}>\n {children ?? '/'}\n </span>\n )\n}\n\nexport {\n Breadcrumbs,\n BreadcrumbsList,\n BreadcrumbsItem,\n BreadcrumbsLink,\n BreadcrumbsPage,\n BreadcrumbsSeparator,\n}\n"],"mappings":";;;;;;;;AAIA,MAAM,eAAe,EACnB,WACA,cAAc,YAAY,cAC1B,GAAG,WAC8B;AACjC,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,cAAY;EAAW,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;EAAQ,CAAA;;AAG3E,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EACE,YAAA,GAAA,OAAA,IACE,+DACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC6B;AAChC,QAAO,iBAAA,GAAA,kBAAA,KAAC,MAAD;EAAI,YAAA,GAAA,OAAA,IAAc,6BAA6B,UAAU;EAAE,GAAI;EAAQ,CAAA;;;;;;;AAQhF,MAAM,mBAAmB,EACvB,WACA,QACA,GAAG,WACgC;AACnC,SAAA,GAAA,0BAAA,WAAiB;EACf,gBAAgB;EAChB;EACA,QAAA,GAAA,2BAAA,YACE,EAAE,YAAA,GAAA,OAAA,IAAc,qCAAqC,UAAU,EAAE,EACjE,KACD;EACF,CAAC;;;AAIJ,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC+B;AAClC,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,gBAAa;EACb,YAAA,GAAA,OAAA,IAAc,yBAAyB,UAAU;EACjD,GAAI;EACJ,CAAA;;;AAKN,MAAM,wBAAwB,EAC5B,UACA,WACA,GAAG,WAC+B;AAClC,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,eAAY;EAAO,YAAA,GAAA,OAAA,IAAc,UAAU;EAAE,GAAI;YACpD,YAAY;EACR,CAAA"}