@flikk/ui 1.0.0-beta.27 → 1.0.0-beta.29

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 (319) hide show
  1. package/dist/bg/1.webp +0 -0
  2. package/dist/bg/10.webp +0 -0
  3. package/dist/bg/11.webp +0 -0
  4. package/dist/bg/12.webp +0 -0
  5. package/dist/bg/13.webp +0 -0
  6. package/dist/bg/14.webp +0 -0
  7. package/dist/bg/15.webp +0 -0
  8. package/dist/bg/16.webp +0 -0
  9. package/dist/bg/17.webp +0 -0
  10. package/dist/bg/18.webp +0 -0
  11. package/dist/bg/19.webp +0 -0
  12. package/dist/bg/2.webp +0 -0
  13. package/dist/bg/20.webp +0 -0
  14. package/dist/bg/21.webp +0 -0
  15. package/dist/bg/22.webp +0 -0
  16. package/dist/bg/3.webp +0 -0
  17. package/dist/bg/4.webp +0 -0
  18. package/dist/bg/5.webp +0 -0
  19. package/dist/bg/6.webp +0 -0
  20. package/dist/bg/7.webp +0 -0
  21. package/dist/bg/8.webp +0 -0
  22. package/dist/bg/9.webp +0 -0
  23. package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
  24. package/dist/components/ai/PromptInput/PromptInput.js +7 -143
  25. package/dist/components/ai/PromptInput/VoiceRecorder.js +0 -88
  26. package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
  27. package/dist/components/canvas/Background.d.ts +19 -0
  28. package/dist/components/canvas/Background.js +23 -0
  29. package/dist/components/canvas/BaseNode.d.ts +15 -0
  30. package/dist/components/canvas/BaseNode.js +20 -0
  31. package/dist/components/canvas/CanvasToolbar.d.ts +34 -0
  32. package/dist/components/canvas/CanvasToolbar.js +34 -0
  33. package/dist/components/canvas/Edge.d.ts +35 -0
  34. package/dist/components/canvas/Edge.js +97 -0
  35. package/dist/components/canvas/EdgeLayer.d.ts +18 -0
  36. package/dist/components/canvas/EdgeLayer.js +111 -0
  37. package/dist/components/canvas/Handle.d.ts +11 -0
  38. package/dist/components/canvas/Handle.js +63 -0
  39. package/dist/components/canvas/MiniMap.d.ts +22 -0
  40. package/dist/components/canvas/MiniMap.js +105 -0
  41. package/dist/components/canvas/NodeCanvas.d.ts +10 -0
  42. package/dist/components/canvas/NodeCanvas.js +477 -0
  43. package/dist/components/canvas/NodeCanvas.theme.d.ts +7 -0
  44. package/dist/components/canvas/NodeCanvas.theme.js +9 -0
  45. package/dist/components/canvas/NodeCanvas.types.d.ts +187 -0
  46. package/dist/components/canvas/NodeControls.d.ts +25 -0
  47. package/dist/components/canvas/NodeControls.js +40 -0
  48. package/dist/components/canvas/NodeRenderer.d.ts +19 -0
  49. package/dist/components/canvas/NodeRenderer.js +117 -0
  50. package/dist/components/canvas/changes.d.ts +11 -0
  51. package/dist/components/canvas/changes.js +76 -0
  52. package/dist/components/canvas/context/CanvasContext.d.ts +32 -0
  53. package/dist/components/canvas/context/CanvasContext.js +14 -0
  54. package/dist/components/canvas/context/ConnectionContext.d.ts +33 -0
  55. package/dist/components/canvas/context/ConnectionContext.js +13 -0
  56. package/dist/components/canvas/context/HandleRegistry.d.ts +24 -0
  57. package/dist/components/canvas/context/HandleRegistry.js +15 -0
  58. package/dist/components/canvas/context/InteractionContext.d.ts +18 -0
  59. package/dist/components/canvas/context/InteractionContext.js +14 -0
  60. package/dist/components/canvas/context/NodeIdContext.d.ts +3 -0
  61. package/dist/components/canvas/context/NodeIdContext.js +15 -0
  62. package/dist/components/canvas/hooks/useConnection.d.ts +17 -0
  63. package/dist/components/canvas/hooks/useConnection.js +29 -0
  64. package/dist/components/canvas/hooks/useMarquee.d.ts +25 -0
  65. package/dist/components/canvas/hooks/useMarquee.js +91 -0
  66. package/dist/components/canvas/hooks/useNodeDrag.d.ts +23 -0
  67. package/dist/components/canvas/hooks/useNodeDrag.js +110 -0
  68. package/dist/components/canvas/hooks/usePanZoom.d.ts +30 -0
  69. package/dist/components/canvas/hooks/usePanZoom.js +189 -0
  70. package/dist/components/canvas/hooks/useViewport.d.ts +21 -0
  71. package/dist/components/canvas/hooks/useViewport.js +35 -0
  72. package/dist/components/canvas/index.d.ts +14 -0
  73. package/dist/components/canvas/index.js +12 -0
  74. package/dist/components/canvas/layout.d.ts +22 -0
  75. package/dist/components/canvas/layout.js +67 -0
  76. package/dist/components/canvas/utils.d.ts +4 -0
  77. package/dist/components/canvas/utils.js +16 -0
  78. package/dist/components/charts/AreaChart/AreaChart.js +136 -101
  79. package/dist/components/charts/AreaChart/AreaChart.types.d.ts +5 -5
  80. package/dist/components/charts/AreaChart/AreaChart.types.js +1 -0
  81. package/dist/components/charts/BarChart/BarChart.js +207 -143
  82. package/dist/components/charts/BarChart/BarChart.types.d.ts +4 -4
  83. package/dist/components/charts/BarChart/BarChart.types.js +1 -0
  84. package/dist/components/charts/ComboChart/ComboChart.types.d.ts +2 -2
  85. package/dist/components/charts/LineChart/LineChart.js +88 -72
  86. package/dist/components/charts/LineChart/LineChart.types.d.ts +3 -3
  87. package/dist/components/charts/RadarChart/RadarChart.js +1 -1
  88. package/dist/components/charts/RadarChart/RadarChart.theme.js +5 -2
  89. package/dist/components/charts/ScatterPlot/ScatterPlot.js +62 -72
  90. package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +10 -1
  91. package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +3 -9
  92. package/dist/components/charts/StackedBarChart/StackedBarChart.js +33 -33
  93. package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +2 -2
  94. package/dist/components/charts/hooks/index.d.ts +2 -0
  95. package/dist/components/charts/hooks/useChartDimensions.d.ts +29 -0
  96. package/dist/components/charts/hooks/useChartDimensions.js +42 -0
  97. package/dist/components/charts/shared/ChartTooltip/ChartTooltip.theme.js +1 -1
  98. package/dist/components/charts/types/chart.types.d.ts +11 -2
  99. package/dist/components/charts/types/chart.types.js +10 -3
  100. package/dist/components/core/Avatar/Avatar.js +5 -1
  101. package/dist/components/core/AvatarGroup/AvatarGroup.js +5 -1
  102. package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +4 -2
  103. package/dist/components/core/Badge/Badge.js +1 -1
  104. package/dist/components/core/Badge/Badge.theme.js +16 -15
  105. package/dist/components/core/Button/Button.js +1 -1
  106. package/dist/components/core/Button/Button.theme.js +2 -2
  107. package/dist/components/core/Calendar/Calendar.theme.js +1 -1
  108. package/dist/components/core/Card/Card.js +7 -3
  109. package/dist/components/core/Card/Card.theme.js +3 -3
  110. package/dist/components/core/Card/Card.types.d.ts +27 -2
  111. package/dist/components/core/CommandPalette/CommandPalette.theme.js +2 -2
  112. package/dist/components/core/ContextMenu/ContextMenu.theme.js +2 -2
  113. package/dist/components/core/ContextMenu/ContextMenuItem.js +1 -1
  114. package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +1 -1
  115. package/dist/components/core/Dropdown/Dropdown.theme.js +3 -3
  116. package/dist/components/core/Dropdown/DropdownMenu.js +57 -29
  117. package/dist/components/core/HeroCard/HeroCard.d.ts +5 -0
  118. package/dist/components/core/HeroCard/HeroCard.js +99 -0
  119. package/dist/components/core/HeroCard/HeroCard.theme.d.ts +3 -0
  120. package/dist/components/core/HeroCard/HeroCard.theme.js +8 -0
  121. package/dist/components/core/HeroCard/HeroCard.types.d.ts +70 -0
  122. package/dist/components/core/HeroCard/index.d.ts +4 -0
  123. package/dist/components/core/Kbd/Kbd.theme.js +1 -1
  124. package/dist/components/core/Modal/Modal.d.ts +1 -1
  125. package/dist/components/core/Modal/Modal.js +2 -7
  126. package/dist/components/core/Modal/Modal.theme.js +4 -8
  127. package/dist/components/core/Modal/Modal.types.d.ts +0 -10
  128. package/dist/components/core/Modal/index.d.ts +1 -1
  129. package/dist/components/core/ModalStack/ModalStack.d.ts +1 -1
  130. package/dist/components/core/ModalStack/ModalStack.types.d.ts +1 -2
  131. package/dist/components/core/ModalStack/ModalStackModal.d.ts +1 -1
  132. package/dist/components/core/ModalStack/ModalStackModal.js +2 -7
  133. package/dist/components/core/PageHeading/PageHeading.theme.js +2 -2
  134. package/dist/components/core/Popover/Popover.theme.js +1 -1
  135. package/dist/components/core/ScrollArea/ScrollArea.js +242 -4
  136. package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -1
  137. package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.d.ts +4 -0
  138. package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.js +23 -0
  139. package/dist/components/core/ScrollArea/smooth/useSmoothScroll.js +4 -0
  140. package/dist/components/core/ScrollArea/smooth/useSmoothScroll.types.d.ts +5 -0
  141. package/dist/components/core/Segmented/Segmented.theme.js +2 -2
  142. package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
  143. package/dist/components/core/index.d.ts +1 -0
  144. package/dist/components/core/index.js +2 -0
  145. package/dist/components/data-display/DescriptionList/DescriptionList.js +23 -7
  146. package/dist/components/data-display/DescriptionList/DescriptionList.theme.js +10 -3
  147. package/dist/components/data-display/DescriptionList/DescriptionList.types.d.ts +49 -10
  148. package/dist/components/data-display/DescriptionList/index.d.ts +1 -1
  149. package/dist/components/data-display/Feed/Feed.js +28 -5
  150. package/dist/components/data-display/Feed/Feed.theme.js +1 -1
  151. package/dist/components/data-display/Feed/Feed.types.d.ts +32 -1
  152. package/dist/components/data-display/Feed/index.d.ts +1 -1
  153. package/dist/components/data-display/Metric/Metric.js +8 -8
  154. package/dist/components/data-display/Metric/Metric.theme.d.ts +3 -2
  155. package/dist/components/data-display/Metric/Metric.theme.js +50 -68
  156. package/dist/components/data-display/Metric/Metric.types.d.ts +19 -21
  157. package/dist/components/data-display/Table/Table.js +2 -2
  158. package/dist/components/data-display/Table/Table.theme.js +24 -4
  159. package/dist/components/data-display/Table/Table.types.d.ts +8 -0
  160. package/dist/components/data-display/Table/TableBody.js +2 -2
  161. package/dist/components/data-display/Table/TableCell.js +1 -1
  162. package/dist/components/data-display/Table/TableRow.d.ts +1 -1
  163. package/dist/components/data-display/Table/TableRow.js +9 -2
  164. package/dist/components/data-display/Timeline/Timeline.js +27 -5
  165. package/dist/components/data-display/Timeline/Timeline.theme.d.ts +10 -2
  166. package/dist/components/data-display/Timeline/Timeline.theme.js +14 -8
  167. package/dist/components/data-display/Timeline/Timeline.types.d.ts +48 -16
  168. package/dist/components/data-display/Timeline/Timeline.utils.d.ts +6 -0
  169. package/dist/components/data-display/Timeline/Timeline.utils.js +11 -0
  170. package/dist/components/data-display/Timeline/TimelineItem.js +13 -20
  171. package/dist/components/data-display/Timeline/TimelineMarker.js +10 -8
  172. package/dist/components/data-display/Timeline/index.d.ts +2 -2
  173. package/dist/components/effects/3d/index.d.ts +0 -2
  174. package/dist/components/effects/3d/index.js +0 -1
  175. package/dist/components/effects/DotPattern/DotPattern.js +1 -1
  176. package/dist/components/effects/Overlay/Overlay.theme.js +1 -2
  177. package/dist/components/effects/Preloader/Preloader.animations.d.ts +23 -0
  178. package/dist/components/effects/Preloader/Preloader.animations.js +150 -0
  179. package/dist/components/effects/Preloader/Preloader.d.ts +3 -0
  180. package/dist/components/effects/Preloader/Preloader.js +119 -0
  181. package/dist/components/effects/Preloader/Preloader.types.d.ts +63 -0
  182. package/dist/components/effects/Preloader/index.d.ts +2 -0
  183. package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +25 -14
  184. package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +2 -0
  185. package/dist/components/effects/TiltCard/TiltCard.d.ts +12 -0
  186. package/dist/components/effects/TiltCard/TiltCard.glow.d.ts +28 -0
  187. package/dist/components/effects/TiltCard/TiltCard.glow.js +114 -0
  188. package/dist/components/effects/TiltCard/TiltCard.js +177 -0
  189. package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.d.ts → TiltCard/TiltCard.shaders.d.ts} +1 -1
  190. package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.js → TiltCard/TiltCard.shaders.js} +1 -1
  191. package/dist/components/effects/TiltCard/TiltCard.types.d.ts +88 -0
  192. package/dist/components/effects/TiltCard/index.d.ts +2 -0
  193. package/dist/components/effects/index.d.ts +4 -12
  194. package/dist/components/effects/index.js +2 -6
  195. package/dist/components/forms/Checkbox/Checkbox.js +7 -1
  196. package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
  197. package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +1 -1
  198. package/dist/components/forms/FileUpload/FileUpload.js +1 -89
  199. package/dist/components/forms/FormLabel/FormLabel.theme.js +1 -1
  200. package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
  201. package/dist/components/forms/Slider/Slider.theme.js +1 -1
  202. package/dist/components/forms/Switch/Switch.js +27 -15
  203. package/dist/components/forms/Switch/Switch.theme.d.ts +36 -6
  204. package/dist/components/forms/Switch/Switch.theme.js +33 -4
  205. package/dist/components/forms/Switch/Switch.types.d.ts +12 -2
  206. package/dist/components/forms/TimePicker/TimePicker.theme.js +1 -2
  207. package/dist/components/forms/TimePicker/TimePickerContent.js +1 -90
  208. package/dist/components/forms/forms.theme.js +1 -1
  209. package/dist/components/forms/index.d.ts +0 -4
  210. package/dist/components/forms/index.js +0 -92
  211. package/dist/components/generative/GenerativeView.d.ts +21 -0
  212. package/dist/components/generative/GenerativeView.js +116 -0
  213. package/dist/components/generative/actions.d.ts +26 -0
  214. package/dist/components/generative/actions.js +51 -0
  215. package/dist/components/generative/index.d.ts +11 -0
  216. package/dist/components/generative/index.js +9 -0
  217. package/dist/components/generative/registry.d.ts +43 -0
  218. package/dist/components/generative/registry.js +114 -0
  219. package/dist/components/generative/resolvers.d.ts +35 -0
  220. package/dist/components/generative/resolvers.js +93 -0
  221. package/dist/components/generative/schema.generated.d.ts +2 -0
  222. package/dist/components/generative/schema.generated.js +1639 -0
  223. package/dist/components/generative/schemaTypes.d.ts +30 -0
  224. package/dist/components/generative/streaming.d.ts +39 -0
  225. package/dist/components/generative/streaming.js +283 -0
  226. package/dist/components/generative/tools.d.ts +21 -0
  227. package/dist/components/generative/tools.js +54 -0
  228. package/dist/components/generative/types.d.ts +41 -0
  229. package/dist/components/generative/useGenerativeStream.d.ts +37 -0
  230. package/dist/components/generative/useGenerativeStream.js +36 -0
  231. package/dist/components/generative/validate.d.ts +24 -0
  232. package/dist/components/generative/validate.js +259 -0
  233. package/dist/components/layout/AppShell/AppShell.theme.js +2 -2
  234. package/dist/components/layout/FormLayout/FormLayout.js +1 -90
  235. package/dist/components/layout/Grid/Grid.d.ts +3 -0
  236. package/dist/components/layout/Grid/Grid.js +50 -0
  237. package/dist/components/layout/Grid/Grid.theme.d.ts +2 -0
  238. package/dist/components/layout/Grid/Grid.theme.js +35 -0
  239. package/dist/components/layout/Grid/Grid.types.d.ts +57 -0
  240. package/dist/components/layout/Grid/index.d.ts +3 -0
  241. package/dist/components/layout/Section/Section.d.ts +3 -0
  242. package/dist/components/layout/Section/Section.js +18 -0
  243. package/dist/components/layout/Section/Section.theme.d.ts +2 -0
  244. package/dist/components/layout/Section/Section.theme.js +10 -0
  245. package/dist/components/layout/Section/Section.types.d.ts +34 -0
  246. package/dist/components/layout/Section/index.d.ts +3 -0
  247. package/dist/components/layout/Stack/Stack.d.ts +3 -0
  248. package/dist/components/layout/Stack/Stack.js +19 -0
  249. package/dist/components/layout/Stack/Stack.theme.d.ts +2 -0
  250. package/dist/components/layout/Stack/Stack.theme.js +10 -0
  251. package/dist/components/layout/Stack/Stack.types.d.ts +39 -0
  252. package/dist/components/layout/Stack/index.d.ts +3 -0
  253. package/dist/components/layout/index.d.ts +3 -0
  254. package/dist/components/layout/index.js +6 -0
  255. package/dist/generative.schema.json +1637 -0
  256. package/dist/index.js +180 -180
  257. package/dist/registry.json +648 -464
  258. package/dist/styles.css +1 -1
  259. package/dist/tools.json +1731 -0
  260. package/package.json +17 -4
  261. package/src/global.scss +53 -101
  262. package/src/styles/theme.css +687 -493
  263. package/dist/bg/1.jpg +0 -0
  264. package/dist/bg/10.jpg +0 -0
  265. package/dist/bg/11.jpg +0 -0
  266. package/dist/bg/14.jpg +0 -0
  267. package/dist/bg/15.jpg +0 -0
  268. package/dist/bg/16.jpg +0 -0
  269. package/dist/bg/17.jpg +0 -0
  270. package/dist/bg/18.jpg +0 -0
  271. package/dist/bg/19.jpg +0 -0
  272. package/dist/bg/2.jpg +0 -0
  273. package/dist/bg/20.jpg +0 -0
  274. package/dist/bg/21.jpg +0 -0
  275. package/dist/bg/22.jpg +0 -0
  276. package/dist/bg/23.jpg +0 -0
  277. package/dist/bg/24.jpg +0 -0
  278. package/dist/bg/3.jpg +0 -0
  279. package/dist/bg/4.jpg +0 -0
  280. package/dist/bg/5.jpg +0 -0
  281. package/dist/bg/6.jpg +0 -0
  282. package/dist/bg/7.jpg +0 -0
  283. package/dist/bg/8.jpg +0 -0
  284. package/dist/bg/9.jpg +0 -0
  285. package/dist/components/effects/MorphingText/MorphingText.d.ts +0 -17
  286. package/dist/components/effects/MorphingText/MorphingText.js +0 -125
  287. package/dist/components/effects/MorphingText/MorphingText.types.d.ts +0 -18
  288. package/dist/components/effects/MorphingText/index.d.ts +0 -2
  289. package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +0 -8
  290. package/dist/components/effects/PageTransition/PageTransition.animations.js +0 -53
  291. package/dist/components/effects/PageTransition/PageTransition.d.ts +0 -3
  292. package/dist/components/effects/PageTransition/PageTransition.js +0 -82
  293. package/dist/components/effects/PageTransition/PageTransition.types.d.ts +0 -15
  294. package/dist/components/effects/PageTransition/index.d.ts +0 -2
  295. package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +0 -26
  296. package/dist/components/effects/ParallaxSection/ParallaxSection.js +0 -71
  297. package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +0 -11
  298. package/dist/components/effects/ParallaxSection/index.d.ts +0 -2
  299. package/dist/components/effects/Spotlight/Spotlight.d.ts +0 -36
  300. package/dist/components/effects/Spotlight/Spotlight.js +0 -112
  301. package/dist/components/effects/Spotlight/Spotlight.types.d.ts +0 -29
  302. package/dist/components/effects/Spotlight/index.d.ts +0 -2
  303. package/dist/components/effects/SpotlightBorder/SpotlightBorder.d.ts +0 -18
  304. package/dist/components/effects/SpotlightBorder/SpotlightBorder.js +0 -213
  305. package/dist/components/effects/SpotlightBorder/SpotlightBorder.types.d.ts +0 -61
  306. package/dist/components/effects/SpotlightBorder/index.d.ts +0 -2
  307. package/dist/components/effects/StickyScroll/StickyScroll.d.ts +0 -30
  308. package/dist/components/effects/StickyScroll/StickyScroll.js +0 -128
  309. package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +0 -19
  310. package/dist/components/effects/StickyScroll/index.d.ts +0 -2
  311. package/dist/components/forms/CronInput/CronInput.d.ts +0 -3
  312. package/dist/components/forms/CronInput/CronInput.js +0 -113
  313. package/dist/components/forms/CronInput/CronInput.theme.d.ts +0 -6
  314. package/dist/components/forms/CronInput/CronInput.theme.js +0 -75
  315. package/dist/components/forms/CronInput/CronInput.types.d.ts +0 -109
  316. package/dist/components/forms/CronInput/CronInput.utils.d.ts +0 -67
  317. package/dist/components/forms/CronInput/CronInput.utils.js +0 -505
  318. package/dist/components/forms/CronInput/index.d.ts +0 -4
  319. /package/dist/components/effects/{SpotlightBorder/SpotlightBorder.types.js → TiltCard/TiltCard.types.js} +0 -0
