blixify-ui-web-mcp 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +5 -0
  2. package/lib/components/action/button/README.md +75 -0
  3. package/lib/components/action/button/button.stories.tsx +138 -0
  4. package/lib/components/action/buttonGroup/README.md +79 -0
  5. package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
  6. package/lib/components/action/iconButton/README.md +39 -0
  7. package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
  8. package/lib/components/action/radioList/README.md +98 -0
  9. package/lib/components/action/radioList/radioList.stories.tsx +181 -0
  10. package/lib/components/action/slider/README.md +86 -0
  11. package/lib/components/action/slider/slider.stories.tsx +133 -0
  12. package/lib/components/action/textButton/README.md +34 -0
  13. package/lib/components/action/textButton/textButton.stories.tsx +16 -0
  14. package/lib/components/action/toggle/README.md +39 -0
  15. package/lib/components/action/toggle/toggle.stories.tsx +23 -0
  16. package/lib/components/advanced/collapse/README.md +106 -0
  17. package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
  18. package/lib/components/advanced/infoWindow/README.md +69 -0
  19. package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
  20. package/lib/components/advanced/popUp/README.md +95 -0
  21. package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
  22. package/lib/components/auth/bareSignIn/README.md +78 -0
  23. package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
  24. package/lib/components/auth/bareSignUp/README.md +130 -0
  25. package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
  26. package/lib/components/auth/signIn/README.md +53 -0
  27. package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
  28. package/lib/components/auth/signUp/README.md +136 -0
  29. package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
  30. package/lib/components/chart/README.md +13 -0
  31. package/lib/components/chart/areaChart/README.md +133 -0
  32. package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
  33. package/lib/components/chart/barChart/README.md +193 -0
  34. package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
  35. package/lib/components/chart/boxPlotChart/README.md +124 -0
  36. package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
  37. package/lib/components/chart/bubbleChart/README.md +166 -0
  38. package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
  39. package/lib/components/chart/card/README.md +107 -0
  40. package/lib/components/chart/card/card.stories.tsx +89 -0
  41. package/lib/components/chart/ganttChart/README.md +142 -0
  42. package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
  43. package/lib/components/chart/heatmapChart/README.md +125 -0
  44. package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
  45. package/lib/components/chart/lineChart/README.md +140 -0
  46. package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
  47. package/lib/components/chart/pieChart/README.md +117 -0
  48. package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
  49. package/lib/components/chart/polarAreaChart/README.md +126 -0
  50. package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
  51. package/lib/components/chart/radarChart/README.md +57 -0
  52. package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
  53. package/lib/components/chart/radialBar/README.md +152 -0
  54. package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
  55. package/lib/components/chart/rangeBarChart/README.md +323 -0
  56. package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
  57. package/lib/components/chart/statsCard/README.md +97 -0
  58. package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
  59. package/lib/components/chart/treemapChart/README.md +142 -0
  60. package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
  61. package/lib/components/chat/chatAnchor/README.md +113 -0
  62. package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
  63. package/lib/components/chat/chatBase/README.md +223 -0
  64. package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
  65. package/lib/components/chat/chatDashboard/README.md +161 -0
  66. package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
  67. package/lib/components/data/dataGraph/README.md +13 -0
  68. package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
  69. package/lib/components/data/dataReference/README.md +62 -0
  70. package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
  71. package/lib/components/data/dataTemplate/README.md +903 -0
  72. package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
  73. package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
  74. package/lib/components/data/dataWrapper/README.md +1077 -0
  75. package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
  76. package/lib/components/data/queryForm/README.md +56 -0
  77. package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
  78. package/lib/components/data/readQuery/README.md +282 -0
  79. package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
  80. package/lib/components/data/readQueryHoc/README.md +89 -0
  81. package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
  82. package/lib/components/data/writeQuery/README.md +178 -0
  83. package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
  84. package/lib/components/design/actionSection/README.md +47 -0
  85. package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
  86. package/lib/components/design/banner/README.md +43 -0
  87. package/lib/components/design/banner/banner.stories.tsx +34 -0
  88. package/lib/components/design/bannerAction/README.md +44 -0
  89. package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
  90. package/lib/components/design/blogSection/README.md +111 -0
  91. package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
  92. package/lib/components/design/carouselSection/README.md +82 -0
  93. package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
  94. package/lib/components/design/designList/README.md +60 -0
  95. package/lib/components/design/designList/designList.stories.tsx +44 -0
  96. package/lib/components/design/faq/README.md +121 -0
  97. package/lib/components/design/faq/faq.stories.tsx +103 -0
  98. package/lib/components/design/fileGrid/README.md +87 -0
  99. package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
  100. package/lib/components/design/fileViewer/README.md +40 -0
  101. package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
  102. package/lib/components/design/footerSection/README.md +62 -0
  103. package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
  104. package/lib/components/design/googleReview/README.md +45 -0
  105. package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
  106. package/lib/components/design/heroSection/README.md +48 -0
  107. package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
  108. package/lib/components/design/iconList/README.md +60 -0
  109. package/lib/components/design/iconList/iconList.stories.tsx +41 -0
  110. package/lib/components/design/imageGallery/README.md +56 -0
  111. package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
  112. package/lib/components/design/imageZoom/README.md +47 -0
  113. package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
  114. package/lib/components/design/leftContent/README.md +47 -0
  115. package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
  116. package/lib/components/design/logoCloud/README.md +42 -0
  117. package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
  118. package/lib/components/design/onboarding/README.md +100 -0
  119. package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
  120. package/lib/components/design/pricing/README.md +112 -0
  121. package/lib/components/design/pricing/pricing.stories.tsx +86 -0
  122. package/lib/components/design/rightContent/README.md +47 -0
  123. package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
  124. package/lib/components/design/sectionList/README.md +51 -0
  125. package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
  126. package/lib/components/design/teams/README.md +62 -0
  127. package/lib/components/design/teams/teams.stories.tsx +61 -0
  128. package/lib/components/display/alert/README.md +82 -0
  129. package/lib/components/display/alert/alert.stories.tsx +71 -0
  130. package/lib/components/display/calendar/README.md +113 -0
  131. package/lib/components/display/calendar/calendar.stories.tsx +159 -0
  132. package/lib/components/display/clipboard/README.md +36 -0
  133. package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
  134. package/lib/components/display/detailList/README.md +61 -0
  135. package/lib/components/display/detailList/detailList.stories.tsx +131 -0
  136. package/lib/components/display/drawer/README.md +74 -0
  137. package/lib/components/display/drawer/drawer.stories.tsx +66 -0
  138. package/lib/components/display/emptyState/README.md +38 -0
  139. package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
  140. package/lib/components/display/feeds/README.md +80 -0
  141. package/lib/components/display/feeds/feeds.stories.tsx +75 -0
  142. package/lib/components/display/flexTable/README.md +160 -0
  143. package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
  144. package/lib/components/display/grid/README.md +121 -0
  145. package/lib/components/display/grid/grid.stories.tsx +234 -0
  146. package/lib/components/display/kanban/README.md +78 -0
  147. package/lib/components/display/kanban/kanban.stories.tsx +133 -0
  148. package/lib/components/display/list/README.md +109 -0
  149. package/lib/components/display/list/list.stories.tsx +188 -0
  150. package/lib/components/display/loading/README.md +25 -0
  151. package/lib/components/display/loading/loading.stories.tsx +15 -0
  152. package/lib/components/display/mapView/README.md +99 -0
  153. package/lib/components/display/mapView/mapView.stories.tsx +225 -0
  154. package/lib/components/display/modal/README.md +43 -0
  155. package/lib/components/display/modal/modal.stories.tsx +81 -0
  156. package/lib/components/display/notification/README.md +43 -0
  157. package/lib/components/display/notification/notification.stories.tsx +30 -0
  158. package/lib/components/display/progress/README.md +25 -0
  159. package/lib/components/display/progress/progress.stories.tsx +15 -0
  160. package/lib/components/display/stepper/README.md +96 -0
  161. package/lib/components/display/stepper/stepper.stories.tsx +175 -0
  162. package/lib/components/display/table/README.md +176 -0
  163. package/lib/components/display/table/table.stories.tsx +330 -0
  164. package/lib/components/display/tag/README.md +74 -0
  165. package/lib/components/display/tag/tag.stories.tsx +79 -0
  166. package/lib/components/input/address/README.md +132 -0
  167. package/lib/components/input/address/address.stories.tsx +147 -0
  168. package/lib/components/input/canvas/README.md +131 -0
  169. package/lib/components/input/canvas/canvas.stories.tsx +165 -0
  170. package/lib/components/input/checkbox/README.md +61 -0
  171. package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
  172. package/lib/components/input/datePicker/README.md +124 -0
  173. package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
  174. package/lib/components/input/form/README.md +55 -0
  175. package/lib/components/input/form/form.stories.tsx +143 -0
  176. package/lib/components/input/markdown/README.md +146 -0
  177. package/lib/components/input/markdown/markdown.stories.tsx +40 -0
  178. package/lib/components/input/monthYearPicker/README.md +69 -0
  179. package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
  180. package/lib/components/input/netPromoterScore/README.md +52 -0
  181. package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
  182. package/lib/components/input/rating/README.md +51 -0
  183. package/lib/components/input/rating/rating.stories.tsx +30 -0
  184. package/lib/components/input/select/README.md +108 -0
  185. package/lib/components/input/select/select.stories.tsx +286 -0
  186. package/lib/components/input/signature/README.md +106 -0
  187. package/lib/components/input/signature/signature.stories.tsx +188 -0
  188. package/lib/components/input/textArea/README.md +55 -0
  189. package/lib/components/input/textArea/textArea.stories.tsx +30 -0
  190. package/lib/components/input/textInput/README.md +81 -0
  191. package/lib/components/input/textInput/textinput.stories.tsx +231 -0
  192. package/lib/components/input/uploadInput/README.md +134 -0
  193. package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
  194. package/lib/components/navigation/bars/README.md +40 -0
  195. package/lib/components/navigation/bars/bars.stories.tsx +85 -0
  196. package/lib/components/navigation/bottomTab/README.md +53 -0
  197. package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
  198. package/lib/components/navigation/breadcrumb/README.md +48 -0
  199. package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
  200. package/lib/components/navigation/header/README.md +149 -0
  201. package/lib/components/navigation/header/header.stories.tsx +107 -0
  202. package/lib/components/navigation/leftNav/README.md +91 -0
  203. package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
  204. package/lib/components/navigation/tabs/README.md +75 -0
  205. package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
  206. package/lib/components/structure/column/README.md +40 -0
  207. package/lib/components/structure/column/column.stories.tsx +26 -0
  208. package/lib/components/structure/container/README.md +34 -0
  209. package/lib/components/structure/container/container.stories.tsx +19 -0
  210. package/lib/components/structure/link/README.md +55 -0
  211. package/lib/components/structure/link/link.stories.tsx +30 -0
  212. package/lib/components/structure/text/README.md +42 -0
  213. package/lib/components/structure/text/text.stories.tsx +39 -0
  214. package/lib/components/template/authPage/authPage.stories.tsx +68 -0
  215. package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
  216. package/lib/components/template/productListing/productListing.stories.tsx +297 -0
  217. package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
  218. package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
  219. package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
  220. package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
  221. package/lib/mcp/server.d.ts +2 -0
  222. package/lib/mcp/server.d.ts.map +1 -0
  223. package/lib/mcp/server.js +33 -0
  224. package/lib/mcp/server.js.map +1 -0
  225. package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
  226. package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
  227. package/lib/mcp/tools/getBackendComponent.js +119 -0
  228. package/lib/mcp/tools/getBackendComponent.js.map +1 -0
  229. package/lib/mcp/tools/getComponent.d.ts +17 -0
  230. package/lib/mcp/tools/getComponent.d.ts.map +1 -0
  231. package/lib/mcp/tools/getComponent.js +118 -0
  232. package/lib/mcp/tools/getComponent.js.map +1 -0
  233. package/lib/mcp/tools/listComponents.d.ts +13 -0
  234. package/lib/mcp/tools/listComponents.d.ts.map +1 -0
  235. package/lib/mcp/tools/listComponents.js +113 -0
  236. package/lib/mcp/tools/listComponents.js.map +1 -0
  237. package/lib/mcp/tools/listTemplates.d.ts +13 -0
  238. package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
  239. package/lib/mcp/tools/listTemplates.js +68 -0
  240. package/lib/mcp/tools/listTemplates.js.map +1 -0
  241. package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
  242. package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
  243. package/lib/mcp/tools/suggestTemplate.js +212 -0
  244. package/lib/mcp/tools/suggestTemplate.js.map +1 -0
  245. package/package.json +23 -0
