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.
- package/README.md +5 -0
- package/lib/components/action/button/README.md +75 -0
- package/lib/components/action/button/button.stories.tsx +138 -0
- package/lib/components/action/buttonGroup/README.md +79 -0
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
- package/lib/components/action/iconButton/README.md +39 -0
- package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
- package/lib/components/action/radioList/README.md +98 -0
- package/lib/components/action/radioList/radioList.stories.tsx +181 -0
- package/lib/components/action/slider/README.md +86 -0
- package/lib/components/action/slider/slider.stories.tsx +133 -0
- package/lib/components/action/textButton/README.md +34 -0
- package/lib/components/action/textButton/textButton.stories.tsx +16 -0
- package/lib/components/action/toggle/README.md +39 -0
- package/lib/components/action/toggle/toggle.stories.tsx +23 -0
- package/lib/components/advanced/collapse/README.md +106 -0
- package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
- package/lib/components/advanced/infoWindow/README.md +69 -0
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
- package/lib/components/advanced/popUp/README.md +95 -0
- package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
- package/lib/components/auth/bareSignIn/README.md +78 -0
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
- package/lib/components/auth/bareSignUp/README.md +130 -0
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
- package/lib/components/auth/signIn/README.md +53 -0
- package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
- package/lib/components/auth/signUp/README.md +136 -0
- package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
- package/lib/components/chart/README.md +13 -0
- package/lib/components/chart/areaChart/README.md +133 -0
- package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
- package/lib/components/chart/barChart/README.md +193 -0
- package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
- package/lib/components/chart/boxPlotChart/README.md +124 -0
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
- package/lib/components/chart/bubbleChart/README.md +166 -0
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
- package/lib/components/chart/card/README.md +107 -0
- package/lib/components/chart/card/card.stories.tsx +89 -0
- package/lib/components/chart/ganttChart/README.md +142 -0
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
- package/lib/components/chart/heatmapChart/README.md +125 -0
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
- package/lib/components/chart/lineChart/README.md +140 -0
- package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
- package/lib/components/chart/pieChart/README.md +117 -0
- package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
- package/lib/components/chart/polarAreaChart/README.md +126 -0
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
- package/lib/components/chart/radarChart/README.md +57 -0
- package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
- package/lib/components/chart/radialBar/README.md +152 -0
- package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
- package/lib/components/chart/rangeBarChart/README.md +323 -0
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
- package/lib/components/chart/statsCard/README.md +97 -0
- package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
- package/lib/components/chart/treemapChart/README.md +142 -0
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
- package/lib/components/chat/chatAnchor/README.md +113 -0
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
- package/lib/components/chat/chatBase/README.md +223 -0
- package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
- package/lib/components/chat/chatDashboard/README.md +161 -0
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
- package/lib/components/data/dataGraph/README.md +13 -0
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
- package/lib/components/data/dataReference/README.md +62 -0
- package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
- package/lib/components/data/dataTemplate/README.md +903 -0
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
- package/lib/components/data/dataWrapper/README.md +1077 -0
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
- package/lib/components/data/queryForm/README.md +56 -0
- package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
- package/lib/components/data/readQuery/README.md +282 -0
- package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
- package/lib/components/data/readQueryHoc/README.md +89 -0
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
- package/lib/components/data/writeQuery/README.md +178 -0
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
- package/lib/components/design/actionSection/README.md +47 -0
- package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
- package/lib/components/design/banner/README.md +43 -0
- package/lib/components/design/banner/banner.stories.tsx +34 -0
- package/lib/components/design/bannerAction/README.md +44 -0
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
- package/lib/components/design/blogSection/README.md +111 -0
- package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
- package/lib/components/design/carouselSection/README.md +82 -0
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
- package/lib/components/design/designList/README.md +60 -0
- package/lib/components/design/designList/designList.stories.tsx +44 -0
- package/lib/components/design/faq/README.md +121 -0
- package/lib/components/design/faq/faq.stories.tsx +103 -0
- package/lib/components/design/fileGrid/README.md +87 -0
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
- package/lib/components/design/fileViewer/README.md +40 -0
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
- package/lib/components/design/footerSection/README.md +62 -0
- package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
- package/lib/components/design/googleReview/README.md +45 -0
- package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
- package/lib/components/design/heroSection/README.md +48 -0
- package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
- package/lib/components/design/iconList/README.md +60 -0
- package/lib/components/design/iconList/iconList.stories.tsx +41 -0
- package/lib/components/design/imageGallery/README.md +56 -0
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
- package/lib/components/design/imageZoom/README.md +47 -0
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
- package/lib/components/design/leftContent/README.md +47 -0
- package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
- package/lib/components/design/logoCloud/README.md +42 -0
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
- package/lib/components/design/onboarding/README.md +100 -0
- package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
- package/lib/components/design/pricing/README.md +112 -0
- package/lib/components/design/pricing/pricing.stories.tsx +86 -0
- package/lib/components/design/rightContent/README.md +47 -0
- package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
- package/lib/components/design/sectionList/README.md +51 -0
- package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
- package/lib/components/design/teams/README.md +62 -0
- package/lib/components/design/teams/teams.stories.tsx +61 -0
- package/lib/components/display/alert/README.md +82 -0
- package/lib/components/display/alert/alert.stories.tsx +71 -0
- package/lib/components/display/calendar/README.md +113 -0
- package/lib/components/display/calendar/calendar.stories.tsx +159 -0
- package/lib/components/display/clipboard/README.md +36 -0
- package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
- package/lib/components/display/detailList/README.md +61 -0
- package/lib/components/display/detailList/detailList.stories.tsx +131 -0
- package/lib/components/display/drawer/README.md +74 -0
- package/lib/components/display/drawer/drawer.stories.tsx +66 -0
- package/lib/components/display/emptyState/README.md +38 -0
- package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
- package/lib/components/display/feeds/README.md +80 -0
- package/lib/components/display/feeds/feeds.stories.tsx +75 -0
- package/lib/components/display/flexTable/README.md +160 -0
- package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
- package/lib/components/display/grid/README.md +121 -0
- package/lib/components/display/grid/grid.stories.tsx +234 -0
- package/lib/components/display/kanban/README.md +78 -0
- package/lib/components/display/kanban/kanban.stories.tsx +133 -0
- package/lib/components/display/list/README.md +109 -0
- package/lib/components/display/list/list.stories.tsx +188 -0
- package/lib/components/display/loading/README.md +25 -0
- package/lib/components/display/loading/loading.stories.tsx +15 -0
- package/lib/components/display/mapView/README.md +99 -0
- package/lib/components/display/mapView/mapView.stories.tsx +225 -0
- package/lib/components/display/modal/README.md +43 -0
- package/lib/components/display/modal/modal.stories.tsx +81 -0
- package/lib/components/display/notification/README.md +43 -0
- package/lib/components/display/notification/notification.stories.tsx +30 -0
- package/lib/components/display/progress/README.md +25 -0
- package/lib/components/display/progress/progress.stories.tsx +15 -0
- package/lib/components/display/stepper/README.md +96 -0
- package/lib/components/display/stepper/stepper.stories.tsx +175 -0
- package/lib/components/display/table/README.md +176 -0
- package/lib/components/display/table/table.stories.tsx +330 -0
- package/lib/components/display/tag/README.md +74 -0
- package/lib/components/display/tag/tag.stories.tsx +79 -0
- package/lib/components/input/address/README.md +132 -0
- package/lib/components/input/address/address.stories.tsx +147 -0
- package/lib/components/input/canvas/README.md +131 -0
- package/lib/components/input/canvas/canvas.stories.tsx +165 -0
- package/lib/components/input/checkbox/README.md +61 -0
- package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
- package/lib/components/input/datePicker/README.md +124 -0
- package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
- package/lib/components/input/form/README.md +55 -0
- package/lib/components/input/form/form.stories.tsx +143 -0
- package/lib/components/input/markdown/README.md +146 -0
- package/lib/components/input/markdown/markdown.stories.tsx +40 -0
- package/lib/components/input/monthYearPicker/README.md +69 -0
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
- package/lib/components/input/netPromoterScore/README.md +52 -0
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
- package/lib/components/input/rating/README.md +51 -0
- package/lib/components/input/rating/rating.stories.tsx +30 -0
- package/lib/components/input/select/README.md +108 -0
- package/lib/components/input/select/select.stories.tsx +286 -0
- package/lib/components/input/signature/README.md +106 -0
- package/lib/components/input/signature/signature.stories.tsx +188 -0
- package/lib/components/input/textArea/README.md +55 -0
- package/lib/components/input/textArea/textArea.stories.tsx +30 -0
- package/lib/components/input/textInput/README.md +81 -0
- package/lib/components/input/textInput/textinput.stories.tsx +231 -0
- package/lib/components/input/uploadInput/README.md +134 -0
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
- package/lib/components/navigation/bars/README.md +40 -0
- package/lib/components/navigation/bars/bars.stories.tsx +85 -0
- package/lib/components/navigation/bottomTab/README.md +53 -0
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
- package/lib/components/navigation/breadcrumb/README.md +48 -0
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
- package/lib/components/navigation/header/README.md +149 -0
- package/lib/components/navigation/header/header.stories.tsx +107 -0
- package/lib/components/navigation/leftNav/README.md +91 -0
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
- package/lib/components/navigation/tabs/README.md +75 -0
- package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
- package/lib/components/structure/column/README.md +40 -0
- package/lib/components/structure/column/column.stories.tsx +26 -0
- package/lib/components/structure/container/README.md +34 -0
- package/lib/components/structure/container/container.stories.tsx +19 -0
- package/lib/components/structure/link/README.md +55 -0
- package/lib/components/structure/link/link.stories.tsx +30 -0
- package/lib/components/structure/text/README.md +42 -0
- package/lib/components/structure/text/text.stories.tsx +39 -0
- package/lib/components/template/authPage/authPage.stories.tsx +68 -0
- package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
- package/lib/components/template/productListing/productListing.stories.tsx +297 -0
- package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
- package/lib/mcp/server.d.ts +2 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +33 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
- package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getBackendComponent.js +119 -0
- package/lib/mcp/tools/getBackendComponent.js.map +1 -0
- package/lib/mcp/tools/getComponent.d.ts +17 -0
- package/lib/mcp/tools/getComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getComponent.js +118 -0
- package/lib/mcp/tools/getComponent.js.map +1 -0
- package/lib/mcp/tools/listComponents.d.ts +13 -0
- package/lib/mcp/tools/listComponents.d.ts.map +1 -0
- package/lib/mcp/tools/listComponents.js +113 -0
- package/lib/mcp/tools/listComponents.js.map +1 -0
- package/lib/mcp/tools/listTemplates.d.ts +13 -0
- package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
- package/lib/mcp/tools/listTemplates.js +68 -0
- package/lib/mcp/tools/listTemplates.js.map +1 -0
- package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
- package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
- package/lib/mcp/tools/suggestTemplate.js +212 -0
- package/lib/mcp/tools/suggestTemplate.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,104 @@
|
|
|
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 { BoxPlotChart } 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("Box Plot Chart", () => {
|
|
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
|
+
const sevenDaysAgo = new Date();
|
|
62
|
+
sevenDaysAgo.setDate(moment().toDate().getDate() - 7);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<div className="font-medium mb-5">Box Plot Chart</div>
|
|
67
|
+
<BoxPlotChart
|
|
68
|
+
title="Electric Generation Performance"
|
|
69
|
+
seriesName="Journey Performance"
|
|
70
|
+
seriesData={seriesData}
|
|
71
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
72
|
+
dateRangeVisible={true}
|
|
73
|
+
customDate={{
|
|
74
|
+
startDate: sevenDaysAgo,
|
|
75
|
+
endDate: moment().toDate(),
|
|
76
|
+
isDuration: true,
|
|
77
|
+
}}
|
|
78
|
+
onChangeDate={handleSetData}
|
|
79
|
+
showDataLabel={false}
|
|
80
|
+
newTabUrl="https://www.google.com/"
|
|
81
|
+
yaxisTitle="Electric Generation (kWh)"
|
|
82
|
+
xaxisTitle="Quarters"
|
|
83
|
+
/>
|
|
84
|
+
<div className="font-medium my-5">Dark Mode Box Plot Chart</div>
|
|
85
|
+
<BoxPlotChart
|
|
86
|
+
title="Performance Distribution"
|
|
87
|
+
seriesName="Data Distribution"
|
|
88
|
+
seriesData={seriesData}
|
|
89
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
90
|
+
dateRangeVisible={true}
|
|
91
|
+
customDate={{
|
|
92
|
+
startDate: sevenDaysAgo,
|
|
93
|
+
endDate: moment().toDate(),
|
|
94
|
+
isDuration: true,
|
|
95
|
+
}}
|
|
96
|
+
onChangeDate={handleSetData}
|
|
97
|
+
showDataLabel={false}
|
|
98
|
+
darkMode={true}
|
|
99
|
+
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
100
|
+
borderColor=""
|
|
101
|
+
/>
|
|
102
|
+
</>
|
|
103
|
+
);
|
|
104
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Bubble Chart
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A bubble chart component for displaying three-dimensional data. e.g: Page views vs time spent with bubble size representing engagement
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { BubbleChart } 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
|
+
x: 95,
|
|
24
|
+
y: 95,
|
|
25
|
+
z: 13.8,
|
|
26
|
+
name: "AN",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
x: 86.5,
|
|
30
|
+
y: 102.9,
|
|
31
|
+
z: 14.7,
|
|
32
|
+
name: "BE",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
x: 80.8,
|
|
36
|
+
y: 91.5,
|
|
37
|
+
z: 15.8,
|
|
38
|
+
name: "CZ",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
x: 80.4,
|
|
42
|
+
y: 102.5,
|
|
43
|
+
z: 12,
|
|
44
|
+
name: "DK",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
x: 80.3,
|
|
48
|
+
y: 86.1,
|
|
49
|
+
z: 11.8,
|
|
50
|
+
name: "FI",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
x: 78.4,
|
|
54
|
+
y: 70.1,
|
|
55
|
+
z: 16.6,
|
|
56
|
+
name: "FR",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
x: 74.2,
|
|
60
|
+
y: 68.5,
|
|
61
|
+
z: 14.5,
|
|
62
|
+
name: "DE",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
x: 73.5,
|
|
66
|
+
y: 83.1,
|
|
67
|
+
z: 10,
|
|
68
|
+
name: "GR",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
x: 71,
|
|
72
|
+
y: 93.2,
|
|
73
|
+
z: 24.7,
|
|
74
|
+
name: "HU",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
x: 69.8,
|
|
78
|
+
y: 57.6,
|
|
79
|
+
z: 10.4,
|
|
80
|
+
name: "IS",
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
const handleSetData = useCallback(
|
|
86
|
+
(customDate?: RangeInterface) => {
|
|
87
|
+
let dummySeriesData: any[] = [];
|
|
88
|
+
chartDummyData.map((eachData) => {
|
|
89
|
+
dummySeriesData.push(eachData);
|
|
90
|
+
return null;
|
|
91
|
+
});
|
|
92
|
+
setSeriesData(dummySeriesData);
|
|
93
|
+
},
|
|
94
|
+
[chartDummyData]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
handleSetData();
|
|
99
|
+
}, [handleSetData]);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<>
|
|
103
|
+
<div className="font-medium mb-5">Bubble Chart</div>
|
|
104
|
+
<BubbleChart
|
|
105
|
+
title="Page Views vs Time Spent"
|
|
106
|
+
seriesName="Pages"
|
|
107
|
+
seriesData={seriesData}
|
|
108
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
109
|
+
dateRangeVisible={true}
|
|
110
|
+
customDate={{
|
|
111
|
+
startDate: sevenDaysAgo,
|
|
112
|
+
endDate: moment().toDate(),
|
|
113
|
+
isDuration: true,
|
|
114
|
+
}}
|
|
115
|
+
onChangeDate={handleSetData}
|
|
116
|
+
showDataLabel={false}
|
|
117
|
+
newTabUrl="https://www.google.com/"
|
|
118
|
+
/>
|
|
119
|
+
<div className="font-medium my-5">Dark Mode Bubble Chart</div>
|
|
120
|
+
<BubbleChart
|
|
121
|
+
title="Analytics Overview"
|
|
122
|
+
seriesName="Data Points"
|
|
123
|
+
seriesData={seriesData}
|
|
124
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
125
|
+
dateRangeVisible={true}
|
|
126
|
+
customDate={{
|
|
127
|
+
startDate: sevenDaysAgo,
|
|
128
|
+
endDate: moment().toDate(),
|
|
129
|
+
isDuration: true,
|
|
130
|
+
}}
|
|
131
|
+
onChangeDate={handleSetData}
|
|
132
|
+
showDataLabel={false}
|
|
133
|
+
darkMode={true}
|
|
134
|
+
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
135
|
+
borderColor=""
|
|
136
|
+
/>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
##### Required props
|
|
142
|
+
|
|
143
|
+
| Name | Type | Description |
|
|
144
|
+
| ------- | -------- | ------------------ |
|
|
145
|
+
| `title` | `string` | Title of the chart |
|
|
146
|
+
|
|
147
|
+
##### Optional props
|
|
148
|
+
|
|
149
|
+
| Name | Type | Default | Description |
|
|
150
|
+
| --------------- | -------------- | --------- | --------------------------------------------- |
|
|
151
|
+
| `seriesData` | `BubbleData[]` | `[]` | Series data with x, y, z coordinates and name |
|
|
152
|
+
| `seriesName` | `string` | "Pages" | Value name in pointer card |
|
|
153
|
+
| `xaxisTitle` | `string` | undefined | Title for the X-axis |
|
|
154
|
+
| `yaxisTitle` | `string` | undefined | Title for the Y-axis |
|
|
155
|
+
| `showToolbar` | `boolean` | `false` | |
|
|
156
|
+
| `showDataLabel` | `boolean` | `false` | |
|
|
157
|
+
| `newTabUrl` | `string` | "" | set URL for create hyperlinks |
|
|
158
|
+
|
|
159
|
+
##### Bubble Data props
|
|
160
|
+
|
|
161
|
+
| Name | Type | Description |
|
|
162
|
+
| ------ | -------- | -------------------------------- |
|
|
163
|
+
| `x` | `number` | X-axis value (Time Spent) |
|
|
164
|
+
| `y` | `number` | Y-axis value (Page Views) |
|
|
165
|
+
| `z` | `number` | Bubble size (Engagement) |
|
|
166
|
+
| `name` | `string` | Optional name for the data point |
|
|
@@ -0,0 +1,144 @@
|
|
|
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 { BubbleChart } 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("Bubble Chart", () => {
|
|
18
|
+
const [seriesData, setSeriesData] = useState<any[]>([]);
|
|
19
|
+
|
|
20
|
+
const chartDummyData = useMemo(() => {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
x: 95,
|
|
24
|
+
y: 95,
|
|
25
|
+
z: 13.8,
|
|
26
|
+
name: "AN",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
x: 86.5,
|
|
30
|
+
y: 102.9,
|
|
31
|
+
z: 14.7,
|
|
32
|
+
name: "BE",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
x: 80.8,
|
|
36
|
+
y: 91.5,
|
|
37
|
+
z: 15.8,
|
|
38
|
+
name: "CZ",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
x: 80.4,
|
|
42
|
+
y: 102.5,
|
|
43
|
+
z: 12,
|
|
44
|
+
name: "DK",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
x: 80.3,
|
|
48
|
+
y: 86.1,
|
|
49
|
+
z: 11.8,
|
|
50
|
+
name: "FI",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
x: 78.4,
|
|
54
|
+
y: 70.1,
|
|
55
|
+
z: 16.6,
|
|
56
|
+
name: "FR",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
x: 74.2,
|
|
60
|
+
y: 68.5,
|
|
61
|
+
z: 14.5,
|
|
62
|
+
name: "DE",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
x: 73.5,
|
|
66
|
+
y: 83.1,
|
|
67
|
+
z: 10,
|
|
68
|
+
name: "GR",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
x: 71,
|
|
72
|
+
y: 93.2,
|
|
73
|
+
z: 24.7,
|
|
74
|
+
name: "HU",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
x: 69.8,
|
|
78
|
+
y: 57.6,
|
|
79
|
+
z: 10.4,
|
|
80
|
+
name: "IS",
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
const handleSetData = useCallback(
|
|
86
|
+
(customDate?: RangeInterface) => {
|
|
87
|
+
let dummySeriesData: any[] = [];
|
|
88
|
+
chartDummyData.map((eachData) => {
|
|
89
|
+
dummySeriesData.push(eachData);
|
|
90
|
+
return null;
|
|
91
|
+
});
|
|
92
|
+
setSeriesData(dummySeriesData);
|
|
93
|
+
},
|
|
94
|
+
[chartDummyData]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
handleSetData();
|
|
99
|
+
}, [handleSetData]);
|
|
100
|
+
|
|
101
|
+
const sevenDaysAgo = new Date();
|
|
102
|
+
sevenDaysAgo.setDate(moment().toDate().getDate() - 7);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
<div className="font-medium mb-5">Bubble Chart</div>
|
|
107
|
+
<BubbleChart
|
|
108
|
+
title="Page Views vs Time Spent"
|
|
109
|
+
seriesName="Pages"
|
|
110
|
+
seriesData={seriesData}
|
|
111
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
112
|
+
dateRangeVisible={true}
|
|
113
|
+
customDate={{
|
|
114
|
+
startDate: sevenDaysAgo,
|
|
115
|
+
endDate: moment().toDate(),
|
|
116
|
+
isDuration: true,
|
|
117
|
+
}}
|
|
118
|
+
onChangeDate={handleSetData}
|
|
119
|
+
showDataLabel={false}
|
|
120
|
+
newTabUrl="https://www.google.com/"
|
|
121
|
+
xaxisTitle="Value A"
|
|
122
|
+
yaxisTitle="Value B"
|
|
123
|
+
/>
|
|
124
|
+
<div className="font-medium my-5">Dark Mode Bubble Chart</div>
|
|
125
|
+
<BubbleChart
|
|
126
|
+
title="Analytics Overview"
|
|
127
|
+
seriesName="Data Points"
|
|
128
|
+
seriesData={seriesData}
|
|
129
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
130
|
+
dateRangeVisible={true}
|
|
131
|
+
customDate={{
|
|
132
|
+
startDate: sevenDaysAgo,
|
|
133
|
+
endDate: moment().toDate(),
|
|
134
|
+
isDuration: true,
|
|
135
|
+
}}
|
|
136
|
+
onChangeDate={handleSetData}
|
|
137
|
+
showDataLabel={false}
|
|
138
|
+
darkMode={true}
|
|
139
|
+
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
140
|
+
borderColor=""
|
|
141
|
+
/>
|
|
142
|
+
</>
|
|
143
|
+
);
|
|
144
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A card component for displaying analytics data. e.g: Total.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { Card } from "blixify-ui-web/lib";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [countData, setCountData] = useState < number > 0;
|
|
19
|
+
|
|
20
|
+
const stats = useMemo(() => {
|
|
21
|
+
const customCurrentDate = new Date();
|
|
22
|
+
const twentyEightDaysAgo = new Date();
|
|
23
|
+
const sevenDaysAgo = new Date();
|
|
24
|
+
const oneDaysAgo = new Date();
|
|
25
|
+
sevenDaysAgo.setDate(customCurrentDate.getDate() - 7);
|
|
26
|
+
oneDaysAgo.setDate(customCurrentDate.getDate() - 1);
|
|
27
|
+
twentyEightDaysAgo.setDate(customCurrentDate.getDate() - 28);
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
stats: 71897,
|
|
32
|
+
createdAt: sevenDaysAgo,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
stats: 230,
|
|
36
|
+
createdAt: oneDaysAgo,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
stats: 2010,
|
|
40
|
+
createdAt: twentyEightDaysAgo,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
const handleSetData = useCallback(
|
|
46
|
+
(startDate?: Date, endDate?: Date) => {
|
|
47
|
+
let dummySeriesData: number = 0;
|
|
48
|
+
stats.map((eachData) => {
|
|
49
|
+
if (startDate && endDate) {
|
|
50
|
+
if (eachData.createdAt >= startDate && eachData.createdAt <= endDate) {
|
|
51
|
+
dummySeriesData += eachData.stats;
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
dummySeriesData += eachData.stats;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return null;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
setCountData(dummySeriesData);
|
|
61
|
+
},
|
|
62
|
+
[stats]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
handleSetData();
|
|
67
|
+
}, [handleSetData]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Card
|
|
71
|
+
icon={<UserGroupIcon className="h-5 w-5 text-white" />}
|
|
72
|
+
title="Completed Tasks"
|
|
73
|
+
description="Total Tasks(s)"
|
|
74
|
+
count={countData}
|
|
75
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
76
|
+
dateRangeVisible={true}
|
|
77
|
+
onChangeDate={handleSetData}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
##### Required props
|
|
83
|
+
|
|
84
|
+
| Name | Type | Description |
|
|
85
|
+
| ------- | --------------- | ------------------- |
|
|
86
|
+
| `icon` | `React Element` | Icon |
|
|
87
|
+
| `title` | `string` | Title |
|
|
88
|
+
| `count` | `number` | Content of the card |
|
|
89
|
+
|
|
90
|
+
##### Optional props
|
|
91
|
+
|
|
92
|
+
| Name | Type | Default | Description |
|
|
93
|
+
| -------------------- | ----------------- | ------- | ----------------------------- |
|
|
94
|
+
| `iconBgColor` | `Tailwind Class` | "" | |
|
|
95
|
+
| `tool` | `React Element` | "" | |
|
|
96
|
+
| `iconTop` | `boolean` | `false` | set the icon on top of title |
|
|
97
|
+
| `iconClassName` | `string` | `false` | set the icon size small |
|
|
98
|
+
| `unit` | `string` | "" | set the unit of value |
|
|
99
|
+
| `subContent` | `React Element` | "" | |
|
|
100
|
+
| `containerClassName` | `string` | "" | set the className of the card |
|
|
101
|
+
| `dateRangeVisible` | `boolean` | `false` | |
|
|
102
|
+
| `hideDesc` | `boolean` | `false` | |
|
|
103
|
+
| `textTruncate` | `boolean` | `false` | |
|
|
104
|
+
| `customDate` | `Range Interface` | | |
|
|
105
|
+
| `onChangeDate` | `function` | | Handle Change Chart Data |
|
|
106
|
+
| `description` | `string` | | Description of the card |
|
|
107
|
+
| `newTabUrl` | `string` | "" | set URL for create hyperlinks |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { PencilIcon, UserGroupIcon } from "@heroicons/react/24/outline";
|
|
2
|
+
import { storiesOf } from "@storybook/react";
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { Card } from ".";
|
|
5
|
+
import { RangeInterface } from "../DateRange";
|
|
6
|
+
import README from "./README.md";
|
|
7
|
+
|
|
8
|
+
const stories = storiesOf("Chart", module);
|
|
9
|
+
|
|
10
|
+
stories.addParameters({
|
|
11
|
+
readme: {
|
|
12
|
+
content: README,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
stories.add("Card", () => {
|
|
17
|
+
const [countData, setCountData] = useState<number>(0);
|
|
18
|
+
|
|
19
|
+
const stats = useMemo(() => {
|
|
20
|
+
const customCurrentDate = new Date();
|
|
21
|
+
const twentyEightDaysAgo = new Date();
|
|
22
|
+
const sevenDaysAgo = new Date();
|
|
23
|
+
const oneDaysAgo = new Date();
|
|
24
|
+
sevenDaysAgo.setDate(customCurrentDate.getDate() - 7);
|
|
25
|
+
oneDaysAgo.setDate(customCurrentDate.getDate() - 1);
|
|
26
|
+
twentyEightDaysAgo.setDate(customCurrentDate.getDate() - 28);
|
|
27
|
+
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
stats: 71897,
|
|
31
|
+
createdAt: sevenDaysAgo,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
stats: 230,
|
|
35
|
+
createdAt: oneDaysAgo,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
stats: 2010,
|
|
39
|
+
createdAt: twentyEightDaysAgo,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const handleSetData = useCallback(
|
|
45
|
+
(customDate?: RangeInterface) => {
|
|
46
|
+
let dummySeriesData: number = 0;
|
|
47
|
+
stats.map((eachData) => {
|
|
48
|
+
if (customDate?.isDuration) {
|
|
49
|
+
if (
|
|
50
|
+
eachData.createdAt >= customDate.startDate &&
|
|
51
|
+
eachData.createdAt <= customDate.endDate
|
|
52
|
+
) {
|
|
53
|
+
dummySeriesData += eachData.stats;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
if (customDate?.endDate && eachData.createdAt <= customDate.endDate) {
|
|
57
|
+
dummySeriesData += eachData.stats;
|
|
58
|
+
} else {
|
|
59
|
+
dummySeriesData += eachData.stats;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
setCountData(dummySeriesData);
|
|
67
|
+
},
|
|
68
|
+
[stats]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
handleSetData();
|
|
73
|
+
}, [handleSetData]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Card
|
|
77
|
+
icon={<UserGroupIcon className="h-5 w-5 text-white" />}
|
|
78
|
+
title="Completed Tasks"
|
|
79
|
+
description="Total Tasks(s)"
|
|
80
|
+
count={countData}
|
|
81
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
82
|
+
dateRangeVisible={true}
|
|
83
|
+
onChangeDate={handleSetData}
|
|
84
|
+
textTruncate={true}
|
|
85
|
+
darkMode={false}
|
|
86
|
+
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
});
|