@@ -1,16 +1,18 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useEffect, useRef, useMemo } from 'react';
3
- import { useReducedMotion, motion } from 'motion/react';
2
+ import React__default, { useId, useState, useEffect, useRef, useMemo } from 'react';
3
+ import { useReducedMotion, motion, AnimatePresence } from 'motion/react';
4
4
  import { cn } from '../../../utils/cn.js';
5
5
  import { useTooltipPosition } from '../hooks/useTooltipPosition.js';
6
6
  import { useChartAccessibility } from '../hooks/useChartAccessibility.js';
7
7
  import { useChartValidation } from '../hooks/useChartValidation.js';
8
+ import { useChartDimensions } from '../hooks/useChartDimensions.js';
8
9
  import { ChartErrorBoundary } from '../shared/ChartErrorBoundary/ChartErrorBoundary.js';
9
10
  import { XAxis } from '../shared/ChartAxis/XAxis.js';
10
11
  import { YAxis } from '../shared/ChartAxis/YAxis.js';
11
12
  import { HorizontalGrid } from '../shared/ChartGrid/HorizontalGrid.js';
12
13
  import { ChartTooltip } from '../shared/ChartTooltip/ChartTooltip.js';
13
14
  import { BAR_CHART_DEFAULTS } from './BarChart.types.js';