@@ -0,0 +1,193 @@
1
+ # Bar Chart
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A bar chart for displaying categorical data. Supports horizontal/vertical orientation, stacked multi-series, distributed colours, custom annotations, and full visual customisation.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { BarChart } from "blixify-ui-web/chart/barChart";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Single series (horizontal):
18
+
19
+ ```jsx
20
+ <BarChart
21
+ title="Sales"
22
+ seriesName="Value"
23
+ seriesData={[
24
+ { x: "Apple", y: 10 },
25
+ { x: "Mango", y: 20 },
26
+ ]}
27
+ orientation="row"
28
+ distributed
29
+ dateRangeVisible={true}
30
+ customDate={{ startDate, endDate, isDuration: true }}
31
+ onChangeDate={handleSetData}
32
+ />
33
+ ```
34
+
35
+ Stacked vertical:
36
+
37
+ ```jsx
38
+ <BarChart
39
+ title="Sales by Company"
40
+ stackedBarSeries={[
41
+ { name: "Company A", data: [400, 430, 448] },
42
+ { name: "Company B", data: [430, 460, 478] },
43
+ ]}
44
+ categories={["Apple", "Mango", "Orange"]}
45
+ orientation="col"
46
+ stackedVertical={true}
47
+ />
48
+ ```
49
+
50
+ Custom styled with annotation labels:
51
+
52
+ ```jsx
53
+ <BarChart
54
+ title=""
55
+ categories={["May", "Jun", "Jul"]}
56
+ seriesData={[
57
+ { x: "May", y: 60 },
58
+ { x: "Jun", y: 65 },
59
+ { x: "Jul", y: 70 },
60
+ ]}
61
+ dataLabels={[
62
+ {
63
+ x: "May",
64
+ y: 60,
65
+ name: "RM 60.00",
66
+ offsetY: -25,
67
+ style: { color: "#fff", fontSize: "12px" },
68
+ },
69
+ {
70
+ x: "May",
71
+ y: 60,
72
+ name: "250 kWh",
73
+ offsetY: -10,
74
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
75
+ },
76
+ ]}
77
+ customBackground="linear-gradient(180deg, #4A3AFF 0%, #6959FF 100%)"
78
+ customColors={["#FFFFFF", "#F5F3FF", "#E0E7FF"]}
79
+ hideAxes={true}
80
+ hideGrid={true}
81
+ roundedBars={true}
82
+ disableZoom={true}
83
+ disableTooltip={true}
84
+ />
85
+ ```
86
+
87
+ ##### Required props
88
+
89
+ | Name | Type | Description |
90
+ | ------- | -------- | ----------------------------------------------------- |
91
+ | `title` | `string` | Title shown in the chart header. Pass `""` to hide it |
92
+
93
+ ##### Chart props
94
+
95
+ | Name | Type | Default | Description |
96
+ | ------------------ | ------------------------------------------- | ----------- | --------------------------------------------------------------- |
97
+ | `seriesData` | `SeriesData[]` | `[]` | Single-series data — array of `{ x: string, y: number }` |
98
+ | `seriesName` | `string` | `""` | Tooltip label for single-series mode |
99
+ | `seriesUnit` | `string` | `""` | Unit appended to tooltip values (e.g. `"kg"`) |
100
+ | `stackedBarSeries` | `SeriesItem[]` | `[]` | Multi-series data. Use with `categories` and `stackedVertical` |
101
+ | `categories` | `string[]` | `[]` | X-axis (or Y-axis for horizontal) category labels |
102
+ | `orientation` | `"row" \| "col"` | `"col"` | `"row"` = horizontal bars, `"col"` = vertical bars |
103
+ | `stackedVertical` | `boolean` | `false` | Stack series on top of each other (requires `stackedBarSeries`) |
104
+ | `distributed` | `boolean` | `false` | Give each bar in a single series a distinct colour |
105
+ | `showDataLabel` | `boolean` | `true` | Show value labels on bars |
106
+ | `showToolbar` | `boolean` | `false` | Show the ApexCharts toolbar |
107
+ | `borderColor` | `string` | `"#e7e7e7"` | Grid line colour. Pass `""` to remove grid lines |
108
+ | `newTabUrl` | `string` | `""` | Makes the chart title a link that opens in a new tab |
109
+ | `onClick` | `(category: string, value: string) => void` | — | Called when a bar is clicked |
110
+
111
+ ##### Visual customisation props
112
+
113
+ | Name | Type | Default | Description |
114
+ | ------------------ | ----------------- | ------- | ------------------------------------------------------------ |
115
+ | `customBackground` | `string` | — | CSS background value (colour or gradient) for the chart area |
116
+ | `customColors` | `string[]` | — | Colour palette for bars. Overrides `colors` from ChartUtils |
117
+ | `hideGrid` | `boolean` | `false` | Hide chart grid lines |
118
+ | `hideAxes` | `boolean` | `false` | Hide both axes (labels, borders, ticks) |
119
+ | `roundedBars` | `boolean` | `false` | Apply rounded corners to bar tops |
120
+ | `disableZoom` | `boolean` | `false` | Disable zoom interaction |
121
+ | `disableTooltip` | `boolean` | `false` | Disable hover tooltips |
122
+ | `customAnimation` | `AnimationConfig` | — | Override default animation settings |
123
+ | `xAxisLabels` | `AxisLabelConfig` | — | Customise X-axis label rotation, style, and formatter |
124
+ | `yAxisLabels` | `AxisLabelConfig` | — | Customise Y-axis label rotation, style, and formatter |
125
+ | `xAxisTitle` | `AxisTitleConfig` | — | Add a title below the X-axis |
126
+ | `yAxisTitle` | `AxisTitleConfig` | — | Add a title beside the Y-axis |
127
+ | `dataLabels` | `DataLabel[]` | `[]` | Annotation labels positioned above specific bars |
128
+
129
+ ##### ChartUtils props (shared across all chart components)
130
+
131
+ | Name | Type | Default | Description |
132
+ | ------------------ | --------------------------------------- | --------------- | ----------------------------------------------------------------------- |
133
+ | `tool` | `ReactElement` | — | Icon or element in the top-right of the chart header |
134
+ | `dateRangeVisible` | `boolean` | `false` | Shows a date range picker below the chart |
135
+ | `customDate` | `RangeInterface` | — | Initial date range for the picker |
136
+ | `onChangeDate` | `(customDate?: RangeInterface) => void` | — | Called when the user applies a new date range |
137
+ | `colors` | `string[]` | — | Series colour palette. Falls back to `localChartColors` in localStorage |
138
+ | `darkMode` | `boolean` | `false` | Switches to dark theme |
139
+ | `darkModeBg` | `string` | `"bg-gray-900"` | Tailwind classes for the dark mode background |
140
+ | `enableGradient` | `boolean` | `false` | Fill bars with a gradient |
141
+ | `chartOnly` | `boolean` | `false` | Render only the canvas — no title, tool, or date range bar |
142
+ | `chartSize` | `number` | `280` | Chart height in pixels |
143
+ | `containerStyle` | `string` | — | Tailwind classes applied to the outer container |
144
+ | `minInterval` | `number` | `60` | Time picker interval in minutes |
145
+
146
+ ##### SeriesData
147
+
148
+ | Name | Type | Description |
149
+ | ---- | -------- | ---------------- |
150
+ | `x` | `string` | Category / label |
151
+ | `y` | `number` | Bar value |
152
+
153
+ ##### SeriesItem (stacked)
154
+
155
+ | Name | Type | Description |
156
+ | ------ | ---------- | ------------------------------------- |
157
+ | `name` | `string` | Series name shown in the legend |
158
+ | `data` | `number[]` | Values aligned to `categories` |
159
+ | `unit` | `string` | Unit appended to this series' tooltip |
160
+
161
+ ##### DataLabel
162
+
163
+ | Name | Type | Description |
164
+ | --------- | -------- | ---------------------------------------------------------------- |
165
+ | `x` | `string` | Category to anchor the label to |
166
+ | `y` | `number` | Y value to anchor the label to |
167
+ | `name` | `string` | Label text |
168
+ | `offsetY` | `number` | Vertical offset from the anchor point (negative = above the bar) |
169
+ | `offsetX` | `number` | Horizontal offset |
170
+ | `style` | `object` | `{ color, fontSize, fontWeight, background, border }` |
171
+
172
+ ##### AnimationConfig
173
+
174
+ | Name | Type | Description |
175
+ | --------- | --------- | ---------------------------------- |
176
+ | `enabled` | `boolean` | Enable or disable animation |
177
+ | `easing` | `string` | Easing function (e.g. `"easeout"`) |
178
+ | `speed` | `number` | Duration in milliseconds |
179
+
180
+ ##### AxisLabelConfig
181
+
182
+ | Name | Type | Description |
183
+ | ----------------------- | --------------------------- | --------------------------------------------- |
184
+ | `show` | `boolean` | Show or hide labels |
185
+ | `rotate` | `number` | Rotation angle in degrees |
186
+ | `rotateAlways` | `boolean` | Always rotate regardless of available space |
187
+ | `hideOverlappingLabels` | `boolean` | Hide labels that overlap |
188
+ | `trim` | `boolean` | Trim long labels |
189
+ | `maxHeight` | `number` | Max height for label area |
190
+ | `style` | `object` | `{ fontSize, fontFamily, fontWeight, color }` |
191
+ | `formatter` | `(value, index?) => string` | Custom label formatter |
192
+ | `offsetX` | `number` | Horizontal offset |
193
+ | `offsetY` | `number` | Vertical offset |
@@ -0,0 +1,318 @@
1
+ import { PencilIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import moment from "moment";
4
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { BarChart } from ".";
6
+ import { RangeInterface } from "../DateRange";
7
+ import README from "./README.md";
8
+ import { StorySection } from "../../storyUtils";
9
+
10
+ const stories = storiesOf("Chart", module);
11
+
12
+ stories.addParameters({
13
+ readme: {
14
+ content: README,
15
+ },
16
+ });
17
+
18
+ const stackedSeries = [
19
+ { name: "Company A", data: [400, 430, 448] },
20
+ { name: "Company B", data: [430, 460, 478] },
21
+ { name: "Company C", data: [448, 470, 490] },
22
+ ];
23
+
24
+ const rawData = [
25
+ { label: "Apple", value: 10, daysAgo: 7 },
26
+ { label: "Mango", value: 20, daysAgo: 7 },
27
+ { label: "Orange", value: 5, daysAgo: 1 },
28
+ { label: "Watermelon", value: 15, daysAgo: 1 },
29
+ { label: "Banana", value: 55, daysAgo: 28 },
30
+ ];
31
+
32
+ stories.add("Bar Chart", () => {
33
+ const [seriesData, setSeriesData] = useState<any[]>([]);
34
+
35
+ const chartDummyData = useMemo(() => {
36
+ const today = new Date();
37
+ return rawData.map((d) => {
38
+ const date = new Date();
39
+ date.setDate(today.getDate() - d.daysAgo);
40
+ return { label: d.label, value: d.value, createdAt: date };
41
+ });
42
+ }, []);
43
+
44
+ const handleSetData = useCallback(
45
+ (customDate?: RangeInterface) => {
46
+ const points = chartDummyData
47
+ .filter((d) => {
48
+ if (!customDate) return true;
49
+ if (customDate.isDuration)
50
+ return (
51
+ d.createdAt >= customDate.startDate &&
52
+ d.createdAt <= customDate.endDate
53
+ );
54
+ return customDate.endDate ? d.createdAt <= customDate.endDate : true;
55
+ })
56
+ .map((d) => ({ x: d.label, y: d.value }));
57
+ setSeriesData(points);
58
+ },
59
+ [chartDummyData]
60
+ );
61
+
62
+ useEffect(() => {
63
+ handleSetData();
64
+ }, [handleSetData]);
65
+
66
+ const sevenDaysAgo = new Date();
67
+ sevenDaysAgo.setDate(moment().toDate().getDate() - 7);
68
+
69
+ const defaultDateRange: RangeInterface = {
70
+ startDate: sevenDaysAgo,
71
+ endDate: moment().toDate(),
72
+ isDuration: true,
73
+ };
74
+
75
+ return (
76
+ <div className="font-sans max-w-3xl p-6">
77
+ <StorySection
78
+ title="Horizontal Bar Chart"
79
+ description={
80
+ <>
81
+ Single series using <code>seriesData</code>. Set{" "}
82
+ <code>orientation="row"</code> for horizontal bars. Use{" "}
83
+ <code>distributed=&#123;true&#125;</code> to give each bar a
84
+ distinct colour. Pass <code>newTabUrl</code> to make the title a
85
+ link.
86
+ </>
87
+ }
88
+ >
89
+ <BarChart
90
+ title="Sales"
91
+ seriesName="Value"
92
+ seriesData={seriesData}
93
+ orientation="row"
94
+ distributed
95
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
96
+ dateRangeVisible={true}
97
+ customDate={defaultDateRange}
98
+ onChangeDate={handleSetData}
99
+ showDataLabel={false}
100
+ newTabUrl="https://www.google.com/"
101
+ />
102
+ </StorySection>
103
+
104
+ <StorySection
105
+ title="Stacked Vertical Bar Chart"
106
+ description={
107
+ <>
108
+ Use <code>stackedBarSeries</code> with <code>categories</code> for
109
+ multi-series. Set <code>stackedVertical=&#123;true&#125;</code> to
110
+ stack the bars. <code>orientation="col"</code> renders vertical bars
111
+ (default).
112
+ </>
113
+ }
114
+ >
115
+ <BarChart
116
+ title="Sales by Company"
117
+ stackedBarSeries={stackedSeries}
118
+ orientation="col"
119
+ categories={["Apple Sales", "Mango Sales", "Orange Sales"]}
120
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
121
+ dateRangeVisible={true}
122
+ customDate={defaultDateRange}
123
+ onChangeDate={handleSetData}
124
+ showDataLabel={false}
125
+ stackedVertical={true}
126
+ />
127
+ </StorySection>
128
+
129
+ <StorySection
130
+ title="Dark Mode with Gradient"
131
+ description={
132
+ <>
133
+ Set <code>darkMode=&#123;true&#125;</code> and{" "}
134
+ <code>darkModeBg</code> for a dark theme.{" "}
135
+ <code>enableGradient</code> fills bars with a gradient.{" "}
136
+ <code>borderColor=""</code> removes grid lines.
137
+ </>
138
+ }
139
+ dark
140
+ >
141
+ <BarChart
142
+ title="Sales by Company"
143
+ stackedBarSeries={stackedSeries}
144
+ orientation="col"
145
+ categories={["Apple Sales", "Mango Sales", "Orange Sales"]}
146
+ tool={<PencilIcon className="h-4 w-4 text-white" />}
147
+ dateRangeVisible={true}
148
+ customDate={defaultDateRange}
149
+ onChangeDate={handleSetData}
150
+ showDataLabel={false}
151
+ stackedVertical={true}
152
+ darkMode={true}
153
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
154
+ borderColor=""
155
+ enableGradient={true}
156
+ />
157
+ </StorySection>
158
+
159
+ <StorySection
160
+ title="Custom Styled with dataLabels"
161
+ description={
162
+ <>
163
+ Use <code>customBackground</code> and <code>customColors</code> for
164
+ full visual control. <code>dataLabels</code> renders annotation
165
+ labels above bars with custom text, offset, and style — useful for
166
+ showing two lines of info per bar (e.g. price + unit).{" "}
167
+ <code>hideAxes</code>, <code>hideGrid</code>, and{" "}
168
+ <code>roundedBars</code> clean up the presentation.
169
+ </>
170
+ }
171
+ >
172
+ <div className="overflow-x-auto w-full">
173
+ <div className="min-w-[600px]">
174
+ <BarChart
175
+ title=""
176
+ containerStyle="bg-gradient-to-b from-[#4a3aff] to-[#6959ff] rounded-2xl p-6 shadow-lg"
177
+ categories={["May", "Jun", "Jul", "Aug", "Sep", "Oct"]}
178
+ seriesData={[
179
+ { x: "May", y: 60 },
180
+ { x: "Jun", y: 65 },
181
+ { x: "Jul", y: 70 },
182
+ { x: "Aug", y: 55 },
183
+ { x: "Sep", y: 58 },
184
+ { x: "Oct", y: 72.85 },
185
+ ]}
186
+ dataLabels={[
187
+ {
188
+ x: "May",
189
+ y: 60,
190
+ name: "RM 60.00",
191
+ offsetY: -25,
192
+ style: {
193
+ color: "#fff",
194
+ fontSize: "12px",
195
+ fontWeight: "bold",
196
+ },
197
+ },
198
+ {
199
+ x: "May",
200
+ y: 60,
201
+ name: "250 kWh",
202
+ offsetY: -10,
203
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
204
+ },
205
+ {
206
+ x: "Jun",
207
+ y: 65,
208
+ name: "RM 65.00",
209
+ offsetY: -25,
210
+ style: {
211
+ color: "#fff",
212
+ fontSize: "12px",
213
+ fontWeight: "bold",
214
+ },
215
+ },
216
+ {
217
+ x: "Jun",
218
+ y: 65,
219
+ name: "260 kWh",
220
+ offsetY: -10,
221
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
222
+ },
223
+ {
224
+ x: "Jul",
225
+ y: 70,
226
+ name: "RM 70.00",
227
+ offsetY: -25,
228
+ style: {
229
+ color: "#fff",
230
+ fontSize: "12px",
231
+ fontWeight: "bold",
232
+ },
233
+ },
234
+ {
235
+ x: "Jul",
236
+ y: 70,
237
+ name: "280 kWh",
238
+ offsetY: -10,
239
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
240
+ },
241
+ {
242
+ x: "Aug",
243
+ y: 55,
244
+ name: "RM 55.00",
245
+ offsetY: -25,
246
+ style: {
247
+ color: "#fff",
248
+ fontSize: "12px",
249
+ fontWeight: "bold",
250
+ },
251
+ },
252
+ {
253
+ x: "Aug",
254
+ y: 55,
255
+ name: "230 kWh",
256
+ offsetY: -10,
257
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
258
+ },
259
+ {
260
+ x: "Sep",
261
+ y: 58,
262
+ name: "RM 58.00",
263
+ offsetY: -25,
264
+ style: {
265
+ color: "#fff",
266
+ fontSize: "12px",
267
+ fontWeight: "bold",
268
+ },
269
+ },
270
+ {
271
+ x: "Sep",
272
+ y: 58,
273
+ name: "240 kWh",
274
+ offsetY: -10,
275
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
276
+ },
277
+ {
278
+ x: "Oct",
279
+ y: 72.85,
280
+ name: "RM 72.85",
281
+ offsetY: -25,
282
+ style: {
283
+ color: "#fff",
284
+ fontSize: "12px",
285
+ fontWeight: "bold",
286
+ },
287
+ },
288
+ {
289
+ x: "Oct",
290
+ y: 72.85,
291
+ name: "302 kWh",
292
+ offsetY: -10,
293
+ style: { color: "rgba(255,255,255,0.7)", fontSize: "10px" },
294
+ },
295
+ ]}
296
+ customBackground="linear-gradient(180deg, #4A3AFF 0%, #6959FF 100%)"
297
+ customColors={[
298
+ "#FFFFFF",
299
+ "#F5F3FF",
300
+ "#E0E7FF",
301
+ "#C7D2FE",
302
+ "#A5B4FC",
303
+ "#818CF8",
304
+ ]}
305
+ hideAxes={true}
306
+ hideGrid={true}
307
+ roundedBars={true}
308
+ showDataLabel={false}
309
+ disableZoom={true}
310
+ disableTooltip={true}
311
+ customAnimation={{ enabled: true, easing: "easeout", speed: 800 }}
312
+ />
313
+ </div>
314
+ </div>
315
+ </StorySection>
316
+ </div>
317
+ );
318
+ });
@@ -0,0 +1,124 @@
1
+ # Box Plot Chart
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A box plot chart component for displaying statistical data distribution. e.g: Performance metrics across different quarters
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { BoxPlotChart } from "blixify-ui-web/lib";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ const [seriesData, setSeriesData] = useState<any[]>([]);
19
+
20
+ const chartDummyData = useMemo(() => {
21
+ return [
22
+ {
23
+ label: "Q1",
24
+ data: [760, 801, 848, 895, 965],
25
+ },
26
+ {
27
+ label: "Q2",
28
+ data: [733, 853, 939, 980, 1080],
29
+ },
30
+ {
31
+ label: "Q3",
32
+ data: [714, 762, 817, 870, 918],
33
+ },
34
+ {
35
+ label: "Q4",
36
+ data: [733, 812, 848, 881, 950],
37
+ },
38
+ {
39
+ label: "Q5",
40
+ data: [800, 844, 897, 928, 1000],
41
+ },
42
+ ];
43
+ }, []);
44
+
45
+ const handleSetData = useCallback(
46
+ (customDate?: RangeInterface) => {
47
+ let dummySeriesData: any[] = [];
48
+ chartDummyData.map((eachData) => {
49
+ dummySeriesData.push({ x: eachData.label, y: eachData.data });
50
+ return null;
51
+ });
52
+ setSeriesData(dummySeriesData);
53
+ },
54
+ [chartDummyData]
55
+ );
56
+
57
+ useEffect(() => {
58
+ handleSetData();
59
+ }, [handleSetData]);
60
+
61
+ return (
62
+ <>
63
+ <div className="font-medium mb-5">Box Plot Chart</div>
64
+ <BoxPlotChart
65
+ title="Electric Generation Performance"
66
+ seriesName="Journey Performance"
67
+ seriesData={seriesData}
68
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
69
+ dateRangeVisible={true}
70
+ customDate={{
71
+ startDate: sevenDaysAgo,
72
+ endDate: moment().toDate(),
73
+ isDuration: true,
74
+ }}
75
+ onChangeDate={handleSetData}
76
+ showDataLabel={false}
77
+ newTabUrl="https://www.google.com/"
78
+ />
79
+ <div className="font-medium my-5">Dark Mode Box Plot Chart</div>
80
+ <BoxPlotChart
81
+ title="Performance Distribution"
82
+ seriesName="Data Distribution"
83
+ seriesData={seriesData}
84
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
85
+ dateRangeVisible={true}
86
+ customDate={{
87
+ startDate: sevenDaysAgo,
88
+ endDate: moment().toDate(),
89
+ isDuration: true,
90
+ }}
91
+ onChangeDate={handleSetData}
92
+ showDataLabel={false}
93
+ darkMode={true}
94
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
95
+ borderColor=""
96
+ />
97
+ </>
98
+ );
99
+ ```
100
+
101
+ ##### Required props
102
+
103
+ | Name | Type | Description |
104
+ | ------- | -------- | ------------------ |
105
+ | `title` | `string` | Title of the chart |
106
+
107
+ ##### Optional props
108
+
109
+ | Name | Type | Default | Description |
110
+ | --------------- | --------------- | --------------------- | -------------------------------------------- |
111
+ | `seriesData` | `BoxPlotData[]` | `[]` | Series data with x(Name) and y(Number array) |
112
+ | `seriesName` | `string` | "Journey Performance" | Value name in pointer card |
113
+ | `xaxisTitle` | `string` | undefined | Title for the X-axis |
114
+ | `yaxisTitle` | `string` | undefined | Title for the Y-axis |
115
+ | `showToolbar` | `boolean` | `false` | |
116
+ | `showDataLabel` | `boolean` | `false` | |
117
+ | `newTabUrl` | `string` | "" | set URL for create hyperlinks |
118
+
119
+ ##### Box Plot Data props
120
+
121
+ | Name | Type | Description |
122
+ | ---- | ---------- | ------------------------------ |
123
+ | `x` | `string` | Name of data category |
124
+ | `y` | `number[]` | Array of values for statistics |