@forgedevstack/bear 1.3.1 → 1.3.2

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 (269) hide show
  1. package/README.md +26 -0
  2. package/dist/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
  3. package/dist/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
  4. package/dist/components/Alert/Alert.cjs +1 -1
  5. package/dist/components/Alert/Alert.js +1 -1
  6. package/dist/components/Avatar/Avatar.cjs +1 -1
  7. package/dist/components/Avatar/Avatar.js +1 -1
  8. package/dist/components/BackTop/BackTop.cjs +1 -1
  9. package/dist/components/BackTop/BackTop.js +1 -1
  10. package/dist/components/Banner/Banner.const.cjs +1 -1
  11. package/dist/components/Banner/Banner.const.js +1 -1
  12. package/dist/components/Blockquote/Blockquote.cjs +1 -1
  13. package/dist/components/Blockquote/Blockquote.js +1 -1
  14. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  15. package/dist/components/BottomSheet/BottomSheet.js +1 -1
  16. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  17. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
  18. package/dist/components/Calendar/Calendar.cjs +1 -1
  19. package/dist/components/Calendar/Calendar.js +1 -1
  20. package/dist/components/Chart/BarChart.cjs +1 -1
  21. package/dist/components/Chart/BarChart.d.ts +1 -2
  22. package/dist/components/Chart/BarChart.js +81 -61
  23. package/dist/components/Chart/Chart.cjs +1 -1
  24. package/dist/components/Chart/Chart.const.cjs +1 -1
  25. package/dist/components/Chart/Chart.const.d.ts +24 -3
  26. package/dist/components/Chart/Chart.const.js +39 -16
  27. package/dist/components/Chart/Chart.d.ts +1 -5
  28. package/dist/components/Chart/Chart.js +19 -23
  29. package/dist/components/Chart/Chart.types.d.ts +11 -19
  30. package/dist/components/Chart/Chart.utils.cjs +1 -1
  31. package/dist/components/Chart/Chart.utils.d.ts +8 -18
  32. package/dist/components/Chart/Chart.utils.js +39 -3
  33. package/dist/components/Chart/FunnelChart.cjs +1 -0
  34. package/dist/components/Chart/FunnelChart.d.ts +2 -0
  35. package/dist/components/Chart/FunnelChart.js +59 -0
  36. package/dist/components/Chart/LineChart.cjs +1 -1
  37. package/dist/components/Chart/LineChart.d.ts +1 -2
  38. package/dist/components/Chart/LineChart.js +51 -55
  39. package/dist/components/Chart/PieChart.cjs +1 -1
  40. package/dist/components/Chart/PieChart.d.ts +1 -2
  41. package/dist/components/Chart/PieChart.js +121 -106
  42. package/dist/components/Chart/PieChart.types.d.ts +8 -0
  43. package/dist/components/Chart/RadarChart.cjs +1 -0
  44. package/dist/components/Chart/RadarChart.d.ts +2 -0
  45. package/dist/components/Chart/RadarChart.js +100 -0
  46. package/dist/components/Chart/index.d.ts +3 -1
  47. package/dist/components/Chat/Chat.cjs +1 -1
  48. package/dist/components/Chat/Chat.js +1 -1
  49. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -1
  50. package/dist/components/CurrencyInput/CurrencyInput.js +1 -1
  51. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  52. package/dist/components/DatePicker/DatePicker.js +1 -1
  53. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  54. package/dist/components/DateRangePicker/DateRangePicker.js +1 -1
  55. package/dist/components/Drawer/Drawer.cjs +1 -1
  56. package/dist/components/Drawer/Drawer.const.cjs +1 -1
  57. package/dist/components/Drawer/Drawer.const.d.ts +2 -11
  58. package/dist/components/Drawer/Drawer.const.js +6 -55
  59. package/dist/components/Drawer/Drawer.d.ts +1 -2
  60. package/dist/components/Drawer/Drawer.js +87 -131
  61. package/dist/components/Drawer/Drawer.types.d.ts +16 -3
  62. package/dist/components/Drawer/Drawer.utils.d.ts +0 -4
  63. package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.cjs +1 -0
  64. package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.d.ts +2 -0
  65. package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.js +26 -0
  66. package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.types.d.ts +20 -0
  67. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.cjs +1 -0
  68. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.d.ts +2 -0
  69. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.js +17 -0
  70. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.cjs +1 -0
  71. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.d.ts +2 -0
  72. package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.js +9 -0
  73. package/dist/components/Drawer/components/DrawerHeader/index.d.ts +2 -0
  74. package/dist/components/Drawer/components/index.d.ts +1 -0
  75. package/dist/components/Drawer/helpers/DrawerOptionalHeader.cjs +1 -0
  76. package/dist/components/Drawer/helpers/DrawerOptionalHeader.d.ts +2 -0
  77. package/dist/components/Drawer/helpers/DrawerOptionalHeader.js +9 -0
  78. package/dist/components/Drawer/helpers/index.d.ts +1 -0
  79. package/dist/components/Drawer/hooks/index.d.ts +1 -0
  80. package/dist/components/Drawer/hooks/useDrawer.cjs +1 -0
  81. package/dist/components/Drawer/hooks/useDrawer.d.ts +2 -0
  82. package/dist/components/Drawer/hooks/useDrawer.js +51 -0
  83. package/dist/components/Editable/Editable.cjs +1 -1
  84. package/dist/components/Editable/Editable.js +1 -1
  85. package/dist/components/FileTree/FileTree.cjs +1 -1
  86. package/dist/components/FileTree/FileTree.js +1 -1
  87. package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
  88. package/dist/components/FloatingChat/FloatingChat.js +1 -1
  89. package/dist/components/Gauge/Gauge.cjs +1 -1
  90. package/dist/components/Gauge/Gauge.const.cjs +1 -1
  91. package/dist/components/Gauge/Gauge.const.d.ts +5 -0
  92. package/dist/components/Gauge/Gauge.const.js +11 -6
  93. package/dist/components/Gauge/Gauge.d.ts +1 -2
  94. package/dist/components/Gauge/Gauge.js +69 -45
  95. package/dist/components/Gauge/Gauge.types.d.ts +11 -2
  96. package/dist/components/Gauge/helpers/GaugeLinearBar.cjs +1 -0
  97. package/dist/components/Gauge/helpers/GaugeLinearBar.d.ts +2 -0
  98. package/dist/components/Gauge/helpers/GaugeLinearBar.js +40 -0
  99. package/dist/components/Heatmap/Heatmap.cjs +1 -1
  100. package/dist/components/Heatmap/Heatmap.const.cjs +1 -1
  101. package/dist/components/Heatmap/Heatmap.const.d.ts +2 -0
  102. package/dist/components/Heatmap/Heatmap.const.js +8 -6
  103. package/dist/components/Heatmap/Heatmap.js +51 -47
  104. package/dist/components/Heatmap/Heatmap.types.d.ts +1 -1
  105. package/dist/components/Icon/Icon.d.ts +2 -39
  106. package/dist/components/Icon/Icon.types.d.ts +1 -17
  107. package/dist/components/Icon/icons/action.d.ts +1 -85
  108. package/dist/components/Icon/icons/bear.d.ts +1 -12
  109. package/dist/components/Icon/icons/charts.d.ts +1 -0
  110. package/dist/components/Icon/icons/commerce.d.ts +1 -25
  111. package/dist/components/Icon/icons/communication.d.ts +1 -48
  112. package/dist/components/Icon/icons/content.d.ts +1 -53
  113. package/dist/components/Icon/icons/device.d.ts +1 -27
  114. package/dist/components/Icon/icons/editor.d.ts +1 -54
  115. package/dist/components/Icon/icons/file.d.ts +1 -25
  116. package/dist/components/Icon/icons/index.d.ts +1 -9
  117. package/dist/components/Icon/icons/media.d.ts +1 -64
  118. package/dist/components/Icon/icons/misc.d.ts +1 -96
  119. package/dist/components/Icon/icons/navigation.d.ts +1 -56
  120. package/dist/components/Icon/icons/social.d.ts +1 -24
  121. package/dist/components/Icon/icons/status.d.ts +1 -61
  122. package/dist/components/Icon/index.d.ts +2 -605
  123. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -1
  124. package/dist/components/ImageAnnotation/ImageAnnotation.js +1 -1
  125. package/dist/components/JsonViewer/JsonViewer.cjs +1 -1
  126. package/dist/components/JsonViewer/JsonViewer.js +1 -1
  127. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -1
  128. package/dist/components/MediaPlayer/MediaPlayer.js +1 -1
  129. package/dist/components/Modal/Modal.cjs +1 -1
  130. package/dist/components/Modal/Modal.js +1 -1
  131. package/dist/components/PageNav/PageNav.cjs +1 -1
  132. package/dist/components/PageNav/PageNav.js +1 -1
  133. package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
  134. package/dist/components/PasswordInput/PasswordInput.js +5 -5
  135. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -1
  136. package/dist/components/PropsPlayground/PropsPlayground.js +1 -1
  137. package/dist/components/Rating/components/StarIcon/StarIcon.cjs +1 -1
  138. package/dist/components/Rating/components/StarIcon/StarIcon.js +1 -1
  139. package/dist/components/Result/Result.utils.cjs +1 -1
  140. package/dist/components/Result/Result.utils.js +1 -1
  141. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
  142. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +1 -1
  143. package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
  144. package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +1 -1
  145. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -1
  146. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +1 -1
  147. package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.cjs +1 -1
  148. package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.js +1 -1
  149. package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
  150. package/dist/components/RichEditor/helpers/IconRender.js +16 -16
  151. package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
  152. package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
  153. package/dist/components/RingProgress/RingProgress.cjs +1 -1
  154. package/dist/components/RingProgress/RingProgress.const.cjs +1 -1
  155. package/dist/components/RingProgress/RingProgress.const.d.ts +3 -0
  156. package/dist/components/RingProgress/RingProgress.const.js +7 -4
  157. package/dist/components/RingProgress/RingProgress.js +38 -37
  158. package/dist/components/RingProgress/RingProgress.types.d.ts +1 -0
  159. package/dist/components/Select/Select.cjs +1 -1
  160. package/dist/components/Select/Select.js +1 -1
  161. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  162. package/dist/components/Sidebar/Sidebar.js +16 -15
  163. package/dist/components/Sidebar/Sidebar.types.d.ts +1 -1
  164. package/dist/components/Sidebar/Sidebar.utils.cjs +1 -0
  165. package/dist/components/Sidebar/Sidebar.utils.d.ts +2 -0
  166. package/dist/components/Sidebar/Sidebar.utils.js +11 -0
  167. package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -1
  168. package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +1 -1
  169. package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -1
  170. package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +55 -51
  171. package/dist/components/Sidebar/index.d.ts +1 -0
  172. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  173. package/dist/components/SliderRange/SliderRange.js +19 -19
  174. package/dist/components/Sparkline/Sparkline.cjs +1 -1
  175. package/dist/components/Sparkline/Sparkline.const.cjs +1 -1
  176. package/dist/components/Sparkline/Sparkline.const.d.ts +5 -0
  177. package/dist/components/Sparkline/Sparkline.const.js +9 -4
  178. package/dist/components/Sparkline/Sparkline.d.ts +1 -2
  179. package/dist/components/Sparkline/Sparkline.js +75 -53
  180. package/dist/components/Sparkline/Sparkline.types.d.ts +2 -0
  181. package/dist/components/Sparkline/Sparkline.utils.cjs +1 -1
  182. package/dist/components/Sparkline/Sparkline.utils.d.ts +7 -12
  183. package/dist/components/Sparkline/Sparkline.utils.js +33 -20
  184. package/dist/components/Sparkline/index.d.ts +2 -2
  185. package/dist/components/Stepper/Stepper.cjs +1 -1
  186. package/dist/components/Stepper/Stepper.js +1 -1
  187. package/dist/components/Tabs/TabList.cjs +1 -1
  188. package/dist/components/Tabs/TabList.js +1 -1
  189. package/dist/components/TimePicker/TimePicker.cjs +1 -1
  190. package/dist/components/TimePicker/TimePicker.js +1 -1
  191. package/dist/components/TimelineChart/TimelineChart.cjs +1 -1
  192. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -1
  193. package/dist/components/TimelineChart/TimelineChart.const.d.ts +3 -0
  194. package/dist/components/TimelineChart/TimelineChart.const.js +7 -4
  195. package/dist/components/TimelineChart/TimelineChart.js +56 -42
  196. package/dist/components/TimelineChart/TimelineChart.types.d.ts +1 -1
  197. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  198. package/dist/components/TreeSelect/TreeSelect.js +1 -1
  199. package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.cjs +1 -1
  200. package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.js +1 -1
  201. package/dist/components/TreeView/TreeView.cjs +1 -1
  202. package/dist/components/TreeView/TreeView.js +3 -2
  203. package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.cjs +1 -1
  204. package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.js +1 -1
  205. package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.cjs +1 -1
  206. package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.js +1 -1
  207. package/dist/components/index.cjs +1 -1
  208. package/dist/components/index.d.ts +2 -2
  209. package/dist/components/index.js +409 -406
  210. package/dist/constants/generals.const.cjs +1 -1
  211. package/dist/constants/generals.const.d.ts +4 -0
  212. package/dist/constants/generals.const.js +50 -47
  213. package/dist/icons.cjs +1 -1
  214. package/dist/icons.d.ts +2 -2
  215. package/dist/icons.js +1 -6
  216. package/dist/index.cjs +1 -1
  217. package/dist/index.js +551 -548
  218. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +1 -0
  219. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +1 -0
  220. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +14 -0
  221. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +35 -0
  222. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +1 -0
  223. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +26 -0
  224. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +1 -0
  225. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +4 -0
  226. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +1 -0
  227. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +130 -0
  228. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +1 -0
  229. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +12 -0
  230. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +1 -0
  231. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +18 -0
  232. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +1 -0
  233. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +6 -0
  234. package/dist/styles/_drawer.css +213 -0
  235. package/dist/styles/_overlays.css +0 -1
  236. package/dist/styles/main.css +1 -0
  237. package/dist/styles.css +226 -25
  238. package/package.json +5 -1
  239. package/dist/components/Icon/Icon.cjs +0 -1
  240. package/dist/components/Icon/Icon.const.d.ts +0 -1
  241. package/dist/components/Icon/Icon.js +0 -45
  242. package/dist/components/Icon/icons/action.cjs +0 -1
  243. package/dist/components/Icon/icons/action.js +0 -351
  244. package/dist/components/Icon/icons/bear.cjs +0 -1
  245. package/dist/components/Icon/icons/bear.js +0 -47
  246. package/dist/components/Icon/icons/commerce.cjs +0 -1
  247. package/dist/components/Icon/icons/commerce.js +0 -124
  248. package/dist/components/Icon/icons/communication.cjs +0 -1
  249. package/dist/components/Icon/icons/communication.js +0 -184
  250. package/dist/components/Icon/icons/content.cjs +0 -1
  251. package/dist/components/Icon/icons/content.js +0 -231
  252. package/dist/components/Icon/icons/device.cjs +0 -1
  253. package/dist/components/Icon/icons/device.js +0 -122
  254. package/dist/components/Icon/icons/editor.cjs +0 -1
  255. package/dist/components/Icon/icons/editor.js +0 -285
  256. package/dist/components/Icon/icons/file.cjs +0 -1
  257. package/dist/components/Icon/icons/file.js +0 -120
  258. package/dist/components/Icon/icons/media.cjs +0 -1
  259. package/dist/components/Icon/icons/media.js +0 -306
  260. package/dist/components/Icon/icons/misc.cjs +0 -1
  261. package/dist/components/Icon/icons/misc.js +0 -450
  262. package/dist/components/Icon/icons/navigation.cjs +0 -1
  263. package/dist/components/Icon/icons/navigation.js +0 -215
  264. package/dist/components/Icon/icons/social.cjs +0 -1
  265. package/dist/components/Icon/icons/social.js +0 -89
  266. package/dist/components/Icon/icons/status.cjs +0 -1
  267. package/dist/components/Icon/icons/status.js +0 -271
  268. package/dist/components/Icon/index.cjs +0 -1
  269. package/dist/components/Icon/index.js +0 -79