15
+ import { X_AXIS_MARGIN } from '../types/chart.types.js';
14
16
  import { ExclamationTriangleIcon } from '@heroicons/react/20/solid';
15
17
 
16
18
  // Pure helper functions moved to module level to avoid recreation per render
@@ -62,10 +64,16 @@ showPlaceholderBars = BAR_CHART_DEFAULTS.showPlaceholderBars, placeholderData,
62
64
  // Color customization
63
65
  colors,
64
66
  // Base props
65
- className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.enableKeyboardNavigation, showValidationWarnings = process.env.NODE_ENV === "development", darkMode = false, children, ...props }) => {
67
+ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.enableKeyboardNavigation, showValidationWarnings = process.env.NODE_ENV === "development", darkMode = false, width, height, children, ...props }) => {
66
68
  var _a, _b;
67
69
  // Resolve barRadius with backward compatibility
68
70
  const resolvedBarRadius = (_a = barRadius !== null && barRadius !== void 0 ? barRadius : radius) !== null && _a !== void 0 ? _a : BAR_CHART_DEFAULTS.barRadius;
71
+ const chartId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
72
+ const isGradientVariant = variant === "gradient";
73
+ const hatchPatternId = `${chartId}-diagonal-hatch`;
74
+ const getBarGradientId = (index) => `${chartId}-bar-gradient-${index}`;
75
+ const getBarShadowId = (index) => `${chartId}-bar-shadow-${index}`;
76
+ const getBarRingId = (index) => `${chartId}-bar-ring-${index}`;
69
77
  // Development warning for deprecated radius prop
70
78
  if (process.env.NODE_ENV !== "production" && radius !== undefined) {
71
79
  console.warn("[BarChart]: The `radius` prop is deprecated and will be removed in a future version. " +
@@ -98,7 +106,19 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
98
106
  return (jsx("div", { className: cn("chart-container flex items-center justify-center text-[var(--color-text-muted)]", className), role: "img", "aria-label": "Empty bar chart", ...props, children: jsx("span", { children: "No data available" }) }));
99
107
  }
100
108
  // Simple color functions based on direct CSS variables (following guidelines)
101
- const getSeriesFillColor = (index) => {
109
+ const getSeriesFillColor = (index, key) => {
110
+ var _a, _b, _c;
111
+ if (key && ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.color)) {
112
+ const customColor = config[key].color;
113
+ if (!customColor.startsWith("var(") &&
114
+ !customColor.startsWith("#") &&
115
+ !customColor.startsWith("rgb") &&
116
+ !customColor.startsWith("hsl") &&
117
+ customColor.includes("-")) {
118
+ return `var(--color-${customColor})`;
119
+ }
120
+ return customColor;
121
+ }
102
122
  const defaultColors = [
103
123
  "var(--color-primary)",
104
124
  "var(--color-warning)",
@@ -106,11 +126,19 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
106
126
  "var(--color-danger)",
107
127
  ];
108
128
  // Use custom colors if provided, otherwise fall back to defaults
109
- const palette = colors && colors.length > 0 ? colors : defaultColors;
129
+ const themedColors = (_c = (_b = theme === null || theme === void 0 ? void 0 : theme.baseStyle) === null || _b === void 0 ? void 0 : _b.colors) === null || _c === void 0 ? void 0 : _c.series;
130
+ const palette = colors && colors.length > 0
131
+ ? colors
132
+ : themedColors && themedColors.length > 0
133
+ ? themedColors
134
+ : defaultColors;
110
135
  return palette[index % palette.length];
111
136
  };
112
137
  const containerRef = useRef(null);
113
- const [dimensions, setDimensions] = useState({ width: 600, height: 400 });
138
+ // Bars must not mount before the real container size is known (cold-load bug:
139
+ // motion captures geometry in the 600×400 fallback space, so the entrance
140
+ // animation rises from below the real baseline). `measured` gates the mount.
141
+ const { dimensions, measured } = useChartDimensions(containerRef);
114
142
  const [hoveredCategory, setHoveredCategory] = useState(null);
115
143
  // Detect if device is mobile/touch
116
144
  const isMobile = typeof window !== "undefined" &&
@@ -129,31 +157,11 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
129
157
  description,
130
158
  enableKeyboardNavigation,
131
159
  });
