@devalok/shilp-sutra 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (541) hide show
  1. package/LICENSE +21 -21
  2. package/dist/_chunks/badge-group.js +306 -246
  3. package/dist/_chunks/badge-group.js.map +1 -0
  4. package/dist/_chunks/chat.js +518 -0
  5. package/dist/_chunks/chat.js.map +1 -0
  6. package/dist/_chunks/date-picker.js +748 -0
  7. package/dist/_chunks/date-picker.js.map +1 -0
  8. package/dist/_chunks/document-preview.js +109 -90
  9. package/dist/_chunks/document-preview.js.map +1 -0
  10. package/dist/_chunks/file-preview.js +492 -504
  11. package/dist/_chunks/file-preview.js.map +1 -0
  12. package/dist/_chunks/framer.js +5564 -5613
  13. package/dist/_chunks/framer.js.map +1 -0
  14. package/dist/_chunks/image-preview.js +127 -88
  15. package/dist/_chunks/image-preview.js.map +1 -0
  16. package/dist/_chunks/keybinding.js +12 -14
  17. package/dist/_chunks/keybinding.js.map +1 -0
  18. package/dist/_chunks/link-context.js +19 -16
  19. package/dist/_chunks/link-context.js.map +1 -0
  20. package/dist/_chunks/mention-suggestion.js +353 -350
  21. package/dist/_chunks/mention-suggestion.js.map +1 -0
  22. package/dist/_chunks/motion-provider.js +26 -20
  23. package/dist/_chunks/motion-provider.js.map +1 -0
  24. package/dist/_chunks/popover.js +123 -0
  25. package/dist/_chunks/popover.js.map +1 -0
  26. package/dist/_chunks/primitives.js +7585 -6426
  27. package/dist/_chunks/primitives.js.map +1 -0
  28. package/dist/_chunks/rich-chat-input.js +2071 -0
  29. package/dist/_chunks/rich-chat-input.js.map +1 -0
  30. package/dist/_chunks/rolldown-runtime.js +21 -0
  31. package/dist/_chunks/shared.js +126 -0
  32. package/dist/_chunks/shared.js.map +1 -0
  33. package/dist/_chunks/sonner.js +605 -734
  34. package/dist/_chunks/sonner.js.map +1 -0
  35. package/dist/_chunks/stat-row.js +418 -440
  36. package/dist/_chunks/stat-row.js.map +1 -0
  37. package/dist/_chunks/tiptap.js +15850 -19964
  38. package/dist/_chunks/tiptap.js.map +1 -0
  39. package/dist/_chunks/tree-view.js +231 -290
  40. package/dist/_chunks/tree-view.js.map +1 -0
  41. package/dist/_chunks/use-calendar.js +161 -208
  42. package/dist/_chunks/use-calendar.js.map +1 -0
  43. package/dist/_chunks/vendor-client.js +314 -2199
  44. package/dist/_chunks/vendor-client.js.map +1 -0
  45. package/dist/_chunks/vendor-utils.js +1721 -2978
  46. package/dist/_chunks/vendor-utils.js.map +1 -0
  47. package/dist/ai/ai-command-provider.js +23 -17
  48. package/dist/ai/ai-command-provider.js.map +1 -0
  49. package/dist/ai/block-renderer.js +68 -51
  50. package/dist/ai/block-renderer.js.map +1 -0
  51. package/dist/ai/blocks/index.js +2 -12
  52. package/dist/ai/blocks/loading.d.ts.map +1 -1
  53. package/dist/ai/command-bar.js +470 -519
  54. package/dist/ai/command-bar.js.map +1 -0
  55. package/dist/ai/conversation.js +241 -227
  56. package/dist/ai/conversation.js.map +1 -0
  57. package/dist/ai/devadoot-icon.d.ts.map +1 -1
  58. package/dist/ai/index.js +181 -167
  59. package/dist/ai/index.js.map +1 -0
  60. package/dist/ai/types.js +0 -1
  61. package/dist/composed/activity-feed.js +232 -202
  62. package/dist/composed/activity-feed.js.map +1 -0
  63. package/dist/composed/avatar-group.js +164 -222
  64. package/dist/composed/avatar-group.js.map +1 -0
  65. package/dist/composed/bulk-action-bar.js +166 -165
  66. package/dist/composed/bulk-action-bar.js.map +1 -0
  67. package/dist/composed/command-palette.js +290 -308
  68. package/dist/composed/command-palette.js.map +1 -0
  69. package/dist/composed/confirm-dialog.js +28 -48
  70. package/dist/composed/confirm-dialog.js.map +1 -0
  71. package/dist/composed/content-card.js +69 -108
  72. package/dist/composed/content-card.js.map +1 -0
  73. package/dist/composed/date-picker/index.js +3 -13
  74. package/dist/composed/deadline-indicator.js +68 -74
  75. package/dist/composed/deadline-indicator.js.map +1 -0
  76. package/dist/composed/emoji-picker.js +83 -110
  77. package/dist/composed/emoji-picker.js.map +1 -0
  78. package/dist/composed/empty-state.d.ts.map +1 -1
  79. package/dist/composed/empty-state.js +64 -103
  80. package/dist/composed/empty-state.js.map +1 -0
  81. package/dist/composed/error-boundary.js +129 -127
  82. package/dist/composed/error-boundary.js.map +1 -0
  83. package/dist/composed/file-preview.js +2 -12
  84. package/dist/composed/filter-bar.js +98 -130
  85. package/dist/composed/filter-bar.js.map +1 -0
  86. package/dist/composed/form-section.js +61 -45
  87. package/dist/composed/form-section.js.map +1 -0
  88. package/dist/composed/global-loading.js +34 -47
  89. package/dist/composed/global-loading.js.map +1 -0
  90. package/dist/composed/index.js +34 -92
  91. package/dist/composed/inline-edit.js +92 -107
  92. package/dist/composed/inline-edit.js.map +1 -0
  93. package/dist/composed/lib/string-utils.js +8 -8
  94. package/dist/composed/lib/string-utils.js.map +1 -0
  95. package/dist/composed/loading-skeleton.js +103 -171
  96. package/dist/composed/loading-skeleton.js.map +1 -0
  97. package/dist/composed/markdown-viewer.js +187 -139
  98. package/dist/composed/markdown-viewer.js.map +1 -0
  99. package/dist/composed/master-detail.js +147 -156
  100. package/dist/composed/master-detail.js.map +1 -0
  101. package/dist/composed/member-picker.js +46 -49
  102. package/dist/composed/member-picker.js.map +1 -0
  103. package/dist/composed/multi-select-popover.d.ts.map +1 -1
  104. package/dist/composed/multi-select-popover.js +185 -179
  105. package/dist/composed/multi-select-popover.js.map +1 -0
  106. package/dist/composed/page-header.js +54 -76
  107. package/dist/composed/page-header.js.map +1 -0
  108. package/dist/composed/page-skeletons.js +143 -127
  109. package/dist/composed/page-skeletons.js.map +1 -0
  110. package/dist/composed/priority-indicator.js +105 -111
  111. package/dist/composed/priority-indicator.js.map +1 -0
  112. package/dist/composed/responsive-overlay.js +36 -41
  113. package/dist/composed/responsive-overlay.js.map +1 -0
  114. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
  115. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
  116. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
  117. package/dist/composed/rich-chat-input.d.ts.map +1 -1
  118. package/dist/composed/rich-chat-input.js +2 -1860
  119. package/dist/composed/rich-text-editor.js +561 -424
  120. package/dist/composed/rich-text-editor.js.map +1 -0
  121. package/dist/composed/schedule-view.js +134 -185
  122. package/dist/composed/schedule-view.js.map +1 -0
  123. package/dist/composed/simple-tooltip.js +21 -21
  124. package/dist/composed/simple-tooltip.js.map +1 -0
  125. package/dist/composed/status-badge.d.ts.map +1 -1
  126. package/dist/composed/status-badge.js +133 -137
  127. package/dist/composed/status-badge.js.map +1 -0
  128. package/dist/hooks/index.js +7 -12
  129. package/dist/hooks/use-color-mode.js +28 -25
  130. package/dist/hooks/use-color-mode.js.map +1 -0
  131. package/dist/hooks/use-mobile.js +13 -13
  132. package/dist/hooks/use-mobile.js.map +1 -0
  133. package/dist/hooks/use-toast.js +2 -4
  134. package/dist/hooks/use-touch-device.js +9 -11
  135. package/dist/hooks/use-touch-device.js.map +1 -0
  136. package/dist/hooks/use-viewport-height.js +14 -14
  137. package/dist/hooks/use-viewport-height.js.map +1 -0
  138. package/dist/motion/check-motion-provider.d.ts +3 -0
  139. package/dist/motion/check-motion-provider.d.ts.map +1 -0
  140. package/dist/motion/index.js +17 -11
  141. package/dist/motion/index.js.map +1 -0
  142. package/dist/motion/primitives-index.js +226 -186
  143. package/dist/motion/primitives-index.js.map +1 -0
  144. package/dist/primitives/react-accordion.d.ts +114 -114
  145. package/dist/primitives/react-alert-dialog.d.ts +51 -51
  146. package/dist/primitives/react-aspect-ratio.d.ts +11 -11
  147. package/dist/primitives/react-avatar.d.ts +24 -24
  148. package/dist/primitives/react-checkbox.d.ts +50 -50
  149. package/dist/primitives/react-collapsible.d.ts +33 -33
  150. package/dist/primitives/react-context-menu.d.ts +96 -96
  151. package/dist/primitives/react-dialog.d.ts +103 -103
  152. package/dist/primitives/react-dropdown-menu.d.ts +97 -97
  153. package/dist/primitives/react-hover-card.d.ts +79 -79
  154. package/dist/primitives/react-label.d.ts +10 -10
  155. package/dist/primitives/react-menu.d.ts +169 -169
  156. package/dist/primitives/react-menubar.d.ts +115 -115
  157. package/dist/primitives/react-navigation-menu.d.ts +126 -126
  158. package/dist/primitives/react-popover.d.ts +85 -85
  159. package/dist/primitives/react-progress.d.ts +19 -19
  160. package/dist/primitives/react-radio-group.d.ts +58 -58
  161. package/dist/primitives/react-roving-focus.d.ts +49 -49
  162. package/dist/primitives/react-select.d.ts +137 -137
  163. package/dist/primitives/react-separator.d.ts +21 -21
  164. package/dist/primitives/react-slider.d.ts +75 -75
  165. package/dist/primitives/react-switch.d.ts +21 -21
  166. package/dist/primitives/react-tabs.d.ts +56 -56
  167. package/dist/primitives/react-toast.d.ts +120 -120
  168. package/dist/primitives/react-toggle-group.d.ts +75 -75
  169. package/dist/primitives/react-toggle.d.ts +24 -24
  170. package/dist/primitives/react-tooltip.d.ts +101 -101
  171. package/dist/primitives/react-visually-hidden.d.ts +22 -22
  172. package/dist/shell/app-command-palette.d.ts +2 -0
  173. package/dist/shell/app-command-palette.d.ts.map +1 -1
  174. package/dist/shell/app-command-palette.js +94 -238
  175. package/dist/shell/app-command-palette.js.map +1 -0
  176. package/dist/shell/bottom-navbar.js +150 -190
  177. package/dist/shell/bottom-navbar.js.map +1 -0
  178. package/dist/shell/command-registry.js +13 -14
  179. package/dist/shell/command-registry.js.map +1 -0
  180. package/dist/shell/index.js +10 -20
  181. package/dist/shell/link-context.js +2 -5
  182. package/dist/shell/notification-center.d.ts.map +1 -1
  183. package/dist/shell/notification-center.js +263 -259
  184. package/dist/shell/notification-center.js.map +1 -0
  185. package/dist/shell/notification-preferences.js +241 -184
  186. package/dist/shell/notification-preferences.js.map +1 -0
  187. package/dist/shell/sidebar.js +251 -281
  188. package/dist/shell/sidebar.js.map +1 -0
  189. package/dist/shell/top-bar.js +203 -237
  190. package/dist/shell/top-bar.js.map +1 -0
  191. package/dist/tailwind/index.cjs +473 -442
  192. package/dist/tailwind/index.js +2 -4
  193. package/dist/tailwind/preset.d.ts.map +1 -1
  194. package/dist/tailwind/preset.js +490 -459
  195. package/dist/tailwind/preset.js.map +1 -0
  196. package/dist/tokens/index.css +4 -4
  197. package/dist/tokens/primitives.css +442 -442
  198. package/dist/tokens/semantic.css +742 -547
  199. package/dist/tokens/typography-semantic.css +123 -100
  200. package/dist/tokens/typography.css +422 -422
  201. package/dist/ui/accordion.js +52 -60
  202. package/dist/ui/accordion.js.map +1 -0
  203. package/dist/ui/alert-dialog.d.ts +6 -2
  204. package/dist/ui/alert-dialog.d.ts.map +1 -1
  205. package/dist/ui/alert-dialog.js +112 -156
  206. package/dist/ui/alert-dialog.js.map +1 -0
  207. package/dist/ui/alert.d.ts +3 -2
  208. package/dist/ui/alert.d.ts.map +1 -1
  209. package/dist/ui/alert.js +203 -99
  210. package/dist/ui/alert.js.map +1 -0
  211. package/dist/ui/aspect-ratio.js +13 -16
  212. package/dist/ui/aspect-ratio.js.map +1 -0
  213. package/dist/ui/autocomplete.d.ts.map +1 -1
  214. package/dist/ui/autocomplete.js +137 -148
  215. package/dist/ui/autocomplete.js.map +1 -0
  216. package/dist/ui/avatar.js +196 -169
  217. package/dist/ui/avatar.js.map +1 -0
  218. package/dist/ui/badge-group.js +2 -7
  219. package/dist/ui/badge-indicator.js +42 -51
  220. package/dist/ui/badge-indicator.js.map +1 -0
  221. package/dist/ui/badge.js +2 -15
  222. package/dist/ui/banner.js +76 -68
  223. package/dist/ui/banner.js.map +1 -0
  224. package/dist/ui/breadcrumb.js +65 -84
  225. package/dist/ui/breadcrumb.js.map +1 -0
  226. package/dist/ui/button-group.js +109 -102
  227. package/dist/ui/button-group.js.map +1 -0
  228. package/dist/ui/button-processing.d.ts.map +1 -1
  229. package/dist/ui/button-processing.js +89 -72
  230. package/dist/ui/button-processing.js.map +1 -0
  231. package/dist/ui/button.js +393 -279
  232. package/dist/ui/button.js.map +1 -0
  233. package/dist/ui/card.js +151 -157
  234. package/dist/ui/card.js.map +1 -0
  235. package/dist/ui/charts/bar-chart.d.ts.map +1 -1
  236. package/dist/ui/charts/chart-container.d.ts +2 -0
  237. package/dist/ui/charts/chart-container.d.ts.map +1 -1
  238. package/dist/ui/charts/index.js +1025 -1319
  239. package/dist/ui/charts/index.js.map +1 -0
  240. package/dist/ui/charts/line-chart.d.ts.map +1 -1
  241. package/dist/ui/chat/index.js +2 -11
  242. package/dist/ui/chat/message-input.d.ts.map +1 -1
  243. package/dist/ui/chat/message-list.d.ts +1 -1
  244. package/dist/ui/chat/message-list.d.ts.map +1 -1
  245. package/dist/ui/chat/message.d.ts.map +1 -1
  246. package/dist/ui/chat/system-message.d.ts.map +1 -1
  247. package/dist/ui/checkbox.d.ts.map +1 -1
  248. package/dist/ui/checkbox.js +82 -100
  249. package/dist/ui/checkbox.js.map +1 -0
  250. package/dist/ui/code.js +18 -32
  251. package/dist/ui/code.js.map +1 -0
  252. package/dist/ui/collapsible.js +21 -29
  253. package/dist/ui/collapsible.js.map +1 -0
  254. package/dist/ui/color-input.d.ts.map +1 -1
  255. package/dist/ui/color-input.js +455 -372
  256. package/dist/ui/color-input.js.map +1 -0
  257. package/dist/ui/color-swatch.js +60 -90
  258. package/dist/ui/color-swatch.js.map +1 -0
  259. package/dist/ui/combobox.d.ts +7 -0
  260. package/dist/ui/combobox.d.ts.map +1 -1
  261. package/dist/ui/combobox.js +278 -293
  262. package/dist/ui/combobox.js.map +1 -0
  263. package/dist/ui/container.js +18 -24
  264. package/dist/ui/container.js.map +1 -0
  265. package/dist/ui/context-menu.js +154 -203
  266. package/dist/ui/context-menu.js.map +1 -0
  267. package/dist/ui/data-table-body.js +116 -213
  268. package/dist/ui/data-table-body.js.map +1 -0
  269. package/dist/ui/data-table-bulk-actions.js +43 -59
  270. package/dist/ui/data-table-bulk-actions.js.map +1 -0
  271. package/dist/ui/data-table-card.js +84 -71
  272. package/dist/ui/data-table-card.js.map +1 -0
  273. package/dist/ui/data-table-context.js +39 -42
  274. package/dist/ui/data-table-context.js.map +1 -0
  275. package/dist/ui/data-table-header.js +98 -139
  276. package/dist/ui/data-table-header.js.map +1 -0
  277. package/dist/ui/data-table-pagination.js +69 -82
  278. package/dist/ui/data-table-pagination.js.map +1 -0
  279. package/dist/ui/data-table-toolbar.js +104 -130
  280. package/dist/ui/data-table-toolbar.js.map +1 -0
  281. package/dist/ui/data-table.js +281 -354
  282. package/dist/ui/data-table.js.map +1 -0
  283. package/dist/ui/devalok-grain.js +77 -66
  284. package/dist/ui/devalok-grain.js.map +1 -0
  285. package/dist/ui/dialog.js +118 -151
  286. package/dist/ui/dialog.js.map +1 -0
  287. package/dist/ui/dropdown-menu.js +152 -203
  288. package/dist/ui/dropdown-menu.js.map +1 -0
  289. package/dist/ui/file-upload.js +242 -266
  290. package/dist/ui/file-upload.js.map +1 -0
  291. package/dist/ui/form.d.ts +8 -0
  292. package/dist/ui/form.d.ts.map +1 -1
  293. package/dist/ui/form.js +62 -56
  294. package/dist/ui/form.js.map +1 -0
  295. package/dist/ui/hover-card.js +54 -54
  296. package/dist/ui/hover-card.js.map +1 -0
  297. package/dist/ui/icon-button.js +21 -26
  298. package/dist/ui/icon-button.js.map +1 -0
  299. package/dist/ui/icon-context.js +17 -17
  300. package/dist/ui/icon-context.js.map +1 -0
  301. package/dist/ui/icon-group.js +22 -29
  302. package/dist/ui/icon-group.js.map +1 -0
  303. package/dist/ui/icon.js +201 -121
  304. package/dist/ui/icon.js.map +1 -0
  305. package/dist/ui/index.d.ts +4 -4
  306. package/dist/ui/index.d.ts.map +1 -1
  307. package/dist/ui/index.js +90 -350
  308. package/dist/ui/index.js.map +1 -0
  309. package/dist/ui/input-otp.d.ts +12 -3
  310. package/dist/ui/input-otp.d.ts.map +1 -1
  311. package/dist/ui/input-otp.js +58 -48
  312. package/dist/ui/input-otp.js.map +1 -0
  313. package/dist/ui/input.d.ts.map +1 -1
  314. package/dist/ui/input.js +93 -169
  315. package/dist/ui/input.js.map +1 -0
  316. package/dist/ui/label.d.ts.map +1 -1
  317. package/dist/ui/label.js +23 -23
  318. package/dist/ui/label.js.map +1 -0
  319. package/dist/ui/lib/check-tokens.d.ts +3 -0
  320. package/dist/ui/lib/check-tokens.d.ts.map +1 -0
  321. package/dist/ui/lib/date-utils.js +14 -11
  322. package/dist/ui/lib/date-utils.js.map +1 -0
  323. package/dist/ui/lib/motion.d.ts +15 -4
  324. package/dist/ui/lib/motion.d.ts.map +1 -1
  325. package/dist/ui/lib/motion.js +83 -33
  326. package/dist/ui/lib/motion.js.map +1 -0
  327. package/dist/ui/lib/utils.js +39 -16
  328. package/dist/ui/lib/utils.js.map +1 -0
  329. package/dist/ui/link.js +13 -24
  330. package/dist/ui/link.js.map +1 -0
  331. package/dist/ui/menubar.js +132 -210
  332. package/dist/ui/menubar.js.map +1 -0
  333. package/dist/ui/navigation-menu.js +163 -193
  334. package/dist/ui/navigation-menu.js.map +1 -0
  335. package/dist/ui/number-input.d.ts +16 -1
  336. package/dist/ui/number-input.d.ts.map +1 -1
  337. package/dist/ui/number-input.js +102 -95
  338. package/dist/ui/number-input.js.map +1 -0
  339. package/dist/ui/pagination.js +122 -159
  340. package/dist/ui/pagination.js.map +1 -0
  341. package/dist/ui/popover.js +2 -131
  342. package/dist/ui/progress-ring.d.ts.map +1 -1
  343. package/dist/ui/progress-ring.js +133 -143
  344. package/dist/ui/progress-ring.js.map +1 -0
  345. package/dist/ui/progress.js +51 -95
  346. package/dist/ui/progress.js.map +1 -0
  347. package/dist/ui/radio.d.ts.map +1 -1
  348. package/dist/ui/radio.js +47 -49
  349. package/dist/ui/radio.js.map +1 -0
  350. package/dist/ui/search-input.js +51 -53
  351. package/dist/ui/search-input.js.map +1 -0
  352. package/dist/ui/segmented-control.d.ts +1 -1
  353. package/dist/ui/segmented-control.d.ts.map +1 -1
  354. package/dist/ui/segmented-control.js +95 -114
  355. package/dist/ui/segmented-control.js.map +1 -0
  356. package/dist/ui/select.d.ts.map +1 -1
  357. package/dist/ui/select.js +137 -157
  358. package/dist/ui/select.js.map +1 -0
  359. package/dist/ui/separator.d.ts.map +1 -1
  360. package/dist/ui/separator.js +18 -25
  361. package/dist/ui/separator.js.map +1 -0
  362. package/dist/ui/sheet.js +135 -163
  363. package/dist/ui/sheet.js.map +1 -0
  364. package/dist/ui/sidebar.js +357 -600
  365. package/dist/ui/sidebar.js.map +1 -0
  366. package/dist/ui/skeleton.js +179 -231
  367. package/dist/ui/skeleton.js.map +1 -0
  368. package/dist/ui/slider.d.ts +22 -3
  369. package/dist/ui/slider.d.ts.map +1 -1
  370. package/dist/ui/slider.js +62 -34
  371. package/dist/ui/slider.js.map +1 -0
  372. package/dist/ui/spinner.js +226 -205
  373. package/dist/ui/spinner.js.map +1 -0
  374. package/dist/ui/split-button.d.ts.map +1 -1
  375. package/dist/ui/split-button.js +228 -276
  376. package/dist/ui/split-button.js.map +1 -0
  377. package/dist/ui/stack.js +56 -70
  378. package/dist/ui/stack.js.map +1 -0
  379. package/dist/ui/stat-card.js +259 -251
  380. package/dist/ui/stat-card.js.map +1 -0
  381. package/dist/ui/status-dot.js +67 -63
  382. package/dist/ui/status-dot.js.map +1 -0
  383. package/dist/ui/stepper.d.ts +10 -0
  384. package/dist/ui/stepper.d.ts.map +1 -1
  385. package/dist/ui/stepper.js +124 -168
  386. package/dist/ui/stepper.js.map +1 -0
  387. package/dist/ui/switch.d.ts.map +1 -1
  388. package/dist/ui/switch.js +56 -55
  389. package/dist/ui/switch.js.map +1 -0
  390. package/dist/ui/table.js +57 -90
  391. package/dist/ui/table.js.map +1 -0
  392. package/dist/ui/tabs.d.ts +3 -1
  393. package/dist/ui/tabs.d.ts.map +1 -1
  394. package/dist/ui/tabs.js +159 -156
  395. package/dist/ui/tabs.js.map +1 -0
  396. package/dist/ui/text.d.ts +1 -1
  397. package/dist/ui/text.d.ts.map +1 -1
  398. package/dist/ui/text.js +60 -59
  399. package/dist/ui/text.js.map +1 -0
  400. package/dist/ui/textarea.js +40 -57
  401. package/dist/ui/textarea.js.map +1 -0
  402. package/dist/ui/toast-registry.d.ts +8 -0
  403. package/dist/ui/toast-registry.d.ts.map +1 -0
  404. package/dist/ui/toast-registry.js +13 -0
  405. package/dist/ui/toast-registry.js.map +1 -0
  406. package/dist/ui/toast-types.js +0 -1
  407. package/dist/ui/toast.d.ts.map +1 -1
  408. package/dist/ui/toast.js +559 -536
  409. package/dist/ui/toast.js.map +1 -0
  410. package/dist/ui/toaster.d.ts.map +1 -1
  411. package/dist/ui/toaster.js +24 -33
  412. package/dist/ui/toaster.js.map +1 -0
  413. package/dist/ui/toggle-group.d.ts +2 -0
  414. package/dist/ui/toggle-group.d.ts.map +1 -1
  415. package/dist/ui/toggle-group.js +44 -41
  416. package/dist/ui/toggle-group.js.map +1 -0
  417. package/dist/ui/toggle.d.ts +2 -0
  418. package/dist/ui/toggle.d.ts.map +1 -1
  419. package/dist/ui/toggle.js +44 -40
  420. package/dist/ui/toggle.js.map +1 -0
  421. package/dist/ui/tooltip.js +80 -65
  422. package/dist/ui/tooltip.js.map +1 -0
  423. package/dist/ui/tree-view/index.js +2 -6
  424. package/dist/ui/visually-hidden.js +12 -10
  425. package/dist/ui/visually-hidden.js.map +1 -0
  426. package/docs/components/_header.md +85 -85
  427. package/docs/components/composed/activity-feed.md +62 -62
  428. package/docs/components/composed/avatar-group.md +65 -65
  429. package/docs/components/composed/bulk-action-bar.md +40 -40
  430. package/docs/components/composed/command-palette.md +40 -40
  431. package/docs/components/composed/confirm-dialog.md +46 -46
  432. package/docs/components/composed/content-card.md +36 -36
  433. package/docs/components/composed/date-picker.md +130 -130
  434. package/docs/components/composed/deadline-indicator.md +27 -27
  435. package/docs/components/composed/emoji-picker.md +52 -52
  436. package/docs/components/composed/empty-state.md +53 -53
  437. package/docs/components/composed/error-boundary.md +29 -29
  438. package/docs/components/composed/file-preview.md +40 -40
  439. package/docs/components/composed/filter-bar.md +57 -57
  440. package/docs/components/composed/form-section.md +31 -31
  441. package/docs/components/composed/global-loading.md +27 -27
  442. package/docs/components/composed/inline-edit.md +35 -35
  443. package/docs/components/composed/loading-skeleton.md +51 -51
  444. package/docs/components/composed/markdown-viewer.md +27 -27
  445. package/docs/components/composed/master-detail.md +48 -48
  446. package/docs/components/composed/member-picker.md +35 -35
  447. package/docs/components/composed/multi-select-popover.md +62 -62
  448. package/docs/components/composed/page-header.md +41 -41
  449. package/docs/components/composed/page-skeletons.md +32 -32
  450. package/docs/components/composed/priority-indicator.md +32 -32
  451. package/docs/components/composed/responsive-overlay.md +34 -34
  452. package/docs/components/composed/rich-text-editor.md +82 -82
  453. package/docs/components/composed/schedule-view.md +39 -39
  454. package/docs/components/composed/simple-tooltip.md +33 -33
  455. package/docs/components/composed/status-badge.md +55 -55
  456. package/docs/components/shell/app-command-palette.md +44 -44
  457. package/docs/components/shell/bottom-navbar.md +52 -52
  458. package/docs/components/shell/command-registry.md +48 -48
  459. package/docs/components/shell/link-context.md +41 -41
  460. package/docs/components/shell/notification-center.md +63 -63
  461. package/docs/components/shell/notification-preferences.md +42 -42
  462. package/docs/components/shell/sidebar.md +92 -92
  463. package/docs/components/shell/top-bar.md +143 -143
  464. package/docs/components/ui/accordion.md +51 -51
  465. package/docs/components/ui/alert-dialog.md +61 -61
  466. package/docs/components/ui/alert.md +46 -46
  467. package/docs/components/ui/aspect-ratio.md +25 -25
  468. package/docs/components/ui/autocomplete.md +48 -48
  469. package/docs/components/ui/avatar.md +56 -56
  470. package/docs/components/ui/badge.md +83 -82
  471. package/docs/components/ui/banner.md +42 -42
  472. package/docs/components/ui/breadcrumb.md +37 -37
  473. package/docs/components/ui/button-group.md +41 -41
  474. package/docs/components/ui/button.md +94 -93
  475. package/docs/components/ui/card.md +52 -52
  476. package/docs/components/ui/charts.md +43 -43
  477. package/docs/components/ui/checkbox.md +36 -36
  478. package/docs/components/ui/chip.md +47 -47
  479. package/docs/components/ui/code.md +28 -28
  480. package/docs/components/ui/collapsible.md +40 -40
  481. package/docs/components/ui/color-input.md +91 -91
  482. package/docs/components/ui/color-swatch.md +25 -25
  483. package/docs/components/ui/combobox.md +54 -54
  484. package/docs/components/ui/container.md +26 -26
  485. package/docs/components/ui/context-menu.md +43 -43
  486. package/docs/components/ui/data-table-body.md +1 -1
  487. package/docs/components/ui/data-table-bulk-actions.md +1 -1
  488. package/docs/components/ui/data-table-card.md +1 -1
  489. package/docs/components/ui/data-table-context.md +1 -1
  490. package/docs/components/ui/data-table-header.md +1 -1
  491. package/docs/components/ui/data-table-pagination.md +1 -1
  492. package/docs/components/ui/data-table-toolbar.md +44 -44
  493. package/docs/components/ui/data-table.md +94 -94
  494. package/docs/components/ui/dialog.md +54 -54
  495. package/docs/components/ui/dropdown-menu.md +48 -48
  496. package/docs/components/ui/file-upload.md +41 -41
  497. package/docs/components/ui/form.md +51 -51
  498. package/docs/components/ui/hover-card.md +32 -32
  499. package/docs/components/ui/icon-button.md +40 -40
  500. package/docs/components/ui/input-otp.md +44 -44
  501. package/docs/components/ui/input.md +74 -74
  502. package/docs/components/ui/label.md +25 -25
  503. package/docs/components/ui/link.md +29 -29
  504. package/docs/components/ui/menubar.md +44 -44
  505. package/docs/components/ui/navigation-menu.md +46 -46
  506. package/docs/components/ui/number-input.md +44 -44
  507. package/docs/components/ui/pagination.md +48 -48
  508. package/docs/components/ui/popover.md +30 -30
  509. package/docs/components/ui/progress-ring.md +41 -41
  510. package/docs/components/ui/progress.md +34 -34
  511. package/docs/components/ui/radio.md +34 -34
  512. package/docs/components/ui/search-input.md +43 -43
  513. package/docs/components/ui/segmented-control.md +50 -50
  514. package/docs/components/ui/select.md +53 -53
  515. package/docs/components/ui/separator.md +32 -32
  516. package/docs/components/ui/sheet.md +47 -47
  517. package/docs/components/ui/sidebar.md +72 -72
  518. package/docs/components/ui/skeleton.md +77 -77
  519. package/docs/components/ui/slider.md +29 -29
  520. package/docs/components/ui/spinner.md +54 -54
  521. package/docs/components/ui/stack.md +39 -39
  522. package/docs/components/ui/stat-card.md +61 -61
  523. package/docs/components/ui/status-dot.md +26 -26
  524. package/docs/components/ui/stepper.md +49 -49
  525. package/docs/components/ui/switch.md +47 -47
  526. package/docs/components/ui/table.md +47 -47
  527. package/docs/components/ui/tabs.md +60 -60
  528. package/docs/components/ui/text.md +37 -37
  529. package/docs/components/ui/textarea.md +39 -39
  530. package/docs/components/ui/toast.md +65 -65
  531. package/docs/components/ui/toaster.md +47 -47
  532. package/docs/components/ui/toggle-group.md +43 -43
  533. package/docs/components/ui/toggle.md +37 -37
  534. package/docs/components/ui/tooltip.md +38 -38
  535. package/docs/components/ui/tree-view.md +65 -65
  536. package/docs/components/ui/visually-hidden.md +21 -21
  537. package/llms-full.txt +5266 -5264
  538. package/llms.txt +624 -580
  539. package/package.json +7 -8
  540. package/dist/_chunks/date-time-picker.js +0 -851
  541. package/dist/_chunks/typing-indicator.js +0 -565
