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,152 @@
1
+ import { PencilIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React, { useCallback, useEffect, useState } from "react";
4
+ import { LineChart } from ".";
5
+ import { RangeInterface } from "../DateRange";
6
+ import README from "./README.md";
7
+ import { StorySection } from "../../storyUtils";
8
+
9
+ const stories = storiesOf("Chart", module);
10
+
11
+ stories.addParameters({
12
+ readme: {
13
+ content: README,
14
+ },
15
+ });
16
+
17
+ const multiLineSeries = [
18
+ { name: "High - 2013", data: [-50, 29.1, 33.453, 60.09, 32, 32, 90] },
19
+ { name: "Low - 2013", data: [12, 60, 14, 18, 17, 70, 13] },
20
+ ];
21
+
22
+ stories.add("Line Chart", () => {
23
+ const [seriesData, setSeriesData] = useState([12, 60, 14, 18, 17]);
24
+ const [categoryData, setCategoryData] = useState<string[]>([
25
+ "JAN",
26
+ "FEB",
27
+ "MAR",
28
+ "APR",
29
+ "MAY",
30
+ ]);
31
+
32
+ const handleSetData = useCallback((customDate?: RangeInterface) => {
33
+ if (customDate?.isDuration) {
34
+ const dateArray: string[] = [];
35
+ const dummyData: number[] = [];
36
+ const current = new Date(customDate.startDate);
37
+ let i = 0;
38
+ while (current <= customDate.endDate) {
39
+ dateArray.push(new Date(current).toDateString());
40
+ dummyData.push(i++);
41
+ current.setDate(current.getDate() + 1);
42
+ }
43
+ setCategoryData(dateArray);
44
+ setSeriesData(dummyData);
45
+ }
46
+ }, []);
47
+
48
+ useEffect(() => {
49
+ handleSetData();
50
+ }, [handleSetData]);
51
+
52
+ return (
53
+ <div className="font-sans max-w-3xl p-6">
54
+ <StorySection
55
+ title="Single Line"
56
+ description={
57
+ <>
58
+ Basic line chart using <code>seriesData</code> (number array) and{" "}
59
+ <code>categories</code> (string array). <code>xaxisTitle</code> and{" "}
60
+ <code>yaxisTitle</code> label the axes. Use{" "}
61
+ <code>showDataLabels</code> to show values on each point, and{" "}
62
+ <code>dataLabels</code> to add custom annotation labels at specific
63
+ coordinates.
64
+ </>
65
+ }
66
+ >
67
+ <LineChart
68
+ title="Sales of the Year"
69
+ categories={categoryData}
70
+ seriesData={seriesData}
71
+ seriesName="Value"
72
+ xaxisTitle="Date"
73
+ yaxisTitle="Value"
74
+ showDataLabels={true}
75
+ disableZoom
76
+ yMin={0}
77
+ hideGrid
78
+ hideOriginBorder
79
+ hideShadow
80
+ dataLabels={[
81
+ {
82
+ x: "APR",
83
+ y: 18,
84
+ name: "BEST",
85
+ offsetY: -10,
86
+ style: { color: "#fff", fontSize: "13px", background: "#00E396" },
87
+ },
88
+ ]}
89
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
90
+ dateRangeVisible={true}
91
+ onChangeDate={handleSetData}
92
+ />
93
+ </StorySection>
94
+
95
+ <StorySection
96
+ title="Multi-Line"
97
+ description={
98
+ <>
99
+ Use <code>multiLineSeries</code> (array of{" "}
100
+ <code>&#123; name, data: number[] &#125;</code>) for multiple lines.
101
+ Set <code>chartController=&#123;true&#125;</code> with a matching{" "}
102
+ <code>chartId</code> to render a brush/zoom controller below the
103
+ main chart. Requires <code>enableGradient</code> and{" "}
104
+ <code>darkMode</code> shown here too.
105
+ </>
106
+ }
107
+ >
108
+ <LineChart
109
+ title="Temperature of the Year"
110
+ categories={["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug"]}
111
+ multiLineSeries={multiLineSeries}
112
+ xaxisTitle="Months"
113
+ yaxisTitle="Temperature"
114
+ enableGradient={true}
115
+ showToolbar={true}
116
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
117
+ dateRangeVisible={true}
118
+ chartId="chartMultiline"
119
+ chartController={true}
120
+ darkMode={true}
121
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
122
+ borderColor=""
123
+ onChangeDate={handleSetData}
124
+ decimalPlaces={2}
125
+ />
126
+ </StorySection>
127
+
128
+ <StorySection
129
+ title="Line Only (no area fill)"
130
+ description={
131
+ <>
132
+ Set <code>disableAreaChart=&#123;true&#125;</code> to render a pure
133
+ line without the area fill underneath. Combine with{" "}
134
+ <code>hideShadow</code> for a clean look.
135
+ </>
136
+ }
137
+ >
138
+ <LineChart
139
+ title="Revenue Trend"
140
+ categories={["Jan", "Feb", "Mar", "Apr", "May", "Jun"]}
141
+ seriesData={[30, 45, 38, 60, 55, 72]}
142
+ seriesName="Revenue"
143
+ xaxisTitle="Month"
144
+ yaxisTitle="Revenue"
145
+ disableAreaChart={true}
146
+ hideShadow={true}
147
+ yMin={0}
148
+ />
149
+ </StorySection>
150
+ </div>
151
+ );
152
+ });
@@ -0,0 +1,117 @@
1
+ # Pie Chart
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A pie/donut chart for displaying proportional data. Supports percentage or raw value display, configurable legend position, dark mode, and an optional date range picker.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { PieChart } from "blixify-ui-web/chart/pieChart";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Default donut chart:
18
+
19
+ ```jsx
20
+ const [series, setSeries] = useState<number[]>([]);
21
+ const [labels, setLabels] = useState<string[]>([]);
22
+
23
+ <PieChart
24
+ title="Sales"
25
+ series={series}
26
+ labels={labels}
27
+ roundValue={true}
28
+ dateRangeVisible={true}
29
+ onChangeDate={(range) => handleSetData(range)}
30
+ />
31
+ ```
32
+
33
+ Pie type with raw value display:
34
+
35
+ ```jsx
36
+ <PieChart
37
+ title="Sales by Value"
38
+ series={[10, 20, 5, 15, 55]}
39
+ labels={["Apple", "Mango", "Orange", "Watermelon", "Banana"]}
40
+ type="pie"
41
+ valueType="value"
42
+ roundValue={true}
43
+ />
44
+ ```
45
+
46
+ Dark mode:
47
+
48
+ ```jsx
49
+ <PieChart
50
+ title="Sales"
51
+ series={series}
52
+ labels={labels}
53
+ darkMode={true}
54
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
55
+ roundValue={true}
56
+ />
57
+ ```
58
+
59
+ Chart only (no header or date range):
60
+
61
+ ```jsx
62
+ <PieChart
63
+ title="Sales"
64
+ series={series}
65
+ labels={labels}
66
+ chartOnly={true}
67
+ chartSize={220}
68
+ />
69
+ ```
70
+
71
+ ##### Required props
72
+
73
+ | Name | Type | Description |
74
+ | -------- | ---------- | -------------------------------------------- |
75
+ | `title` | `string` | Title shown in the chart header |
76
+ | `series` | `number[]` | Numeric value for each slice |
77
+ | `labels` | `string[]` | Label for each slice (aligned with `series`) |
78
+
79
+ ##### Optional props
80
+
81
+ | Name | Type | Default | Description |
82
+ | ------------- | ---------------------------------------- | ----------- | ------------------------------------------------------------- |
83
+ | `type` | `"pie" \| "donut"` | `"donut"` | Chart type |
84
+ | `valueType` | `"percent" \| "value"` | `"percent"` | Whether labels and data labels show percentages or raw values |
85
+ | `roundValue` | `boolean` | `false` | Round displayed values to whole numbers |
86
+ | `legendPos` | `"top" \| "bottom" \| "right" \| "left"` | `"top"` | Position of the legend |
87
+ | `legendAlign` | `"right" \| "left" \| "center"` | `"right"` | Horizontal alignment of the legend |
88
+ | `newTabUrl` | `string` | `""` | Makes the chart title a link that opens in a new tab |
89
+
90
+ > Note: Legend labels are truncated to 10 characters. The full label is shown in the tooltip on hover.
91
+
92
+ ##### ChartUtils props (shared across all chart components)
93
+
94
+ | Name | Type | Default | Description |
95
+ | ------------------ | --------------------------------------- | --------------- | ------------------------------------------------------------------------------------ |
96
+ | `tool` | `ReactElement` | — | Icon or element rendered in the top-right of the chart header |
97
+ | `dateRangeVisible` | `boolean` | `false` | Shows a date range picker below the chart |
98
+ | `customDate` | `RangeInterface` | — | Initial date range for the picker |
99
+ | `onChangeDate` | `(customDate?: RangeInterface) => void` | — | Called when the user applies a new date range |
100
+ | `colors` | `string[]` | — | Custom hex colour array for slices. Falls back to `localChartColors` in localStorage |
101
+ | `darkMode` | `boolean` | `false` | Switches the chart to a dark theme |
102
+ | `darkModeBg` | `string` | `"bg-gray-900"` | Tailwind classes for the dark mode background |
103
+ | `enableGradient` | `boolean` | `false` | Fill slices with a gradient instead of solid colour |
104
+ | `chartOnly` | `boolean` | `false` | Renders only the chart canvas — no title, tool, or date range bar |
105
+ | `chartSize` | `number` | `280` | Chart height in pixels |
106
+ | `containerStyle` | `string` | — | Tailwind classes applied to the outer container |
107
+ | `minInterval` | `number` | `60` | Time picker interval in minutes (used in the date range modal) |
108
+
109
+ ##### RangeInterface
110
+
111
+ | Name | Type | Description |
112
+ | ------------ | --------- | -------------------------------------------------------- |
113
+ | `startDate` | `Date` | Start of the range |
114
+ | `endDate` | `Date` | End of the range |
115
+ | `isDuration` | `boolean` | `true` = date range, `false` = "beginning until endDate" |
116
+ | `startTime` | `string` | Optional time string `"HH:mm:ss"` for same-day ranges |
117
+ | `endTime` | `string` | Optional time string `"HH:mm:ss"` for same-day ranges |
@@ -0,0 +1,180 @@
1
+ import { PencilIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
4
+ import { PieChart } from ".";
5
+ import { StorySection } from "../../storyUtils";
6
+ import { RangeInterface } from "../DateRange";
7
+ import README from "./README.md";
8
+
9
+ const stories = storiesOf("Chart", module);
10
+
11
+ stories.addParameters({
12
+ readme: {
13
+ content: README,
14
+ },
15
+ });
16
+
17
+ const dummyData = [
18
+ { label: "Apple", value: 10 },
19
+ { label: "Mango", value: 20 },
20
+ { label: "Orange", value: 5 },
21
+ { label: "Watermelon", value: 15 },
22
+ { label: "Bananananananananananananan", value: 55 },
23
+ ];
24
+
25
+ const series = dummyData.map((d) => d.value);
26
+ const labels = dummyData.map((d) => d.label);
27
+
28
+ stories.add("Pie Chart", () => {
29
+ const [seriesData, setSeriesData] = useState<number[]>([]);
30
+ const [labelData, setLabelData] = useState<string[]>([]);
31
+
32
+ const chartDummyData = useMemo(() => {
33
+ const now = new Date();
34
+ const sevenDaysAgo = new Date();
35
+ const oneDaysAgo = new Date();
36
+ const twentyEightDaysAgo = new Date();
37
+ sevenDaysAgo.setDate(now.getDate() - 7);
38
+ oneDaysAgo.setDate(now.getDate() - 1);
39
+ twentyEightDaysAgo.setDate(now.getDate() - 28);
40
+ return [
41
+ { label: "Apple", value: 10, createdAt: sevenDaysAgo },
42
+ { label: "Mango", value: 20, createdAt: sevenDaysAgo },
43
+ { label: "Orange", value: 5, createdAt: oneDaysAgo },
44
+ { label: "Watermelon", value: 15, createdAt: oneDaysAgo },
45
+ {
46
+ label: "Bananananananananananananan",
47
+ value: 55,
48
+ createdAt: twentyEightDaysAgo,
49
+ },
50
+ ];
51
+ }, []);
52
+
53
+ const handleSetData = useCallback(
54
+ (customDate?: RangeInterface) => {
55
+ const s: number[] = [];
56
+ const l: string[] = [];
57
+ chartDummyData.forEach((d) => {
58
+ if (customDate?.isDuration) {
59
+ if (
60
+ d.createdAt >= customDate.startDate &&
61
+ d.createdAt <= customDate.endDate
62
+ ) {
63
+ s.push(d.value);
64
+ l.push(d.label);
65
+ }
66
+ } else {
67
+ s.push(d.value);
68
+ l.push(d.label);
69
+ }
70
+ });
71
+ setSeriesData(s);
72
+ setLabelData(l);
73
+ },
74
+ [chartDummyData]
75
+ );
76
+
77
+ useEffect(() => {
78
+ handleSetData();
79
+ }, [handleSetData]);
80
+
81
+ return (
82
+ <>
83
+ <StorySection
84
+ title="Default (Donut)"
85
+ description="Default chart type is donut. Legend shows truncated labels (max 10 chars); tooltip shows the full label."
86
+ >
87
+ <div className="w-full">
88
+ <PieChart
89
+ title="Sales"
90
+ series={seriesData}
91
+ labels={labelData}
92
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
93
+ dateRangeVisible={true}
94
+ onChangeDate={handleSetData}
95
+ roundValue={true}
96
+ />
97
+ </div>
98
+ </StorySection>
99
+
100
+ <StorySection
101
+ title="Pie Type"
102
+ description='Pass type="pie" to render a filled pie chart instead of a donut.'
103
+ >
104
+ <div className="w-full">
105
+ <PieChart
106
+ title="Sales (Pie)"
107
+ series={series}
108
+ labels={labels}
109
+ type="pie"
110
+ roundValue={true}
111
+ />
112
+ </div>
113
+ </StorySection>
114
+
115
+ <StorySection
116
+ title="Value Display (valueType=value)"
117
+ description='By default labels show percentages. Pass valueType="value" to show raw numbers instead.'
118
+ >
119
+ <div className="w-full">
120
+ <PieChart
121
+ title="Sales by Value"
122
+ series={series}
123
+ labels={labels}
124
+ valueType="value"
125
+ roundValue={true}
126
+ />
127
+ </div>
128
+ </StorySection>
129
+
130
+ <StorySection
131
+ title="Legend Positions"
132
+ description='legendPos controls where the legend is rendered. legendAlign controls horizontal alignment. Defaults: legendPos="top", legendAlign="right".'
133
+ >
134
+ <div className="w-full">
135
+ <PieChart
136
+ title="Legend Bottom Center"
137
+ series={series}
138
+ labels={labels}
139
+ legendPos="bottom"
140
+ legendAlign="center"
141
+ roundValue={true}
142
+ />
143
+ </div>
144
+ </StorySection>
145
+
146
+ <StorySection
147
+ title="Dark Mode"
148
+ description="Pass darkMode=true and optionally darkModeBg to customise the background."
149
+ dark
150
+ >
151
+ <div className="w-full">
152
+ <PieChart
153
+ title="Sales"
154
+ series={series}
155
+ labels={labels}
156
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
157
+ darkMode={true}
158
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
159
+ roundValue={true}
160
+ />
161
+ </div>
162
+ </StorySection>
163
+
164
+ <StorySection
165
+ title="Chart Only"
166
+ description="chartOnly=true removes the title, tool, and date range bar — renders just the chart canvas."
167
+ >
168
+ <div className="w-full">
169
+ <PieChart
170
+ title="Sales"
171
+ series={series}
172
+ labels={labels}
173
+ chartOnly={true}
174
+ chartSize={220}
175
+ />
176
+ </div>
177
+ </StorySection>
178
+ </>
179
+ );
180
+ });
@@ -0,0 +1,126 @@
1
+ # Polar Area Chart
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A polar area chart component for displaying data in a circular format. e.g: Performance metrics distribution
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { PolarAreaChart } 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: "Series A",
24
+ value: 14,
25
+ },
26
+ {
27
+ label: "Series B",
28
+ value: 23,
29
+ },
30
+ {
31
+ label: "Series C",
32
+ value: 21,
33
+ },
34
+ {
35
+ label: "Series D",
36
+ value: 17,
37
+ },
38
+ {
39
+ label: "Series E",
40
+ value: 15,
41
+ },
42
+ {
43
+ label: "Series F",
44
+ value: 10,
45
+ },
46
+ ];
47
+ }, []);
48
+
49
+ const handleSetData = useCallback(
50
+ (customDate?: RangeInterface) => {
51
+ let dummySeriesData: any[] = [];
52
+ chartDummyData.map((eachData) => {
53
+ dummySeriesData.push({ x: eachData.label, y: eachData.value });
54
+ return null;
55
+ });
56
+ setSeriesData(dummySeriesData);
57
+ },
58
+ [chartDummyData]
59
+ );
60
+
61
+ useEffect(() => {
62
+ handleSetData();
63
+ }, [handleSetData]);
64
+
65
+ return (
66
+ <>
67
+ <div className="font-medium mb-5">Polar Area Chart</div>
68
+ <PolarAreaChart
69
+ title="Data Distribution"
70
+ seriesName="Values"
71
+ seriesData={seriesData}
72
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
73
+ dateRangeVisible={true}
74
+ customDate={{
75
+ startDate: sevenDaysAgo,
76
+ endDate: moment().toDate(),
77
+ isDuration: true,
78
+ }}
79
+ onChangeDate={handleSetData}
80
+ showDataLabel={true}
81
+ newTabUrl="https://www.google.com/"
82
+ />
83
+ <div className="font-medium my-5">Dark Mode Polar Area Chart</div>
84
+ <PolarAreaChart
85
+ title="Performance Metrics"
86
+ seriesName="Metrics"
87
+ seriesData={seriesData}
88
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
89
+ dateRangeVisible={true}
90
+ customDate={{
91
+ startDate: sevenDaysAgo,
92
+ endDate: moment().toDate(),
93
+ isDuration: true,
94
+ }}
95
+ onChangeDate={handleSetData}
96
+ showDataLabel={true}
97
+ darkMode={true}
98
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
99
+ borderColor=""
100
+ />
101
+ </>
102
+ );
103
+ ```
104
+
105
+ ##### Required props
106
+
107
+ | Name | Type | Description |
108
+ | ------- | -------- | ------------------ |
109
+ | `title` | `string` | Title of the chart |
110
+
111
+ ##### Optional props
112
+
113
+ | Name | Type | Default | Description |
114
+ | --------------- | ----------------- | ------- | -------------------------------------------- |
115
+ | `seriesData` | `PolarAreaData[]` | `[]` | Series data with x(Name) and y(Number) value |
116
+ | `seriesName` | `string` | "" | Value name in pointer card |
117
+ | `showToolbar` | `boolean` | `false` | |
118
+ | `showDataLabel` | `boolean` | `true` | |
119
+ | `newTabUrl` | `string` | "" | set URL for create hyperlinks |
120
+
121
+ ##### Polar Area Data props
122
+
123
+ | Name | Type | Description |
124
+ | ---- | -------- | ------------- |
125
+ | `x` | `string` | Name of data |
126
+ | `y` | `number` | Value of data |
@@ -0,0 +1,106 @@
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 { PolarAreaChart } from ".";
6
+ import { RangeInterface } from "../DateRange";
7
+ import README from "./README.md";
8
+
9
+ const stories = storiesOf("Chart", module);
10
+
11
+ stories.addParameters({
12
+ readme: {
13
+ content: README,
14
+ },
15
+ });
16
+
17
+ stories.add("Polar Area Chart", () => {
18
+ const [seriesData, setSeriesData] = useState<any[]>([]);
19
+
20
+ const chartDummyData = useMemo(() => {
21
+ return [
22
+ {
23
+ label: "Series A",
24
+ value: 14,
25
+ },
26
+ {
27
+ label: "Series B",
28
+ value: 23,
29
+ },
30
+ {
31
+ label: "Series C",
32
+ value: 21,
33
+ },
34
+ {
35
+ label: "Series D",
36
+ value: 17,
37
+ },
38
+ {
39
+ label: "Series E",
40
+ value: 15,
41
+ },
42
+ {
43
+ label: "Series F",
44
+ value: 10,
45
+ },
46
+ ];
47
+ }, []);
48
+
49
+ const handleSetData = useCallback(
50
+ (customDate?: RangeInterface) => {
51
+ let dummySeriesData: any[] = [];
52
+ chartDummyData.map((eachData) => {
53
+ dummySeriesData.push({ x: eachData.label, y: eachData.value });
54
+ return null;
55
+ });
56
+ setSeriesData(dummySeriesData);
57
+ },
58
+ [chartDummyData]
59
+ );
60
+
61
+ useEffect(() => {
62
+ handleSetData();
63
+ }, [handleSetData]);
64
+
65
+ const sevenDaysAgo = new Date();
66
+ sevenDaysAgo.setDate(moment().toDate().getDate() - 7);
67
+
68
+ return (
69
+ <>
70
+ <div className="font-medium mb-5">Polar Area Chart</div>
71
+ <PolarAreaChart
72
+ title="Data Distribution"
73
+ seriesName="Values"
74
+ seriesData={seriesData}
75
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
76
+ dateRangeVisible={true}
77
+ customDate={{
78
+ startDate: sevenDaysAgo,
79
+ endDate: moment().toDate(),
80
+ isDuration: true,
81
+ }}
82
+ onChangeDate={handleSetData}
83
+ showDataLabel={true}
84
+ newTabUrl="https://www.google.com/"
85
+ />
86
+ <div className="font-medium my-5">Dark Mode Polar Area Chart</div>
87
+ <PolarAreaChart
88
+ title="Performance Metrics"
89
+ seriesName="Metrics"
90
+ seriesData={seriesData}
91
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
92
+ dateRangeVisible={true}
93
+ customDate={{
94
+ startDate: sevenDaysAgo,
95
+ endDate: moment().toDate(),
96
+ isDuration: true,
97
+ }}
98
+ onChangeDate={handleSetData}
99
+ showDataLabel={true}
100
+ darkMode={true}
101
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
102
+ borderColor=""
103
+ />
104
+ </>
105
+ );
106
+ });