132
- // Measure container dimensions
133
- useEffect(() => {
134
- const updateDimensions = () => {
135
- if (containerRef.current) {
136
- const { width, height } = containerRef.current.getBoundingClientRect();
137
- setDimensions({
138
- width: width || 600,
139
- height: height || 400,
140
- });
141
- }
142
- };
143
- updateDimensions();
144
- const resizeObserver = new ResizeObserver(updateDimensions);
145
- if (containerRef.current) {
146
- resizeObserver.observe(containerRef.current);
147
- }
148
- return () => {
149
- resizeObserver.disconnect();
150
- };
151
- }, []);
152
160
  // Calculate dimensions with safe math
153
161
  const margin = useMemo(() => ({
154
162
  top: 15,
155
163
  right: showYAxis ? 20 : 0,
156
- bottom: showXAxis ? 20 : 0,
164
+ bottom: showXAxis ? X_AXIS_MARGIN : 0,
157
165
  left: showYAxis ? 60 : 0,
158
166
  }), [showYAxis, showXAxis]);
159
167
  const innerWidth = Math.max(0, dimensions.width - margin.left - margin.right);
@@ -182,7 +190,7 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
182
190
  const individualBarWidth = safeMath.divide(availableBarWidth, dataKeys.length, 0);
183
191
  // Handle keyboard focus tooltips
