@seekalfred/primitives 0.5.1 → 0.7.1

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 (446) hide show
  1. package/README.md +682 -19
  2. package/dist/accordion/accordion.js +10 -4
  3. package/dist/accordion/accordion.js.map +1 -1
  4. package/dist/action-button/action-button.d.ts +50 -0
  5. package/dist/action-button/action-button.js +159 -0
  6. package/dist/action-button/action-button.js.map +1 -0
  7. package/dist/action-button/index.d.ts +2 -0
  8. package/dist/action-button/index.js +2 -0
  9. package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
  10. package/dist/activity-heatmap/activity-heatmap.js +699 -0
  11. package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
  12. package/dist/activity-heatmap/index.d.ts +2 -0
  13. package/dist/activity-heatmap/index.js +2 -0
  14. package/dist/alert/alert.d.ts +19 -1
  15. package/dist/alert/alert.js +180 -23
  16. package/dist/alert/alert.js.map +1 -1
  17. package/dist/alert-dialog/alert-dialog.d.ts +45 -18
  18. package/dist/alert-dialog/alert-dialog.js +128 -9
  19. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  20. package/dist/alert-dialog/index.d.ts +2 -2
  21. package/dist/alert-dialog/index.js +2 -2
  22. package/dist/animated-counter/animated-counter.d.ts +38 -0
  23. package/dist/animated-counter/animated-counter.js +230 -0
  24. package/dist/animated-counter/animated-counter.js.map +1 -0
  25. package/dist/animated-counter/index.d.ts +2 -0
  26. package/dist/animated-counter/index.js +2 -0
  27. package/dist/announcement-bar/announcement-bar.d.ts +67 -0
  28. package/dist/announcement-bar/announcement-bar.js +364 -0
  29. package/dist/announcement-bar/announcement-bar.js.map +1 -0
  30. package/dist/announcement-bar/index.d.ts +2 -0
  31. package/dist/announcement-bar/index.js +2 -0
  32. package/dist/avatar/avatar.d.ts +6 -0
  33. package/dist/avatar/avatar.js +47 -16
  34. package/dist/avatar/avatar.js.map +1 -1
  35. package/dist/badge/badge.d.ts +10 -3
  36. package/dist/badge/badge.js +35 -5
  37. package/dist/badge/badge.js.map +1 -1
  38. package/dist/bar-chart/bar-chart.d.ts +51 -0
  39. package/dist/bar-chart/bar-chart.js +565 -0
  40. package/dist/bar-chart/bar-chart.js.map +1 -0
  41. package/dist/bar-chart/index.d.ts +2 -0
  42. package/dist/bar-chart/index.js +2 -0
  43. package/dist/breadcrumb/breadcrumb.d.ts +2 -29
  44. package/dist/breadcrumb/breadcrumb.js +32 -9
  45. package/dist/breadcrumb/breadcrumb.js.map +1 -1
  46. package/dist/brush-chart/brush-chart.d.ts +64 -0
  47. package/dist/brush-chart/brush-chart.js +1056 -0
  48. package/dist/brush-chart/brush-chart.js.map +1 -0
  49. package/dist/brush-chart/index.d.ts +2 -0
  50. package/dist/brush-chart/index.js +2 -0
  51. package/dist/button/button.d.ts +36 -23
  52. package/dist/button/button.js +198 -45
  53. package/dist/button/button.js.map +1 -1
  54. package/dist/button-group/button-group.d.ts +76 -0
  55. package/dist/button-group/button-group.js +402 -0
  56. package/dist/button-group/button-group.js.map +1 -0
  57. package/dist/button-group/index.d.ts +2 -0
  58. package/dist/button-group/index.js +2 -0
  59. package/dist/calendar/calendar.d.ts +1 -1
  60. package/dist/calendar/calendar.js +257 -30
  61. package/dist/calendar/calendar.js.map +1 -1
  62. package/dist/card/card.d.ts +9 -2
  63. package/dist/card/card.js +16 -5
  64. package/dist/card/card.js.map +1 -1
  65. package/dist/card-stack/card-stack.d.ts +54 -0
  66. package/dist/card-stack/card-stack.js +492 -0
  67. package/dist/card-stack/card-stack.js.map +1 -0
  68. package/dist/card-stack/index.d.ts +2 -0
  69. package/dist/card-stack/index.js +2 -0
  70. package/dist/carousel/carousel.d.ts +56 -0
  71. package/dist/carousel/carousel.js +389 -0
  72. package/dist/carousel/carousel.js.map +1 -0
  73. package/dist/carousel/index.d.ts +2 -0
  74. package/dist/carousel/index.js +2 -0
  75. package/dist/checkbox/checkbox.d.ts +0 -7
  76. package/dist/checkbox/checkbox.js +26 -29
  77. package/dist/checkbox/checkbox.js.map +1 -1
  78. package/dist/chip-group/chip-group.d.ts +37 -0
  79. package/dist/chip-group/chip-group.js +148 -0
  80. package/dist/chip-group/chip-group.js.map +1 -0
  81. package/dist/chip-group/index.d.ts +2 -0
  82. package/dist/chip-group/index.js +2 -0
  83. package/dist/confirm-morph/confirm-morph.d.ts +85 -0
  84. package/dist/confirm-morph/confirm-morph.js +652 -0
  85. package/dist/confirm-morph/confirm-morph.js.map +1 -0
  86. package/dist/confirm-morph/index.d.ts +2 -0
  87. package/dist/confirm-morph/index.js +2 -0
  88. package/dist/copy-button/copy-button.d.ts +32 -0
  89. package/dist/copy-button/copy-button.js +134 -0
  90. package/dist/copy-button/copy-button.js.map +1 -0
  91. package/dist/copy-button/index.d.ts +2 -0
  92. package/dist/copy-button/index.js +2 -0
  93. package/dist/countdown/countdown.d.ts +45 -0
  94. package/dist/countdown/countdown.js +298 -0
  95. package/dist/countdown/countdown.js.map +1 -0
  96. package/dist/countdown/index.d.ts +2 -0
  97. package/dist/countdown/index.js +2 -0
  98. package/dist/date-picker/date-picker.d.ts +51 -0
  99. package/dist/date-picker/date-picker.js +241 -0
  100. package/dist/date-picker/date-picker.js.map +1 -0
  101. package/dist/date-picker/date-range-picker.d.ts +78 -0
  102. package/dist/date-picker/date-range-picker.js +1015 -0
  103. package/dist/date-picker/date-range-picker.js.map +1 -0
  104. package/dist/date-picker/index.d.ts +4 -0
  105. package/dist/date-picker/index.js +4 -0
  106. package/dist/date-picker/picker-parts.d.ts +46 -0
  107. package/dist/date-picker/picker-parts.js +135 -0
  108. package/dist/date-picker/picker-parts.js.map +1 -0
  109. package/dist/dialog/dialog.d.ts +10 -14
  110. package/dist/dialog/dialog.js +40 -12
  111. package/dist/dialog/dialog.js.map +1 -1
  112. package/dist/donut-chart/donut-chart.d.ts +64 -0
  113. package/dist/donut-chart/donut-chart.js +576 -0
  114. package/dist/donut-chart/donut-chart.js.map +1 -0
  115. package/dist/donut-chart/index.d.ts +2 -0
  116. package/dist/donut-chart/index.js +2 -0
  117. package/dist/empty-state/empty-state.d.ts +55 -0
  118. package/dist/empty-state/empty-state.js +89 -0
  119. package/dist/empty-state/empty-state.js.map +1 -0
  120. package/dist/empty-state/index.d.ts +2 -0
  121. package/dist/empty-state/index.js +2 -0
  122. package/dist/expanding-button-group/expanding-button-group.d.ts +54 -0
  123. package/dist/expanding-button-group/expanding-button-group.js +350 -0
  124. package/dist/expanding-button-group/expanding-button-group.js.map +1 -0
  125. package/dist/expanding-button-group/index.d.ts +2 -0
  126. package/dist/expanding-button-group/index.js +2 -0
  127. package/dist/file-drop-zone/file-drop-zone.d.ts +71 -0
  128. package/dist/file-drop-zone/file-drop-zone.js +116 -0
  129. package/dist/file-drop-zone/file-drop-zone.js.map +1 -0
  130. package/dist/file-drop-zone/index.d.ts +2 -0
  131. package/dist/file-drop-zone/index.js +2 -0
  132. package/dist/filter-bar/filter-bar.d.ts +142 -0
  133. package/dist/filter-bar/filter-bar.js +416 -0
  134. package/dist/filter-bar/filter-bar.js.map +1 -0
  135. package/dist/filter-bar/index.d.ts +2 -0
  136. package/dist/filter-bar/index.js +2 -0
  137. package/dist/floating-button-group/floating-button-group.d.ts +61 -0
  138. package/dist/floating-button-group/floating-button-group.js +340 -0
  139. package/dist/floating-button-group/floating-button-group.js.map +1 -0
  140. package/dist/floating-button-group/index.d.ts +2 -0
  141. package/dist/floating-button-group/index.js +2 -0
  142. package/dist/gauge/gauge.d.ts +45 -0
  143. package/dist/gauge/gauge.js +219 -0
  144. package/dist/gauge/gauge.js.map +1 -0
  145. package/dist/gauge/index.d.ts +2 -0
  146. package/dist/gauge/index.js +2 -0
  147. package/dist/icon-morph/icon-morph.d.ts +55 -0
  148. package/dist/icon-morph/icon-morph.js +331 -0
  149. package/dist/icon-morph/icon-morph.js.map +1 -0
  150. package/dist/icon-morph/index.d.ts +2 -0
  151. package/dist/icon-morph/index.js +2 -0
  152. package/dist/in-view-title/in-view-title.d.ts +33 -0
  153. package/dist/in-view-title/in-view-title.js +119 -0
  154. package/dist/in-view-title/in-view-title.js.map +1 -0
  155. package/dist/in-view-title/index.d.ts +2 -0
  156. package/dist/in-view-title/index.js +2 -0
  157. package/dist/index.d.ts +71 -6
  158. package/dist/index.js +73 -11
  159. package/dist/input/input.d.ts +22 -0
  160. package/dist/input/input.js +36 -12
  161. package/dist/input/input.js.map +1 -1
  162. package/dist/lib/cn.js +11 -1
  163. package/dist/lib/cn.js.map +1 -1
  164. package/dist/lib/count-to.js +113 -0
  165. package/dist/lib/count-to.js.map +1 -0
  166. package/dist/lib/eye-morph.js +62 -0
  167. package/dist/lib/eye-morph.js.map +1 -0
  168. package/dist/lib/field-message.js +354 -0
  169. package/dist/lib/field-message.js.map +1 -0
  170. package/dist/lib/field-shell.js +81 -0
  171. package/dist/lib/field-shell.js.map +1 -0
  172. package/dist/lib/field-surface.js +11 -8
  173. package/dist/lib/field-surface.js.map +1 -1
  174. package/dist/lib/flag-emoji.js +50 -0
  175. package/dist/lib/flag-emoji.js.map +1 -0
  176. package/dist/lib/flip.js +88 -0
  177. package/dist/lib/flip.js.map +1 -0
  178. package/dist/lib/height-follow.js +59 -0
  179. package/dist/lib/height-follow.js.map +1 -0
  180. package/dist/lib/icon-swap.js +47 -0
  181. package/dist/lib/icon-swap.js.map +1 -0
  182. package/dist/lib/leaving-list.js +57 -0
  183. package/dist/lib/leaving-list.js.map +1 -0
  184. package/dist/lib/menu-highlight.js +64 -0
  185. package/dist/lib/menu-highlight.js.map +1 -0
  186. package/dist/lib/merge-refs.js +3 -3
  187. package/dist/lib/merge-refs.js.map +1 -1
  188. package/dist/lib/morph-text.js +128 -0
  189. package/dist/lib/morph-text.js.map +1 -0
  190. package/dist/lib/motion.js +169 -0
  191. package/dist/lib/motion.js.map +1 -0
  192. package/dist/lib/pausable-timeout.js +67 -0
  193. package/dist/lib/pausable-timeout.js.map +1 -0
  194. package/dist/lib/rolling-value.js +31 -0
  195. package/dist/lib/rolling-value.js.map +1 -0
  196. package/dist/lib/spring-progress.js +114 -0
  197. package/dist/lib/spring-progress.js.map +1 -0
  198. package/dist/lib/spring-tween.js +500 -0
  199. package/dist/lib/spring-tween.js.map +1 -0
  200. package/dist/lib/svg-id.js +10 -0
  201. package/dist/lib/svg-id.js.map +1 -0
  202. package/dist/lib/swap-text.js +79 -0
  203. package/dist/lib/swap-text.js.map +1 -0
  204. package/dist/lib/use-copy-feedback.js +36 -0
  205. package/dist/lib/use-copy-feedback.js.map +1 -0
  206. package/dist/line-chart/index.d.ts +2 -0
  207. package/dist/line-chart/index.js +2 -0
  208. package/dist/line-chart/line-chart.d.ts +76 -0
  209. package/dist/line-chart/line-chart.js +611 -0
  210. package/dist/line-chart/line-chart.js.map +1 -0
  211. package/dist/mention-input/index.d.ts +2 -0
  212. package/dist/mention-input/index.js +2 -0
  213. package/dist/mention-input/mention-input.d.ts +98 -0
  214. package/dist/mention-input/mention-input.js +576 -0
  215. package/dist/mention-input/mention-input.js.map +1 -0
  216. package/dist/menu/menu.d.ts +2 -0
  217. package/dist/menu/menu.js +23 -12
  218. package/dist/menu/menu.js.map +1 -1
  219. package/dist/money-input/index.d.ts +2 -0
  220. package/dist/money-input/index.js +2 -0
  221. package/dist/money-input/money-input.d.ts +65 -0
  222. package/dist/money-input/money-input.js +607 -0
  223. package/dist/money-input/money-input.js.map +1 -0
  224. package/dist/morph-select/index.d.ts +2 -0
  225. package/dist/morph-select/index.js +2 -0
  226. package/dist/morph-select/morph-select.d.ts +71 -0
  227. package/dist/morph-select/morph-select.js +693 -0
  228. package/dist/morph-select/morph-select.js.map +1 -0
  229. package/dist/multi-select/index.d.ts +2 -0
  230. package/dist/multi-select/index.js +2 -0
  231. package/dist/multi-select/multi-select.d.ts +36 -0
  232. package/dist/multi-select/multi-select.js +152 -0
  233. package/dist/multi-select/multi-select.js.map +1 -0
  234. package/dist/number-field/index.d.ts +2 -0
  235. package/dist/number-field/index.js +2 -0
  236. package/dist/number-field/number-field.d.ts +42 -0
  237. package/dist/number-field/number-field.js +199 -0
  238. package/dist/number-field/number-field.js.map +1 -0
  239. package/dist/onboarding-checklist/index.d.ts +2 -0
  240. package/dist/onboarding-checklist/index.js +2 -0
  241. package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
  242. package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
  243. package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
  244. package/dist/page-header/index.d.ts +2 -0
  245. package/dist/page-header/index.js +2 -0
  246. package/dist/page-header/page-header.d.ts +75 -0
  247. package/dist/page-header/page-header.js +83 -0
  248. package/dist/page-header/page-header.js.map +1 -0
  249. package/dist/password-field/index.d.ts +2 -0
  250. package/dist/password-field/index.js +2 -0
  251. package/dist/password-field/password-field.d.ts +37 -0
  252. package/dist/password-field/password-field.js +101 -0
  253. package/dist/password-field/password-field.js.map +1 -0
  254. package/dist/password-strength/index.d.ts +2 -0
  255. package/dist/password-strength/index.js +2 -0
  256. package/dist/password-strength/password-strength.d.ts +127 -0
  257. package/dist/password-strength/password-strength.js +455 -0
  258. package/dist/password-strength/password-strength.js.map +1 -0
  259. package/dist/phone-input/index.d.ts +3 -0
  260. package/dist/phone-input/index.js +3 -0
  261. package/dist/phone-input/phone-countries.d.ts +29 -0
  262. package/dist/phone-input/phone-countries.js +170 -0
  263. package/dist/phone-input/phone-countries.js.map +1 -0
  264. package/dist/phone-input/phone-input.d.ts +66 -0
  265. package/dist/phone-input/phone-input.js +440 -0
  266. package/dist/phone-input/phone-input.js.map +1 -0
  267. package/dist/popover/popover.d.ts +20 -0
  268. package/dist/popover/popover.js +33 -9
  269. package/dist/popover/popover.js.map +1 -1
  270. package/dist/progress/progress.js +46 -5
  271. package/dist/progress/progress.js.map +1 -1
  272. package/dist/radio-group/radio-group.js +8 -7
  273. package/dist/radio-group/radio-group.js.map +1 -1
  274. package/dist/reactions/index.d.ts +2 -0
  275. package/dist/reactions/index.js +2 -0
  276. package/dist/reactions/reactions.d.ts +50 -0
  277. package/dist/reactions/reactions.js +315 -0
  278. package/dist/reactions/reactions.js.map +1 -0
  279. package/dist/rich-text-editor/index.d.ts +3 -0
  280. package/dist/rich-text-editor/index.js +2 -0
  281. package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
  282. package/dist/rich-text-editor/rich-text-editor.js +909 -0
  283. package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
  284. package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
  285. package/dist/rich-text-editor/rich-text-engine.js +366 -0
  286. package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
  287. package/dist/rich-text-editor/rich-text-html.js +174 -0
  288. package/dist/rich-text-editor/rich-text-html.js.map +1 -0
  289. package/dist/rich-text-editor/rich-text-icons.js +43 -0
  290. package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
  291. package/dist/ridgeline/index.d.ts +2 -0
  292. package/dist/ridgeline/index.js +2 -0
  293. package/dist/ridgeline/ridgeline.d.ts +55 -0
  294. package/dist/ridgeline/ridgeline.js +701 -0
  295. package/dist/ridgeline/ridgeline.js.map +1 -0
  296. package/dist/scroll-area/index.d.ts +2 -2
  297. package/dist/scroll-area/index.js +2 -2
  298. package/dist/scroll-area/scroll-area.d.ts +75 -28
  299. package/dist/scroll-area/scroll-area.js +212 -41
  300. package/dist/scroll-area/scroll-area.js.map +1 -1
  301. package/dist/scrub-input/evaluate.d.ts +14 -0
  302. package/dist/scrub-input/evaluate.js +72 -0
  303. package/dist/scrub-input/evaluate.js.map +1 -0
  304. package/dist/scrub-input/index.d.ts +3 -0
  305. package/dist/scrub-input/index.js +3 -0
  306. package/dist/scrub-input/scrub-input.d.ts +74 -0
  307. package/dist/scrub-input/scrub-input.js +486 -0
  308. package/dist/scrub-input/scrub-input.js.map +1 -0
  309. package/dist/search-field/index.d.ts +2 -0
  310. package/dist/search-field/index.js +2 -0
  311. package/dist/search-field/search-field.d.ts +27 -0
  312. package/dist/search-field/search-field.js +155 -0
  313. package/dist/search-field/search-field.js.map +1 -0
  314. package/dist/select/select.d.ts +3 -1
  315. package/dist/select/select.js +95 -25
  316. package/dist/select/select.js.map +1 -1
  317. package/dist/separator/separator.d.ts +1 -1
  318. package/dist/sheet/sheet.js +4 -2
  319. package/dist/sheet/sheet.js.map +1 -1
  320. package/dist/shortcut-recorder/index.d.ts +3 -0
  321. package/dist/shortcut-recorder/index.js +3 -0
  322. package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
  323. package/dist/shortcut-recorder/shortcut-model.js +206 -0
  324. package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
  325. package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
  326. package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
  327. package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
  328. package/dist/side-nav/index.d.ts +2 -0
  329. package/dist/side-nav/index.js +2 -0
  330. package/dist/side-nav/side-nav.d.ts +72 -0
  331. package/dist/side-nav/side-nav.js +142 -0
  332. package/dist/side-nav/side-nav.js.map +1 -0
  333. package/dist/skeleton/skeleton.d.ts +8 -2
  334. package/dist/skeleton/skeleton.js +6 -2
  335. package/dist/skeleton/skeleton.js.map +1 -1
  336. package/dist/slider/index.d.ts +2 -2
  337. package/dist/slider/slider.d.ts +46 -14
  338. package/dist/slider/slider.js +188 -50
  339. package/dist/slider/slider.js.map +1 -1
  340. package/dist/slope-chart/index.d.ts +2 -0
  341. package/dist/slope-chart/index.js +2 -0
  342. package/dist/slope-chart/slope-chart.d.ts +54 -0
  343. package/dist/slope-chart/slope-chart.js +568 -0
  344. package/dist/slope-chart/slope-chart.js.map +1 -0
  345. package/dist/sparkline/index.d.ts +2 -0
  346. package/dist/sparkline/index.js +2 -0
  347. package/dist/sparkline/sparkline.d.ts +46 -0
  348. package/dist/sparkline/sparkline.js +390 -0
  349. package/dist/sparkline/sparkline.js.map +1 -0
  350. package/dist/split-bar/index.d.ts +2 -0
  351. package/dist/split-bar/index.js +2 -0
  352. package/dist/split-bar/split-bar.d.ts +62 -0
  353. package/dist/split-bar/split-bar.js +513 -0
  354. package/dist/split-bar/split-bar.js.map +1 -0
  355. package/dist/split-button/index.d.ts +2 -0
  356. package/dist/split-button/index.js +2 -0
  357. package/dist/split-button/split-button.d.ts +46 -0
  358. package/dist/split-button/split-button.js +123 -0
  359. package/dist/split-button/split-button.js.map +1 -0
  360. package/dist/stat-card/index.d.ts +2 -0
  361. package/dist/stat-card/index.js +2 -0
  362. package/dist/stat-card/stat-card.d.ts +101 -0
  363. package/dist/stat-card/stat-card.js +249 -0
  364. package/dist/stat-card/stat-card.js.map +1 -0
  365. package/dist/stepper/index.d.ts +2 -0
  366. package/dist/stepper/index.js +2 -0
  367. package/dist/stepper/stepper.d.ts +51 -0
  368. package/dist/stepper/stepper.js +215 -0
  369. package/dist/stepper/stepper.js.map +1 -0
  370. package/dist/streamgraph/index.d.ts +2 -0
  371. package/dist/streamgraph/index.js +2 -0
  372. package/dist/streamgraph/streamgraph.d.ts +70 -0
  373. package/dist/streamgraph/streamgraph.js +613 -0
  374. package/dist/streamgraph/streamgraph.js.map +1 -0
  375. package/dist/styles.css +1 -1
  376. package/dist/swipe-actions/index.d.ts +2 -0
  377. package/dist/swipe-actions/index.js +2 -0
  378. package/dist/swipe-actions/swipe-actions.d.ts +67 -0
  379. package/dist/swipe-actions/swipe-actions.js +552 -0
  380. package/dist/swipe-actions/swipe-actions.js.map +1 -0
  381. package/dist/switch/switch.js +10 -9
  382. package/dist/switch/switch.js.map +1 -1
  383. package/dist/table/index.d.ts +2 -2
  384. package/dist/table/index.js +2 -2
  385. package/dist/table/table.d.ts +87 -4
  386. package/dist/table/table.js +441 -165
  387. package/dist/table/table.js.map +1 -1
  388. package/dist/tabs/tabs.js +143 -7
  389. package/dist/tabs/tabs.js.map +1 -1
  390. package/dist/tag-input/index.d.ts +2 -0
  391. package/dist/tag-input/index.js +2 -0
  392. package/dist/tag-input/tag-input.d.ts +40 -0
  393. package/dist/tag-input/tag-input.js +269 -0
  394. package/dist/tag-input/tag-input.js.map +1 -0
  395. package/dist/text-morph/index.d.ts +2 -0
  396. package/dist/text-morph/index.js +2 -0
  397. package/dist/text-morph/text-morph.d.ts +23 -0
  398. package/dist/text-morph/text-morph.js +21 -0
  399. package/dist/text-morph/text-morph.js.map +1 -0
  400. package/dist/text-reveal/index.d.ts +2 -0
  401. package/dist/text-reveal/index.js +2 -0
  402. package/dist/text-reveal/text-reveal.d.ts +27 -0
  403. package/dist/text-reveal/text-reveal.js +51 -0
  404. package/dist/text-reveal/text-reveal.js.map +1 -0
  405. package/dist/text-shimmer/index.d.ts +2 -0
  406. package/dist/text-shimmer/index.js +2 -0
  407. package/dist/text-shimmer/text-shimmer.d.ts +29 -0
  408. package/dist/text-shimmer/text-shimmer.js +29 -0
  409. package/dist/text-shimmer/text-shimmer.js.map +1 -0
  410. package/dist/textarea/textarea.d.ts +23 -0
  411. package/dist/textarea/textarea.js +24 -2
  412. package/dist/textarea/textarea.js.map +1 -1
  413. package/dist/theme-switch/index.d.ts +2 -0
  414. package/dist/theme-switch/index.js +2 -0
  415. package/dist/theme-switch/theme-switch.d.ts +37 -0
  416. package/dist/theme-switch/theme-switch.js +123 -0
  417. package/dist/theme-switch/theme-switch.js.map +1 -0
  418. package/dist/time-picker/index.d.ts +2 -0
  419. package/dist/time-picker/index.js +2 -0
  420. package/dist/time-picker/time-picker.d.ts +54 -0
  421. package/dist/time-picker/time-picker.js +201 -0
  422. package/dist/time-picker/time-picker.js.map +1 -0
  423. package/dist/toast/index.d.ts +2 -2
  424. package/dist/toast/index.js +2 -2
  425. package/dist/toast/toast.d.ts +6 -0
  426. package/dist/toast/toast.js +98 -36
  427. package/dist/toast/toast.js.map +1 -1
  428. package/dist/tooltip/tooltip.d.ts +10 -3
  429. package/dist/tooltip/tooltip.js +67 -18
  430. package/dist/tooltip/tooltip.js.map +1 -1
  431. package/dist/treemap/index.d.ts +2 -0
  432. package/dist/treemap/index.js +2 -0
  433. package/dist/treemap/treemap.d.ts +53 -0
  434. package/dist/treemap/treemap.js +699 -0
  435. package/dist/treemap/treemap.js.map +1 -0
  436. package/dist/usage-meter/index.d.ts +2 -0
  437. package/dist/usage-meter/index.js +2 -0
  438. package/dist/usage-meter/usage-meter.d.ts +50 -0
  439. package/dist/usage-meter/usage-meter.js +440 -0
  440. package/dist/usage-meter/usage-meter.js.map +1 -0
  441. package/dist/waffle-chart/index.d.ts +2 -0
  442. package/dist/waffle-chart/index.js +2 -0
  443. package/dist/waffle-chart/waffle-chart.d.ts +57 -0
  444. package/dist/waffle-chart/waffle-chart.js +426 -0
  445. package/dist/waffle-chart/waffle-chart.js.map +1 -0
  446. package/package.json +245 -3