@@ -1,31 +1,54 @@
1
- const A = {
2
- DEFAULT_INNER_RADIUS: 0.6
3
- }, c = {
1
+ const E = {
2
+ DEFAULT_HEIGHT: 200,
3
+ DEFAULT_BAR_RADIUS: 4,
4
+ DEFAULT_BAR_GAP: 0.2,
5
+ DEFAULT_STROKE_WIDTH: 2,
6
+ DEFAULT_INNER_RADIUS: 0.6,
7
+ DEFAULT_START_ANGLE: -90,
8
+ DEFAULT_PAD_ANGLE: 2,
9
+ OUTER_RADIUS: 45,
10
+ CENTER: 50,
11
+ HALF_SWEEP: 180,
12
+ FULL_SWEEP: 360,
13
+ EXPLODE_OFFSET: 4,
14
+ ROSE_MIN_RADIUS: 14,
15
+ RADAR_RINGS: 4,
16
+ RADAR_LABEL_OFFSET: 8,
17
+ FUNNEL_MIN_WIDTH: 18,
18
+ SLICE_DELAY_MS: 100,
19
+ DOT_RADIUS: 1.5,
20
+ VIEWBOX: 100,
21
+ LINE_Y_RANGE: 80,
22
+ LINE_Y_PAD: 10,
23
+ BEZIER_DIVISOR: 3,
24
+ LARGE_ARC_THRESHOLD: 180,
25
+ HALF_PIE_START: -180
26
+ }, _ = {
4
27
  BAR: "bar",
5
28
  LINE: "line",
6
29
  AREA: "area",
7
30
  PIE: "pie",
8
- DONUT: "donut"
9
- }, e = [
31
+ DONUT: "donut",
32
+ RADAR: "radar",
33
+ FUNNEL: "funnel",
34
+ STACKED: "stacked"
35
+ }, A = "full", R = "half", L = "rose", T = "bottom", D = "none", I = [
10
36
  "#ec4899",
11
- // pink
12
37
  "#8b5cf6",
13
- // purple
14
38
  "#3b82f6",
15
- // blue
16
39
  "#10b981",
17
- // emerald
18
40
  "#f59e0b",
19
- // amber
20
41
  "#ef4444",
21
- // red
22
42
  "#06b6d4",
23
- // cyan
24
43
  "#84cc16"
25
- // lime
26
44
  ];
27
45
  export {
28
- A as CHART,
29
- c as CHART_TYPES,
30
- e as DEFAULT_COLORS
46
+ E as CHART,
47
+ T as CHART_LEGEND_BOTTOM,
48
+ D as CHART_LEGEND_NONE,
49
+ _ as CHART_TYPES,
50
+ I as DEFAULT_COLORS,
51
+ A as PIE_VIEW_FULL,
52
+ R as PIE_VIEW_HALF,
53
+ L as PIE_VIEW_ROSE
31
54
  };
@@ -1,6 +1,2 @@
1
- import { FC } from 'react';
2
1
  import { ChartProps } from './Chart.types';
3
- /**
4
- * Main Chart Component
5
- */
6
- export declare const Chart: FC<ChartProps>;
2
+ export declare const Chart: (props: ChartProps) => JSX.Element;
@@ -1,27 +1,23 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { BarChart as i } from "./BarChart.js";
3
- import { LineChart as n } from "./LineChart.js";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { BarChart as R } from "./BarChart.js";
3
+ import { LineChart as e } from "./LineChart.js";
4
4
  import { PieChart as m } from "./PieChart.js";
5
- import { CHART_TYPES as r, CHART as A } from "./Chart.const.js";
6
- const C = ({
7
- id: o,
8
- type: a,
9
- ...t
10
- }) => {
11
- switch (a) {
12
- case r.BAR:
13
- return /* @__PURE__ */ e(i, { ...t });
14
- case r.LINE:
15
- case r.AREA:
16
- return /* @__PURE__ */ e(n, { ...t, fill: a === r.AREA });
17
- case r.PIE:
18
- return /* @__PURE__ */ e(m, { ...t });
19
- case r.DONUT:
20
- return /* @__PURE__ */ e(m, { ...t, innerRadius: A.DEFAULT_INNER_RADIUS });
21
- default:
22
- return /* @__PURE__ */ e(i, { ...t });
23
- }
5
+ import { RadarChart as A } from "./RadarChart.js";
6
+ import { FunnelChart as E } from "./FunnelChart.js";
7
+ import { CHART_TYPES as t, CHART as p } from "./Chart.const.js";
8
+ const a = {
9
+ [t.BAR]: (r) => /* @__PURE__ */ o(R, { ...r }),
10
+ [t.STACKED]: (r) => /* @__PURE__ */ o(R, { ...r, stacked: !0 }),
11
+ [t.LINE]: (r) => /* @__PURE__ */ o(e, { ...r }),
12
+ [t.AREA]: (r) => /* @__PURE__ */ o(e, { ...r, fill: !0 }),
13
+ [t.PIE]: (r) => /* @__PURE__ */ o(m, { ...r }),
14
+ [t.DONUT]: (r) => /* @__PURE__ */ o(m, { ...r, innerRadius: p.DEFAULT_INNER_RADIUS }),
15
+ [t.RADAR]: (r) => /* @__PURE__ */ o(A, { ...r }),
16
+ [t.FUNNEL]: (r) => /* @__PURE__ */ o(E, { ...r })
17
+ }, d = (r) => {
18
+ const { type: i, ...n } = r;
19
+ return (a[i] ?? a[t.BAR])(n);
24
20
  };
25
21
  export {
26
- C as Chart
22
+ d as Chart
27
23
  };
@@ -1,53 +1,43 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut';
2
+ export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'funnel' | 'stacked';
3
+ export type PieView = 'full' | 'half' | 'rose';
4
+ export type ChartLegendPosition = 'right' | 'bottom' | 'none';
3
5
  export interface ChartDataPoint {
4
6
  label: string;
5
7
  value: number;
6
8
  color?: string;
9
+ stacks?: number[];
7
10
  }
8
11
  export interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
9
12
  testId?: string;
10
- /** Chart type */
11
13
  type: ChartType;
12
- /** Data points */
13
14
  data: ChartDataPoint[];
14
- /** Chart height */
15
15
  height?: number;
16
- /** Show labels */
17
16
  showLabels?: boolean;
18
- /** Show values */
19
17
  showValues?: boolean;
20
- /** Animate on render */
21
18
  animated?: boolean;
22
- /** Primary color (used for single-color charts) */
23
19
  color?: string;
24
- /** Show grid lines */
25
20
  showGrid?: boolean;
21
+ pieView?: PieView;
22
+ explodeIndex?: number;
23
+ legendPosition?: ChartLegendPosition;
24
+ stepped?: boolean;
25
+ stacked?: boolean;
26
26
  }
27
27
  export interface BarChartProps extends Omit<ChartProps, 'type'> {
28
- /** Bar orientation */
29
28
  orientation?: 'vertical' | 'horizontal';
30
- /** Bar border radius */
31
29
  barRadius?: number;
32
- /** Gap between bars (0-1) */
33
30
  barGap?: number;
34
31
  }
35
32
  export interface LineChartProps extends Omit<ChartProps, 'type'> {
36
- /** Show area fill */
37
33
  fill?: boolean;
38
- /** Line width */
39
34
  strokeWidth?: number;
40
- /** Show dots at data points */
41
35
  showDots?: boolean;
42
- /** Smooth curve */
43
36
  smooth?: boolean;
44
37
  }
45
38
  export interface PieChartProps extends Omit<ChartProps, 'type'> {
46
- /** Inner radius for donut chart (0-1) */
47
39
  innerRadius?: number;
48
- /** Start angle in degrees */
49
40
  startAngle?: number;
50
- /** Padding between slices */
51
41
  padAngle?: number;
52
42
  onSliceClick?: (item: ChartDataPoint, index: number) => void;
53
43
  onSliceHover?: (item: ChartDataPoint | null, index: number | null) => void;
@@ -56,3 +46,5 @@ export interface PieChartProps extends Omit<ChartProps, 'type'> {
56
46
  sliceTooltipDescription?: (item: ChartDataPoint, index: number) => ReactNode;
57
47
  sliceTooltipContent?: (item: ChartDataPoint, index: number) => ReactNode;
58
48
  }
49
+ export type RadarChartProps = Omit<ChartProps, 'type'>;
50
+ export type FunnelChartProps = Omit<ChartProps, 'type'>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./Chart.const.cjs"),o=(e,r)=>r||t.DEFAULT_COLORS[e%t.DEFAULT_COLORS.length];exports.getChartColor=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../constants/numbers.const.cjs"),a=require("./Chart.const.cjs"),x=(r,c)=>c||a.DEFAULT_COLORS[r%a.DEFAULT_COLORS.length],o=(r,c,$=a.CHART.CENTER)=>{const t=r*Math.PI/a.CHART.HALF_SWEEP;return{x:$+c*Math.cos(t),y:$+c*Math.sin(t)}},T=(r,c)=>{const $=r*Math.PI/a.CHART.HALF_SWEEP;return{x:c*Math.cos($),y:c*Math.sin($)}},A=(r,c,$=E.ZERO,t=a.CHART.OUTER_RADIUS)=>{const e=$*t,n=o(r,t),R=o(c,t),O=o(r,e),s=o(c,e),C=c-r>a.CHART.LARGE_ARC_THRESHOLD?E.ONE:E.ZERO;return $>E.ZERO?`M ${n.x},${n.y} A ${t},${t} 0 ${C},1 ${R.x},${R.y} L ${s.x},${s.y} A ${e},${e} 0 ${C},0 ${O.x},${O.y} Z`:`M ${a.CHART.CENTER},${a.CHART.CENTER} L ${n.x},${n.y} A ${t},${t} 0 ${C},1 ${R.x},${R.y} Z`},l=(r,c=!0,$=!1)=>r.length===E.ZERO?"":$?r.reduce((t,e,n,R)=>{if(n===E.ZERO)return`M ${e.x},${e.y}`;const O=R[n-E.ONE];return`${t} L ${e.x},${O.y} L ${e.x},${e.y}`},""):c?r.reduce((t,e,n,R)=>{if(n===E.ZERO)return`M ${e.x},${e.y}`;const O=R[n-E.ONE],s=O.x+(e.x-O.x)/a.CHART.BEZIER_DIVISOR,C=e.x-(e.x-O.x)/a.CHART.BEZIER_DIVISOR;return`${t} C ${s},${O.y} ${C},${e.y} ${e.x},${e.y}`},""):r.reduce((t,e,n)=>`${t} ${n===E.ZERO?"M":"L"} ${e.x},${e.y}`,""),u=r=>{const c=Math.max(...r.map(n=>n.value)),$=Math.min(...r.map(n=>n.value)),t=c-$||E.ONE,e=r.length-E.ONE||E.ONE;return r.map((n,R)=>({x:R/e*a.CHART.VIEWBOX,y:a.CHART.VIEWBOX-(n.value-$)/t*a.CHART.LINE_Y_RANGE-a.CHART.LINE_Y_PAD}))},h=(r,c)=>!r||r.length===E.ZERO?c:r.reduce(($,t)=>$+t,E.ZERO);exports.calculateLinePoints=u;exports.createArcPath=A;exports.generateLinePath=l;exports.getChartColor=x;exports.getStackTotal=h;exports.polarOffset=T;exports.polarToCartesian=o;
@@ -1,31 +1,21 @@
1
- /**
2
- * Get color for chart element by index
3
- */
4
1
  export declare const getChartColor: (index: number, customColor?: string) => string;
5
- /**
6
- * Convert polar coordinates to cartesian
7
- */
8
- export declare const polarToCartesian: (angle: number, radius: number) => {
2
+ export declare const polarToCartesian: (angle: number, radius: number, center?: number) => {
9
3
  x: number;
10
4
  y: number;
11
5
  };
12
- /**
13
- * Create SVG arc path for pie/donut charts
14
- */
15
- export declare const createArcPath: (startAngle: number, endAngle: number, innerRadius?: number) => string;
16
- /**
17
- * Generate smooth bezier line path
18
- */
6
+ export declare const polarOffset: (angle: number, distance: number) => {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ export declare const createArcPath: (startAngle: number, endAngle: number, innerRadius?: number, outerRadius?: number) => string;
19
11
  export declare const generateLinePath: (points: Array<{
20
12
  x: number;
21
13
  y: number;
22
- }>, smooth?: boolean) => string;
23
- /**
24
- * Calculate line chart points from data
25
- */
14
+ }>, smooth?: boolean, stepped?: boolean) => string;
26
15
  export declare const calculateLinePoints: (data: Array<{
27
16
  value: number;
28
17
  }>) => Array<{
29
18
  x: number;
30
19
  y: number;
31
20
  }>;
21
+ export declare const getStackTotal: (stacks: number[] | undefined, value: number) => number;
@@ -1,5 +1,41 @@
1
- import { DEFAULT_COLORS as r } from "./Chart.const.js";
2
- const n = (t, o) => o || r[t % r.length];
1
+ import { ZERO as y, ONE as o } from "../../constants/numbers.const.js";
2
+ import { DEFAULT_COLORS as L, CHART as x } from "./Chart.const.js";
3
+ const M = ($, n) => n || L[$ % L.length], h = ($, n, c = x.CENTER) => {
4
+ const e = $ * Math.PI / x.HALF_SWEEP;
5
+ return {
6
+ x: c + n * Math.cos(e),
7
+ y: c + n * Math.sin(e)
8
+ };
9
+ }, f = ($, n) => {
10
+ const c = $ * Math.PI / x.HALF_SWEEP;
11
+ return {
12
+ x: n * Math.cos(c),
13
+ y: n * Math.sin(c)
14
+ };
15
+ }, _ = ($, n, c = y, e = x.OUTER_RADIUS) => {
16
+ const r = c * e, t = h($, e), E = h(n, e), a = h($, r), I = h(n, r), s = n - $ > x.LARGE_ARC_THRESHOLD ? o : y;
17
+ return c > y ? `M ${t.x},${t.y} A ${e},${e} 0 ${s},1 ${E.x},${E.y} L ${I.x},${I.y} A ${r},${r} 0 ${s},0 ${a.x},${a.y} Z` : `M ${x.CENTER},${x.CENTER} L ${t.x},${t.y} A ${e},${e} 0 ${s},1 ${E.x},${E.y} Z`;
18
+ }, m = ($, n = !0, c = !1) => $.length === y ? "" : c ? $.reduce((e, r, t, E) => {
19
+ if (t === y) return `M ${r.x},${r.y}`;
20
+ const a = E[t - o];
21
+ return `${e} L ${r.x},${a.y} L ${r.x},${r.y}`;
22
+ }, "") : n ? $.reduce((e, r, t, E) => {
23
+ if (t === y) return `M ${r.x},${r.y}`;
24
+ const a = E[t - o], I = a.x + (r.x - a.x) / x.BEZIER_DIVISOR, s = r.x - (r.x - a.x) / x.BEZIER_DIVISOR;
25
+ return `${e} C ${I},${a.y} ${s},${r.y} ${r.x},${r.y}`;
26
+ }, "") : $.reduce((e, r, t) => `${e} ${t === y ? "M" : "L"} ${r.x},${r.y}`, ""), O = ($) => {
27
+ const n = Math.max(...$.map((t) => t.value)), c = Math.min(...$.map((t) => t.value)), e = n - c || o, r = $.length - o || o;
28
+ return $.map((t, E) => ({
29
+ x: E / r * x.VIEWBOX,
30
+ y: x.VIEWBOX - (t.value - c) / e * x.LINE_Y_RANGE - x.LINE_Y_PAD
31
+ }));
32
+ }, A = ($, n) => !$ || $.length === y ? n : $.reduce((c, e) => c + e, y);
3
33
  export {
4
- n as getChartColor
34
+ O as calculateLinePoints,
35
+ _ as createArcPath,
36
+ m as generateLinePath,
37
+ M as getChartColor,
38
+ A as getStackTotal,
39
+ f as polarOffset,
40
+ h as polarToCartesian
5
41
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("../../constants/numbers.const.cjs"),o=require("../../utils/cn.cjs");require("react");const b=require("../Box/Box.cjs"),l=require("../Flex/Flex.cjs"),p=require("../Typography/Typography.cjs"),r=require("./Chart.const.cjs"),H=require("./Chart.utils.cjs"),_=s=>{const{data:a,height:c=r.CHART.DEFAULT_HEIGHT,showLabels:u=!0,showValues:i=!0,animated:h=!0,color:d,className:m,...C}=s,g=Math.max(...a.map(e=>e.value),n.ONE);return t.jsx(l.Flex,{direction:"column",gap:1,justify:"center",className:o.cn("Bear-Chart Bear-Chart--funnel bear-w-full",m),style:{height:c},...C,children:a.map((e,x)=>{const N=Math.max(e.value/g*r.CHART.VIEWBOX,r.CHART.FUNNEL_MIN_WIDTH),T=H.getChartColor(x,e.color||d);return t.jsxs(l.Flex,{direction:"column",align:"center",gap:1,className:"bear-w-full",children:[t.jsx(b.Box,{className:o.cn("Bear-Chart__funnel-step bear-rounded-md",h&&"animate-grow-right"),style:{width:`${N}%`,height:`${r.CHART.VIEWBOX/Math.max(a.length,n.ONE)/2}%`,minHeight:r.CHART.FUNNEL_MIN_WIDTH,backgroundColor:T}}),u&&t.jsxs(p.Typography,{variant:"caption",color:"muted",children:[e.label,i?` · ${e.value}`:""]})]},e.label)})})};exports.FunnelChart=_;
@@ -0,0 +1,2 @@
1
+ import { FunnelChartProps } from './Chart.types';
2
+ export declare const FunnelChart: (props: FunnelChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
2
+ import { ONE as l } from "../../constants/numbers.const.js";
3
+ import { cn as n } from "../../utils/cn.js";
4
+ import "react";
5
+ import { Box as b } from "../Box/Box.js";
6
+ import { Flex as m } from "../Flex/Flex.js";
7
+ import { Typography as w } from "../Typography/Typography.js";
8
+ import { CHART as a } from "./Chart.const.js";
9
+ import { getChartColor as E } from "./Chart.utils.js";
10
+ const L = (c) => {
11
+ const {
12
+ data: t,
13
+ height: i = a.DEFAULT_HEIGHT,
14
+ showLabels: s = !0,
15
+ showValues: h = !0,
16
+ animated: u = !0,
17
+ color: p,
18
+ className: d,
19
+ ...f
20
+ } = c, g = Math.max(...t.map((r) => r.value), l);
21
+ return /* @__PURE__ */ o(
22
+ m,
23
+ {
24
+ direction: "column",
25
+ gap: 1,
26
+ justify: "center",
27
+ className: n("Bear-Chart Bear-Chart--funnel bear-w-full", d),
28
+ style: { height: i },
29
+ ...f,
30
+ children: t.map((r, N) => {
31
+ const x = Math.max(r.value / g * a.VIEWBOX, a.FUNNEL_MIN_WIDTH), C = E(N, r.color || p);
32
+ return /* @__PURE__ */ e(m, { direction: "column", align: "center", gap: 1, className: "bear-w-full", children: [
33
+ /* @__PURE__ */ o(
34
+ b,
35
+ {
36
+ className: n(
37
+ "Bear-Chart__funnel-step bear-rounded-md",
38
+ u && "animate-grow-right"
39
+ ),
40
+ style: {
41
+ width: `${x}%`,
42
+ height: `${a.VIEWBOX / Math.max(t.length, l) / 2}%`,
43
+ minHeight: a.FUNNEL_MIN_WIDTH,
44
+ backgroundColor: C
45
+ }
46
+ }
47
+ ),
48
+ s && /* @__PURE__ */ e(w, { variant: "caption", color: "muted", children: [
49
+ r.label,
50
+ h ? ` · ${r.value}` : ""
51
+ ] })
52
+ ] }, r.label);
53
+ })
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ L as FunnelChart
59
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),m=require("react"),u=require("../../utils/cn.cjs"),N=({data:a,height:y=200,showLabels:d=!0,showDots:h=!0,smooth:f=!0,fill:p=!1,strokeWidth:j=2,color:i="var(--bear-primary-500, #ec4899)",animated:x=!0,className:$,...v})=>{const n=m.useMemo(()=>{const r=Math.max(...a.map(t=>t.value)),e=Math.min(...a.map(t=>t.value)),l=r-e||1;return a.map((t,c)=>({x:c/(a.length-1||1)*100,y:100-(t.value-e)/l*80-10,...t}))},[a]),o=m.useMemo(()=>n.length===0?"":f?n.reduce((r,e,l,t)=>{if(l===0)return`M ${e.x},${e.y}`;const c=t[l-1],M=c.x+(e.x-c.x)/3,L=e.x-(e.x-c.x)/3;return`${r} C ${M},${c.y} ${L},${e.y} ${e.x},${e.y}`},""):n.reduce((r,e,l)=>`${r} ${l===0?"M":"L"} ${e.x},${e.y}`,""),[n,f]),g=m.useMemo(()=>n.length===0?"":`${o} L 100,100 L 0,100 Z`,[o,n]);return s.jsxs("div",{className:u.cn("w-full",$),style:{height:y},...v,children:[s.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[s.jsx("stop",{offset:"0%",stopColor:i,stopOpacity:"0.3"}),s.jsx("stop",{offset:"100%",stopColor:i,stopOpacity:"0"})]})}),p&&s.jsx("path",{d:g,fill:"url(#line-gradient)",className:u.cn(x&&"animate-fade-in")}),s.jsx("path",{d:o,fill:"none",stroke:i,strokeWidth:j/10,strokeLinecap:"round",strokeLinejoin:"round",className:u.cn(x&&"animate-draw-line")}),h&&n.map((r,e)=>s.jsx("circle",{cx:r.x,cy:r.y,r:1.5,fill:i,className:u.cn(x&&"animate-scale-in"),style:{animationDelay:`${e*50}ms`}},e))]}),d&&s.jsx("div",{className:"flex justify-between mt-2",children:a.map((r,e)=>s.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:r.label},e))})]})};exports.LineChart=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../constants/numbers.const.cjs"),r=require("../../utils/cn.cjs");require("react");const a=require("./Chart.const.cjs"),m=require("./Chart.utils.cjs"),E=p=>{const{data:l,height:x=a.CHART.DEFAULT_HEIGHT,showLabels:b=!0,showDots:f=!0,smooth:T=!0,fill:C=!1,stepped:d=!1,strokeWidth:j=a.CHART.DEFAULT_STROKE_WIDTH,color:t="var(--bear-primary-500, #ec4899)",animated:n=!0,className:y,...R}=p,i=m.calculateLinePoints(l),h=m.generateLinePath(i,T&&!d,d),A=i.length===c.ZERO?"":`${h} L ${a.CHART.VIEWBOX},${a.CHART.VIEWBOX} L 0,${a.CHART.VIEWBOX} Z`;return e.jsxs("div",{className:r.cn("Bear-Chart Bear-Chart--line bear-w-full",y),style:{height:x},...R,children:[e.jsxs("svg",{viewBox:`0 0 ${a.CHART.VIEWBOX} ${a.CHART.VIEWBOX}`,preserveAspectRatio:"none",className:"bear-h-full bear-w-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:t,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:t,stopOpacity:"0"})]})}),C&&e.jsx("path",{d:A,fill:"url(#line-gradient)",className:r.cn(n&&"animate-fade-in")}),e.jsx("path",{d:h,fill:"none",stroke:t,strokeWidth:j/c.TEN,strokeLinecap:"round",strokeLinejoin:"round",className:r.cn(n&&"animate-draw-line")}),f&&i.map((s,o)=>{var u;return e.jsx("circle",{cx:s.x,cy:s.y,r:a.CHART.DOT_RADIUS,fill:t,className:r.cn(n&&"animate-scale-in"),style:{animationDelay:`${o*c.FIFTY}ms`}},((u=l[o])==null?void 0:u.label)??o)})]}),b&&e.jsx("div",{className:"bear-mt-2 bear-flex bear-justify-between",children:l.map(s=>e.jsx("span",{className:"bear-text-xs bear-text-gray-600 dark:bear-text-slate-300",children:s.label},s.label))})]})};exports.LineChart=E;
@@ -1,3 +1,2 @@
1
- import { FC } from 'react';
2
1
  import { LineChartProps } from './Chart.types';
3
- export declare const LineChart: FC<LineChartProps>;
2
+ export declare const LineChart: (props: LineChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,73 +1,69 @@
1
- import { jsxs as o, jsx as s } from "react/jsx-runtime";
2
- import { useMemo as f } from "react";
3
- import { cn as u } from "../../utils/cn.js";
4
- const b = ({
5
- data: n,
6
- height: y = 200,
7
- showLabels: d = !0,
8
- showDots: h = !0,
9
- smooth: p = !0,
10
- fill: $ = !1,
11
- strokeWidth: v = 2,
12
- color: i = "var(--bear-primary-500, #ec4899)",
13
- animated: x = !0,
14
- className: g,
15
- ...N
16
- }) => {
17
- const a = f(() => {
18
- const r = Math.max(...n.map((t) => t.value)), e = Math.min(...n.map((t) => t.value)), l = r - e || 1;
19
- return n.map((t, c) => ({
20
- x: c / (n.length - 1 || 1) * 100,
21
- y: 100 - (t.value - e) / l * 80 - 10,
22
- ...t
23
- }));
24
- }, [n]), m = f(() => a.length === 0 ? "" : p ? a.reduce((r, e, l, t) => {
25
- if (l === 0) return `M ${e.x},${e.y}`;
26
- const c = t[l - 1], k = c.x + (e.x - c.x) / 3, w = e.x - (e.x - c.x) / 3;
27
- return `${r} C ${k},${c.y} ${w},${e.y} ${e.x},${e.y}`;
28
- }, "") : a.reduce((r, e, l) => `${r} ${l === 0 ? "M" : "L"} ${e.x},${e.y}`, ""), [a, p]), L = f(() => a.length === 0 ? "" : `${m} L 100,100 L 0,100 Z`, [m, a]);
29
- return /* @__PURE__ */ o("div", { className: u("w-full", g), style: { height: y }, ...N, children: [
30
- /* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
31
- /* @__PURE__ */ s("defs", { children: /* @__PURE__ */ o("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
32
- /* @__PURE__ */ s("stop", { offset: "0%", stopColor: i, stopOpacity: "0.3" }),
33
- /* @__PURE__ */ s("stop", { offset: "100%", stopColor: i, stopOpacity: "0" })
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { ZERO as I, TEN as N, FIFTY as T } from "../../constants/numbers.const.js";
3
+ import { cn as s } from "../../utils/cn.js";
4
+ import "react";
5
+ import { CHART as a } from "./Chart.const.js";
6
+ import { calculateLinePoints as B, generateLinePath as W } from "./Chart.utils.js";
7
+ const A = (f) => {
8
+ const {
9
+ data: l,
10
+ height: h = a.DEFAULT_HEIGHT,
11
+ showLabels: b = !0,
12
+ showDots: u = !0,
13
+ smooth: y = !0,
14
+ fill: x = !1,
15
+ stepped: m = !1,
16
+ strokeWidth: E = a.DEFAULT_STROKE_WIDTH,
17
+ color: r = "var(--bear-primary-500, #ec4899)",
18
+ animated: o = !0,
19
+ className: L,
20
+ ...O
21
+ } = f, i = B(l), p = W(i, y && !m, m), D = i.length === I ? "" : `${p} L ${a.VIEWBOX},${a.VIEWBOX} L 0,${a.VIEWBOX} Z`;
22
+ return /* @__PURE__ */ c("div", { className: s("Bear-Chart Bear-Chart--line bear-w-full", L), style: { height: h }, ...O, children: [
23
+ /* @__PURE__ */ c("svg", { viewBox: `0 0 ${a.VIEWBOX} ${a.VIEWBOX}`, preserveAspectRatio: "none", className: "bear-h-full bear-w-full", children: [
24
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ c("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
25
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: r, stopOpacity: "0.3" }),
26
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: r, stopOpacity: "0" })
34
27
  ] }) }),
35
- $ && /* @__PURE__ */ s(
28
+ x && /* @__PURE__ */ e(
36
29
  "path",
37
30
  {
38
- d: L,
31
+ d: D,
39
32
  fill: "url(#line-gradient)",
40
- className: u(x && "animate-fade-in")
33
+ className: s(o && "animate-fade-in")
41
34
  }
42
35
  ),
43
- /* @__PURE__ */ s(
36
+ /* @__PURE__ */ e(
44
37
  "path",
45
38
  {
46
- d: m,
39
+ d: p,
47
40
  fill: "none",
48
- stroke: i,
49
- strokeWidth: v / 10,
41
+ stroke: r,
42
+ strokeWidth: E / N,
50
43
  strokeLinecap: "round",
51
44
  strokeLinejoin: "round",
52
- className: u(x && "animate-draw-line")
45
+ className: s(o && "animate-draw-line")
53
46
  }
54
47
  ),
55
- h && a.map((r, e) => /* @__PURE__ */ s(
56
- "circle",
57
- {
58
- cx: r.x,
59
- cy: r.y,
60
- r: 1.5,
61
- fill: i,
62
- className: u(x && "animate-scale-in"),
63
- style: { animationDelay: `${e * 50}ms` }
64
- },
65
- e
66
- ))
48
+ u && i.map((t, n) => {
49
+ var d;
50
+ return /* @__PURE__ */ e(
51
+ "circle",
52
+ {
53
+ cx: t.x,
54
+ cy: t.y,
55
+ r: a.DOT_RADIUS,
56
+ fill: r,
57
+ className: s(o && "animate-scale-in"),
58
+ style: { animationDelay: `${n * T}ms` }
59
+ },
60
+ ((d = l[n]) == null ? void 0 : d.label) ?? n
61
+ );
62
+ })
67
63
  ] }),
68
- d && /* @__PURE__ */ s("div", { className: "flex justify-between mt-2", children: n.map((r, e) => /* @__PURE__ */ s("span", { className: "text-xs text-gray-600 dark:text-slate-300", children: r.label }, e)) })
64
+ b && /* @__PURE__ */ e("div", { className: "bear-mt-2 bear-flex bear-justify-between", children: l.map((t) => /* @__PURE__ */ e("span", { className: "bear-text-xs bear-text-gray-600 dark:bear-text-slate-300", children: t.label }, t.label)) })
69
65
  ] });
70
66
  };
71
67
  export {
72
- b as LineChart
68
+ A as LineChart
73
69
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),A=require("../../utils/cn.cjs"),X=require("../Portal/Portal.cjs"),g=require("../Card/Card.cjs"),L=require("./Chart.utils.cjs"),c=45,Y=({data:s,height:N=200,showLabels:R=!0,innerRadius:w=0,startAngle:P=-90,padAngle:f=2,animated:_=!0,onSliceClick:d,onSliceHover:x,showSliceTooltip:j=!0,sliceTooltipTitle:y,sliceTooltipDescription:m,sliceTooltipContent:v,className:B,...C})=>{const h=s.reduce((r,e)=>r+e.value,0),[n,o]=b.useState(null),q=b.useCallback((r,e,a)=>{const u=s[a];if(x==null||x(u,a),!j)return;const l=Math.round(u.value/h*100);o({x:r,y:e,index:a,label:u.label,value:u.value,pct:l})},[s,x,j,h]),E=b.useCallback(()=>{o(null),x==null||x(null,null)},[x]),O=b.useMemo(()=>{let r=P;return s.map((e,a)=>{const u=e.value/h*360-f,l={startAngle:r,endAngle:r+u,color:L.getChartColor(a,e.color),...e};return r+=u+f,l})},[s,h,P,f]),$=(r,e)=>{const a=r*Math.PI/180;return{x:50+e*Math.cos(a),y:50+e*Math.sin(a)}},U=(r,e)=>{const a=w*c,u=$(r,c),l=$(e,c),I=$(r,a),p=$(e,a),M=e-r>180?1:0;return w>0?`M ${u.x},${u.y} A ${c},${c} 0 ${M},1 ${l.x},${l.y} L ${p.x},${p.y} A ${a},${a} 0 ${M},0 ${I.x},${I.y} Z`:`M 50,50 L ${u.x},${u.y} A ${c},${c} 0 ${M},1 ${l.x},${l.y} Z`};return t.jsxs("div",{className:A.cn("relative flex max-w-full flex-wrap items-center gap-4",B),...C,children:[t.jsx("div",{style:{width:N,height:N},className:"min-w-0 shrink-0",children:t.jsx("svg",{viewBox:"0 0 100 100",className:"h-full w-full",children:O.map((r,e)=>t.jsx("path",{d:U(r.startAngle,r.endAngle),fill:r.color,className:A.cn(d&&"cursor-pointer","transition-opacity hover:opacity-80",_&&"animate-scale-in"),style:{animationDelay:`${e*100}ms`},onClick:()=>d==null?void 0:d(s[e],e),tabIndex:0,role:"button","aria-label":`${s[e].label} ${Math.round(s[e].value/h*100)}%`,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d==null||d(s[e],e))},onMouseEnter:a=>q(a.clientX,a.clientY,e),onMouseMove:a=>q(a.clientX,a.clientY,e),onMouseLeave:E},e))})}),R&&t.jsx("div",{className:"flex flex-col gap-2",children:s.map((r,e)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:L.getChartColor(e,r.color)}}),t.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:r.label}),t.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(r.value/h*100),"%"]})]},e))}),n&&j&&t.jsx(X.Portal,{children:t.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:n.x+12,top:n.y+12},children:t.jsxs(g.Card,{variant:"elevated",padding:"none",children:[(y||m)&&t.jsx(g.CardHeader,{title:(y==null?void 0:y(s[n.index],n.index))??n.label,subtitle:m==null?void 0:m(s[n.index],n.index)}),t.jsx(g.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(v==null?void 0:v(s[n.index],n.index))??t.jsxs("span",{children:[n.value," (",n.pct,"%)"]})})]})})})]})};exports.PieChart=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("react"),d=require("../../constants/numbers.const.cjs"),j=require("../../utils/cn.cjs"),Y=require("../Portal/Portal.cjs"),g=require("../Card/Card.cjs"),b=require("../Flex/Flex.cjs"),w=require("../Box/Box.cjs"),N=require("../Typography/Typography.cjs"),a=require("./Chart.const.cjs"),R=require("./Chart.utils.cjs"),z=f=>{const{data:n,height:C=a.CHART.DEFAULT_HEIGHT,showLabels:P=!0,innerRadius:B=d.ZERO,startAngle:D,padAngle:x=a.CHART.DEFAULT_PAD_ANGLE,animated:F=!0,pieView:_=a.PIE_VIEW_FULL,explodeIndex:S,legendPosition:y="right",onSliceClick:u,onSliceHover:i,showSliceTooltip:m=!0,sliceTooltipTitle:A,sliceTooltipDescription:E,sliceTooltipContent:p,className:M,...q}=f,h=n.reduce((e,r)=>e+r.value,d.ZERO),[s,H]=k.useState(null),I=_===a.PIE_VIEW_HALF,O=_===a.PIE_VIEW_ROSE,L=I?a.CHART.HALF_SWEEP:a.CHART.FULL_SWEEP,U=D??(I?a.CHART.HALF_PIE_START:a.CHART.DEFAULT_START_ANGLE),V=Math.max(...n.map(e=>e.value),d.ONE),W=y===a.CHART_LEGEND_NONE||!P,X=y===a.CHART_LEGEND_BOTTOM,v=(e,r,c)=>{const o=n[c];if(i==null||i(o,c),!m)return;const l=Math.round(o.value/h*a.CHART.VIEWBOX);H({x:e,y:r,index:c,label:o.label,value:o.value,pct:l})},$=()=>{H(null),i==null||i(null,null)};let T=U;const G=n.map((e,r)=>{const c=O?L/n.length-x:e.value/h*L-x,o=T,l=T+c;T+=c+x;const Z=O?a.CHART.ROSE_MIN_RADIUS+e.value/V*(a.CHART.OUTER_RADIUS-a.CHART.ROSE_MIN_RADIUS):a.CHART.OUTER_RADIUS;return{startAngle:o,endAngle:l,color:R.getChartColor(r,e.color),outerRadius:Z,...e}});return t.jsxs(b.Flex,{direction:X?"column":"row",align:"center",gap:4,wrap:"wrap",className:j.cn("Bear-Chart Bear-Chart--pie bear-relative bear-max-w-full",M),...q,children:[t.jsx(w.Box,{style:{width:C,height:C},className:"bear-min-w-0 bear-shrink-0",children:t.jsx("svg",{viewBox:`0 0 ${a.CHART.VIEWBOX} ${a.CHART.VIEWBOX}`,className:"bear-h-full bear-w-full",children:G.map((e,r)=>{const c=(e.startAngle+e.endAngle)/2,o=S===r?R.polarOffset(c,a.CHART.EXPLODE_OFFSET):{x:d.ZERO,y:d.ZERO};return t.jsx("g",{transform:`translate(${o.x} ${o.y})`,children:t.jsx("path",{d:R.createArcPath(e.startAngle,e.endAngle,B,e.outerRadius),fill:e.color,className:j.cn(u&&"bear-cursor-pointer","bear-transition-opacity hover:bear-opacity-80",F&&"animate-scale-in"),style:{animationDelay:`${r*a.CHART.SLICE_DELAY_MS}ms`},onClick:()=>u==null?void 0:u(n[r],r),tabIndex:0,role:"button","aria-label":`${n[r].label} ${Math.round(n[r].value/h*a.CHART.VIEWBOX)}%`,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),u==null||u(n[r],r))},onMouseEnter:l=>v(l.clientX,l.clientY,r),onMouseMove:l=>v(l.clientX,l.clientY,r),onMouseLeave:$})},e.label)})})}),!W&&t.jsx(b.Flex,{direction:"column",gap:2,children:n.map((e,r)=>t.jsxs(b.Flex,{align:"center",gap:2,children:[t.jsx(w.Box,{className:"bear-h-3 bear-w-3 bear-rounded-full",style:{backgroundColor:R.getChartColor(r,e.color)}}),t.jsx(N.Typography,{variant:"body2",color:"muted",children:e.label}),t.jsxs(N.Typography,{variant:"body2",color:"muted",children:[Math.round(e.value/h*a.CHART.VIEWBOX),"%"]})]},e.label))}),s&&m&&t.jsx(Y.Portal,{children:t.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:s.x+12,top:s.y+12},children:t.jsxs(g.Card,{variant:"elevated",padding:"none",children:[(A||E)&&t.jsx(g.CardHeader,{title:(A==null?void 0:A(n[s.index],s.index))??s.label,subtitle:E==null?void 0:E(n[s.index],s.index)}),t.jsx(g.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(p==null?void 0:p(n[s.index],s.index))??t.jsxs("span",{children:[s.value," (",s.pct,"%)"]})})]})})})]})};exports.PieChart=z;
@@ -1,3 +1,2 @@
1
- import { FC } from 'react';
2
1
  import { PieChartProps } from './Chart.types';
3
- export declare const PieChart: FC<PieChartProps>;
2
+ export declare const PieChart: (props: PieChartProps) => import("react/jsx-runtime").JSX.Element;