184
192
  useEffect(() => {
185
- var _a, _b;
193
+ var _a;
186
194
  if (isKeyboardMode &&
187
195
  focusedElementIndex >= 0 &&
188
196
  focusedElementIndex < sanitizedData.length) {
@@ -201,7 +209,7 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
201
209
  const isNeg = value < 0;
202
210
  const y = isNeg ? zeroY : zeroY - barHeight;
203
211
  // Get the fill color for the first series (index 0)
204
- const fillColor = getSeriesFillColor(0);
212
+ const fillColor = getSeriesFillColor(0, key);
205
213
  const content = {
206
214
  category: item.name || `Category ${focusedElementIndex + 1}`,
207
215
  series: [
@@ -209,7 +217,7 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
209
217
  key,
210
218
  label: ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) || key,
211
219
  value: value,
212
- color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || fillColor,
220
+ color: fillColor,
213
221
  },
214
222
  ],
215
223
  };
@@ -278,11 +286,12 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
278
286
  rawValue === undefined ||
279
287
  (typeof rawValue === "number" && !isFinite(rawValue));
280
288
  // Get fill color for this data series using direct CSS variables
281
- const fillColor = getSeriesFillColor(keyIndex);
289
+ const fillColor = getSeriesFillColor(keyIndex, key);
282
290
  const isHovered = hoveredCategory === index;
283
291
  const isAnyBarHovered = hoveredCategory !== null;
284
292
  const shouldReduceOpacity = isAnyBarHovered && !isHovered;
285
293
  const isFocused = isKeyboardMode && focusedElementIndex === index;
294
+ const isEmphasized = isHovered || isFocused;
286
295
  // Handle null bars - either skip or show placeholder
287
296
  if (isNull) {
288
297
  if (!showPlaceholderBars) {
@@ -327,7 +336,7 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
327
336
  }, className: "transition-opacity duration-200", style: {
328
337
  originY: 1,
329
338
  transformOrigin: "bottom",
330
- fill: "url(#diagonalHatch)",
339
+ fill: `url(#${hatchPatternId})`,
331
340
  opacity: 0.75,
332
341
  }, "aria-label": `${item.name || `Category ${index + 1}`} - ${((_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) || key}: No data` }, keyIndex));
333
342
  }
@@ -339,122 +348,177 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
339
348
  ? createRoundedBottomBarPath(barX, barY, individualBarWidth, barHeight, resolvedBarRadius)
340
349
  : createRoundedTopBarPath(barX, barY, individualBarWidth, barHeight, resolvedBarRadius);
341
350
  const delay = (index * dataKeys.length + keyIndex) * BAR_STAGGER;