@@ -1,1330 +1,1036 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as p, Fragment as te } from "react/jsx-runtime";
3
- import * as ne from "react";
4
- import { useRef as ye, useState as me, useEffect as xe, useCallback as Re } from "react";
5
- import { cn as H } from "../lib/utils.js";
6
- import { scaleBand as Xe, scaleLinear as oe, scalePoint as Le } from "d3-scale";
7
- import { tweens as se, motionProps as ce } from "../lib/motion.js";
8
- import { axisLeft as De, axisBottom as Pe, axisRight as ze, axisTop as Be } from "d3-axis";
9
- import { select as Ve } from "d3-selection";
10
- import { u as _e } from "../../_chunks/motion-provider.js";
11
- import { m as re } from "../../_chunks/framer.js";
12
- import { line as he, curveMonotoneX as de, curveLinear as Ae, stack as je, stackOrderNone as Te, stackOffsetNone as Ye, area as Ne, pie as Oe, arc as ve, lineRadial as We, curveLinearClosed as Ie } from "d3-shape";
13
- const Fe = {
14
- top: 20,
15
- right: 20,
16
- bottom: 40,
17
- left: 50
18
- }, be = ne.forwardRef(
19
- ({
20
- height: t = 300,
21
- margin: a,
22
- className: o,
23
- ariaLabel: x = "Chart",
24
- children: d,
25
- ...M
26
- }, i) => {
27
- const k = ye(null), [G, P] = me(0), v = { ...Fe, ...a };
28
- xe(() => {
29
- if (!k.current) return;
30
- const B = new ResizeObserver((N) => {
31
- const z = N[0];
32
- z && P(z.contentRect.width);
33
- });
34
- return B.observe(k.current), () => B.disconnect();
35
- }, []);
36
- const R = Math.max(0, G - v.left - v.right), Z = Math.max(0, t - v.top - v.bottom);
37
- return /* @__PURE__ */ e(
38
- "div",
39
- {
40
- ref: (B) => {
41
- k.current = B, typeof i == "function" ? i(B) : i && (i.current = B);
42
- },
43
- className: H("relative w-full", o),
44
- ...M,
45
- children: G > 0 && /* @__PURE__ */ e("svg", { width: G, height: t, role: "img", "aria-label": x, children: /* @__PURE__ */ e("g", { transform: `translate(${v.left},${v.top})`, children: d({ width: R, height: Z, margin: v }) }) })
46
- }
47
- );
48
- }
49
- );
50
- be.displayName = "ChartContainer";
51
- function ee({
52
- scale: t,
53
- orientation: a,
54
- transform: o,
55
- tickCount: x,
56
- tickFormat: d,
57
- label: M,
58
- className: i
59
- }) {
60
- const k = ye(null);
61
- return xe(() => {
62
- if (!k.current) return;
63
- const P = {
64
- top: Be,
65
- right: ze,
66
- bottom: Pe,
67
- left: De
68
- }[a];
69
- let v = P(t);
70
- x && (v = v.ticks(x)), d && (v = v.tickFormat(d));
71
- const R = Ve(k.current);
72
- R.call(v), R.selectAll(".tick line").attr("stroke", "var(--color-surface-border)"), R.selectAll(".tick text").attr("fill", "var(--color-surface-fg-muted)").attr("font-size", "var(--font-size-xs)"), R.selectAll(".domain").attr("stroke", "var(--color-surface-border-strong)");
73
- }, [t, a, x, d]), /* @__PURE__ */ e("g", { ref: k, transform: o, className: i, children: M && /* @__PURE__ */ e(
74
- "text",
75
- {
76
- textAnchor: "middle",
77
- fill: "var(--color-surface-fg-muted)",
78
- fontSize: "var(--font-size-sm)",
79
- ...a === "bottom" ? { x: "50%", dy: 35 } : a === "left" ? { transform: "rotate(-90)", y: -40, x: 0 } : {},
80
- children: M
81
- }
82
- ) });
2
+ import { a as e } from "../../_chunks/framer.js";
3
+ import { motionProps as t, tweens as n } from "../lib/motion.js";
4
+ import { cn as r } from "../lib/utils.js";
5
+ import { n as i } from "../../_chunks/motion-provider.js";
6
+ import * as a from "react";
7
+ import { useCallback as o, useEffect as s, useRef as c, useState as l } from "react";
8
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { scaleBand as p, scaleLinear as m, scalePoint as h } from "d3-scale";
10
+ import { axisBottom as g, axisLeft as _, axisRight as v, axisTop as y } from "d3-axis";
11
+ import { select as b } from "d3-selection";
12
+ import { arc as x, area as S, curveLinear as C, curveLinearClosed as w, curveMonotoneX as T, line as E, lineRadial as D, pie as O, stack as k, stackOffsetNone as A, stackOrderNone as j } from "d3-shape";
13
+ //#region src/ui/charts/_internal/types.ts
14
+ var M = {
15
+ top: 20,
16
+ right: 20,
17
+ bottom: 40,
18
+ left: 50
19
+ }, N = a.forwardRef(({ height: e = 300, margin: t, className: n, ariaLabel: i = "Chart", ariaDescription: a, children: o, ...u }, p) => {
20
+ let m = c(null), [h, g] = l(0), _ = {
21
+ ...M,
22
+ ...t
23
+ };
24
+ s(() => {
25
+ if (!m.current) return;
26
+ let e = new ResizeObserver((e) => {
27
+ let t = e[0];
28
+ t && g(t.contentRect.width);
29
+ });
30
+ return e.observe(m.current), () => e.disconnect();
31
+ }, []);
32
+ let v = Math.max(0, h - _.left - _.right), y = Math.max(0, e - _.top - _.bottom);
33
+ return /* @__PURE__ */ d("div", {
34
+ ref: (e) => {
35
+ m.current = e, typeof p == "function" ? p(e) : p && (p.current = e);
36
+ },
37
+ className: r("relative w-full", n),
38
+ ...u,
39
+ children: h > 0 && /* @__PURE__ */ f("svg", {
40
+ width: h,
41
+ height: e,
42
+ role: "img",
43
+ "aria-label": i,
44
+ children: [a && /* @__PURE__ */ d("desc", { children: a }), /* @__PURE__ */ d("g", {
45
+ transform: `translate(${_.left},${_.top})`,
46
+ children: o({
47
+ width: v,
48
+ height: y,
49
+ margin: _
50
+ })
51
+ })]
52
+ })
53
+ });
54
+ });
55
+ N.displayName = "ChartContainer";
56
+ //#endregion
57
+ //#region src/ui/charts/_internal/axes.tsx
58
+ function P({ scale: e, orientation: t, transform: n, tickCount: r, tickFormat: i, label: a, className: o }) {
59
+ let l = c(null);
60
+ return s(() => {
61
+ if (!l.current) return;
62
+ let n = {
63
+ top: y,
64
+ right: v,
65
+ bottom: g,
66
+ left: _
67
+ }[t], a = n(e);
68
+ r && (a = a.ticks(r)), i && (a = a.tickFormat(i));
69
+ let o = b(l.current);
70
+ o.call(a), o.selectAll(".tick line").attr("stroke", "var(--color-surface-border)"), o.selectAll(".tick text").attr("fill", "var(--color-surface-fg-muted)").attr("font-size", "var(--font-size-xs)"), o.selectAll(".domain").attr("stroke", "var(--color-surface-border-strong)");
71
+ }, [
72
+ e,
73
+ t,
74
+ r,
75
+ i
76
+ ]), /* @__PURE__ */ d("g", {
77
+ ref: l,
78
+ transform: n,
79
+ className: o,
80
+ children: a && /* @__PURE__ */ d("text", {
81
+ textAnchor: "middle",
82
+ fill: "var(--color-surface-fg-muted)",
83
+ fontSize: "var(--font-size-sm)",
84
+ ...t === "bottom" ? {
85
+ x: "50%",
86
+ dy: 35
87
+ } : t === "left" ? {
88
+ transform: "rotate(-90)",
89
+ y: -40,
90
+ x: 0
91
+ } : {},
92
+ children: a
93
+ })
94
+ });
83
95
  }
84
- ee.displayName = "Axis";
85
- function fe({
86
- width: t,
87
- height: a,
88
- xScale: o,
89
- yScale: x,
90
- horizontal: d = !0,
91
- vertical: M = !1
92
- }) {
93
- return /* @__PURE__ */ p("g", { className: "grid-lines", children: [
94
- d && x?.ticks && x.ticks().map((i, k) => /* @__PURE__ */ e(
95
- "line",
96
- {
97
- x1: 0,
98
- x2: t,
99
- y1: x(i),
100
- y2: x(i),
101
- stroke: "var(--color-surface-border)",
102
- strokeDasharray: "3,3",
103
- opacity: 0.6
104
- },
105
- `h-${k}`
106
- )),
107
- M && o?.ticks && o.ticks().map((i, k) => /* @__PURE__ */ e(
108
- "line",
109
- {
110
- x1: o(i),
111
- x2: o(i),
112
- y1: 0,
113
- y2: a,
114
- stroke: "var(--color-surface-border)",
115
- strokeDasharray: "3,3",
116
- opacity: 0.6
117
- },
118
- `v-${k}`
119
- ))
120
- ] });
96
+ P.displayName = "Axis";
97
+ //#endregion
98
+ //#region src/ui/charts/_internal/grid-lines.tsx
99
+ function F({ width: e, height: t, xScale: n, yScale: r, horizontal: i = !0, vertical: a = !1 }) {
100
+ return /* @__PURE__ */ f("g", {
101
+ className: "grid-lines",
102
+ children: [i && r?.ticks && r.ticks().map((t, n) => /* @__PURE__ */ d("line", {
103
+ x1: 0,
104
+ x2: e,
105
+ y1: r(t),
106
+ y2: r(t),
107
+ stroke: "var(--color-surface-border)",
108
+ strokeDasharray: "3,3",
109
+ opacity: .6
110
+ }, `h-${n}`)), a && n?.ticks && n.ticks().map((e, r) => /* @__PURE__ */ d("line", {
111
+ x1: n(e),
112
+ x2: n(e),
113
+ y1: 0,
114
+ y2: t,
115
+ stroke: "var(--color-surface-border)",
116
+ strokeDasharray: "3,3",
117
+ opacity: .6
118
+ }, `v-${r}`))]
119
+ });
121
120
  }
122
- fe.displayName = "GridLines";
123
- function ie({ items: t, position: a = "bottom", className: o }) {
124
- return /* @__PURE__ */ e(
125
- "div",
126
- {
127
- className: H(
128
- "flex gap-ds-04 text-ds-sm text-surface-fg-muted",
129
- a === "left" || a === "right" ? "flex-col" : "flex-row flex-wrap justify-center",
130
- o
131
- ),
132
- children: t.map((d) => /* @__PURE__ */ p("div", { className: "flex items-center gap-ds-02", children: [
133
- /* @__PURE__ */ e(
134
- "span",
135
- {
136
- className: "inline-block h-3 w-3 shrink-0 rounded-ds-sm",
137
- style: { backgroundColor: d.color }
138
- }
139
- ),
140
- /* @__PURE__ */ e("span", { children: d.label })
141
- ] }, d.label))
142
- }
143
- );
121
+ F.displayName = "GridLines";
122
+ //#endregion
123
+ //#region src/ui/charts/_internal/legend.tsx
124
+ function I({ items: e, position: t = "bottom", className: n }) {
125
+ return /* @__PURE__ */ d("div", {
126
+ className: r("flex gap-ds-04 text-ds-sm text-surface-fg-muted", t === "left" || t === "right" ? "flex-col" : "flex-row flex-wrap justify-center", n),
127
+ children: e.map((e) => /* @__PURE__ */ f("div", {
128
+ className: "flex items-center gap-ds-02",
129
+ children: [/* @__PURE__ */ d("span", {
130
+ className: "inline-block h-3 w-3 shrink-0 rounded-ds-sm",
131
+ style: { backgroundColor: e.color }
132
+ }), /* @__PURE__ */ d("span", { children: e.label })]
133
+ }, e.label))
134
+ });
144
135
  }
145
- ie.displayName = "Legend";
146
- function ue({ state: t, className: a }) {
147
- return t.visible ? /* @__PURE__ */ e(
148
- "div",
149
- {
150
- className: H(
151
- "pointer-events-none absolute z-tooltip",
152
- "rounded-ds-md border border-surface-border-strong",
153
- "bg-surface-overlay px-ds-03 py-ds-02",
154
- "shadow-raised-hover",
155
- "text-ds-sm text-surface-fg",
156
- a
157
- ),
158
- style: { left: t.x + 12, top: t.y - 12 },
159
- children: t.content
160
- }
161
- ) : null;
136
+ I.displayName = "Legend";
137
+ //#endregion
138
+ //#region src/ui/charts/_internal/tooltip.tsx
139
+ function L({ state: e, className: t }) {
140
+ return e.visible ? /* @__PURE__ */ d("div", {
141
+ className: r("pointer-events-none absolute z-tooltip", "rounded-ds-md border border-surface-border-strong", "bg-surface-overlay px-ds-03 py-ds-02", "shadow-raised-hover", "text-ds-sm text-surface-fg", t),
142
+ style: {
143
+ left: e.x + 12,
144
+ top: e.y - 12
145
+ },
146
+ children: e.content
147
+ }) : null;
162
148
  }
163
- ue.displayName = "ChartTooltip";
164
- function pe() {
165
- const [t, a] = me({
166
- visible: !1,
167
- x: 0,
168
- y: 0,
169
- content: null
170
- }), o = Re((d, M, i) => {
171
- a({ visible: !0, x: d, y: M, content: i });
172
- }, []), x = Re(() => {
173
- a((d) => ({ ...d, visible: !1 }));
174
- }, []);
175
- return { tooltip: t, show: o, hide: x };
149
+ L.displayName = "ChartTooltip";
150
+ function R() {
151
+ let [e, t] = l({
152
+ visible: !1,
153
+ x: 0,
154
+ y: 0,
155
+ content: null
156
+ });
157
+ return {
158
+ tooltip: e,
159
+ show: o((e, n, r) => {
160
+ t({
161
+ visible: !0,
162
+ x: e,
163
+ y: n,
164
+ content: r
165
+ });
166
+ }, []),
167
+ hide: o(() => {
168
+ t((e) => ({
169
+ ...e,
170
+ visible: !1
171
+ }));
172
+ }, [])
173
+ };
176
174
  }
177
- const Me = [
178
- "chart-1",
179
- "chart-2",
180
- "chart-3",
181
- "chart-4",
182
- "chart-5",
183
- "chart-6",
184
- "chart-7",
185
- "chart-8"
175
+ //#endregion
176
+ //#region src/ui/charts/_internal/colors.ts
177
+ var z = [
178
+ "chart-1",
179
+ "chart-2",
180
+ "chart-3",
181
+ "chart-4",
182
+ "chart-5",
183
+ "chart-6",
184
+ "chart-7",
185
+ "chart-8"
186
186
  ];
187
- function $e(t) {
188
- return `var(--${t})`;
187
+ function B(e) {
188
+ return `var(--${e})`;
189
189
  }
190
- function ae(t, a = 0) {
191
- return t ? Me.includes(t) ? $e(t) : t : $e(Me[a % Me.length]);
190
+ function V(e, t = 0) {
191
+ return e ? z.includes(e) ? B(e) : e : B(z[t % z.length]);
192
192
  }
193
- function le() {
194
- const { reducedMotion: t } = _e();
195
- return t;
193
+ //#endregion
194
+ //#region src/ui/charts/_internal/animation.ts
195
+ function H() {
196
+ let { reducedMotion: e } = i();
197
+ return e;
196
198
  }
197
- function Ee(t, a = 300) {
198
- return t ? 0 : a;
199
+ function U(e, t = 300) {
200
+ return e ? 0 : t;
199
201
  }
200
- const Ue = ne.forwardRef(
201
- ({
202
- data: t,
203
- xKey: a,
204
- yKey: o,
205
- orientation: x = "vertical",
206
- stacked: d = !1,
207
- grouped: M = !1,
208
- color: i,
209
- height: k = 300,
210
- showGrid: G = !0,
211
- showTooltip: P = !0,
212
- showLegend: v = !1,
213
- animate: R = !0,
214
- barRadius: Z = 4,
215
- xLabel: B,
216
- yLabel: N,
217
- seriesLabels: z,
218
- ariaLabel: X,
219
- className: W,
220
- ...q
221
- }, j) => {
222
- const { tooltip: T, show: V, hide: J } = pe(), E = le(), m = x === "vertical", S = R && !E, y = Array.isArray(o) ? o : [o], c = y.length > 1, I = c ? y.map(
223
- (C, L) => ae(
224
- Array.isArray(i) ? i[L] : typeof i == "string" ? i : void 0,
225
- L
226
- )
227
- ) : [
228
- ae(
229
- typeof i == "string" ? i : Array.isArray(i) ? i[0] : void 0,
230
- 0
231
- )
232
- ];
233
- return /* @__PURE__ */ p(
234
- re.div,
235
- {
236
- ref: j,
237
- className: H("relative", W),
238
- ...S ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
239
- ...ce(q),
240
- children: [
241
- /* @__PURE__ */ e(be, { height: k, ariaLabel: X ?? "Bar chart", children: ({ width: C, height: L, margin: u }) => {
242
- const l = t.map((A) => String(A[a]));
243
- let s;
244
- d ? s = Math.max(
245
- ...t.map(
246
- (A) => y.reduce((w, $) => w + (Number(A[$]) || 0), 0)
247
- )
248
- ) : s = Math.max(
249
- ...t.flatMap((A) => y.map((w) => Number(A[w]) || 0))
250
- );
251
- const b = Xe().domain(l).range(m ? [0, C] : [0, L]).padding(0.2), n = oe().domain([0, s * 1.1]).range(m ? [L, 0] : [0, C]).nice(), r = b.bandwidth(), f = c && M ? r / y.length : r;
252
- return /* @__PURE__ */ p(te, { children: [
253
- G && /* @__PURE__ */ e(
254
- fe,
255
- {
256
- width: C,
257
- height: L,
258
- yScale: m ? n : void 0,
259
- xScale: m ? void 0 : n,
260
- horizontal: m,
261
- vertical: !m
262
- }
263
- ),
264
- t.map((A) => {
265
- const w = String(A[a]);
266
- let $ = 0;
267
- return y.map((Q, h) => {
268
- const g = Number(A[Q]) || 0, _ = I[h] || I[0];
269
- let Y, F, K, D;
270
- return m ? (Y = (b(w) ?? 0) + (M && c ? h * f : 0), F = n(d ? $ + g : g), K = f, D = d ? n($) - n($ + g) : L - n(g)) : (Y = d ? n($) : 0, F = (b(w) ?? 0) + (M && c ? h * f : 0), K = d ? n($ + g) - n($) : n(g), D = f), d && ($ += g), /* @__PURE__ */ e(
271
- "rect",
272
- {
273
- x: Y,
274
- y: F,
275
- width: Math.max(0, K),
276
- height: Math.max(0, D),
277
- rx: Z,
278
- fill: _,
279
- className: "transition-opacity hover:opacity-80",
280
- onMouseMove: (U) => {
281
- if (P) {
282
- const O = U.currentTarget.closest("div")?.getBoundingClientRect();
283
- V(
284
- U.clientX - (O?.left ?? 0),
285
- U.clientY - (O?.top ?? 0),
286
- /* @__PURE__ */ p("div", { children: [
287
- /* @__PURE__ */ e("div", { className: "font-medium", children: w }),
288
- c && /* @__PURE__ */ e("div", { className: "text-surface-fg-muted", children: z?.[h] ?? Q }),
289
- /* @__PURE__ */ e("div", { children: g.toLocaleString() })
290
- ] })
291
- );
292
- }
293
- },
294
- onMouseLeave: J
295
- },
296
- `${w}-${Q}`
297
- );
298
- });
299
- }),
300
- m ? /* @__PURE__ */ p(te, { children: [
301
- /* @__PURE__ */ e(
302
- ee,
303
- {
304
- scale: b,
305
- orientation: "bottom",
306
- transform: `translate(0,${L})`,
307
- label: B
308
- }
309
- ),
310
- /* @__PURE__ */ e(ee, { scale: n, orientation: "left", label: N })
311
- ] }) : /* @__PURE__ */ p(te, { children: [
312
- /* @__PURE__ */ e(
313
- ee,
314
- {
315
- scale: n,
316
- orientation: "bottom",
317
- transform: `translate(0,${L})`,
318
- label: B
319
- }
320
- ),
321
- /* @__PURE__ */ e(
322
- ee,
323
- {
324
- scale: b,
325
- orientation: "left",
326
- label: N
327
- }
328
- )
329
- ] })
330
- ] });
331
- } }),
332
- P && /* @__PURE__ */ e(ue, { state: T }),
333
- v && c && /* @__PURE__ */ e(
334
- ie,
335
- {
336
- items: y.map((C, L) => ({
337
- label: z?.[L] ?? C,
338
- color: I[L]
339
- })),
340
- className: "mt-ds-04"
341
- }
342
- )
343
- ]
344
- }
345
- );
346
- }
347
- );
348
- Ue.displayName = "BarChart";
349
- const Ze = ne.forwardRef(
350
- ({
351
- data: t,
352
- xKey: a,
353
- series: o,
354
- curved: x = !1,
355
- showDots: d = !1,
356
- dotSize: M = 4,
357
- strokeWidth: i = 2,
358
- height: k = 300,
359
- showGrid: G = !0,
360
- showTooltip: P = !0,
361
- showLegend: v = !1,
362
- animate: R = !0,
363
- xLabel: Z,
364
- yLabel: B,
365
- ariaLabel: N,
366
- className: z,
367
- ...X
368
- }, W) => {
369
- const { tooltip: q, show: j, hide: T } = pe(), V = le(), J = R && !V, E = o.map((m, S) => ae(m.color, S));
370
- return /* @__PURE__ */ p(
371
- re.div,
372
- {
373
- ref: W,
374
- className: H("relative", z),
375
- ...J ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
376
- ...ce(X),
377
- children: [
378
- /* @__PURE__ */ e(be, { height: k, ariaLabel: N ?? "Line chart", children: ({ width: m, height: S, margin: y }) => {
379
- const c = t.map((r) => r[a]), I = c.every((r) => typeof r == "number");
380
- let C, L;
381
- if (I) {
382
- const r = c, f = Math.min(...r), A = Math.max(...r), w = oe().domain([f, A]).range([0, m]);
383
- C = w, L = ($) => w(Number($[a]));
384
- } else {
385
- const r = c.map(String), f = Le().domain(r).range([0, m]).padding(0.5);
386
- C = f, L = (A) => f(String(A[a])) ?? 0;
387
- }
388
- const u = t.flatMap(
389
- (r) => o.map((f) => Number(r[f.key]) || 0)
390
- ), l = Math.max(...u), s = oe().domain([0, l * 1.1]).range([S, 0]).nice(), b = x ? de : Ae, n = he().curve(b).defined((r) => r != null);
391
- return /* @__PURE__ */ p(te, { children: [
392
- G && /* @__PURE__ */ e(
393
- fe,
394
- {
395
- width: m,
396
- height: S,
397
- yScale: s,
398
- horizontal: !0
399
- }
400
- ),
401
- o.map((r, f) => {
402
- const w = n.x(($) => L($)).y(($) => s(Number($[r.key]) || 0))(t) ?? "";
403
- return /* @__PURE__ */ p("g", { children: [
404
- /* @__PURE__ */ e(
405
- "path",
406
- {
407
- d: w,
408
- fill: "none",
409
- stroke: E[f],
410
- strokeWidth: i,
411
- strokeLinejoin: "round",
412
- strokeLinecap: "round"
413
- }
414
- ),
415
- d && t.map(($, Q) => {
416
- const h = L($), g = s(Number($[r.key]) || 0);
417
- return /* @__PURE__ */ e(
418
- "circle",
419
- {
420
- cx: h,
421
- cy: g,
422
- r: M,
423
- fill: E[f],
424
- className: "transition-opacity hover:opacity-80"
425
- },
426
- `${r.key}-dot-${Q}`
427
- );
428
- })
429
- ] }, r.key);
430
- }),
431
- P && t.map((r, f) => {
432
- const A = L(r), w = m / Math.max(t.length - 1, 1);
433
- return /* @__PURE__ */ e(
434
- "rect",
435
- {
436
- x: A - w / 2,
437
- y: 0,
438
- width: w,
439
- height: S,
440
- fill: "transparent",
441
- onMouseMove: ($) => {
442
- const Q = $.currentTarget.closest("div")?.getBoundingClientRect();
443
- j(
444
- $.clientX - (Q?.left ?? 0),
445
- $.clientY - (Q?.top ?? 0),
446
- /* @__PURE__ */ p("div", { children: [
447
- /* @__PURE__ */ e("div", { className: "font-medium", children: String(r[a]) }),
448
- o.map((h, g) => /* @__PURE__ */ p(
449
- "div",
450
- {
451
- className: "flex items-center gap-ds-02",
452
- children: [
453
- /* @__PURE__ */ e(
454
- "span",
455
- {
456
- className: "inline-block h-2 w-2 rounded-ds-full",
457
- style: { backgroundColor: E[g] }
458
- }
459
- ),
460
- /* @__PURE__ */ p("span", { className: "text-surface-fg-muted", children: [
461
- h.label,
462
- ":"
463
- ] }),
464
- " ",
465
- Number(r[h.key]).toLocaleString()
466
- ]
467
- },
468
- h.key
469
- ))
470
- ] })
471
- );
472
- },
473
- onMouseLeave: T
474
- },
475
- `hover-${f}`
476
- );
477
- }),
478
- /* @__PURE__ */ e(
479
- ee,
480
- {
481
- scale: C,
482
- orientation: "bottom",
483
- transform: `translate(0,${S})`,
484
- label: Z
485
- }
486
- ),
487
- /* @__PURE__ */ e(ee, { scale: s, orientation: "left", label: B })
488
- ] });
489
- } }),
490
- P && /* @__PURE__ */ e(ue, { state: q }),
491
- v && o.length > 1 && /* @__PURE__ */ e(
492
- ie,
493
- {
494
- items: o.map((m, S) => ({
495
- label: m.label,
496
- color: E[S]
497
- })),
498
- className: "mt-ds-04"
499
- }
500
- )
501
- ]
502
- }
503
- );
504
- }
505
- );
506
- Ze.displayName = "LineChart";
507
- const qe = ne.forwardRef(
508
- ({
509
- data: t,
510
- xKey: a,
511
- series: o,
512
- curved: x = !1,
513
- stacked: d = !1,
514
- fillOpacity: M = 0.3,
515
- gradient: i = !1,
516
- strokeWidth: k = 2,
517
- height: G = 300,
518
- showGrid: P = !0,
519
- showTooltip: v = !0,
520
- showLegend: R = !1,
521
- animate: Z = !0,
522
- xLabel: B,
523
- yLabel: N,
524
- ariaLabel: z,
525
- className: X,
526
- ...W
527
- }, q) => {
528
- const { tooltip: j, show: T, hide: V } = pe(), J = le(), E = Z && !J, m = o.map((y, c) => ae(y.color, c)), S = ne.useId();
529
- return /* @__PURE__ */ p(
530
- re.div,
531
- {
532
- ref: q,
533
- className: H("relative", X),
534
- ...E ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
535
- ...ce(W),
536
- children: [
537
- /* @__PURE__ */ e(be, { height: G, ariaLabel: z ?? "Area chart", children: ({ width: y, height: c, margin: I }) => {
538
- const C = t.map((h) => h[a]), L = C.every((h) => typeof h == "number");
539
- let u, l, s;
540
- if (L) {
541
- const h = C, g = Math.min(...h), _ = Math.max(...h), Y = oe().domain([g, _]).range([0, y]);
542
- u = Y, l = (F) => Y(Number(F[a])), s = (F) => Y(Number(t[F][a]));
543
- } else {
544
- const h = C.map(String), g = Le().domain(h).range([0, y]).padding(0.5);
545
- u = g, l = (_) => g(String(_[a])) ?? 0, s = (_) => g(String(t[_][a])) ?? 0;
546
- }
547
- let b;
548
- d ? b = Math.max(
549
- ...t.map(
550
- (h) => o.reduce((g, _) => g + (Number(h[_.key]) || 0), 0)
551
- )
552
- ) : b = Math.max(
553
- ...t.flatMap(
554
- (h) => o.map((g) => Number(h[g.key]) || 0)
555
- )
556
- );
557
- const n = oe().domain([0, b * 1.1]).range([c, 0]).nice(), r = x ? de : Ae, f = () => t.map((h, g) => {
558
- const _ = l(h), Y = y / Math.max(t.length - 1, 1);
559
- return /* @__PURE__ */ e(
560
- "rect",
561
- {
562
- x: _ - Y / 2,
563
- y: 0,
564
- width: Y,
565
- height: c,
566
- fill: "transparent",
567
- onMouseMove: (F) => {
568
- const K = F.currentTarget.closest("div")?.getBoundingClientRect();
569
- T(
570
- F.clientX - (K?.left ?? 0),
571
- F.clientY - (K?.top ?? 0),
572
- /* @__PURE__ */ p("div", { children: [
573
- /* @__PURE__ */ e("div", { className: "font-medium", children: String(h[a]) }),
574
- o.map((D, U) => /* @__PURE__ */ p(
575
- "div",
576
- {
577
- className: "flex items-center gap-ds-02",
578
- children: [
579
- /* @__PURE__ */ e(
580
- "span",
581
- {
582
- className: "inline-block h-2 w-2 rounded-ds-full",
583
- style: { backgroundColor: m[U] }
584
- }
585
- ),
586
- /* @__PURE__ */ p("span", { className: "text-surface-fg-muted", children: [
587
- D.label,
588
- ":"
589
- ] }),
590
- " ",
591
- Number(h[D.key]).toLocaleString()
592
- ]
593
- },
594
- D.key
595
- ))
596
- ] })
597
- );
598
- },
599
- onMouseLeave: V
600
- },
601
- `hover-${g}`
602
- );
603
- }), A = () => i ? /* @__PURE__ */ e("defs", { children: o.map((h, g) => /* @__PURE__ */ p(
604
- "linearGradient",
605
- {
606
- id: `${S}-gradient-${g}`,
607
- x1: "0",
608
- y1: "0",
609
- x2: "0",
610
- y2: "1",
611
- children: [
612
- /* @__PURE__ */ e(
613
- "stop",
614
- {
615
- offset: "0%",
616
- stopColor: m[g],
617
- stopOpacity: M
618
- }
619
- ),
620
- /* @__PURE__ */ e(
621
- "stop",
622
- {
623
- offset: "100%",
624
- stopColor: m[g],
625
- stopOpacity: 0.05
626
- }
627
- )
628
- ]
629
- },
630
- `grad-${g}`
631
- )) }) : null, w = () => /* @__PURE__ */ p(te, { children: [
632
- /* @__PURE__ */ e(
633
- ee,
634
- {
635
- scale: u,
636
- orientation: "bottom",
637
- transform: `translate(0,${c})`,
638
- label: B
639
- }
640
- ),
641
- /* @__PURE__ */ e(ee, { scale: n, orientation: "left", label: N })
642
- ] });
643
- if (d) {
644
- const h = o.map((D) => D.key), g = je().keys(h).order(Te).offset(Ye), _ = t.map((D) => {
645
- const U = { [a]: String(D[a]) };
646
- for (const O of o)
647
- U[O.key] = Number(D[O.key]) || 0;
648
- return U;
649
- }), Y = g(_), F = Ne().curve(r).x((D, U) => s(U)).y0((D) => n(D[0])).y1((D) => n(D[1])), K = he().curve(r).x((D, U) => s(U)).y((D) => n(D[1]));
650
- return /* @__PURE__ */ p(te, { children: [
651
- A(),
652
- P && /* @__PURE__ */ e(
653
- fe,
654
- {
655
- width: y,
656
- height: c,
657
- yScale: n,
658
- horizontal: !0
659
- }
660
- ),
661
- [...Y].reverse().map((D, U) => {
662
- const O = Y.length - 1 - U, ke = D, Se = F(ke) ?? "", we = K(ke) ?? "", Ge = i ? `url(#${S}-gradient-${O})` : m[O];
663
- return /* @__PURE__ */ p("g", { children: [
664
- /* @__PURE__ */ e(
665
- "path",
666
- {
667
- d: Se,
668
- fill: Ge,
669
- opacity: i ? 1 : M
670
- }
671
- ),
672
- /* @__PURE__ */ e(
673
- "path",
674
- {
675
- d: we,
676
- fill: "none",
677
- stroke: m[O],
678
- strokeWidth: k,
679
- strokeLinejoin: "round",
680
- strokeLinecap: "round"
681
- }
682
- )
683
- ] }, o[O].key);
684
- }),
685
- v && f(),
686
- w()
687
- ] });
688
- }
689
- const $ = Ne().curve(r).defined((h) => h != null), Q = he().curve(r).defined((h) => h != null);
690
- return /* @__PURE__ */ p(te, { children: [
691
- A(),
692
- P && /* @__PURE__ */ e(
693
- fe,
694
- {
695
- width: y,
696
- height: c,
697
- yScale: n,
698
- horizontal: !0
699
- }
700
- ),
701
- [...o].reverse().map((h, g) => {
702
- const _ = o.length - 1 - g, Y = $.x((O) => l(O)).y0(c).y1((O) => n(Number(O[h.key]) || 0)), F = Q.x((O) => l(O)).y((O) => n(Number(O[h.key]) || 0)), K = Y(t) ?? "", D = F(t) ?? "", U = i ? `url(#${S}-gradient-${_})` : m[_];
703
- return /* @__PURE__ */ p("g", { children: [
704
- /* @__PURE__ */ e(
705
- "path",
706
- {
707
- d: K,
708
- fill: U,
709
- opacity: i ? 1 : M
710
- }
711
- ),
712
- /* @__PURE__ */ e(
713
- "path",
714
- {
715
- d: D,
716
- fill: "none",
717
- stroke: m[_],
718
- strokeWidth: k,
719
- strokeLinejoin: "round",
720
- strokeLinecap: "round"
721
- }
722
- )
723
- ] }, h.key);
724
- }),
725
- v && f(),
726
- w()
727
- ] });
728
- } }),
729
- v && /* @__PURE__ */ e(ue, { state: j }),
730
- R && o.length > 1 && /* @__PURE__ */ e(
731
- ie,
732
- {
733
- items: o.map((y, c) => ({
734
- label: y.label,
735
- color: m[c]
736
- })),
737
- className: "mt-ds-04"
738
- }
739
- )
740
- ]
741
- }
742
- );
743
- }
744
- );
745
- qe.displayName = "AreaChart";
746
- const Je = ne.forwardRef(
747
- ({
748
- data: t,
749
- variant: a = "pie",
750
- innerRadius: o = 0.6,
751
- padAngle: x = 0,
752
- cornerRadius: d = 0,
753
- height: M = 300,
754
- showTooltip: i = !0,
755
- showLegend: k = !1,
756
- showLabels: G = !1,
757
- animate: P = !0,
758
- className: v,
759
- centerLabel: R,
760
- ariaLabel: Z,
761
- ...B
762
- }, N) => {
763
- const z = ye(null), [X, W] = me(0), [q, j] = me(null), { tooltip: T, show: V, hide: J } = pe(), E = le(), m = P && !E;
764
- xe(() => {
765
- if (!z.current) return;
766
- const n = new ResizeObserver((r) => {
767
- const f = r[0];
768
- f && W(f.contentRect.width);
769
- });
770
- return n.observe(z.current), () => n.disconnect();
771
- }, []);
772
- const y = (X > 0 ? Math.min(X, M) : M) / 2, c = a === "donut" ? y * o : 0, I = t.map((n, r) => ae(n.color, r)), C = t.reduce((n, r) => n + r.value, 0), u = Oe().value((n) => n.value).padAngle(x).sort(null)(t), l = ve().innerRadius(c).outerRadius(y - 2).cornerRadius(d), s = c + (y - 2 - c) * 0.7, b = ve().innerRadius(s).outerRadius(s);
773
- return /* @__PURE__ */ p(
774
- re.div,
775
- {
776
- ref: (n) => {
777
- z.current = n, typeof N == "function" ? N(n) : N && (N.current = n);
778
- },
779
- className: H("relative w-full", v),
780
- ...m ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
781
- ...ce(B),
782
- children: [
783
- X > 0 && /* @__PURE__ */ p(te, { children: [
784
- /* @__PURE__ */ e(
785
- "svg",
786
- {
787
- width: X,
788
- height: M,
789
- role: "img",
790
- "aria-label": Z ?? "Pie chart",
791
- children: /* @__PURE__ */ p("g", { transform: `translate(${X / 2},${M / 2})`, children: [
792
- u.map((n, r) => {
793
- const f = l(n);
794
- if (!f) return null;
795
- const [A, w] = l.centroid(n), $ = Math.atan2(w, A), Q = Math.cos($) * 4, h = Math.sin($) * 4, g = q === r;
796
- return /* @__PURE__ */ e(
797
- "path",
798
- {
799
- d: f,
800
- fill: I[r],
801
- className: "cursor-pointer transition-transform",
802
- style: {
803
- transform: g ? `translate(${Q}px, ${h}px)` : void 0
804
- },
805
- onMouseEnter: () => j(r),
806
- onMouseMove: (_) => {
807
- if (i) {
808
- const Y = _.currentTarget.closest("div")?.getBoundingClientRect(), F = C > 0 ? (n.data.value / C * 100).toFixed(1) : "0";
809
- V(
810
- _.clientX - (Y?.left ?? 0),
811
- _.clientY - (Y?.top ?? 0),
812
- /* @__PURE__ */ p("div", { children: [
813
- /* @__PURE__ */ e("div", { className: "font-medium", children: n.data.label }),
814
- /* @__PURE__ */ p("div", { children: [
815
- n.data.value.toLocaleString(),
816
- " (",
817
- F,
818
- "%)"
819
- ] })
820
- ] })
821
- );
822
- }
823
- },
824
- onMouseLeave: () => {
825
- j(null), J();
826
- }
827
- },
828
- `slice-${n.data.label}-${r}`
829
- );
830
- }),
831
- G && u.map((n, r) => {
832
- const [f, A] = b.centroid(n), w = C > 0 ? (n.data.value / C * 100).toFixed(0) : "0";
833
- return C > 0 && n.data.value / C < 0.03 ? null : /* @__PURE__ */ p(
834
- "text",
835
- {
836
- x: f,
837
- y: A,
838
- textAnchor: "middle",
839
- dominantBaseline: "central",
840
- className: "pointer-events-none fill-accent-fg text-ds-xs font-medium",
841
- children: [
842
- w,
843
- "%"
844
- ]
845
- },
846
- `label-${n.data.label}-${r}`
847
- );
848
- }),
849
- a === "donut" && R && c > 0 && /* @__PURE__ */ e(
850
- "foreignObject",
851
- {
852
- x: -c * 0.7,
853
- y: -c * 0.7,
854
- width: c * 1.4,
855
- height: c * 1.4,
856
- children: /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center text-center text-surface-fg", children: R })
857
- }
858
- )
859
- ] })
860
- }
861
- ),
862
- i && /* @__PURE__ */ e(ue, { state: T })
863
- ] }),
864
- k && /* @__PURE__ */ e(
865
- ie,
866
- {
867
- items: t.map((n, r) => ({
868
- label: n.label,
869
- color: I[r]
870
- })),
871
- className: "mt-ds-04"
872
- }
873
- )
874
- ]
875
- }
876
- );
877
- }
878
- );
879
- Je.displayName = "PieChart";
880
- const Ce = { duration: 1, ease: "easeOut" }, Qe = ne.forwardRef(
881
- ({
882
- data: t,
883
- variant: a = "line",
884
- width: o = 120,
885
- height: x = 32,
886
- color: d,
887
- showLastDot: M = !1,
888
- strokeWidth: i = 1.5,
889
- animate: k = !0,
890
- className: G,
891
- ...P
892
- }, v) => {
893
- const R = ae(d, 0), Z = le(), B = k && !Z;
894
- if (!t.length) return null;
895
- const N = a === "bar" ? 1 : i, z = o - N * 2, X = x - N * 2, W = oe().domain([0, Math.max(t.length - 1, 1)]).range([N, N + z]), q = Math.min(...t), j = Math.max(...t), T = q === j ? [q - 1, j + 1] : [q, j], V = oe().domain(T).range([N + X, N]);
896
- if (a === "bar") {
897
- const c = Math.max(
898
- 1,
899
- (z - 1 * (t.length - 1)) / t.length
900
- ), I = N + X;
901
- return /* @__PURE__ */ e(
902
- "svg",
903
- {
904
- ref: v,
905
- width: o,
906
- height: x,
907
- role: "img",
908
- "aria-label": "Sparkline bar chart",
909
- className: H("inline-block align-middle", G),
910
- ...P,
911
- children: t.map((C, L) => {
912
- const u = N + L * (c + 1), l = V(C), s = Math.max(1, I - l);
913
- return /* @__PURE__ */ e(
914
- "rect",
915
- {
916
- x: u,
917
- y: l,
918
- width: c,
919
- height: s,
920
- rx: Math.min(1, c / 2),
921
- fill: R
922
- },
923
- L
924
- );
925
- })
926
- }
927
- );
928
- }
929
- if (a === "area") {
930
- const y = Ne().curve(de).x((l, s) => W(s)).y0(N + X).y1((l) => V(l)), c = he().curve(de).x((l, s) => W(s)).y((l) => V(l)), I = y(t) ?? "", C = c(t) ?? "", L = W(t.length - 1), u = V(t[t.length - 1]);
931
- return /* @__PURE__ */ p(
932
- "svg",
933
- {
934
- ref: v,
935
- width: o,
936
- height: x,
937
- role: "img",
938
- "aria-label": "Sparkline area chart",
939
- className: H("inline-block align-middle", G),
940
- ...P,
941
- children: [
942
- /* @__PURE__ */ e("path", { d: I, fill: R, opacity: 0.2 }),
943
- B ? /* @__PURE__ */ e(
944
- re.path,
945
- {
946
- d: C,
947
- fill: "none",
948
- stroke: R,
949
- strokeWidth: i,
950
- strokeLinejoin: "round",
951
- strokeLinecap: "round",
952
- initial: { pathLength: 0 },
953
- animate: { pathLength: 1 },
954
- transition: Ce
955
- }
956
- ) : /* @__PURE__ */ e(
957
- "path",
958
- {
959
- d: C,
960
- fill: "none",
961
- stroke: R,
962
- strokeWidth: i,
963
- strokeLinejoin: "round",
964
- strokeLinecap: "round"
965
- }
966
- ),
967
- M && /* @__PURE__ */ e(
968
- "circle",
969
- {
970
- cx: L,
971
- cy: u,
972
- r: i + 1,
973
- fill: R
974
- }
975
- )
976
- ]
977
- }
978
- );
979
- }
980
- const E = he().curve(de).x((y, c) => W(c)).y((y) => V(y))(t) ?? "", m = W(t.length - 1), S = V(t[t.length - 1]);
981
- return /* @__PURE__ */ p(
982
- "svg",
983
- {
984
- ref: v,
985
- width: o,
986
- height: x,
987
- role: "img",
988
- "aria-label": "Sparkline chart",
989
- className: H("inline-block align-middle", G),
990
- ...P,
991
- children: [
992
- B ? /* @__PURE__ */ e(
993
- re.path,
994
- {
995
- d: E,
996
- fill: "none",
997
- stroke: R,
998
- strokeWidth: i,
999
- strokeLinejoin: "round",
1000
- strokeLinecap: "round",
1001
- initial: { pathLength: 0 },
1002
- animate: { pathLength: 1 },
1003
- transition: Ce
1004
- }
1005
- ) : /* @__PURE__ */ e(
1006
- "path",
1007
- {
1008
- d: E,
1009
- fill: "none",
1010
- stroke: R,
1011
- strokeWidth: i,
1012
- strokeLinejoin: "round",
1013
- strokeLinecap: "round"
1014
- }
1015
- ),
1016
- M && /* @__PURE__ */ e(
1017
- "circle",
1018
- {
1019
- cx: m,
1020
- cy: S,
1021
- r: i + 1,
1022
- fill: R
1023
- }
1024
- )
1025
- ]
1026
- }
1027
- );
1028
- }
1029
- );
1030
- Qe.displayName = "Sparkline";
1031
- const ge = (t) => t * Math.PI / 180, He = ne.forwardRef(
1032
- ({
1033
- value: t,
1034
- max: a = 100,
1035
- min: o = 0,
1036
- label: x,
1037
- valueLabel: d,
1038
- color: M,
1039
- trackColor: i = "var(--color-surface-border)",
1040
- height: k = 200,
1041
- startAngle: G = -120,
1042
- endAngle: P = 120,
1043
- thickness: v = 16,
1044
- animate: R = !0,
1045
- className: Z,
1046
- ...B
1047
- }, N) => {
1048
- const z = le(), X = Ee(z, R ? 600 : 0), W = R && !z, q = ae(M, 0), j = k, T = j / 2, V = Math.min(Math.max(t, o), a), J = a === o ? 0 : (V - o) / (a - o), E = G + (P - G) * J, m = typeof d == "function" ? d(V) : typeof d == "string" ? d : String(V), S = ve().innerRadius(T - v).outerRadius(T).startAngle(ge(G)).endAngle(ge(P)).cornerRadius(v / 2), y = ve().innerRadius(T - v).outerRadius(T).startAngle(ge(G)).endAngle(ge(E)).cornerRadius(v / 2), c = S(null) ?? "", I = y(null) ?? "";
1049
- return /* @__PURE__ */ e(
1050
- re.div,
1051
- {
1052
- ref: N,
1053
- className: H("inline-flex flex-col items-center", Z),
1054
- ...W ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
1055
- ...ce(B),
1056
- role: "meter",
1057
- "aria-valuenow": V,
1058
- "aria-valuemin": o,
1059
- "aria-valuemax": a,
1060
- "aria-label": x ?? "Gauge chart",
1061
- children: /* @__PURE__ */ e("svg", { width: j, height: j, role: "img", "aria-hidden": "true", children: /* @__PURE__ */ p("g", { transform: `translate(${T},${T})`, children: [
1062
- /* @__PURE__ */ e("path", { d: c, fill: i }),
1063
- /* @__PURE__ */ e(
1064
- "path",
1065
- {
1066
- d: I,
1067
- fill: q,
1068
- style: X > 0 ? { transition: `d ${X}ms ease-out` } : void 0
1069
- }
1070
- ),
1071
- /* @__PURE__ */ e(
1072
- "text",
1073
- {
1074
- x: 0,
1075
- y: x ? -4 : 0,
1076
- textAnchor: "middle",
1077
- dominantBaseline: "central",
1078
- className: "fill-surface-fg text-ds-2xl font-semibold",
1079
- children: m
1080
- }
1081
- ),
1082
- x && /* @__PURE__ */ e(
1083
- "text",
1084
- {
1085
- x: 0,
1086
- y: 20,
1087
- textAnchor: "middle",
1088
- dominantBaseline: "central",
1089
- className: "fill-surface-fg-muted text-ds-xs",
1090
- children: x
1091
- }
1092
- )
1093
- ] }) })
1094
- }
1095
- );
1096
- }
1097
- );
1098
- He.displayName = "GaugeChart";
1099
- const Ke = ne.forwardRef(
1100
- ({
1101
- data: t,
1102
- axes: a,
1103
- series: o,
1104
- maxValue: x,
1105
- levels: d = 5,
1106
- fillOpacity: M = 0.25,
1107
- showDots: i = !1,
1108
- height: k = 300,
1109
- showTooltip: G = !0,
1110
- showLegend: P = !1,
1111
- animate: v = !0,
1112
- ariaLabel: R,
1113
- className: Z,
1114
- ...B
1115
- }, N) => {
1116
- const z = ye(null), [X, W] = me(0), { tooltip: q, show: j, hide: T } = pe(), V = le(), J = v && !V;
1117
- xe(() => {
1118
- if (!z.current) return;
1119
- const u = new ResizeObserver((l) => {
1120
- const s = l[0];
1121
- s && W(s.contentRect.width);
1122
- });
1123
- return u.observe(z.current), () => u.disconnect();
1124
- }, []);
1125
- const m = (X > 0 ? Math.min(X, k) : k) / 2 - 40, S = o.map((u, l) => ae(u.color, l)), y = x ?? Math.max(
1126
- ...t.flatMap((u) => o.map((l) => Number(u[l.key]) || 0)),
1127
- 1
1128
- ), c = 2 * Math.PI / a.length, I = We().radius((u) => m * u / y).angle((u, l) => l * c).curve(Ie), C = (u) => a.map((l, s) => Number(t[s]?.[u]) || 0), L = (u, l) => {
1129
- const s = c * u - Math.PI / 2, b = m * l / y;
1130
- return {
1131
- x: b * Math.cos(s),
1132
- y: b * Math.sin(s)
1133
- };
1134
- };
1135
- return /* @__PURE__ */ p(
1136
- re.div,
1137
- {
1138
- ref: (u) => {
1139
- z.current = u, typeof N == "function" ? N(u) : N && (N.current = u);
1140
- },
1141
- className: H("relative w-full", Z),
1142
- ...J ? { initial: { opacity: 0, scale: 0.96 }, animate: { opacity: 1, scale: 1 }, transition: se.fade } : {},
1143
- ...ce(B),
1144
- children: [
1145
- X > 0 && /* @__PURE__ */ p(te, { children: [
1146
- /* @__PURE__ */ e(
1147
- "svg",
1148
- {
1149
- width: X,
1150
- height: k,
1151
- role: "img",
1152
- "aria-label": R ?? "Radar chart",
1153
- children: /* @__PURE__ */ p("g", { transform: `translate(${X / 2},${k / 2})`, children: [
1154
- Array.from({ length: d }, (u, l) => {
1155
- const s = m / d * (l + 1), b = a.map((n, r) => {
1156
- const f = c * r - Math.PI / 2;
1157
- return `${s * Math.cos(f)},${s * Math.sin(f)}`;
1158
- }).join(" ");
1159
- return /* @__PURE__ */ e(
1160
- "polygon",
1161
- {
1162
- points: b,
1163
- fill: "none",
1164
- stroke: "var(--color-surface-border)",
1165
- strokeDasharray: "3,3",
1166
- strokeWidth: 1
1167
- },
1168
- `grid-${l}`
1169
- );
1170
- }),
1171
- a.map((u, l) => {
1172
- const s = c * l - Math.PI / 2, b = m * Math.cos(s), n = m * Math.sin(s);
1173
- return /* @__PURE__ */ e(
1174
- "line",
1175
- {
1176
- x1: 0,
1177
- y1: 0,
1178
- x2: b,
1179
- y2: n,
1180
- stroke: "var(--color-surface-border)",
1181
- strokeWidth: 1
1182
- },
1183
- `axis-${l}`
1184
- );
1185
- }),
1186
- a.map((u, l) => {
1187
- const s = c * l - Math.PI / 2, b = m + 18, n = b * Math.cos(s), r = b * Math.sin(s);
1188
- let f = "middle";
1189
- return Math.abs(Math.cos(s)) > 0.1 && (f = Math.cos(s) > 0 ? "start" : "end"), /* @__PURE__ */ e(
1190
- "text",
1191
- {
1192
- x: n,
1193
- y: r,
1194
- textAnchor: f,
1195
- dominantBaseline: "central",
1196
- className: "fill-surface-fg-muted text-ds-xs",
1197
- children: u
1198
- },
1199
- `label-${l}`
1200
- );
1201
- }),
1202
- Array.from({ length: d }, (u, l) => {
1203
- const s = Math.round(y / d * (l + 1)), b = m / d * (l + 1), n = -Math.PI / 2, r = b * Math.cos(n) + 4, f = b * Math.sin(n);
1204
- return /* @__PURE__ */ e(
1205
- "text",
1206
- {
1207
- x: r,
1208
- y: f,
1209
- textAnchor: "start",
1210
- dominantBaseline: "auto",
1211
- className: "fill-surface-fg-subtle text-ds-xs",
1212
- children: s
1213
- },
1214
- `level-label-${l}`
1215
- );
1216
- }),
1217
- o.map((u, l) => {
1218
- const s = C(u.key), b = I(s);
1219
- return b ? /* @__PURE__ */ p("g", { children: [
1220
- /* @__PURE__ */ e(
1221
- "path",
1222
- {
1223
- d: b,
1224
- fill: S[l],
1225
- fillOpacity: M,
1226
- stroke: S[l],
1227
- strokeWidth: 2,
1228
- strokeLinejoin: "round"
1229
- }
1230
- ),
1231
- i && s.map((n, r) => {
1232
- const { x: f, y: A } = L(r, n);
1233
- return /* @__PURE__ */ e(
1234
- "circle",
1235
- {
1236
- cx: f,
1237
- cy: A,
1238
- r: 4,
1239
- fill: S[l],
1240
- stroke: "var(--color-surface-base)",
1241
- strokeWidth: 2,
1242
- className: "transition-opacity"
1243
- },
1244
- `dot-${u.key}-${r}`
1245
- );
1246
- })
1247
- ] }, u.key) : null;
1248
- }),
1249
- G && a.map((u, l) => {
1250
- const s = c * l - Math.PI / 2, b = m * Math.cos(s), n = m * Math.sin(s);
1251
- return /* @__PURE__ */ e(
1252
- "circle",
1253
- {
1254
- cx: b,
1255
- cy: n,
1256
- r: 16,
1257
- fill: "transparent",
1258
- className: "cursor-pointer",
1259
- onMouseMove: (r) => {
1260
- const f = r.currentTarget.closest("div")?.getBoundingClientRect();
1261
- j(
1262
- r.clientX - (f?.left ?? 0),
1263
- r.clientY - (f?.top ?? 0),
1264
- /* @__PURE__ */ p("div", { children: [
1265
- /* @__PURE__ */ e("div", { className: "font-medium", children: u }),
1266
- o.map((A, w) => {
1267
- const $ = Number(t[l]?.[A.key]) || 0;
1268
- return /* @__PURE__ */ p(
1269
- "div",
1270
- {
1271
- className: "flex items-center gap-ds-02",
1272
- children: [
1273
- /* @__PURE__ */ e(
1274
- "span",
1275
- {
1276
- className: "inline-block h-2 w-2 rounded-ds-full",
1277
- style: { backgroundColor: S[w] }
1278
- }
1279
- ),
1280
- /* @__PURE__ */ p("span", { className: "text-surface-fg-muted", children: [
1281
- A.label,
1282
- ":"
1283
- ] }),
1284
- " ",
1285
- $.toLocaleString()
1286
- ]
1287
- },
1288
- A.key
1289
- );
1290
- })
1291
- ] })
1292
- );
1293
- },
1294
- onMouseLeave: T
1295
- },
1296
- `hover-${l}`
1297
- );
1298
- })
1299
- ] })
1300
- }
1301
- ),
1302
- G && /* @__PURE__ */ e(ue, { state: q })
1303
- ] }),
1304
- P && /* @__PURE__ */ e(
1305
- ie,
1306
- {
1307
- items: o.map((u, l) => ({
1308
- label: u.label,
1309
- color: S[l]
1310
- })),
1311
- className: "mt-ds-04"
1312
- }
1313
- )
1314
- ]
1315
- }
1316
- );
1317
- }
1318
- );
1319
- Ke.displayName = "RadarChart";
1320
- export {
1321
- qe as AreaChart,
1322
- Ue as BarChart,
1323
- be as ChartContainer,
1324
- He as GaugeChart,
1325
- ie as Legend,
1326
- Ze as LineChart,
1327
- Je as PieChart,
1328
- Ke as RadarChart,
1329
- Qe as Sparkline
1330
- };
202
+ //#endregion
203
+ //#region src/ui/charts/bar-chart.tsx
204
+ var W = a.forwardRef(({ data: i, xKey: a, yKey: o, orientation: s = "vertical", stacked: c = !1, grouped: l = !1, color: h, height: g = 300, showGrid: _ = !0, showTooltip: v = !0, showLegend: y = !1, animate: b = !0, barRadius: x = 4, xLabel: S, yLabel: C, seriesLabels: w, ariaLabel: T, className: E, ...D }, O) => {
205
+ let { tooltip: k, show: A, hide: j } = R(), M = H(), z = s === "vertical", B = b && !M, U = Array.isArray(o) ? o : [o], W = U.length > 1, G = W ? U.map((e, t) => V(Array.isArray(h) ? h[t] : typeof h == "string" ? h : void 0, t)) : [V(typeof h == "string" ? h : Array.isArray(h) ? h[0] : void 0, 0)];
206
+ return /* @__PURE__ */ f(e.div, {
207
+ ref: O,
208
+ className: r("relative", E),
209
+ ...B ? {
210
+ initial: {
211
+ opacity: 0,
212
+ scale: .96
213
+ },
214
+ animate: {
215
+ opacity: 1,
216
+ scale: 1
217
+ },
218
+ transition: n.fade
219
+ } : {},
220
+ ...t(D),
221
+ children: [
222
+ /* @__PURE__ */ d(N, {
223
+ height: g,
224
+ ariaLabel: T ?? "Bar chart",
225
+ children: ({ width: e, height: t, margin: n }) => {
226
+ let r = i.map((e) => String(e[a])), o = i.map((e) => `${String(e[a])} ${U.map((t, n) => `${w?.[n] ?? t}: ${Number(e[t]).toLocaleString()}`).join(", ")}`).join(". "), s;
227
+ s = Math.max(...c ? i.map((e) => U.reduce((t, n) => t + (Number(e[n]) || 0), 0)) : i.flatMap((e) => U.map((t) => Number(e[t]) || 0)));
228
+ let h = p().domain(r).range(z ? [0, e] : [0, t]).padding(.2), g = m().domain([0, s * 1.1]).range(z ? [t, 0] : [0, e]).nice(), y = h.bandwidth(), b = W && l ? y / U.length : y;
229
+ return /* @__PURE__ */ f(u, { children: [
230
+ /* @__PURE__ */ d("desc", { children: o }),
231
+ _ && /* @__PURE__ */ d(F, {
232
+ width: e,
233
+ height: t,
234
+ yScale: z ? g : void 0,
235
+ xScale: z ? void 0 : g,
236
+ horizontal: z,
237
+ vertical: !z
238
+ }),
239
+ i.map((e) => {
240
+ let n = String(e[a]), r = 0;
241
+ return U.map((i, a) => {
242
+ let o = Number(e[i]) || 0, s = G[a] || G[0], u, p, m, _;
243
+ z ? (u = (h(n) ?? 0) + (l && W ? a * b : 0), p = g(c ? r + o : o), m = b, _ = c ? g(r) - g(r + o) : t - g(o)) : (u = c ? g(r) : 0, p = (h(n) ?? 0) + (l && W ? a * b : 0), m = c ? g(r + o) - g(r) : g(o), _ = b), c && (r += o);
244
+ let y = w?.[a] ?? i, S = W ? `${n}, ${y}: ${o.toLocaleString()}` : `${n}: ${o.toLocaleString()}`, C = /* @__PURE__ */ f("div", { children: [
245
+ /* @__PURE__ */ d("div", {
246
+ className: "font-medium",
247
+ children: n
248
+ }),
249
+ W && /* @__PURE__ */ d("div", {
250
+ className: "text-surface-fg-muted",
251
+ children: y
252
+ }),
253
+ /* @__PURE__ */ d("div", { children: o.toLocaleString() })
254
+ ] });
255
+ return /* @__PURE__ */ d("rect", {
256
+ x: u,
257
+ y: p,
258
+ width: Math.max(0, m),
259
+ height: Math.max(0, _),
260
+ rx: x,
261
+ fill: s,
262
+ className: "transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:opacity-80",
263
+ tabIndex: v ? 0 : void 0,
264
+ role: v ? "graphics-symbol" : void 0,
265
+ "aria-label": S,
266
+ onMouseMove: (e) => {
267
+ if (v) {
268
+ let t = e.currentTarget.closest("div")?.getBoundingClientRect();
269
+ A(e.clientX - (t?.left ?? 0), e.clientY - (t?.top ?? 0), C);
270
+ }
271
+ },
272
+ onMouseLeave: j,
273
+ onFocus: (e) => {
274
+ if (v) {
275
+ let t = e.currentTarget.closest("div")?.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect();
276
+ A(n.left + n.width / 2 - (t?.left ?? 0), n.top - (t?.top ?? 0), C);
277
+ }
278
+ },
279
+ onBlur: j
280
+ }, `${n}-${i}`);
281
+ });
282
+ }),
283
+ z ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(P, {
284
+ scale: h,
285
+ orientation: "bottom",
286
+ transform: `translate(0,${t})`,
287
+ label: S
288
+ }), /* @__PURE__ */ d(P, {
289
+ scale: g,
290
+ orientation: "left",
291
+ label: C
292
+ })] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(P, {
293
+ scale: g,
294
+ orientation: "bottom",
295
+ transform: `translate(0,${t})`,
296
+ label: S
297
+ }), /* @__PURE__ */ d(P, {
298
+ scale: h,
299
+ orientation: "left",
300
+ label: C
301
+ })] })
302
+ ] });
303
+ }
304
+ }),
305
+ v && /* @__PURE__ */ d(L, { state: k }),
306
+ y && W && /* @__PURE__ */ d(I, {
307
+ items: U.map((e, t) => ({
308
+ label: w?.[t] ?? e,
309
+ color: G[t]
310
+ })),
311
+ className: "mt-ds-04"
312
+ })
313
+ ]
314
+ });
315
+ });
316
+ W.displayName = "BarChart";
317
+ //#endregion
318
+ //#region src/ui/charts/line-chart.tsx
319
+ var G = a.forwardRef(({ data: i, xKey: a, series: o, curved: s = !1, showDots: c = !1, dotSize: l = 4, strokeWidth: p = 2, height: g = 300, showGrid: _ = !0, showTooltip: v = !0, showLegend: y = !1, animate: b = !0, xLabel: x, yLabel: S, ariaLabel: w, className: D, ...O }, k) => {
320
+ let { tooltip: A, show: j, hide: M } = R(), z = H(), B = b && !z, U = o.map((e, t) => V(e.color, t));
321
+ return /* @__PURE__ */ f(e.div, {
322
+ ref: k,
323
+ className: r("relative", D),
324
+ ...B ? {
325
+ initial: {
326
+ opacity: 0,
327
+ scale: .96
328
+ },
329
+ animate: {
330
+ opacity: 1,
331
+ scale: 1
332
+ },
333
+ transition: n.fade
334
+ } : {},
335
+ ...t(O),
336
+ children: [
337
+ /* @__PURE__ */ d(N, {
338
+ height: g,
339
+ ariaLabel: w ?? "Line chart",
340
+ children: ({ width: e, height: t, margin: n }) => {
341
+ let r = i.map((e) => e[a]), g = r.every((e) => typeof e == "number"), y, b;
342
+ if (g) {
343
+ let t = r, n = Math.min(...t), i = Math.max(...t), o = m().domain([n, i]).range([0, e]);
344
+ y = o, b = (e) => o(Number(e[a]));
345
+ } else {
346
+ let t = r.map(String), n = h().domain(t).range([0, e]).padding(.5);
347
+ y = n, b = (e) => n(String(e[a])) ?? 0;
348
+ }
349
+ let w = i.flatMap((e) => o.map((t) => Number(e[t.key]) || 0)), D = Math.max(...w), O = m().domain([0, D * 1.1]).range([t, 0]).nice(), k = s ? T : C, A = E().curve(k).defined((e) => e != null);
350
+ return /* @__PURE__ */ f(u, { children: [
351
+ /* @__PURE__ */ d("desc", { children: i.map((e) => `${String(e[a])} — ${o.map((t) => `${t.label}: ${Number(e[t.key]).toLocaleString()}`).join(", ")}`).join(". ") }),
352
+ _ && /* @__PURE__ */ d(F, {
353
+ width: e,
354
+ height: t,
355
+ yScale: O,
356
+ horizontal: !0
357
+ }),
358
+ o.map((e, t) => /* @__PURE__ */ f("g", { children: [/* @__PURE__ */ d("path", {
359
+ d: A.x((e) => b(e)).y((t) => O(Number(t[e.key]) || 0))(i) ?? "",
360
+ fill: "none",
361
+ stroke: U[t],
362
+ strokeWidth: p,
363
+ strokeLinejoin: "round",
364
+ strokeLinecap: "round"
365
+ }), c && i.map((n, r) => /* @__PURE__ */ d("circle", {
366
+ cx: b(n),
367
+ cy: O(Number(n[e.key]) || 0),
368
+ r: l,
369
+ fill: U[t],
370
+ className: "transition-opacity hover:opacity-80"
371
+ }, `${e.key}-dot-${r}`))] }, e.key)),
372
+ v && i.map((n, r) => {
373
+ let s = b(n), c = e / Math.max(i.length - 1, 1), l = String(n[a]), u = `${l}: ${o.map((e) => `${e.label} ${Number(n[e.key]).toLocaleString()}`).join(", ")}`, p = /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("div", {
374
+ className: "font-medium",
375
+ children: l
376
+ }), o.map((e, t) => /* @__PURE__ */ f("div", {
377
+ className: "flex items-center gap-ds-02",
378
+ children: [
379
+ /* @__PURE__ */ d("span", {
380
+ className: "inline-block h-2 w-2 rounded-ds-full",
381
+ style: { backgroundColor: U[t] }
382
+ }),
383
+ /* @__PURE__ */ f("span", {
384
+ className: "text-surface-fg-muted",
385
+ children: [e.label, ":"]
386
+ }),
387
+ " ",
388
+ Number(n[e.key]).toLocaleString()
389
+ ]
390
+ }, e.key))] });
391
+ return /* @__PURE__ */ d("rect", {
392
+ x: s - c / 2,
393
+ y: 0,
394
+ width: c,
395
+ height: t,
396
+ fill: "transparent",
397
+ tabIndex: 0,
398
+ role: "graphics-symbol",
399
+ "aria-label": u,
400
+ className: "focus-visible:outline-none",
401
+ onMouseMove: (e) => {
402
+ let t = e.currentTarget.closest("div")?.getBoundingClientRect();
403
+ j(e.clientX - (t?.left ?? 0), e.clientY - (t?.top ?? 0), p);
404
+ },
405
+ onMouseLeave: M,
406
+ onFocus: (e) => {
407
+ let t = e.currentTarget.closest("div")?.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect();
408
+ j(n.left + n.width / 2 - (t?.left ?? 0), n.top + n.height / 2 - (t?.top ?? 0), p);
409
+ },
410
+ onBlur: M
411
+ }, `hover-${r}`);
412
+ }),
413
+ /* @__PURE__ */ d(P, {
414
+ scale: y,
415
+ orientation: "bottom",
416
+ transform: `translate(0,${t})`,
417
+ label: x
418
+ }),
419
+ /* @__PURE__ */ d(P, {
420
+ scale: O,
421
+ orientation: "left",
422
+ label: S
423
+ })
424
+ ] });
425
+ }
426
+ }),
427
+ v && /* @__PURE__ */ d(L, { state: A }),
428
+ y && o.length > 1 && /* @__PURE__ */ d(I, {
429
+ items: o.map((e, t) => ({
430
+ label: e.label,
431
+ color: U[t]
432
+ })),
433
+ className: "mt-ds-04"
434
+ })
435
+ ]
436
+ });
437
+ });
438
+ G.displayName = "LineChart";
439
+ //#endregion
440
+ //#region src/ui/charts/area-chart.tsx
441
+ var K = a.forwardRef(({ data: i, xKey: o, series: s, curved: c = !1, stacked: l = !1, fillOpacity: p = .3, gradient: g = !1, strokeWidth: _ = 2, height: v = 300, showGrid: y = !0, showTooltip: b = !0, showLegend: x = !1, animate: w = !0, xLabel: D, yLabel: O, ariaLabel: M, className: z, ...B }, U) => {
442
+ let { tooltip: W, show: G, hide: K } = R(), q = H(), J = w && !q, Y = s.map((e, t) => V(e.color, t)), X = a.useId();
443
+ return /* @__PURE__ */ f(e.div, {
444
+ ref: U,
445
+ className: r("relative", z),
446
+ ...J ? {
447
+ initial: {
448
+ opacity: 0,
449
+ scale: .96
450
+ },
451
+ animate: {
452
+ opacity: 1,
453
+ scale: 1
454
+ },
455
+ transition: n.fade
456
+ } : {},
457
+ ...t(B),
458
+ children: [
459
+ /* @__PURE__ */ d(N, {
460
+ height: v,
461
+ ariaLabel: M ?? "Area chart",
462
+ children: ({ width: e, height: t, margin: n }) => {
463
+ let r = i.map((e) => e[o]), a = r.every((e) => typeof e == "number"), v, x, w;
464
+ if (a) {
465
+ let t = r, n = Math.min(...t), a = Math.max(...t), s = m().domain([n, a]).range([0, e]);
466
+ v = s, x = (e) => s(Number(e[o])), w = (e) => s(Number(i[e][o]));
467
+ } else {
468
+ let t = r.map(String), n = h().domain(t).range([0, e]).padding(.5);
469
+ v = n, x = (e) => n(String(e[o])) ?? 0, w = (e) => n(String(i[e][o])) ?? 0;
470
+ }
471
+ let M;
472
+ M = Math.max(...l ? i.map((e) => s.reduce((t, n) => t + (Number(e[n.key]) || 0), 0)) : i.flatMap((e) => s.map((t) => Number(e[t.key]) || 0)));
473
+ let N = m().domain([0, M * 1.1]).range([t, 0]).nice(), I = c ? T : C, L = () => i.map((n, r) => {
474
+ let a = x(n), c = e / Math.max(i.length - 1, 1);
475
+ return /* @__PURE__ */ d("rect", {
476
+ x: a - c / 2,
477
+ y: 0,
478
+ width: c,
479
+ height: t,
480
+ fill: "transparent",
481
+ onMouseMove: (e) => {
482
+ let t = e.currentTarget.closest("div")?.getBoundingClientRect();
483
+ G(e.clientX - (t?.left ?? 0), e.clientY - (t?.top ?? 0), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("div", {
484
+ className: "font-medium",
485
+ children: String(n[o])
486
+ }), s.map((e, t) => /* @__PURE__ */ f("div", {
487
+ className: "flex items-center gap-ds-02",
488
+ children: [
489
+ /* @__PURE__ */ d("span", {
490
+ className: "inline-block h-2 w-2 rounded-ds-full",
491
+ style: { backgroundColor: Y[t] }
492
+ }),
493
+ /* @__PURE__ */ f("span", {
494
+ className: "text-surface-fg-muted",
495
+ children: [e.label, ":"]
496
+ }),
497
+ " ",
498
+ Number(n[e.key]).toLocaleString()
499
+ ]
500
+ }, e.key))] }));
501
+ },
502
+ onMouseLeave: K
503
+ }, `hover-${r}`);
504
+ }), R = () => g ? /* @__PURE__ */ d("defs", { children: s.map((e, t) => /* @__PURE__ */ f("linearGradient", {
505
+ id: `${X}-gradient-${t}`,
506
+ x1: "0",
507
+ y1: "0",
508
+ x2: "0",
509
+ y2: "1",
510
+ children: [/* @__PURE__ */ d("stop", {
511
+ offset: "0%",
512
+ stopColor: Y[t],
513
+ stopOpacity: p
514
+ }), /* @__PURE__ */ d("stop", {
515
+ offset: "100%",
516
+ stopColor: Y[t],
517
+ stopOpacity: .05
518
+ })]
519
+ }, `grad-${t}`)) }) : null, z = () => /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(P, {
520
+ scale: v,
521
+ orientation: "bottom",
522
+ transform: `translate(0,${t})`,
523
+ label: D
524
+ }), /* @__PURE__ */ d(P, {
525
+ scale: N,
526
+ orientation: "left",
527
+ label: O
528
+ })] });
529
+ if (l) {
530
+ let n = s.map((e) => e.key), r = k().keys(n).order(j).offset(A)(i.map((e) => {
531
+ let t = { [o]: String(e[o]) };
532
+ for (let n of s) t[n.key] = Number(e[n.key]) || 0;
533
+ return t;
534
+ })), a = S().curve(I).x((e, t) => w(t)).y0((e) => N(e[0])).y1((e) => N(e[1])), c = E().curve(I).x((e, t) => w(t)).y((e) => N(e[1]));
535
+ return /* @__PURE__ */ f(u, { children: [
536
+ R(),
537
+ y && /* @__PURE__ */ d(F, {
538
+ width: e,
539
+ height: t,
540
+ yScale: N,
541
+ horizontal: !0
542
+ }),
543
+ [...r].reverse().map((e, t) => {
544
+ let n = r.length - 1 - t, i = e, o = a(i) ?? "", l = c(i) ?? "";
545
+ return /* @__PURE__ */ f("g", { children: [/* @__PURE__ */ d("path", {
546
+ d: o,
547
+ fill: g ? `url(#${X}-gradient-${n})` : Y[n],
548
+ opacity: g ? 1 : p
549
+ }), /* @__PURE__ */ d("path", {
550
+ d: l,
551
+ fill: "none",
552
+ stroke: Y[n],
553
+ strokeWidth: _,
554
+ strokeLinejoin: "round",
555
+ strokeLinecap: "round"
556
+ })] }, s[n].key);
557
+ }),
558
+ b && L(),
559
+ z()
560
+ ] });
561
+ }
562
+ let B = S().curve(I).defined((e) => e != null), V = E().curve(I).defined((e) => e != null);
563
+ return /* @__PURE__ */ f(u, { children: [
564
+ R(),
565
+ y && /* @__PURE__ */ d(F, {
566
+ width: e,
567
+ height: t,
568
+ yScale: N,
569
+ horizontal: !0
570
+ }),
571
+ [...s].reverse().map((e, n) => {
572
+ let r = s.length - 1 - n, a = B.x((e) => x(e)).y0(t).y1((t) => N(Number(t[e.key]) || 0)), o = V.x((e) => x(e)).y((t) => N(Number(t[e.key]) || 0)), c = a(i) ?? "", l = o(i) ?? "";
573
+ return /* @__PURE__ */ f("g", { children: [/* @__PURE__ */ d("path", {
574
+ d: c,
575
+ fill: g ? `url(#${X}-gradient-${r})` : Y[r],
576
+ opacity: g ? 1 : p
577
+ }), /* @__PURE__ */ d("path", {
578
+ d: l,
579
+ fill: "none",
580
+ stroke: Y[r],
581
+ strokeWidth: _,
582
+ strokeLinejoin: "round",
583
+ strokeLinecap: "round"
584
+ })] }, e.key);
585
+ }),
586
+ b && L(),
587
+ z()
588
+ ] });
589
+ }
590
+ }),
591
+ b && /* @__PURE__ */ d(L, { state: W }),
592
+ x && s.length > 1 && /* @__PURE__ */ d(I, {
593
+ items: s.map((e, t) => ({
594
+ label: e.label,
595
+ color: Y[t]
596
+ })),
597
+ className: "mt-ds-04"
598
+ })
599
+ ]
600
+ });
601
+ });
602
+ K.displayName = "AreaChart";
603
+ //#endregion
604
+ //#region src/ui/charts/pie-chart.tsx
605
+ var q = a.forwardRef(({ data: i, variant: a = "pie", innerRadius: o = .6, padAngle: p = 0, cornerRadius: m = 0, height: h = 300, showTooltip: g = !0, showLegend: _ = !1, showLabels: v = !1, animate: y = !0, className: b, centerLabel: S, ariaLabel: C, ...w }, T) => {
606
+ let E = c(null), [D, k] = l(0), [A, j] = l(null), { tooltip: M, show: N, hide: P } = R(), F = H(), z = y && !F;
607
+ s(() => {
608
+ if (!E.current) return;
609
+ let e = new ResizeObserver((e) => {
610
+ let t = e[0];
611
+ t && k(t.contentRect.width);
612
+ });
613
+ return e.observe(E.current), () => e.disconnect();
614
+ }, []);
615
+ let B = (D > 0 ? Math.min(D, h) : h) / 2, U = a === "donut" ? B * o : 0, W = i.map((e, t) => V(e.color, t)), G = i.reduce((e, t) => e + t.value, 0), K = O().value((e) => e.value).padAngle(p).sort(null)(i), q = x().innerRadius(U).outerRadius(B - 2).cornerRadius(m), J = U + (B - 2 - U) * .7, Y = x().innerRadius(J).outerRadius(J);
616
+ return /* @__PURE__ */ f(e.div, {
617
+ ref: (e) => {
618
+ E.current = e, typeof T == "function" ? T(e) : T && (T.current = e);
619
+ },
620
+ className: r("relative w-full", b),
621
+ ...z ? {
622
+ initial: {
623
+ opacity: 0,
624
+ scale: .96
625
+ },
626
+ animate: {
627
+ opacity: 1,
628
+ scale: 1
629
+ },
630
+ transition: n.fade
631
+ } : {},
632
+ ...t(w),
633
+ children: [D > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("svg", {
634
+ width: D,
635
+ height: h,
636
+ role: "img",
637
+ "aria-label": C ?? "Pie chart",
638
+ children: /* @__PURE__ */ f("g", {
639
+ transform: `translate(${D / 2},${h / 2})`,
640
+ children: [
641
+ K.map((e, t) => {
642
+ let n = q(e);
643
+ if (!n) return null;
644
+ let [r, i] = q.centroid(e), a = Math.atan2(i, r), o = Math.cos(a) * 4, s = Math.sin(a) * 4, c = A === t;
645
+ return /* @__PURE__ */ d("path", {
646
+ d: n,
647
+ fill: W[t],
648
+ className: "cursor-pointer transition-transform",
649
+ style: { transform: c ? `translate(${o}px, ${s}px)` : void 0 },
650
+ onMouseEnter: () => j(t),
651
+ onMouseMove: (t) => {
652
+ if (g) {
653
+ let n = t.currentTarget.closest("div")?.getBoundingClientRect(), r = G > 0 ? (e.data.value / G * 100).toFixed(1) : "0";
654
+ N(t.clientX - (n?.left ?? 0), t.clientY - (n?.top ?? 0), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("div", {
655
+ className: "font-medium",
656
+ children: e.data.label
657
+ }), /* @__PURE__ */ f("div", { children: [
658
+ e.data.value.toLocaleString(),
659
+ " (",
660
+ r,
661
+ "%)"
662
+ ] })] }));
663
+ }
664
+ },
665
+ onMouseLeave: () => {
666
+ j(null), P();
667
+ }
668
+ }, `slice-${e.data.label}-${t}`);
669
+ }),
670
+ v && K.map((e, t) => {
671
+ let [n, r] = Y.centroid(e), i = G > 0 ? (e.data.value / G * 100).toFixed(0) : "0";
672
+ return G > 0 && e.data.value / G < .03 ? null : /* @__PURE__ */ f("text", {
673
+ x: n,
674
+ y: r,
675
+ textAnchor: "middle",
676
+ dominantBaseline: "central",
677
+ className: "pointer-events-none fill-accent-fg text-ds-xs font-medium",
678
+ children: [i, "%"]
679
+ }, `label-${e.data.label}-${t}`);
680
+ }),
681
+ a === "donut" && S && U > 0 && /* @__PURE__ */ d("foreignObject", {
682
+ x: -U * .7,
683
+ y: -U * .7,
684
+ width: U * 1.4,
685
+ height: U * 1.4,
686
+ children: /* @__PURE__ */ d("div", {
687
+ className: "flex h-full w-full items-center justify-center text-center text-surface-fg",
688
+ children: S
689
+ })
690
+ })
691
+ ]
692
+ })
693
+ }), g && /* @__PURE__ */ d(L, { state: M })] }), _ && /* @__PURE__ */ d(I, {
694
+ items: i.map((e, t) => ({
695
+ label: e.label,
696
+ color: W[t]
697
+ })),
698
+ className: "mt-ds-04"
699
+ })]
700
+ });
701
+ });
702
+ q.displayName = "PieChart";
703
+ //#endregion
704
+ //#region src/ui/charts/sparkline.tsx
705
+ var J = {
706
+ duration: 1,
707
+ ease: "easeOut"
708
+ }, Y = a.forwardRef(({ data: t, variant: n = "line", width: i = 120, height: a = 32, color: o, showLastDot: s = !1, strokeWidth: c = 1.5, animate: l = !0, className: u, ...p }, h) => {
709
+ let g = V(o, 0), _ = H(), v = l && !_;
710
+ if (!t.length) return null;
711
+ let y = n === "bar" ? 1 : c, b = i - y * 2, x = a - y * 2, C = m().domain([0, Math.max(t.length - 1, 1)]).range([y, y + b]), w = Math.min(...t), D = Math.max(...t), O = w === D ? [w - 1, D + 1] : [w, D], k = m().domain(O).range([y + x, y]);
712
+ if (n === "bar") {
713
+ let e = Math.max(1, (b - 1 * (t.length - 1)) / t.length), n = y + x;
714
+ return /* @__PURE__ */ d("svg", {
715
+ ref: h,
716
+ width: i,
717
+ height: a,
718
+ role: "img",
719
+ "aria-label": "Sparkline bar chart",
720
+ className: r("inline-block align-middle", u),
721
+ ...p,
722
+ children: t.map((t, r) => {
723
+ let i = y + r * (e + 1), a = k(t);
724
+ return /* @__PURE__ */ d("rect", {
725
+ x: i,
726
+ y: a,
727
+ width: e,
728
+ height: Math.max(1, n - a),
729
+ rx: Math.min(1, e / 2),
730
+ fill: g
731
+ }, r);
732
+ })
733
+ });
734
+ }
735
+ if (n === "area") {
736
+ let n = S().curve(T).x((e, t) => C(t)).y0(y + x).y1((e) => k(e)), o = E().curve(T).x((e, t) => C(t)).y((e) => k(e)), l = n(t) ?? "", m = o(t) ?? "", _ = C(t.length - 1), b = k(t[t.length - 1]);
737
+ return /* @__PURE__ */ f("svg", {
738
+ ref: h,
739
+ width: i,
740
+ height: a,
741
+ role: "img",
742
+ "aria-label": "Sparkline area chart",
743
+ className: r("inline-block align-middle", u),
744
+ ...p,
745
+ children: [
746
+ /* @__PURE__ */ d("path", {
747
+ d: l,
748
+ fill: g,
749
+ opacity: .2
750
+ }),
751
+ v ? /* @__PURE__ */ d(e.path, {
752
+ d: m,
753
+ fill: "none",
754
+ stroke: g,
755
+ strokeWidth: c,
756
+ strokeLinejoin: "round",
757
+ strokeLinecap: "round",
758
+ initial: { pathLength: 0 },
759
+ animate: { pathLength: 1 },
760
+ transition: J
761
+ }) : /* @__PURE__ */ d("path", {
762
+ d: m,
763
+ fill: "none",
764
+ stroke: g,
765
+ strokeWidth: c,
766
+ strokeLinejoin: "round",
767
+ strokeLinecap: "round"
768
+ }),
769
+ s && /* @__PURE__ */ d("circle", {
770
+ cx: _,
771
+ cy: b,
772
+ r: c + 1,
773
+ fill: g
774
+ })
775
+ ]
776
+ });
777
+ }
778
+ let A = E().curve(T).x((e, t) => C(t)).y((e) => k(e))(t) ?? "", j = C(t.length - 1), M = k(t[t.length - 1]);
779
+ return /* @__PURE__ */ f("svg", {
780
+ ref: h,
781
+ width: i,
782
+ height: a,
783
+ role: "img",
784
+ "aria-label": "Sparkline chart",
785
+ className: r("inline-block align-middle", u),
786
+ ...p,
787
+ children: [v ? /* @__PURE__ */ d(e.path, {
788
+ d: A,
789
+ fill: "none",
790
+ stroke: g,
791
+ strokeWidth: c,
792
+ strokeLinejoin: "round",
793
+ strokeLinecap: "round",
794
+ initial: { pathLength: 0 },
795
+ animate: { pathLength: 1 },
796
+ transition: J
797
+ }) : /* @__PURE__ */ d("path", {
798
+ d: A,
799
+ fill: "none",
800
+ stroke: g,
801
+ strokeWidth: c,
802
+ strokeLinejoin: "round",
803
+ strokeLinecap: "round"
804
+ }), s && /* @__PURE__ */ d("circle", {
805
+ cx: j,
806
+ cy: M,
807
+ r: c + 1,
808
+ fill: g
809
+ })]
810
+ });
811
+ });
812
+ Y.displayName = "Sparkline";
813
+ //#endregion
814
+ //#region src/ui/charts/gauge-chart.tsx
815
+ var X = (e) => e * Math.PI / 180, Z = a.forwardRef(({ value: i, max: a = 100, min: o = 0, label: s, valueLabel: c, color: l, trackColor: u = "var(--color-surface-border)", height: p = 200, startAngle: m = -120, endAngle: h = 120, thickness: g = 16, animate: _ = !0, className: v, ...y }, b) => {
816
+ let S = H(), C = U(S, _ ? 600 : 0), w = _ && !S, T = V(l, 0), E = p, D = E / 2, O = Math.min(Math.max(i, o), a), k = a === o ? 0 : (O - o) / (a - o), A = m + (h - m) * k, j = typeof c == "function" ? c(O) : typeof c == "string" ? c : String(O), M = x().innerRadius(D - g).outerRadius(D).startAngle(X(m)).endAngle(X(h)).cornerRadius(g / 2), N = x().innerRadius(D - g).outerRadius(D).startAngle(X(m)).endAngle(X(A)).cornerRadius(g / 2), P = M(null) ?? "", F = N(null) ?? "";
817
+ return /* @__PURE__ */ d(e.div, {
818
+ ref: b,
819
+ className: r("inline-flex flex-col items-center", v),
820
+ ...w ? {
821
+ initial: {
822
+ opacity: 0,
823
+ scale: .96
824
+ },
825
+ animate: {
826
+ opacity: 1,
827
+ scale: 1
828
+ },
829
+ transition: n.fade
830
+ } : {},
831
+ ...t(y),
832
+ role: "meter",
833
+ "aria-valuenow": O,
834
+ "aria-valuemin": o,
835
+ "aria-valuemax": a,
836
+ "aria-label": s ?? "Gauge chart",
837
+ children: /* @__PURE__ */ d("svg", {
838
+ width: E,
839
+ height: E,
840
+ role: "img",
841
+ "aria-hidden": "true",
842
+ children: /* @__PURE__ */ f("g", {
843
+ transform: `translate(${D},${D})`,
844
+ children: [
845
+ /* @__PURE__ */ d("path", {
846
+ d: P,
847
+ fill: u
848
+ }),
849
+ /* @__PURE__ */ d("path", {
850
+ d: F,
851
+ fill: T,
852
+ style: C > 0 ? { transition: `d ${C}ms ease-out` } : void 0
853
+ }),
854
+ /* @__PURE__ */ d("text", {
855
+ x: 0,
856
+ y: s ? -4 : 0,
857
+ textAnchor: "middle",
858
+ dominantBaseline: "central",
859
+ className: "fill-surface-fg text-ds-2xl font-semibold",
860
+ children: j
861
+ }),
862
+ s && /* @__PURE__ */ d("text", {
863
+ x: 0,
864
+ y: 20,
865
+ textAnchor: "middle",
866
+ dominantBaseline: "central",
867
+ className: "fill-surface-fg-muted text-ds-xs",
868
+ children: s
869
+ })
870
+ ]
871
+ })
872
+ })
873
+ });
874
+ });
875
+ Z.displayName = "GaugeChart";
876
+ //#endregion
877
+ //#region src/ui/charts/radar-chart.tsx
878
+ var Q = a.forwardRef(({ data: i, axes: a, series: o, maxValue: p, levels: m = 5, fillOpacity: h = .25, showDots: g = !1, height: _ = 300, showTooltip: v = !0, showLegend: y = !1, animate: b = !0, ariaLabel: x, className: S, ...C }, T) => {
879
+ let E = c(null), [O, k] = l(0), { tooltip: A, show: j, hide: M } = R(), N = H(), P = b && !N;
880
+ s(() => {
881
+ if (!E.current) return;
882
+ let e = new ResizeObserver((e) => {
883
+ let t = e[0];
884
+ t && k(t.contentRect.width);
885
+ });
886
+ return e.observe(E.current), () => e.disconnect();
887
+ }, []);
888
+ let F = (O > 0 ? Math.min(O, _) : _) / 2 - 40, z = o.map((e, t) => V(e.color, t)), B = p ?? Math.max(...i.flatMap((e) => o.map((t) => Number(e[t.key]) || 0)), 1), U = 2 * Math.PI / a.length, W = D().radius((e) => F * e / B).angle((e, t) => t * U).curve(w), G = (e) => a.map((t, n) => Number(i[n]?.[e]) || 0), K = (e, t) => {
889
+ let n = U * e - Math.PI / 2, r = F * t / B;
890
+ return {
891
+ x: r * Math.cos(n),
892
+ y: r * Math.sin(n)
893
+ };
894
+ };
895
+ return /* @__PURE__ */ f(e.div, {
896
+ ref: (e) => {
897
+ E.current = e, typeof T == "function" ? T(e) : T && (T.current = e);
898
+ },
899
+ className: r("relative w-full", S),
900
+ ...P ? {
901
+ initial: {
902
+ opacity: 0,
903
+ scale: .96
904
+ },
905
+ animate: {
906
+ opacity: 1,
907
+ scale: 1
908
+ },
909
+ transition: n.fade
910
+ } : {},
911
+ ...t(C),
912
+ children: [O > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("svg", {
913
+ width: O,
914
+ height: _,
915
+ role: "img",
916
+ "aria-label": x ?? "Radar chart",
917
+ children: /* @__PURE__ */ f("g", {
918
+ transform: `translate(${O / 2},${_ / 2})`,
919
+ children: [
920
+ Array.from({ length: m }, (e, t) => {
921
+ let n = F / m * (t + 1);
922
+ return /* @__PURE__ */ d("polygon", {
923
+ points: a.map((e, t) => {
924
+ let r = U * t - Math.PI / 2;
925
+ return `${n * Math.cos(r)},${n * Math.sin(r)}`;
926
+ }).join(" "),
927
+ fill: "none",
928
+ stroke: "var(--color-surface-border)",
929
+ strokeDasharray: "3,3",
930
+ strokeWidth: 1
931
+ }, `grid-${t}`);
932
+ }),
933
+ a.map((e, t) => {
934
+ let n = U * t - Math.PI / 2;
935
+ return /* @__PURE__ */ d("line", {
936
+ x1: 0,
937
+ y1: 0,
938
+ x2: F * Math.cos(n),
939
+ y2: F * Math.sin(n),
940
+ stroke: "var(--color-surface-border)",
941
+ strokeWidth: 1
942
+ }, `axis-${t}`);
943
+ }),
944
+ a.map((e, t) => {
945
+ let n = U * t - Math.PI / 2, r = F + 18, i = r * Math.cos(n), a = r * Math.sin(n), o = "middle";
946
+ return Math.abs(Math.cos(n)) > .1 && (o = Math.cos(n) > 0 ? "start" : "end"), /* @__PURE__ */ d("text", {
947
+ x: i,
948
+ y: a,
949
+ textAnchor: o,
950
+ dominantBaseline: "central",
951
+ className: "fill-surface-fg-muted text-ds-xs",
952
+ children: e
953
+ }, `label-${t}`);
954
+ }),
955
+ Array.from({ length: m }, (e, t) => {
956
+ let n = Math.round(B / m * (t + 1)), r = F / m * (t + 1), i = -Math.PI / 2;
957
+ return /* @__PURE__ */ d("text", {
958
+ x: r * Math.cos(i) + 4,
959
+ y: r * Math.sin(i),
960
+ textAnchor: "start",
961
+ dominantBaseline: "auto",
962
+ className: "fill-surface-fg-subtle text-ds-xs",
963
+ children: n
964
+ }, `level-label-${t}`);
965
+ }),
966
+ o.map((e, t) => {
967
+ let n = G(e.key), r = W(n);
968
+ return r ? /* @__PURE__ */ f("g", { children: [/* @__PURE__ */ d("path", {
969
+ d: r,
970
+ fill: z[t],
971
+ fillOpacity: h,
972
+ stroke: z[t],
973
+ strokeWidth: 2,
974
+ strokeLinejoin: "round"
975
+ }), g && n.map((n, r) => {
976
+ let { x: i, y: a } = K(r, n);
977
+ return /* @__PURE__ */ d("circle", {
978
+ cx: i,
979
+ cy: a,
980
+ r: 4,
981
+ fill: z[t],
982
+ stroke: "var(--color-surface-base)",
983
+ strokeWidth: 2,
984
+ className: "transition-opacity"
985
+ }, `dot-${e.key}-${r}`);
986
+ })] }, e.key) : null;
987
+ }),
988
+ v && a.map((e, t) => {
989
+ let n = U * t - Math.PI / 2;
990
+ return /* @__PURE__ */ d("circle", {
991
+ cx: F * Math.cos(n),
992
+ cy: F * Math.sin(n),
993
+ r: 16,
994
+ fill: "transparent",
995
+ className: "cursor-pointer",
996
+ onMouseMove: (n) => {
997
+ let r = n.currentTarget.closest("div")?.getBoundingClientRect();
998
+ j(n.clientX - (r?.left ?? 0), n.clientY - (r?.top ?? 0), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("div", {
999
+ className: "font-medium",
1000
+ children: e
1001
+ }), o.map((e, n) => {
1002
+ let r = Number(i[t]?.[e.key]) || 0;
1003
+ return /* @__PURE__ */ f("div", {
1004
+ className: "flex items-center gap-ds-02",
1005
+ children: [
1006
+ /* @__PURE__ */ d("span", {
1007
+ className: "inline-block h-2 w-2 rounded-ds-full",
1008
+ style: { backgroundColor: z[n] }
1009
+ }),
1010
+ /* @__PURE__ */ f("span", {
1011
+ className: "text-surface-fg-muted",
1012
+ children: [e.label, ":"]
1013
+ }),
1014
+ " ",
1015
+ r.toLocaleString()
1016
+ ]
1017
+ }, e.key);
1018
+ })] }));
1019
+ },
1020
+ onMouseLeave: M
1021
+ }, `hover-${t}`);
1022
+ })
1023
+ ]
1024
+ })
1025
+ }), v && /* @__PURE__ */ d(L, { state: A })] }), y && /* @__PURE__ */ d(I, {
1026
+ items: o.map((e, t) => ({
1027
+ label: e.label,
1028
+ color: z[t]
1029
+ })),
1030
+ className: "mt-ds-04"
1031
+ })]
1032
+ });
1033
+ });
1034
+ Q.displayName = "RadarChart";
1035
+ //#endregion
1036
+ export { K as AreaChart, W as BarChart, N as ChartContainer, Z as GaugeChart, I as Legend, G as LineChart, q as PieChart, Q as RadarChart, Y as Sparkline };