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,208 @@
1
+ import { PencilIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React, { useEffect, useMemo, useState } from "react";
4
+ import { RangeBarChart } from ".";
5
+ import README from "./README.md";
6
+
7
+ const stories = storiesOf("Chart", module);
8
+
9
+ stories.addParameters({
10
+ readme: {
11
+ content: README,
12
+ },
13
+ });
14
+
15
+ interface RangeData {
16
+ category: string;
17
+ value: [Date, Date];
18
+ }
19
+
20
+ stories.add("Range Bar Chart", () => {
21
+ const [rangeData, setRangeData] = useState<RangeData[]>([]);
22
+
23
+ const chartDummyData = useMemo((): RangeData[] => {
24
+ const today = new Date();
25
+ today.setHours(0, 0, 0, 0);
26
+
27
+ const sleepStart = new Date(today);
28
+ sleepStart.setHours(23, 0, 0, 0);
29
+ const sleepEnd = new Date(today);
30
+ sleepEnd.setDate(today.getDate() + 1);
31
+ sleepEnd.setHours(7, 0, 0, 0);
32
+
33
+ const awake1Start = new Date(today);
34
+ awake1Start.setHours(7, 0, 0, 0);
35
+ const awake1End = new Date(today);
36
+ awake1End.setHours(12, 0, 0, 0);
37
+
38
+ const awake2Start = new Date(today);
39
+ awake2Start.setHours(17, 0, 0, 0);
40
+ const awake2End = new Date(today);
41
+ awake2End.setHours(23, 0, 0, 0);
42
+
43
+ return [
44
+ {
45
+ category: "Sleep",
46
+ value: [sleepStart, sleepEnd],
47
+ },
48
+ {
49
+ category: "Awake",
50
+ value: [awake1Start, awake1End],
51
+ },
52
+ {
53
+ category: "Awake",
54
+ value: [awake2Start, awake2End],
55
+ },
56
+ ];
57
+ }, []);
58
+
59
+ useEffect(() => {
60
+ setRangeData(chartDummyData);
61
+ }, [chartDummyData]);
62
+
63
+ const today = new Date();
64
+ today.setHours(0, 0, 0, 0);
65
+ const tomorrow = new Date(today);
66
+ tomorrow.setDate(today.getDate() + 1);
67
+
68
+ return (
69
+ <>
70
+ <div className="font-medium mb-5">Sleep/Awake Timeline</div>
71
+ <RangeBarChart
72
+ title="Daily Sleep Schedule"
73
+ seriesName="Status"
74
+ data={rangeData}
75
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
76
+ showDataLabel={false}
77
+ chartOnly={true}
78
+ />
79
+
80
+ <div className="font-medium my-5">Dark Mode Sleep/Awake Timeline</div>
81
+ <RangeBarChart
82
+ title="Daily Sleep Schedule"
83
+ seriesName="Status"
84
+ data={rangeData}
85
+ darkMode={true}
86
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
87
+ borderColor=""
88
+ enableGradient={true}
89
+ />
90
+
91
+ <div className="font-medium my-5">Multi-Color Range Bar Chart</div>
92
+ <RangeBarChart
93
+ title="Activity Schedule"
94
+ seriesName="Activities"
95
+ data={[
96
+ {
97
+ category: "Sleep",
98
+ value: [
99
+ new Date(
100
+ today.getFullYear(),
101
+ today.getMonth(),
102
+ today.getDate(),
103
+ 23,
104
+ 0,
105
+ 0
106
+ ),
107
+ new Date(
108
+ today.getFullYear(),
109
+ today.getMonth(),
110
+ today.getDate() + 1,
111
+ 7,
112
+ 0,
113
+ 0
114
+ ),
115
+ ],
116
+ },
117
+ {
118
+ category: "Work",
119
+ value: [
120
+ new Date(
121
+ today.getFullYear(),
122
+ today.getMonth(),
123
+ today.getDate(),
124
+ 9,
125
+ 0,
126
+ 0
127
+ ),
128
+ new Date(
129
+ today.getFullYear(),
130
+ today.getMonth(),
131
+ today.getDate(),
132
+ 17,
133
+ 0,
134
+ 0
135
+ ),
136
+ ],
137
+ },
138
+ {
139
+ category: "Exercise",
140
+ value: [
141
+ new Date(
142
+ today.getFullYear(),
143
+ today.getMonth(),
144
+ today.getDate(),
145
+ 7,
146
+ 0,
147
+ 0
148
+ ),
149
+ new Date(
150
+ today.getFullYear(),
151
+ today.getMonth(),
152
+ today.getDate(),
153
+ 9,
154
+ 0,
155
+ 0
156
+ ),
157
+ ],
158
+ },
159
+ {
160
+ category: "Meal",
161
+ value: [
162
+ new Date(
163
+ today.getFullYear(),
164
+ today.getMonth(),
165
+ today.getDate(),
166
+ 12,
167
+ 0,
168
+ 0
169
+ ),
170
+ new Date(
171
+ today.getFullYear(),
172
+ today.getMonth(),
173
+ today.getDate(),
174
+ 13,
175
+ 0,
176
+ 0
177
+ ),
178
+ ],
179
+ },
180
+ {
181
+ category: "Leisure",
182
+ value: [
183
+ new Date(
184
+ today.getFullYear(),
185
+ today.getMonth(),
186
+ today.getDate(),
187
+ 18,
188
+ 0,
189
+ 0
190
+ ),
191
+ new Date(
192
+ today.getFullYear(),
193
+ today.getMonth(),
194
+ today.getDate(),
195
+ 23,
196
+ 0,
197
+ 0
198
+ ),
199
+ ],
200
+ },
201
+ ]}
202
+ customColors={["#6366F1", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6"]}
203
+ chartSize={500}
204
+ showDataLabel={false}
205
+ />
206
+ </>
207
+ );
208
+ });
@@ -0,0 +1,97 @@
1
+ # Stats Card
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A responsive grid of stat cards for displaying analytics data. Each card shows a name, value, optional previous value, and an optional change badge with increase/decrease indicator.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { StatsCard } from "blixify-ui-web/chart/statsCard";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Default (4-column grid):
18
+
19
+ ```jsx
20
+ <StatsCard
21
+ stats={[
22
+ {
23
+ name: "Total Subscribers",
24
+ stats: "71,897",
25
+ previousStats: "70,946",
26
+ change: "12%",
27
+ changeType: "increase",
28
+ icon: <ArrowDownOnSquareStackIcon className="w-6 h-6 text-gray-600" />,
29
+ actionIcon: <CogIcon className="w-5 h-5 text-gray-600" />,
30
+ onActionIconClick: () => {},
31
+ },
32
+ ]}
33
+ />
34
+ ```
35
+
36
+ With date range picker:
37
+
38
+ ```jsx
39
+ <StatsCard
40
+ stats={seriesData}
41
+ dateRangeVisible={true}
42
+ onChangeDate={(range) => handleSetData(range)}
43
+ />
44
+ ```
45
+
46
+ Dark mode:
47
+
48
+ ```jsx
49
+ <StatsCard
50
+ stats={stats}
51
+ darkMode={true}
52
+ darkModeBg="bg-gradient-to-r from-gray-900 to-slate-700"
53
+ icon={<PencilIcon className="w-4 h-4 text-primary-600" />}
54
+ />
55
+ ```
56
+
57
+ ##### Required props
58
+
59
+ | Name | Type | Description |
60
+ | ------- | ------------- | ----------------------------- |
61
+ | `stats` | `StatsData[]` | Array of stat card data items |
62
+
63
+ ##### Optional props
64
+
65
+ | Name | Type | Default | Description |
66
+ | ------------------ | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------- |
67
+ | `gridSize` | `1 \| 2 \| 3` | — | Max columns in the grid. `1` = 1-col, `2` = 2-col, `3` = 2-col md / 3-col lg. When omitted, defaults to 2-col md / 4-col lg |
68
+ | `minGridSize` | `2` | — | Forces a 2-column minimum on small screens. Only `2` is supported |
69
+ | `icon` | `ReactElement` | — | Small icon rendered in the top-right corner of the card group |
70
+ | `darkMode` | `boolean` | `false` | Switches cards to a dark theme |
71
+ | `darkModeBg` | `string` | `"bg-gray-900"` | Tailwind classes for the dark mode card background |
72
+ | `dateRangeVisible` | `boolean` | `false` | Shows a date range picker below the cards |
73
+ | `customDate` | `RangeInterface` | — | Initial date range for the picker |
74
+ | `onChangeDate` | `(customDate?: RangeInterface) => void` | — | Called when the user applies a new date range |
75
+
76
+ ##### StatsData
77
+
78
+ | Name | Type | Required | Description |
79
+ | ------------------- | -------------- | -------- | --------------------------------------------------------------------------- |
80
+ | `name` | `string` | yes | Card label |
81
+ | `stats` | `string` | yes | Primary stat value displayed prominently |
82
+ | `icon` | `ReactElement` | yes | Icon shown next to the card name |
83
+ | `previousStats` | `string` | no | Previous value shown as "from {previousStats}" |
84
+ | `change` | `string` | no | Change amount shown in the badge (e.g. `"12%"`) |
85
+ | `changeType` | `string` | no | `"increase"` renders a green up-arrow badge; anything else renders red down |
86
+ | `actionIcon` | `ReactElement` | no | Icon rendered in the top-right of the individual card |
87
+ | `onActionIconClick` | `() => void` | no | Click handler for `actionIcon` |
88
+
89
+ ##### RangeInterface
90
+
91
+ | Name | Type | Description |
92
+ | ------------ | --------- | -------------------------------------------------------- |
93
+ | `startDate` | `Date` | Start of the range |
94
+ | `endDate` | `Date` | End of the range |
95
+ | `isDuration` | `boolean` | `true` = date range, `false` = "beginning until endDate" |
96
+ | `startTime` | `string` | Optional time string `"HH:mm:ss"` for same-day ranges |
97
+ | `endTime` | `string` | Optional time string `"HH:mm:ss"` for same-day ranges |
@@ -0,0 +1,183 @@
1
+ import {
2
+ ArrowDownOnSquareStackIcon,
3
+ CogIcon,
4
+ MapIcon,
5
+ PencilIcon,
6
+ UserGroupIcon,
7
+ } from "@heroicons/react/24/outline";
8
+ import { storiesOf } from "@storybook/react";
9
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
10
+ import { StatsCard } from ".";
11
+ import { StorySection } from "../../storyUtils";
12
+ import { RangeInterface } from "../DateRange";
13
+ import README from "./README.md";
14
+
15
+ const stories = storiesOf("Chart", module);
16
+
17
+ stories.addParameters({
18
+ readme: {
19
+ content: README,
20
+ },
21
+ });
22
+
23
+ const baseStats = [
24
+ {
25
+ name: "Total Subscribers",
26
+ stats: "71,897",
27
+ previousStats: "70,946",
28
+ change: "12%",
29
+ changeType: "increase",
30
+ icon: <ArrowDownOnSquareStackIcon className="w-6 h-6 text-gray-600" />,
31
+ actionIcon: <CogIcon className="w-5 h-5 text-gray-600" />,
32
+ onActionIconClick: () => {},
33
+ },
34
+ {
35
+ name: "Avg. Open Rate",
36
+ stats: "58.16%",
37
+ icon: <MapIcon className="w-6 h-6 text-gray-600" />,
38
+ actionIcon: <CogIcon className="w-5 h-5 text-gray-600" />,
39
+ onActionIconClick: () => {},
40
+ },
41
+ {
42
+ name: "Avg. Click Rate",
43
+ stats: "24.57%",
44
+ previousStats: "28.62%",
45
+ change: "4.05%",
46
+ changeType: "decrease",
47
+ icon: <UserGroupIcon className="w-6 h-6 text-gray-600" />,
48
+ actionIcon: <CogIcon className="w-5 h-5 text-gray-600" />,
49
+ onActionIconClick: () => {},
50
+ },
51
+ ];
52
+
53
+ stories.add("Stats Card", () => {
54
+ const chartDummyData = useMemo(() => {
55
+ const now = new Date();
56
+ const sevenDaysAgo = new Date();
57
+ const oneDaysAgo = new Date();
58
+ const twentyEightDaysAgo = new Date();
59
+ sevenDaysAgo.setDate(now.getDate() - 7);
60
+ oneDaysAgo.setDate(now.getDate() - 1);
61
+ twentyEightDaysAgo.setDate(now.getDate() - 28);
62
+ return [
63
+ { ...baseStats[0], createdAt: sevenDaysAgo },
64
+ { ...baseStats[1], createdAt: sevenDaysAgo },
65
+ { ...baseStats[2], createdAt: oneDaysAgo },
66
+ {
67
+ name: "Active Users",
68
+ stats: "3,240",
69
+ previousStats: "3,100",
70
+ change: "4.5%",
71
+ changeType: "increase",
72
+ icon: <UserGroupIcon className="w-6 h-6 text-gray-600" />,
73
+ createdAt: twentyEightDaysAgo,
74
+ },
75
+ ];
76
+ }, []);
77
+
78
+ const [seriesData, setSeriesData] = useState<any[]>([]);
79
+
80
+ const handleSetData = useCallback(
81
+ (customDate?: RangeInterface) => {
82
+ const result: any[] = [];
83
+ chartDummyData.forEach((d) => {
84
+ if (customDate?.isDuration) {
85
+ if (
86
+ d.createdAt >= customDate.startDate &&
87
+ d.createdAt <= customDate.endDate
88
+ ) {
89
+ result.push(d);
90
+ }
91
+ } else {
92
+ result.push(d);
93
+ }
94
+ });
95
+ setSeriesData(result);
96
+ },
97
+ [chartDummyData]
98
+ );
99
+
100
+ useEffect(() => {
101
+ handleSetData();
102
+ }, [handleSetData]);
103
+
104
+ return (
105
+ <>
106
+ <StorySection
107
+ title="Default (4-column grid)"
108
+ description="When gridSize is omitted the component defaults to a 4-column grid on large screens. Each card shows a name, stat value, optional previous stat, and an optional change badge."
109
+ >
110
+ <div className="w-full">
111
+ <StatsCard
112
+ stats={seriesData}
113
+ dateRangeVisible={true}
114
+ onChangeDate={handleSetData}
115
+ />
116
+ </div>
117
+ </StorySection>
118
+
119
+ <StorySection
120
+ title="gridSize=3"
121
+ description="gridSize=3 renders a 3-column grid on large screens (2-column on medium)."
122
+ >
123
+ <div className="w-full">
124
+ <StatsCard stats={baseStats} gridSize={3} />
125
+ </div>
126
+ </StorySection>
127
+
128
+ <StorySection
129
+ title="gridSize=2"
130
+ description="gridSize=2 renders a 2-column grid."
131
+ >
132
+ <div className="w-full">
133
+ <StatsCard stats={baseStats.slice(0, 2)} gridSize={2} />
134
+ </div>
135
+ </StorySection>
136
+
137
+ <StorySection
138
+ title="gridSize=1"
139
+ description="gridSize=1 renders a single-column layout."
140
+ >
141
+ <div className="w-full">
142
+ <StatsCard stats={baseStats.slice(0, 1)} gridSize={1} />
143
+ </div>
144
+ </StorySection>
145
+
146
+ <StorySection
147
+ title="minGridSize=2"
148
+ description="minGridSize=2 forces a 2-column minimum on small screens (default is 1-column on mobile)."
149
+ >
150
+ <div className="w-full">
151
+ <StatsCard stats={baseStats} minGridSize={2} />
152
+ </div>
153
+ </StorySection>
154
+
155
+ <StorySection
156
+ title="Header Icon"
157
+ description="Pass icon to render a small icon in the top-right corner of the card group."
158
+ >
159
+ <div className="w-full">
160
+ <StatsCard
161
+ stats={baseStats}
162
+ icon={<PencilIcon className="w-4 h-4 text-primary-600" />}
163
+ />
164
+ </div>
165
+ </StorySection>
166
+
167
+ <StorySection
168
+ title="Dark Mode"
169
+ description="Pass darkMode=true and optionally darkModeBg to customise the background."
170
+ dark
171
+ >
172
+ <div className="w-full">
173
+ <StatsCard
174
+ stats={baseStats}
175
+ darkMode={true}
176
+ darkModeBg="bg-gradient-to-r from-gray-900 to-slate-700"
177
+ icon={<PencilIcon className="w-4 h-4 text-primary-600" />}
178
+ />
179
+ </div>
180
+ </StorySection>
181
+ </>
182
+ );
183
+ });
@@ -0,0 +1,142 @@
1
+ # Treemap Chart
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A treemap chart component for displaying hierarchical data in nested rectangles. e.g: Page views distribution across different categories
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { TreemapChart } 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: "Analytics",
24
+ value: 20,
25
+ },
26
+ {
27
+ label: "Ecommerce",
28
+ value: 15,
29
+ },
30
+ {
31
+ label: "Desktop",
32
+ value: 13,
33
+ },
34
+ {
35
+ label: "Mobile",
36
+ value: 12,
37
+ },
38
+ {
39
+ label: "Social",
40
+ value: 10,
41
+ },
42
+ {
43
+ label: "Other",
44
+ value: 8,
45
+ },
46
+ {
47
+ label: "Marketing",
48
+ value: 7,
49
+ },
50
+ {
51
+ label: "Development",
52
+ value: 6,
53
+ },
54
+ {
55
+ label: "Design",
56
+ value: 5,
57
+ },
58
+ {
59
+ label: "Support",
60
+ value: 4,
61
+ },
62
+ ];
63
+ }, []);
64
+
65
+ const handleSetData = useCallback(
66
+ (customDate?: RangeInterface) => {
67
+ let dummySeriesData: any[] = [];
68
+ chartDummyData.map((eachData) => {
69
+ dummySeriesData.push({ x: eachData.label, y: eachData.value });
70
+ return null;
71
+ });
72
+ setSeriesData(dummySeriesData);
73
+ },
74
+ [chartDummyData]
75
+ );
76
+
77
+ useEffect(() => {
78
+ handleSetData();
79
+ }, [handleSetData]);
80
+
81
+ return (
82
+ <>
83
+ <div className="font-medium mb-5">Treemap Chart</div>
84
+ <TreemapChart
85
+ title="Page Views Distribution"
86
+ seriesName="Pages"
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
+ newTabUrl="https://www.google.com/"
98
+ />
99
+ <div className="font-medium my-5">Dark Mode Treemap Chart</div>
100
+ <TreemapChart
101
+ title="Data Categories"
102
+ seriesName="Categories"
103
+ seriesData={seriesData}
104
+ tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
105
+ dateRangeVisible={true}
106
+ customDate={{
107
+ startDate: sevenDaysAgo,
108
+ endDate: moment().toDate(),
109
+ isDuration: true,
110
+ }}
111
+ onChangeDate={handleSetData}
112
+ showDataLabel={true}
113
+ darkMode={true}
114
+ darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
115
+ borderColor=""
116
+ />
117
+ </>
118
+ );
119
+ ```
120
+
121
+ ##### Required props
122
+
123
+ | Name | Type | Description |
124
+ | ------- | -------- | ------------------ |
125
+ | `title` | `string` | Title of the chart |
126
+
127
+ ##### Optional props
128
+
129
+ | Name | Type | Default | Description |
130
+ | --------------- | --------------- | ------- | -------------------------------------------- |
131
+ | `seriesData` | `TreemapData[]` | `[]` | Series data with x(Name) and y(Number) value |
132
+ | `seriesName` | `string` | "Pages" | Value name in pointer card |
133
+ | `showToolbar` | `boolean` | `false` | |
134
+ | `showDataLabel` | `boolean` | `true` | |
135
+ | `newTabUrl` | `string` | "" | set URL for create hyperlinks |
136
+
137
+ ##### Treemap Data props
138
+
139
+ | Name | Type | Description |
140
+ | ---- | -------- | ------------- |
141
+ | `x` | `string` | Name of data |
142
+ | `y` | `number` | Value of data |