342
- return (jsx(motion.path, { d: pathD, initial: shouldAnimate && showAnimation && !shouldReduceMotion
343
- ? { scaleY: 0, opacity: 0 }
344
- : { scaleY: 1, opacity: 1 }, animate: {
345
- scaleY: 1,
346
- opacity: 1,
347
- }, transition: {
348
- type: "spring",
349
- stiffness: 100,
350
- damping: 20,
351
- delay,
352
- }, className: cn("transition-colors duration-200", !isNull && "cursor-pointer", isFocused && "stroke-2"), style: {
353
- originY: isNegative ? 0 : 1,
354
- transformOrigin: isNegative ? "top" : "bottom",
355
- fill: isNull
356
- ? "var(--color-surface-sunken)"
357
- : shouldReduceOpacity
358
- ? "var(--color-surface-sunken)"
359
- : fillColor,
360
- opacity: !isNull && shouldReduceOpacity ? 0.9 : 1,
361
- stroke: isFocused ? "var(--color-primary)" : "none",
362
- }, onMouseEnter: !isNull
363
- ? (e) => {
364
- setHoveredCategory(index);
365
- // Create content with ALL series for this category
366
- const series = dataKeys
367
- .map((dataKey, idx) => {
368
- var _a, _b;
369
- const seriesValue = item[dataKey];
370
- const isSeriesNull = seriesValue === null ||
371
- seriesValue === undefined ||
372
- (typeof seriesValue === "number" &&
373
- !isFinite(seriesValue));
374
- return {
375
- key: dataKey,
376
- label: ((_a = config[dataKey]) === null || _a === void 0 ? void 0 : _a.label) || dataKey,
377
- value: isSeriesNull ? 0 : seriesValue,
378
- color: ((_b = config[dataKey]) === null || _b === void 0 ? void 0 : _b.color) || getSeriesFillColor(idx),
379
- };
380
- })
381
- .filter((series) => {
382
- // Only include non-null and non-zero values in tooltip
383
- const rawVal = item[series.key];
384
- return (rawVal != null &&
385
- typeof rawVal === "number" &&
386
- isFinite(rawVal) &&
387
- rawVal !== 0);
388
- });
389
- const content = {
390
- category: item.name || `Category ${index + 1}`,
391
- series,
392
- };
393
- const svgCoordinates = {
394
- x: barX + individualBarWidth / 2,
395
- y: barY,
396
- dimensions,
397
- };
398
- handleMouseEnter(e, content, svgCoordinates);
399
- }
400
- : undefined, onMouseMove: !isNull
401
- ? (e) => {
402
- if (hoveredCategory === index) {
403
- const svgCoordinates = {
404
- x: barX + individualBarWidth / 2,
405
- y: barY,
406
- dimensions,
407
- };
408
- handleMouseMove(e, svgCoordinates);
409
- }
410
- }
411
- : undefined, onMouseLeave: !isNull
412
- ? () => {
413
- setHoveredCategory(null);
414
- handleMouseLeave();
415
- }
416
- : undefined }, keyIndex));
351
+ const gradientFill = `url(#${getBarGradientId(keyIndex)})`;
352
+ const shadowFilter = `url(#${getBarShadowId(keyIndex)})`;
353
+ const ringFilter = `url(#${getBarRingId(keyIndex)})`;
354
+ const commonInitial = shouldAnimate && showAnimation && !shouldReduceMotion
355
+ ? { scaleY: 0, opacity: 0 }
356
+ : { scaleY: 1, opacity: 1 };
357
+ const commonTransition = {
358
+ type: "spring",
359
+ stiffness: 100,
360
+ damping: 20,
361
+ delay,
362
+ // Opacity carries both the mount fade-in and the hover dim. On mount it
363
+ // must wait out the same stagger delay as scaleY — a visible bar at
364
+ // scaleY≈0 renders as a glowing stub straddling the x-axis. After mount
365
+ // (hasAnimated), hover dims must respond with no delay. Motion re-reads
366
+ // this only when the opacity target changes, so the switch is safe.
367
+ opacity: {
368
+ type: "tween",
369
+ duration: 0.25,
370
+ ease: "easeOut",
371
+ delay: hasAnimated ? 0 : delay,
372
+ },
373
+ };
374
+ return (jsxs(React__default.Fragment, { children: [jsx(AnimatePresence, { children: isGradientVariant && isEmphasized && (jsx(motion.path, { d: pathD, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
375
+ opacity: {
376
+ duration: 0.45,
377
+ ease: "easeOut",
378
+ },
379
+ }, fill: "none", stroke: fillColor, strokeWidth: Math.min(14, Math.max(8, individualBarWidth * 0.08)), strokeOpacity: 0.24, strokeLinejoin: "round", vectorEffect: "non-scaling-stroke", filter: ringFilter, style: {
380
+ pointerEvents: "none",
381
+ } })) }), jsx(motion.path, { d: pathD, initial: commonInitial, animate: {
382
+ scaleY: 1,
383
+ // Hover dim lives in `animate`, not `style`: motion.path freezes
384
+ // plain style values at mount and ignores re-render changes
385
+ opacity: shouldReduceOpacity ? (isGradientVariant ? 0.42 : 0.9) : 1,
386
+ }, transition: commonTransition, className: cn(isGradientVariant
387
+ ? "transition-all duration-300 ease-out"
388
+ : "transition-colors duration-200", !isNull && "cursor-pointer", isFocused && "stroke-2"), style: {
389
+ originY: isNegative ? 0 : 1,
390
+ transformOrigin: isNegative ? "top" : "bottom",
391
+ fill: isGradientVariant
392
+ ? gradientFill
393
+ : isNull
394
+ ? "var(--color-surface-sunken)"
395
+ : shouldReduceOpacity
396
+ ? "var(--color-surface-sunken)"
397
+ : fillColor,
398
+ // Element opacity applies post-filter, so the animated hover dim
399
+ // fades the shadow along with the bar — no need to toggle it here
400
+ filter: isGradientVariant ? shadowFilter : undefined,
401
+ stroke: isFocused
402
+ ? "var(--color-primary)"
403
+ : isGradientVariant && isEmphasized
404
+ ? fillColor
405
+ : isGradientVariant
406
+ ? "rgba(255,255,255,0.24)"
407
+ : "none",
408
+ strokeWidth: isFocused
409
+ ? 3
410
+ : isGradientVariant && isEmphasized
411
+ ? 2
412
+ : isGradientVariant
413
+ ? 1
414
+ : undefined,
415
+ strokeOpacity: isGradientVariant && isEmphasized ? 0.78 : 1,
416
+ strokeLinejoin: "round",
417
+ vectorEffect: "non-scaling-stroke",
418
+ }, onMouseEnter: !isNull
419
+ ? (e) => {
420
+ setHoveredCategory(index);
421
+ // Create content with ALL series for this category
422
+ const series = dataKeys
423
+ .map((dataKey, idx) => {
424
+ var _a;
425
+ const seriesValue = item[dataKey];
426
+ const isSeriesNull = seriesValue === null ||
427
+ seriesValue === undefined ||
428
+ (typeof seriesValue === "number" &&
429
+ !isFinite(seriesValue));
430
+ return {
431
+ key: dataKey,
432
+ label: ((_a = config[dataKey]) === null || _a === void 0 ? void 0 : _a.label) || dataKey,
433
+ value: isSeriesNull ? 0 : seriesValue,
434
+ color: getSeriesFillColor(idx, dataKey),
435
+ };
436
+ })
437
+ .filter((series) => {
438
+ // Only include non-null and non-zero values in tooltip
439
+ const rawVal = item[series.key];
440
+ return (rawVal != null &&
441
+ typeof rawVal === "number" &&
442
+ isFinite(rawVal) &&
443
+ rawVal !== 0);
444
+ });
445
+ const content = {
446
+ category: item.name || `Category ${index + 1}`,
447
+ series,
448
+ };
449
+ const svgCoordinates = {
450
+ x: barX + individualBarWidth / 2,
451
+ y: barY,
452
+ dimensions,
453
+ };
454
+ handleMouseEnter(e, content, svgCoordinates);
455
+ }
456
+ : undefined, onMouseMove: !isNull
457
+ ? (e) => {
458
+ if (hoveredCategory === index) {
459
+ const svgCoordinates = {
460
+ x: barX + individualBarWidth / 2,
461
+ y: barY,
462
+ dimensions,
463
+ };
464
+ handleMouseMove(e, svgCoordinates);
465
+ }
466
+ }
467
+ : undefined, onMouseLeave: !isNull
468
+ ? () => {
469
+ setHoveredCategory(null);
470
+ handleMouseLeave();
471
+ }
472
+ : undefined })] }, keyIndex));
417
473
  };