@@ -0,0 +1,613 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { mergeRefs } from "../lib/merge-refs.js";
4
+ import { prefersReducedMotion, useIsomorphicLayoutEffect } from "../lib/motion.js";
5
+ import { SMOOTH, SNAPPY, SWELL, live, retarget, tween } from "../lib/spring-tween.js";
6
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/streamgraph/streamgraph.tsx
9
+ /** Samples across the plot: every layer is resampled onto the same grid, so datasets of any length morph into each other. */
10
+ const N = 161;
11
+ /** Room above and below the stream, and the gap between the crosshair and its tooltip, in pixels. */
12
+ const PAD = 10;
13
+ const GAP = 14;
14
+ /** The first four layers take chart-1 to chart-4; later layers fall back to neutral steps that alternate in lightness. */
15
+ const SHADES = [
16
+ 30,
17
+ 18,
18
+ 24,
19
+ 14
20
+ ];
21
+ const colorOf = (item, index) => item.color ?? (index < 4 ? `var(--color-chart-${index + 1})` : `color-mix(in oklab, var(--color-foreground) ${SHADES[(index - 4) % SHADES.length]}%, var(--color-surface))`);
22
+ const GROUPED = new Intl.NumberFormat("en-US", { maximumFractionDigits: 1 });
23
+ const clamp = (value, low, high) => Math.min(high, Math.max(low, value));
24
+ /** The first layer sits in the middle of the stream and the rest alternate above and below it; a flat baseline stacks them in order. */
25
+ function stackOrder(count, mode) {
26
+ const order = Array.from({ length: count }, (_, index) => index);
27
+ if (mode === "zero") return order;
28
+ return order.reduce((list, index) => index === 0 ? [0] : index % 2 ? [...list, index] : [index, ...list], []);
29
+ }
30
+ /** Resamples values onto the shared grid with monotone cubic tangents, so curves never swing past the data or below zero. */
31
+ function resample(raw) {
32
+ const values = raw.map((value) => Math.max(0, value || 0));
33
+ const out = new Array(N);
34
+ if (!values.length) return out.fill(0);
35
+ if (values.length === 1) return out.fill(values[0]);
36
+ const last = values.length - 1;
37
+ const slopes = values.slice(1).map((value, index) => value - values[index]);
38
+ const tangents = values.map((_, index) => index === 0 || index === last ? 0 : (Math.sign(slopes[index - 1]) + Math.sign(slopes[index])) * Math.min(Math.abs(slopes[index - 1]), Math.abs(slopes[index]), Math.abs(slopes[index - 1] + slopes[index]) / 4) || 0);
39
+ if (last > 1) {
40
+ tangents[0] = (3 * slopes[0] - tangents[1]) / 2;
41
+ tangents[last] = (3 * slopes[last - 1] - tangents[last - 1]) / 2;
42
+ } else tangents[0] = tangents[1] = slopes[0];
43
+ for (let k = 0; k < N; k++) {
44
+ const at = k / 160 * last;
45
+ const seg = Math.min(last - 1, Math.floor(at));
46
+ const t = at - seg;
47
+ const t2 = t * t;
48
+ const t3 = t2 * t;
49
+ const a = values[seg];
50
+ const b = values[seg + 1];
51
+ const value = (2 * t3 - 3 * t2 + 1) * a + (t3 - 2 * t2 + t) * tangents[seg] + (3 * t2 - 2 * t3) * b + (t3 - t2) * tangents[seg + 1];
52
+ out[k] = clamp(value, Math.min(a, b), Math.max(a, b));
53
+ }
54
+ return out;
55
+ }
56
+ /** The baseline under the stack. Wiggle follows Byron and Wattenberg, then removes its linear drift so the stream stays level. */
57
+ function baseline(layers, mode) {
58
+ const g = new Array(N).fill(0);
59
+ const totals = g.map((_, j) => layers.reduce((sum, layer) => sum + layer[j], 0));
60
+ if (mode === "zero" || !layers.length) return g;
61
+ if (mode === "silhouette") return totals.map((total) => -total / 2);
62
+ for (let j = 1; j < N; j++) {
63
+ let s1 = 0;
64
+ let s2 = 0;
65
+ let below = 0;
66
+ for (const layer of layers) {
67
+ const change = layer[j] - layer[j - 1];
68
+ s1 += layer[j];
69
+ s2 += (below + change / 2) * layer[j];
70
+ below += change;
71
+ }
72
+ g[j] = g[j - 1] - (s1 ? s2 / s1 : 0);
73
+ }
74
+ const centers = g.map((value, j) => value + totals[j] / 2);
75
+ const mx = 80;
76
+ const my = centers.reduce((sum, value) => sum + value, 0) / N;
77
+ let num = 0;
78
+ let den = 0;
79
+ centers.forEach((value, j) => {
80
+ num += (j - mx) * (value - my);
81
+ den += (j - mx) ** 2;
82
+ });
83
+ const slope = den ? num / den : 0;
84
+ return g.map((value, j) => value - (my + slope * (j - mx)));
85
+ }
86
+ /** Axis labels that fit: at most one per 72 pixels, counted back from the latest. */
87
+ function axisPicks(data, width) {
88
+ const labeled = data.flatMap((item, index) => item.axisLabel ? [index] : []);
89
+ if (!width || !labeled.length) return [];
90
+ const stride = Math.ceil(labeled.length / Math.max(2, Math.floor(width / 72)));
91
+ return labeled.reverse().filter((_, rank) => rank % stride === 0).reverse();
92
+ }
93
+ const Streamgraph = forwardRef(function Streamgraph({ data, series, label, unit = "", height = 260, offset = "wiggle", formatValue, hiddenSeries, defaultHiddenSeries, onHiddenSeriesChange, onActiveChange, legend = true, directLabels = true, categoryLabel = "Date", emptyLabel = "No data for this range", className }, ref) {
94
+ const figure = useRef(null);
95
+ const refs = useMemo(() => mergeRefs(ref, figure), [ref]);
96
+ const plot = useRef(null);
97
+ const svg = useRef(null);
98
+ const tip = useRef(null);
99
+ const last = data.length - 1;
100
+ const empty = data.length === 0;
101
+ const [ownHidden, setOwnHidden] = useState(defaultHiddenSeries ?? []);
102
+ const hidden = hiddenSeries ?? ownHidden;
103
+ const toggle = (key) => {
104
+ const next = hidden.includes(key) ? hidden.filter((item) => item !== key) : [...hidden, key];
105
+ if (hiddenSeries === void 0) setOwnHidden(next);
106
+ onHiddenSeriesChange?.(next);
107
+ };
108
+ const visible = series.filter((item) => !hidden.includes(item.key));
109
+ const signature = `${series.map((item) => item.key).join(",")}|${data.map((item) => series.map((line) => item.values[line.key] ?? 0).join(",")).join(";")}`;
110
+ const targets = useMemo(() => new Map(series.map((line) => [line.key, resample(data.map((item) => item.values[line.key] ?? 0))])), [signature]);
111
+ const [hover, setHover] = useState(null);
112
+ const [seenSignature, setSeenSignature] = useState(signature);
113
+ if (seenSignature !== signature) {
114
+ setSeenSignature(signature);
115
+ setHover(null);
116
+ }
117
+ const index = hover && !empty ? Math.min(hover.index, last) : null;
118
+ const [legendKey, setLegendKey] = useState(null);
119
+ const wanted = hover?.key ?? legendKey;
120
+ const activeKey = wanted && visible.some((item) => item.key === wanted) ? wanted : null;
121
+ const width = useRef(0);
122
+ const [plotWidth, setPlotWidth] = useState(0);
123
+ const shapes = useRef(/* @__PURE__ */ new Map());
124
+ const presence = useRef(/* @__PURE__ */ new Map());
125
+ const frame = useRef(null);
126
+ const spots = useRef(/* @__PURE__ */ new Map());
127
+ const grow = useRef(live(0));
128
+ const cursor = useRef(live(1));
129
+ const current = useRef({
130
+ series,
131
+ offset,
132
+ height
133
+ });
134
+ useIsomorphicLayoutEffect(() => {
135
+ current.current = {
136
+ series,
137
+ offset,
138
+ height
139
+ };
140
+ });
141
+ /** One writer for every drawn attribute: morphs, toggles, the first swell, the crosshair and resizes all repaint through here. */
142
+ const paint = useCallback(() => {
143
+ const root = svg.current;
144
+ const w = width.current;
145
+ if (!root || !w) return;
146
+ const { series: order, offset: mode, height: h } = current.current;
147
+ const layers = order.map((line) => {
148
+ const shape = shapes.current.get(line.key);
149
+ const p = presence.current.get(line.key)?.value ?? 1;
150
+ return shape ? shape.map((value) => value * p) : new Array(N).fill(0);
151
+ });
152
+ const stack = stackOrder(order.length, mode);
153
+ const g = baseline(stack.map((i) => layers[i]), mode);
154
+ const lower = new Array(order.length);
155
+ const upper = new Array(order.length);
156
+ let running = g.slice();
157
+ for (const i of stack) {
158
+ const layer = layers[i];
159
+ lower[i] = running;
160
+ running = running.map((value, j) => value + layer[j]);
161
+ upper[i] = running;
162
+ }
163
+ let lo = Infinity;
164
+ let hi = -Infinity;
165
+ for (let j = 0; j < N; j++) {
166
+ lo = Math.min(lo, g[j]);
167
+ hi = Math.max(hi, running[j]);
168
+ }
169
+ if (!Number.isFinite(lo) || hi - lo < 1e-9) {
170
+ lo = -1;
171
+ hi = 1;
172
+ }
173
+ const span = hi - lo;
174
+ const s = grow.current.value;
175
+ const center = g.map((value, j) => (value + running[j]) / 2);
176
+ const toY = (value) => PAD + (1 - (value - lo) / span) * (h - 20);
177
+ const yAt = (value, j) => toY(center[j] + (value - center[j]) * s);
178
+ frame.current = {
179
+ lower,
180
+ upper,
181
+ toY
182
+ };
183
+ const xs = Array.from({ length: N }, (_, j) => j / 160 * w);
184
+ order.forEach((line, i) => {
185
+ const top = upper[i];
186
+ const bottom = lower[i];
187
+ const node = root.querySelector(`[data-layer="${CSS.escape(line.key)}"]`);
188
+ if (node) {
189
+ let d = "";
190
+ for (let j = 0; j < N; j++) d += `${j ? "L" : "M"}${xs[j].toFixed(1)},${yAt(top[j], j).toFixed(1)}`;
191
+ for (let j = 160; j >= 0; j--) d += `L${xs[j].toFixed(1)},${yAt(bottom[j], j).toFixed(1)}`;
192
+ node.setAttribute("d", `${d}Z`);
193
+ }
194
+ const text = root.querySelector(`[data-name="${CSS.escape(line.key)}"]`);
195
+ if (!text) return;
196
+ let best = 4;
197
+ for (let j = 4; j < 157; j++) if (top[j] - bottom[j] > top[best] - bottom[best]) best = j;
198
+ const held = spots.current.get(line.key);
199
+ const j = held !== void 0 && top[held] - bottom[held] >= (top[best] - bottom[best]) * .8 ? held : best;
200
+ spots.current.set(line.key, j);
201
+ const thickness = (top[j] - bottom[j]) / span * (h - 20) * s;
202
+ const room = text.getComputedTextLength?.() ?? 60;
203
+ text.setAttribute("x", clamp(xs[j], room / 2 + 6, w - room / 2 - 6).toFixed(1));
204
+ text.setAttribute("y", yAt((top[j] + bottom[j]) / 2, j).toFixed(1));
205
+ text.style.opacity = thickness >= 19 && room + 16 < w ? "1" : "0";
206
+ });
207
+ const x = cursor.current.value * w;
208
+ const cross = root.querySelector("[data-part=crosshair]");
209
+ cross?.setAttribute("x1", x.toFixed(1));
210
+ cross?.setAttribute("x2", x.toFixed(1));
211
+ }, []);
212
+ useIsomorphicLayoutEffect(() => {
213
+ const node = plot.current;
214
+ if (!node) return;
215
+ const read = () => {
216
+ width.current = node.clientWidth;
217
+ setPlotWidth(node.clientWidth);
218
+ paint();
219
+ };
220
+ read();
221
+ if (typeof ResizeObserver === "undefined") return;
222
+ const observer = new ResizeObserver(read);
223
+ observer.observe(node);
224
+ return () => observer.disconnect();
225
+ }, [paint]);
226
+ useIsomorphicLayoutEffect(paint, [
227
+ height,
228
+ offset,
229
+ paint,
230
+ series
231
+ ]);
232
+ const mounted = useRef(false);
233
+ useEffect(() => {
234
+ const moves = [];
235
+ for (const [key, to] of targets) {
236
+ const from = shapes.current.get(key);
237
+ if (!from) {
238
+ shapes.current.set(key, to);
239
+ if (mounted.current) {
240
+ const entering = live(0);
241
+ presence.current.set(key, entering);
242
+ retarget(entering, hidden.includes(key) ? 0 : 1, SMOOTH, paint);
243
+ }
244
+ continue;
245
+ }
246
+ moves.push({
247
+ key,
248
+ from,
249
+ to
250
+ });
251
+ }
252
+ for (const key of [...shapes.current.keys()]) if (!targets.has(key)) shapes.current.delete(key);
253
+ mounted.current = true;
254
+ if (!moves.length) {
255
+ paint();
256
+ return;
257
+ }
258
+ return tween(SMOOTH, (p) => {
259
+ for (const move of moves) shapes.current.set(move.key, move.from.map((value, j) => value + (move.to[j] - value) * p));
260
+ paint();
261
+ }, () => {
262
+ for (const move of moves) shapes.current.set(move.key, move.to);
263
+ paint();
264
+ });
265
+ }, [paint, targets]);
266
+ const hiddenKey = hidden.join("|");
267
+ useEffect(() => {
268
+ for (const line of series) {
269
+ const to = hidden.includes(line.key) ? 0 : 1;
270
+ const track = presence.current.get(line.key);
271
+ if (!track) presence.current.set(line.key, live(to));
272
+ else retarget(track, to, SMOOTH, paint);
273
+ }
274
+ paint();
275
+ }, [
276
+ hiddenKey,
277
+ paint,
278
+ series.length
279
+ ]);
280
+ useEffect(() => () => {
281
+ grow.current.stop();
282
+ cursor.current.stop();
283
+ for (const track of presence.current.values()) track.stop();
284
+ }, []);
285
+ useEffect(() => {
286
+ const node = figure.current;
287
+ if (empty || !node) return;
288
+ if (prefersReducedMotion() || typeof IntersectionObserver === "undefined") {
289
+ grow.current.value = 1;
290
+ paint();
291
+ return;
292
+ }
293
+ const observer = new IntersectionObserver(([entry]) => {
294
+ if (!entry?.isIntersecting) return;
295
+ observer.disconnect();
296
+ retarget(grow.current, 1, SWELL, paint);
297
+ }, { threshold: .3 });
298
+ observer.observe(node);
299
+ return () => observer.disconnect();
300
+ }, [empty, paint]);
301
+ const shownBefore = useRef(false);
302
+ useIsomorphicLayoutEffect(() => {
303
+ const bubble = tip.current;
304
+ const w = width.current;
305
+ if (index === null || !bubble || !w) {
306
+ shownBefore.current = false;
307
+ return;
308
+ }
309
+ const share = last > 0 ? index / last : .5;
310
+ const x = share * w;
311
+ if (!shownBefore.current) {
312
+ cursor.current.stop();
313
+ cursor.current.value = share;
314
+ paint();
315
+ } else retarget(cursor.current, share, SNAPPY, paint);
316
+ let y = hover?.y ?? null;
317
+ const f = frame.current;
318
+ if (y === null && f && activeKey) {
319
+ const i = series.findIndex((line) => line.key === activeKey);
320
+ const j = Math.round(share * 160);
321
+ if (i >= 0) y = f.toY((f.upper[i][j] + f.lower[i][j]) / 2);
322
+ }
323
+ const tw = bubble.offsetWidth;
324
+ const th = bubble.offsetHeight;
325
+ let left = x + GAP;
326
+ if (left + tw > w) left = x - GAP - tw;
327
+ if (!shownBefore.current) bubble.style.transition = "none";
328
+ bubble.style.translate = `${clamp(left, 0, Math.max(0, w - tw))}px ${clamp((y ?? height / 2) - th / 2, 0, Math.max(0, height - th))}px`;
329
+ if (!shownBefore.current) {
330
+ bubble.offsetWidth;
331
+ bubble.style.transition = "";
332
+ }
333
+ shownBefore.current = true;
334
+ });
335
+ const onActive = useRef(onActiveChange);
336
+ useIsomorphicLayoutEffect(() => {
337
+ onActive.current = onActiveChange;
338
+ });
339
+ useEffect(() => {
340
+ onActive.current?.(index, activeKey);
341
+ }, [index, activeKey]);
342
+ const read = (clientX, clientY) => {
343
+ const rect = plot.current?.getBoundingClientRect();
344
+ const f = frame.current;
345
+ if (!rect?.width || empty) return null;
346
+ const share = clamp((clientX - rect.left) / rect.width, 0, 1);
347
+ const y = clientY - rect.top;
348
+ const at = last > 0 ? Math.round(share * last) : 0;
349
+ const j = Math.round(share * 160);
350
+ let key = null;
351
+ if (f) series.forEach((line, i) => {
352
+ if (hidden.includes(line.key)) return;
353
+ const top = f.toY(f.upper[i][j]);
354
+ const bottom = f.toY(f.lower[i][j]);
355
+ if (y >= top - 1 && y <= bottom + 1) key = line.key;
356
+ });
357
+ return {
358
+ index: at,
359
+ key,
360
+ y
361
+ };
362
+ };
363
+ const onKeyDown = (event) => {
364
+ if (empty) return;
365
+ if (event.key === "Escape" && hover) {
366
+ event.preventDefault();
367
+ setHover(null);
368
+ return;
369
+ }
370
+ const from = index ?? last;
371
+ const keys = visible.map((line) => line.key);
372
+ const at = activeKey ? keys.indexOf(activeKey) : -1;
373
+ const page = Math.max(1, Math.round(data.length / 6));
374
+ const move = {
375
+ ArrowLeft: () => ({
376
+ index: clamp(from - 1, 0, last),
377
+ key: activeKey,
378
+ y: null
379
+ }),
380
+ ArrowRight: () => ({
381
+ index: clamp(index === null ? last : from + 1, 0, last),
382
+ key: activeKey,
383
+ y: null
384
+ }),
385
+ PageDown: () => ({
386
+ index: clamp(from - page, 0, last),
387
+ key: activeKey,
388
+ y: null
389
+ }),
390
+ PageUp: () => ({
391
+ index: clamp(from + page, 0, last),
392
+ key: activeKey,
393
+ y: null
394
+ }),
395
+ Home: () => ({
396
+ index: 0,
397
+ key: activeKey,
398
+ y: null
399
+ }),
400
+ End: () => ({
401
+ index: last,
402
+ key: activeKey,
403
+ y: null
404
+ }),
405
+ ArrowUp: () => ({
406
+ index: from,
407
+ key: keys[at < 0 ? keys.length - 1 : Math.min(keys.length - 1, at + 1)] ?? null,
408
+ y: null
409
+ }),
410
+ ArrowDown: () => ({
411
+ index: from,
412
+ key: keys[at < 0 ? 0 : Math.max(0, at - 1)] ?? null,
413
+ y: null
414
+ })
415
+ }[event.key];
416
+ if (!move) return;
417
+ event.preventDefault();
418
+ setHover(move());
419
+ };
420
+ const suffix = unit ? ` ${unit}` : "";
421
+ const format = (value, line) => `${formatValue ? formatValue(value, line) : GROUPED.format(value)}${suffix}`;
422
+ const reading = index === null ? null : data[index];
423
+ const total = (datum) => visible.reduce((sum, line) => sum + Math.max(0, datum.values[line.key] ?? 0), 0);
424
+ const activeLine = series.find((line) => line.key === activeKey);
425
+ const announce = reading ? `${reading.label}. ${activeLine && activeKey ? `${activeLine.label} ${format(reading.values[activeKey] ?? 0, activeLine)}, ` : ""}${visible.length} layers, ${GROUPED.format(total(reading))}${suffix} in total` : "";
426
+ const summary = empty ? `${label}. ${emptyLabel}.` : `${label}, ${data[0].label} to ${data[last].label}. ${visible.map((line) => `${line.label}, latest ${format(data[last].values[line.key] ?? 0, line)}`).join(". ")}.`;
427
+ const picks = axisPicks(data, plotWidth);
428
+ return /* @__PURE__ */ jsxs("figure", {
429
+ ref: refs,
430
+ "data-slot": "streamgraph",
431
+ "aria-label": label,
432
+ className: cn("streamgraph box-border font-sans text-foreground", className),
433
+ children: [
434
+ legend && series.length > 1 ? /* @__PURE__ */ jsx("div", {
435
+ role: "group",
436
+ "aria-label": `${label} layers`,
437
+ onPointerLeave: () => setLegendKey(null),
438
+ className: "-mx-2 flex min-w-0 flex-wrap gap-x-1 gap-y-0.5",
439
+ children: series.map((line, at) => /* @__PURE__ */ jsxs("button", {
440
+ type: "button",
441
+ "data-slot": "streamgraph-toggle",
442
+ "aria-pressed": !hidden.includes(line.key),
443
+ onClick: () => toggle(line.key),
444
+ onPointerEnter: (event) => {
445
+ if (event.pointerType === "mouse") setLegendKey(line.key);
446
+ },
447
+ onFocus: (event) => {
448
+ if (event.currentTarget.matches(":focus-visible")) setLegendKey(line.key);
449
+ },
450
+ onBlur: () => setLegendKey(null),
451
+ style: { "--series": colorOf(line, at) },
452
+ className: "chart-legend-toggle",
453
+ children: [/* @__PURE__ */ jsx("span", {
454
+ "aria-hidden": "true",
455
+ className: "chart-layer-swatch"
456
+ }), /* @__PURE__ */ jsx("span", {
457
+ className: "chart-toggle-label",
458
+ children: line.label
459
+ })]
460
+ }, line.key))
461
+ }) : null,
462
+ /* @__PURE__ */ jsxs("div", {
463
+ "data-slot": "streamgraph-chart",
464
+ "data-scrubbing": index !== null || void 0,
465
+ "data-focus": activeKey ? "" : void 0,
466
+ className: "streamgraph-frame",
467
+ children: [/* @__PURE__ */ jsxs("div", {
468
+ ref: plot,
469
+ role: "slider",
470
+ tabIndex: empty ? -1 : 0,
471
+ "aria-label": `${label}, explore by ${categoryLabel.toLowerCase()}`,
472
+ "aria-orientation": "horizontal",
473
+ "aria-valuemin": 1,
474
+ "aria-valuemax": Math.max(1, data.length),
475
+ "aria-valuenow": (index ?? last) + 1,
476
+ "aria-valuetext": reading ? announce : summary,
477
+ className: "line-chart-plot streamgraph-plot",
478
+ style: { height },
479
+ onPointerMove: (event) => {
480
+ if (event.pointerType === "mouse" || event.buttons) setHover(read(event.clientX, event.clientY));
481
+ },
482
+ onPointerDown: (event) => {
483
+ if (event.pointerType !== "mouse") event.currentTarget.setPointerCapture?.(event.pointerId);
484
+ setHover(read(event.clientX, event.clientY));
485
+ },
486
+ onPointerUp: (event) => {
487
+ if (event.pointerType !== "mouse") setHover(null);
488
+ },
489
+ onPointerCancel: () => setHover(null),
490
+ onPointerLeave: (event) => {
491
+ if (event.pointerType === "mouse") setHover(null);
492
+ },
493
+ onKeyDown,
494
+ onBlur: () => setHover(null),
495
+ onFocus: (event) => {
496
+ if (event.currentTarget.matches(":focus-visible") && !empty) setHover((now) => now ?? {
497
+ index: last,
498
+ key: null,
499
+ y: null
500
+ });
501
+ },
502
+ children: [
503
+ /* @__PURE__ */ jsxs("svg", {
504
+ ref: svg,
505
+ width: "100%",
506
+ height,
507
+ "aria-hidden": "true",
508
+ focusable: "false",
509
+ className: "block overflow-visible",
510
+ children: [
511
+ series.map((line, at) => /* @__PURE__ */ jsx("path", {
512
+ "data-layer": line.key,
513
+ "data-active": activeKey === line.key || void 0,
514
+ className: "streamgraph-layer",
515
+ style: { "--series": colorOf(line, at) }
516
+ }, line.key)),
517
+ /* @__PURE__ */ jsx("line", {
518
+ "data-part": "crosshair",
519
+ className: "line-chart-crosshair",
520
+ y1: 0,
521
+ y2: height
522
+ }),
523
+ directLabels ? series.map((line) => /* @__PURE__ */ jsx("text", {
524
+ "data-name": line.key,
525
+ "data-hidden": hidden.includes(line.key) || void 0,
526
+ "data-dim": activeKey !== null && activeKey !== line.key || void 0,
527
+ textAnchor: "middle",
528
+ dominantBaseline: "central",
529
+ className: "streamgraph-name",
530
+ children: line.label
531
+ }, line.key)) : null
532
+ ]
533
+ }),
534
+ /* @__PURE__ */ jsxs("div", {
535
+ ref: tip,
536
+ "aria-hidden": "true",
537
+ "data-slot": "streamgraph-tooltip",
538
+ className: "line-chart-tooltip",
539
+ children: [/* @__PURE__ */ jsx("p", {
540
+ className: "m-0 mb-0.5 whitespace-nowrap text-xs tabular-nums text-text-secondary",
541
+ children: reading?.label ?? ""
542
+ }), stackOrder(series.length, offset).reverse().map((at) => series[at]).filter((line) => !hidden.includes(line.key)).map((line) => /* @__PURE__ */ jsxs("p", {
543
+ "data-active": activeKey === line.key || void 0,
544
+ className: "streamgraph-tip-row",
545
+ style: { "--series": colorOf(line, series.indexOf(line)) },
546
+ children: [
547
+ /* @__PURE__ */ jsx("span", { className: "chart-tip-swatch" }),
548
+ /* @__PURE__ */ jsx("span", {
549
+ className: "streamgraph-tip-name",
550
+ children: line.label
551
+ }),
552
+ /* @__PURE__ */ jsx("span", {
553
+ className: "ms-2 flex-none whitespace-nowrap font-medium tabular-nums text-foreground",
554
+ children: reading ? format(reading.values[line.key] ?? 0, line) : ""
555
+ })
556
+ ]
557
+ }, line.key))]
558
+ }),
559
+ empty || visible.length === 0 ? /* @__PURE__ */ jsx("p", {
560
+ className: "pointer-events-none absolute inset-0 m-0 grid place-items-center text-sm text-muted-foreground motion-safe:animate-fade-in",
561
+ children: empty ? emptyLabel : "Choose a layer to show"
562
+ }) : null
563
+ ]
564
+ }), /* @__PURE__ */ jsx("div", {
565
+ "aria-hidden": "true",
566
+ className: "relative min-w-0 [grid-area:2/1]",
567
+ children: picks.map((at) => {
568
+ const share = last > 0 ? at / last : .5;
569
+ return /* @__PURE__ */ jsx("span", {
570
+ className: "absolute top-2 whitespace-nowrap text-xs leading-none tabular-nums text-muted-foreground motion-safe:animate-fade-in",
571
+ style: {
572
+ left: `${share * 100}%`,
573
+ translate: `${-share * 100}% 0`
574
+ },
575
+ children: data[at].axisLabel
576
+ }, data[at].key);
577
+ })
578
+ })]
579
+ }),
580
+ /* @__PURE__ */ jsx("p", {
581
+ className: "sr-only",
582
+ "aria-live": "polite",
583
+ "aria-atomic": "true",
584
+ children: announce
585
+ }),
586
+ /* @__PURE__ */ jsx("p", {
587
+ className: "sr-only",
588
+ children: summary
589
+ }),
590
+ empty ? null : /* @__PURE__ */ jsx("div", {
591
+ className: "sr-only",
592
+ children: /* @__PURE__ */ jsxs("table", { children: [
593
+ /* @__PURE__ */ jsx("caption", { children: label }),
594
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
595
+ scope: "col",
596
+ children: categoryLabel
597
+ }), series.map((line) => /* @__PURE__ */ jsx("th", {
598
+ scope: "col",
599
+ children: line.label
600
+ }, line.key))] }) }),
601
+ /* @__PURE__ */ jsx("tbody", { children: data.map((item) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
602
+ scope: "row",
603
+ children: item.label
604
+ }), series.map((line) => /* @__PURE__ */ jsx("td", { children: format(item.values[line.key] ?? 0, line) }, line.key))] }, item.key)) })
605
+ ] })
606
+ })
607
+ ]
608
+ });
609
+ });
610
+ //#endregion
611
+ export { Streamgraph };
612
+
613
+ //# sourceMappingURL=streamgraph.js.map