418
- return (jsx(ChartErrorBoundary, { className: className, showErrorDetails: process.env.NODE_ENV === "development", children: jsxs("div", { ref: containerRef, className: cn("chart-container w-full h-full", darkMode && "dark", className), ...chartAccessibilityProps, onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction, ...props, children: [descriptionProps && jsx("div", { ...descriptionProps }), showValidationWarnings && hasWarnings && (jsxs("div", { className: "absolute top-2 left-2 right-2 z-10 p-2 bg-[var(--color-warning-50)] border border-[var(--color-warning-200)] rounded text-sm text-[var(--color-warning)] shadow-sm", children: [jsx("strong", { children: "Chart Warnings:" }), jsx("ul", { className: "mt-1", children: validation.warnings
474
+ return (jsx(ChartErrorBoundary, { className: className, showErrorDetails: process.env.NODE_ENV === "development", children: jsxs("div", { ref: containerRef, className: cn("chart-container w-full h-full", darkMode && "dark", className), style: {
475
+ width: width !== undefined ? (typeof width === "number" ? `${width}px` : width) : undefined,
476
+ height: height !== undefined ? (typeof height === "number" ? `${height}px` : height) : undefined,
477
+ }, ...chartAccessibilityProps, onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction, ...props, children: [descriptionProps && jsx("div", { ...descriptionProps }), showValidationWarnings && hasWarnings && (jsxs("div", { className: "absolute top-2 left-2 right-2 z-10 p-2 bg-[var(--color-warning-50)] border border-[var(--color-warning-200)] rounded text-sm text-[var(--color-warning)] shadow-sm", children: [jsx("strong", { children: "Chart Warnings:" }), jsx("ul", { className: "mt-1", children: validation.warnings
419
478
  .filter((warning) => !warning.message.includes("has no valid numeric values"))
420
- .map((warning, index) => (jsxs("li", { children: ["\u2022 ", warning.message] }, index))) }), validation.warnings.some((warning) => warning.message.includes("has no valid numeric values")) && (jsx("div", { className: "mt-2 pt-2 border-t border-[var(--color-warning-200)]", children: jsx("span", { className: "text-[var(--color-warning)]", children: "\u2139\uFE0F Null/undefined values are handled by using averages from other data points" }) }))] })), jsxs("svg", { width: "100%", height: "100%", viewBox: `0 0 ${dimensions.width} ${dimensions.height}`, children: [jsx("defs", { children: jsxs("pattern", { id: "diagonalHatch", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [jsx("rect", { width: "8", height: "8", fill: "var(--color-neutral-50)" }), jsx("path", { d: "M-2,2 l4,-4\n M0,8 l8,-8\n M6,10 l4,-4", style: { stroke: "black", strokeWidth: 4, opacity: 0.1 } })] }) }), jsx(HorizontalGrid, { show: showGrid, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5 }), jsx(YAxis, { show: showYAxis, min: minValue, max: maxValue, x: margin.left, y: margin.top, height: innerHeight, showGrid: false, gridWidth: innerWidth, tickFormatter: (value) => {
479
+ .map((warning, index) => (jsxs("li", { children: ["\u2022 ", warning.message] }, index))) }), validation.warnings.some((warning) => warning.message.includes("has no valid numeric values")) && (jsx("div", { className: "mt-2 pt-2 border-t border-[var(--color-warning-200)]", children: jsx("span", { className: "text-[var(--color-warning)]", children: "\u2139\uFE0F Null/undefined values are handled by using averages from other data points" }) }))] })), jsxs("svg", { width: "100%", height: "100%", viewBox: `0 0 ${dimensions.width} ${dimensions.height}`, style: { overflow: isGradientVariant ? "visible" : undefined }, children: [jsxs("defs", { children: [jsxs("pattern", { id: hatchPatternId, patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [jsx("rect", { width: "8", height: "8", fill: "var(--color-neutral-50)" }), jsx("path", { d: "M-2,2 l4,-4\n M0,8 l8,-8\n M6,10 l4,-4", style: { stroke: "black", strokeWidth: 4, opacity: 0.1 } })] }), isGradientVariant &&
480
+ dataKeys.map((key, index) => {
481
+ const color = getSeriesFillColor(index, key);
482
+ return (jsxs(React__default.Fragment, { children: [jsxs("linearGradient", { id: getBarGradientId(index), x1: "0", y1: "0", x2: "0", y2: "1", children: [jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.46" }), jsx("stop", { offset: "14%", stopColor: color, stopOpacity: "0.9" }), jsx("stop", { offset: "42%", stopColor: color, stopOpacity: "1" }), jsx("stop", { offset: "72%", stopColor: color, stopOpacity: "0.96" }), jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0.82" })] }), jsx("filter", { id: getBarShadowId(index), x: "-35%", y: "-35%", width: "170%", height: "190%", colorInterpolationFilters: "sRGB", children: jsx("feDropShadow", { dx: "0", dy: "10", stdDeviation: "8", floodColor: color, floodOpacity: "0.22" }) }), jsxs("filter", { id: getBarRingId(index), x: "-25%", y: "-25%", width: "150%", height: "165%", colorInterpolationFilters: "sRGB", children: [jsx("feDropShadow", { dx: "0", dy: "0", stdDeviation: "4", floodColor: color, floodOpacity: "0.42" }), jsx("feDropShadow", { dx: "0", dy: "10", stdDeviation: "8", floodColor: color, floodOpacity: "0.18" })] })] }, key));
483
+ })] }), jsx(HorizontalGrid, { show: showGrid, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5 }), jsx(YAxis, { show: showYAxis, min: minValue, max: maxValue, x: margin.left, y: margin.top, height: innerHeight, showGrid: false, gridWidth: innerWidth, tickFormatter: (value) => {
421
484
  if (Math.abs(value) >= 1000)
422
485
  return `${(value / 1000).toFixed(0)}k`;
423
486
  return value.toString();
424
- } }), minValue < 0 && maxValue > 0 && (jsx("line", { x1: margin.left, y1: margin.top + innerHeight - ((0 - minValue) / (maxValue - minValue)) * innerHeight, x2: margin.left + innerWidth, y2: margin.top + innerHeight - ((0 - minValue) / (maxValue - minValue)) * innerHeight, className: "stroke-[var(--color-text-secondary)]", strokeWidth: 1, opacity: 0.6 })), jsx("g", { className: "chart-bars", children: (() => {
425
- // Calculate the zero baseline position (where value=0 maps to in pixel space)
426
- const range = maxValue - minValue;
427
- const scaledZero = range > 0
428
- ? safeMath.scale(0, minValue, maxValue, 0, innerHeight)
429
- : 0;
430
- const zeroY = margin.top + innerHeight - scaledZero;
431
- return sanitizedData.map((item, index) => {
432
- const x = margin.left + index * (barWidth + categoryGap);
433
- return (jsx("g", { children: dataKeys.map((key, keyIndex) => {
434
- const rawValue = item[key];
435
- const value = typeof rawValue === "number" && isFinite(rawValue)
436
- ? rawValue
437
- : 0;
438
- const isNull = rawValue === null ||
439
- rawValue === undefined ||
440
- (typeof rawValue === "number" && !isFinite(rawValue));
441
- // For null values, use the average of non-null values
442
- const actualValue = isNull
443
- ? calculateAverageForKey(sanitizedData, key, safeMath.divide)
444
- : value;
445
- const scaledValue = range > 0
446
- ? safeMath.scale(actualValue, minValue, maxValue, 0, innerHeight)
447
- : 0;
448
- const barHeight = Math.abs(scaledValue - scaledZero);
449
- const isNeg = actualValue < 0;
450
- const barX = x + keyIndex * (individualBarWidth + gap);
451
- // Positive: bar extends upward from zero baseline
452
- // Negative: bar extends downward from zero baseline
453
- const barY = isNeg ? zeroY : zeroY - barHeight;
454
- return renderBarPath(item, index, key, keyIndex, barX, barY, barHeight, true, isNeg);
455
- }) }, index));
456
- });
457
- })() }), jsx(XAxis, { show: showXAxis, data: sanitizedData, x: margin.left, y: margin.top + innerHeight, width: innerWidth, categoryWidth: barWidth, categoryGap: categoryGap })] }), jsx(ChartTooltip, { tooltipRef: tooltipRef, content: tooltipData === null || tooltipData === void 0 ? void 0 : tooltipData.content, active: !!tooltipData, position: tooltipData
487
+ } }), minValue < 0 && maxValue > 0 && (jsx("line", { x1: margin.left, y1: margin.top + innerHeight - ((0 - minValue) / (maxValue - minValue)) * innerHeight, x2: margin.left + innerWidth, y2: margin.top + innerHeight - ((0 - minValue) / (maxValue - minValue)) * innerHeight, className: "stroke-[var(--color-text-secondary)]", strokeWidth: 1, opacity: 0.6 })), jsx("g", { className: "chart-bars", children: measured &&
488
+ (() => {
489
+ // Calculate the zero baseline position (where value=0 maps to in pixel space)
490
+ const range = maxValue - minValue;
491
+ const scaledZero = range > 0
492
+ ? safeMath.scale(0, minValue, maxValue, 0, innerHeight)
493
+ : 0;
494
+ const zeroY = margin.top + innerHeight - scaledZero;
495
+ return sanitizedData.map((item, index) => {
496
+ const x = margin.left + index * (barWidth + categoryGap);
497
+ return (jsx("g", { children: dataKeys.map((key, keyIndex) => {
498
+ const rawValue = item[key];
499
+ const value = typeof rawValue === "number" && isFinite(rawValue)
500
+ ? rawValue
501
+ : 0;
502
+ const isNull = rawValue === null ||
503
+ rawValue === undefined ||
504
+ (typeof rawValue === "number" && !isFinite(rawValue));
505
+ // For null values, use the average of non-null values
506
+ const actualValue = isNull
507
+ ? calculateAverageForKey(sanitizedData, key, safeMath.divide)
508
+ : value;
509
+ const scaledValue = range > 0
510
+ ? safeMath.scale(actualValue, minValue, maxValue, 0, innerHeight)
511
+ : 0;
512
+ const barHeight = Math.abs(scaledValue - scaledZero);
513
+ const isNeg = actualValue < 0;
514
+ const barX = x + keyIndex * (individualBarWidth + gap);
515
+ // Positive: bar extends upward from zero baseline
516
+ // Negative: bar extends downward from zero baseline
517
+ const barY = isNeg ? zeroY : zeroY - barHeight;
518
+ return renderBarPath(item, index, key, keyIndex, barX, barY, barHeight, true, isNeg);
519
+ }) }, index));
520
+ });
521
+ })() }), jsx(XAxis, { show: showXAxis, data: sanitizedData, x: margin.left, y: margin.top + innerHeight, width: innerWidth, categoryWidth: barWidth, categoryGap: categoryGap })] }), jsx(ChartTooltip, { tooltipRef: tooltipRef, content: tooltipData === null || tooltipData === void 0 ? void 0 : tooltipData.content, active: !!tooltipData, position: tooltipData
458
522
  ? { x: tooltipData.x, y: tooltipData.y }
459
523
  : { x: 0, y: 0 } }), children] }) }));
460
524
  };
@@ -1,4 +1,4 @@
1
- import { BaseChartProps, StandardChartDisplayProps, StandardVisualProps, BarChartSpecificProps } from "../types/chart.types";
1
+ import { BaseChartProps, StandardChartDisplayProps, StandardVisualProps, BarChartSpecificProps, ChartVariant } from "../types/chart.types";
2
2
  export interface BarChartProps extends BaseChartProps, StandardChartDisplayProps, StandardVisualProps, BarChartSpecificProps {
3
3
  barRadius?: number;
4
4
  radius?: number;
@@ -24,6 +24,7 @@ export interface BarChartProps extends BaseChartProps, StandardChartDisplayProps
24
24
  darkMode?: boolean;
25
25
  }
26
26
  export declare const BAR_CHART_DEFAULTS: {
27
+ readonly variant: ChartVariant;
27
28
  readonly barRadius: 32;
28
29
  readonly radius: 32;
29
30
  readonly gap: 4;
@@ -34,16 +35,15 @@ export declare const BAR_CHART_DEFAULTS: {
34
35
  readonly showGrid: true;
35
36
  readonly showXAxis: true;
36
37
  readonly showYAxis: true;
37
- readonly dotRadius: 4;
38
+ readonly dotRadius: 3;
38
39
  readonly cellRadius: 4;
39
40
  readonly strokeWidth: 2;
40
41
  readonly curved: true;
41
42
  readonly curveType: import("..").CurveType;
42
43
  readonly fillOpacity: 0.3;
43
44
  readonly showStroke: true;
44
- readonly showDots: true;
45
+ readonly showDots: false;
45
46
  readonly stacked: false;
46
- readonly variant: import("..").ChartVariant;
47
47
  readonly enableKeyboardNavigation: true;
48
48
  };
49
49
  export type BarChartData = BaseChartProps["data"][0];
@@ -3,6 +3,7 @@ import { CHART_DEFAULTS } from '../types/chart.types.js';
3
3
  // Default values using centralized defaults
4
4
  const BAR_CHART_DEFAULTS = {
5
5
  ...CHART_DEFAULTS,
6
+ variant: "gradient", // BarChart defaults to the gradient (premium) look; use variant="default" for flat fills
6
7
  barRadius: CHART_DEFAULTS.barRadius, // 24 - For bar corner rounding
7
8
  radius: CHART_DEFAULTS.barRadius, // @deprecated - kept for backward compatibility
8
9
  gap: CHART_DEFAULTS.gap,
@@ -29,11 +29,11 @@ export interface ComboChartProps extends BaseChartProps, StandardChartDisplayPro
29
29
  }
30
30
  export declare const COMBO_CHART_DEFAULTS: {
31
31
  readonly barRadius: 32;
32
- readonly dotRadius: 4;
32
+ readonly dotRadius: 3;
33
33
  readonly categoryGap: 16;
34
34
  readonly curved: true;
35
35
  readonly curveType: import("..").CurveType;
36
- readonly showDots: true;
36
+ readonly showDots: false;
37
37
  readonly showDualAxis: false;
38
38
  readonly showGrid: true;
39
39
  readonly showXAxis: true;