blixify-ui-web-mcp 0.1.2 → 0.1.18
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/lib/components/action/button/README.md +12 -11
- package/lib/components/action/button/button.stories.tsx +4 -10
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
- package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
- package/lib/components/action/radioList/radioList.stories.tsx +4 -10
- package/lib/components/action/slider/slider.stories.tsx +4 -10
- package/lib/components/action/textButton/textButton.stories.tsx +4 -10
- package/lib/components/action/toggle/toggle.stories.tsx +4 -10
- package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
- package/lib/components/advanced/popUp/README.md +21 -7
- package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
- package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
- package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
- package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
- package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
- package/lib/components/chart/card/card.stories.tsx +4 -10
- package/lib/components/chart/ganttChart/README.md +96 -110
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
- package/lib/components/chart/heatmapChart/README.md +93 -82
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
- package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
- package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
- package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
- package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
- package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
- package/lib/components/chat/chatAnchor/README.md +61 -79
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
- package/lib/components/chat/chatBase/README.md +244 -196
- package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
- package/lib/components/chat/chatDashboard/README.md +89 -129
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
- package/lib/components/data/dataGraph/README.md +135 -1
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
- package/lib/components/data/dataReference/README.md +141 -43
- package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
- package/lib/components/data/dataTemplate/README.md +88 -61
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
- package/lib/components/data/dataWrapper/README.md +48 -46
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
- package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
- package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
- package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
- package/lib/components/design/banner/banner.stories.tsx +4 -10
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
- package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
- package/lib/components/design/designList/designList.stories.tsx +4 -10
- package/lib/components/design/faq/faq.stories.tsx +4 -10
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
- package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
- package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
- package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
- package/lib/components/design/iconList/iconList.stories.tsx +4 -10
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
- package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
- package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
- package/lib/components/design/pricing/pricing.stories.tsx +4 -10
- package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
- package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
- package/lib/components/design/teams/teams.stories.tsx +4 -10
- package/lib/components/display/alert/alert.stories.tsx +4 -10
- package/lib/components/display/calendar/README.md +49 -0
- package/lib/components/display/calendar/calendar.stories.tsx +71 -28
- package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
- package/lib/components/display/detailList/detailList.stories.tsx +5 -10
- package/lib/components/display/drawer/drawer.stories.tsx +5 -10
- package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
- package/lib/components/display/feeds/feeds.stories.tsx +4 -10
- package/lib/components/display/flexTable/README.md +11 -7
- package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
- package/lib/components/display/grid/README.md +28 -27
- package/lib/components/display/grid/grid.stories.tsx +4 -10
- package/lib/components/display/kanban/kanban.stories.tsx +14 -20
- package/lib/components/display/list/README.md +30 -29
- package/lib/components/display/list/list.stories.tsx +4 -10
- package/lib/components/display/loading/loading.stories.tsx +5 -10
- package/lib/components/display/mapView/mapView.stories.tsx +4 -10
- package/lib/components/display/modal/modal.stories.tsx +4 -11
- package/lib/components/display/notification/notification.stories.tsx +4 -10
- package/lib/components/display/progress/progress.stories.tsx +5 -10
- package/lib/components/display/stepper/stepper.stories.tsx +5 -10
- package/lib/components/display/table/README.md +38 -37
- package/lib/components/display/table/table.stories.tsx +8 -14
- package/lib/components/display/tag/tag.stories.tsx +4 -10
- package/lib/components/input/address/address.stories.tsx +4 -10
- package/lib/components/input/canvas/canvas.stories.tsx +4 -10
- package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
- package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
- package/lib/components/input/form/form.stories.tsx +4 -10
- package/lib/components/input/markdown/markdown.stories.tsx +5 -10
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
- package/lib/components/input/rating/rating.stories.tsx +4 -10
- package/lib/components/input/select/README.md +30 -29
- package/lib/components/input/select/select.stories.tsx +4 -10
- package/lib/components/input/signature/signature.stories.tsx +4 -10
- package/lib/components/input/textArea/textArea.stories.tsx +4 -10
- package/lib/components/input/textInput/textinput.stories.tsx +4 -10
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
- package/lib/components/navigation/bars/README.md +90 -17
- package/lib/components/navigation/bars/bars.stories.tsx +128 -60
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
- package/lib/components/navigation/breadcrumb/README.md +40 -20
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
- package/lib/components/navigation/header/README.md +67 -108
- package/lib/components/navigation/header/header.stories.tsx +165 -49
- package/lib/components/navigation/leftNav/README.md +121 -66
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
- package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
- package/lib/components/structure/column/column.stories.tsx +5 -10
- package/lib/components/structure/container/container.stories.tsx +5 -10
- package/lib/components/structure/link/link.stories.tsx +4 -10
- package/lib/components/structure/text/text.stories.tsx +5 -10
- package/lib/components/template/authPage/authPage.stories.tsx +6 -5
- package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
- package/lib/components/template/productListing/productListing.stories.tsx +7 -13
- package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
- package/package.json +1 -1
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import
|
|
3
|
-
import moment from "moment";
|
|
2
|
+
import dayjs from "../../dayjs";
|
|
4
3
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
4
|
import { BoxPlotChart } from ".";
|
|
6
5
|
import { RangeInterface } from "../DateRange";
|
|
7
|
-
import README from "./README.md";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Box Plot Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
export const BoxPlotChartStory = () => {
|
|
18
12
|
const [seriesData, setSeriesData] = useState<any[]>([]);
|
|
19
13
|
|
|
20
14
|
const chartDummyData = useMemo(() => {
|
|
@@ -59,7 +53,7 @@ stories.add("Box Plot Chart", () => {
|
|
|
59
53
|
}, [handleSetData]);
|
|
60
54
|
|
|
61
55
|
const sevenDaysAgo = new Date();
|
|
62
|
-
sevenDaysAgo.setDate(
|
|
56
|
+
sevenDaysAgo.setDate(dayjs().toDate().getDate() - 7);
|
|
63
57
|
|
|
64
58
|
return (
|
|
65
59
|
<>
|
|
@@ -72,7 +66,7 @@ stories.add("Box Plot Chart", () => {
|
|
|
72
66
|
dateRangeVisible={true}
|
|
73
67
|
customDate={{
|
|
74
68
|
startDate: sevenDaysAgo,
|
|
75
|
-
endDate:
|
|
69
|
+
endDate: dayjs().toDate(),
|
|
76
70
|
isDuration: true,
|
|
77
71
|
}}
|
|
78
72
|
onChangeDate={handleSetData}
|
|
@@ -90,7 +84,7 @@ stories.add("Box Plot Chart", () => {
|
|
|
90
84
|
dateRangeVisible={true}
|
|
91
85
|
customDate={{
|
|
92
86
|
startDate: sevenDaysAgo,
|
|
93
|
-
endDate:
|
|
87
|
+
endDate: dayjs().toDate(),
|
|
94
88
|
isDuration: true,
|
|
95
89
|
}}
|
|
96
90
|
onChangeDate={handleSetData}
|
|
@@ -101,4 +95,4 @@ stories.add("Box Plot Chart", () => {
|
|
|
101
95
|
/>
|
|
102
96
|
</>
|
|
103
97
|
);
|
|
104
|
-
}
|
|
98
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import
|
|
3
|
-
import moment from "moment";
|
|
2
|
+
import dayjs from "../../dayjs";
|
|
4
3
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
4
|
import { BubbleChart } from ".";
|
|
6
5
|
import { RangeInterface } from "../DateRange";
|
|
7
|
-
import README from "./README.md";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Bubble Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
export const BubbleChartStory = () => {
|
|
18
12
|
const [seriesData, setSeriesData] = useState<any[]>([]);
|
|
19
13
|
|
|
20
14
|
const chartDummyData = useMemo(() => {
|
|
@@ -99,7 +93,7 @@ stories.add("Bubble Chart", () => {
|
|
|
99
93
|
}, [handleSetData]);
|
|
100
94
|
|
|
101
95
|
const sevenDaysAgo = new Date();
|
|
102
|
-
sevenDaysAgo.setDate(
|
|
96
|
+
sevenDaysAgo.setDate(dayjs().toDate().getDate() - 7);
|
|
103
97
|
|
|
104
98
|
return (
|
|
105
99
|
<>
|
|
@@ -112,7 +106,7 @@ stories.add("Bubble Chart", () => {
|
|
|
112
106
|
dateRangeVisible={true}
|
|
113
107
|
customDate={{
|
|
114
108
|
startDate: sevenDaysAgo,
|
|
115
|
-
endDate:
|
|
109
|
+
endDate: dayjs().toDate(),
|
|
116
110
|
isDuration: true,
|
|
117
111
|
}}
|
|
118
112
|
onChangeDate={handleSetData}
|
|
@@ -130,7 +124,7 @@ stories.add("Bubble Chart", () => {
|
|
|
130
124
|
dateRangeVisible={true}
|
|
131
125
|
customDate={{
|
|
132
126
|
startDate: sevenDaysAgo,
|
|
133
|
-
endDate:
|
|
127
|
+
endDate: dayjs().toDate(),
|
|
134
128
|
isDuration: true,
|
|
135
129
|
}}
|
|
136
130
|
onChangeDate={handleSetData}
|
|
@@ -141,4 +135,4 @@ stories.add("Bubble Chart", () => {
|
|
|
141
135
|
/>
|
|
142
136
|
</>
|
|
143
137
|
);
|
|
144
|
-
}
|
|
138
|
+
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { PencilIcon, UserGroupIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { Card } from ".";
|
|
5
4
|
import { RangeInterface } from "../DateRange";
|
|
6
|
-
import README from "./README.md";
|
|
7
5
|
|
|
8
|
-
const
|
|
6
|
+
const meta = { title: "Chart/Card" };
|
|
7
|
+
export default meta;
|
|
9
8
|
|
|
10
|
-
stories.addParameters({
|
|
11
|
-
readme: {
|
|
12
|
-
content: README,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
9
|
|
|
16
|
-
|
|
10
|
+
export const CardStory = () => {
|
|
17
11
|
const [countData, setCountData] = useState<number>(0);
|
|
18
12
|
|
|
19
13
|
const stats = useMemo(() => {
|
|
@@ -86,4 +80,4 @@ stories.add("Card", () => {
|
|
|
86
80
|
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
87
81
|
/>
|
|
88
82
|
);
|
|
89
|
-
}
|
|
83
|
+
}
|
|
@@ -4,100 +4,82 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
A
|
|
7
|
+
A horizontal range bar chart for visualising project timelines. Supports read-only display, an editable write mode with an inline task table, date range filtering, dark mode, and click callbacks.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { GanttChart } from "blixify-ui-web/
|
|
12
|
+
import { GanttChart } from "blixify-ui-web/components/chart/ganttChart";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
##### Usage
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
const [ganttTasks, setGanttTasks] = useState<any[]>([]);
|
|
17
|
+
Read mode (display only):
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
```jsx
|
|
20
|
+
const [tasks, setTasks] = useState([
|
|
21
21
|
{
|
|
22
22
|
id: "task1",
|
|
23
|
-
name: "
|
|
24
|
-
start: new Date(
|
|
25
|
-
end: new Date(
|
|
26
|
-
duration: 2,
|
|
27
|
-
progress: 100,
|
|
28
|
-
color: "#008FFB", // Individual task color
|
|
23
|
+
name: "Planning",
|
|
24
|
+
start: new Date("2024-01-01"),
|
|
25
|
+
end: new Date("2024-01-05"),
|
|
29
26
|
},
|
|
30
27
|
{
|
|
31
28
|
id: "task2",
|
|
32
|
-
name: "Design Phase",
|
|
33
|
-
start: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000),
|
|
34
|
-
end: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000),
|
|
35
|
-
duration: 5,
|
|
36
|
-
progress: 75,
|
|
37
|
-
color: "#00E396", // Individual task color
|
|
38
|
-
dependencies: ["task1"],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "task3",
|
|
42
29
|
name: "Development",
|
|
43
|
-
start: new Date(),
|
|
44
|
-
end: new Date(
|
|
45
|
-
duration: 10,
|
|
46
|
-
progress: 40,
|
|
47
|
-
color: "#FEB019", // Individual task color
|
|
48
|
-
dependencies: ["task2"],
|
|
30
|
+
start: new Date("2024-01-05"),
|
|
31
|
+
end: new Date("2024-01-15"),
|
|
49
32
|
},
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
);
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
<GanttChart
|
|
36
|
+
title="Project Timeline"
|
|
37
|
+
tasks={tasks}
|
|
38
|
+
showTooltip={true}
|
|
39
|
+
showDataLabel={true}
|
|
40
|
+
dateRangeVisible={true}
|
|
41
|
+
onClick={(taskId, taskName) => console.log(taskId, taskName)}
|
|
42
|
+
/>;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Write mode (editable table + chart):
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
<GanttChart
|
|
49
|
+
title="Project Timeline"
|
|
50
|
+
tasks={tasks}
|
|
51
|
+
mode="write"
|
|
52
|
+
label="Tasks"
|
|
53
|
+
onTaskChange={(updatedTasks) => setTasks(updatedTasks)}
|
|
54
|
+
onClick={(taskId, taskName) => console.log(taskId, taskName)}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Dark mode:
|
|
59
|
+
|
|
60
|
+
```jsx
|
|
61
|
+
<GanttChart
|
|
62
|
+
title="Sprint"
|
|
63
|
+
tasks={tasks}
|
|
64
|
+
darkMode={true}
|
|
65
|
+
darkModeBg="bg-gray-900"
|
|
66
|
+
borderColor="#374151"
|
|
67
|
+
enableGradient={true}
|
|
68
|
+
colors={["#3B82F6", "#10B981", "#F59E0B"]}
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Chart only (no card wrapper):
|
|
73
|
+
|
|
74
|
+
```jsx
|
|
75
|
+
<GanttChart
|
|
76
|
+
title="Minimal"
|
|
77
|
+
tasks={tasks}
|
|
78
|
+
chartOnly={true}
|
|
79
|
+
containerStyle="h-64 w-full"
|
|
80
|
+
showDataLabel={false}
|
|
81
|
+
showToolbar={false}
|
|
82
|
+
/>
|
|
101
83
|
```
|
|
102
84
|
|
|
103
85
|
##### Required props
|
|
@@ -108,35 +90,39 @@ return (
|
|
|
108
90
|
|
|
109
91
|
##### Optional props
|
|
110
92
|
|
|
111
|
-
| Name
|
|
112
|
-
|
|
|
113
|
-
| `tasks`
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
| `
|
|
93
|
+
| Name | Type | Default | Description |
|
|
94
|
+
| ------------------ | -------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `tasks` | `GanttTask[]` | `[]` | Array of task objects to render on the chart |
|
|
96
|
+
| `mode` | `"read" \| "write"` | `"read"` | `"write"` renders an editable table above the chart where tasks can be added, edited, and deleted |
|
|
97
|
+
| `label` | `string` | — | Field label shown above the chart in write mode |
|
|
98
|
+
| `labelExtra` | `ReactElement` | — | Extra element rendered next to the label |
|
|
99
|
+
| `infoElement` | `ReactElement` | — | Content for an info popover shown via a question mark icon next to the label |
|
|
100
|
+
| `onClick` | `(taskId: string, taskName: string) => void` | — | Called when a task bar is clicked |
|
|
101
|
+
| `onTaskChange` | `(tasks: GanttTask[]) => void` | — | Called with the updated task array when tasks are added, edited, or deleted. Required when `mode="write"`. |
|
|
102
|
+
| `showGrid` | `boolean` | `true` | Show or hide chart grid lines |
|
|
103
|
+
| `showTooltip` | `boolean` | `true` | Show or hide the hover tooltip with task name, start, end, and duration |
|
|
104
|
+
| `showDataLabel` | `boolean` | `true` | Show or hide the task name label inside each bar |
|
|
105
|
+
| `showToolbar` | `boolean` | `true` | Show or hide the ApexCharts toolbar (download, zoom, etc.) |
|
|
106
|
+
| `borderColor` | `string` | `#e7e7e7` | Grid line border color |
|
|
107
|
+
| `colors` | `string[]` | — | Color array applied per task in order. Falls back to localStorage `localChartColors` then ApexCharts defaults |
|
|
108
|
+
| `enableGradient` | `boolean` | `false` | Applies a gradient fill to task bars |
|
|
109
|
+
| `darkMode` | `boolean` | `false` | Switches axis labels and text to white |
|
|
110
|
+
| `darkModeBg` | `string` | `bg-gray-900` | Tailwind bg class for the card background in dark mode |
|
|
111
|
+
| `dateRangeVisible` | `boolean` | `false` | Shows a date range picker below the chart |
|
|
112
|
+
| `customDate` | `RangeInterface` | — | Pre-selected date range passed to the date range picker |
|
|
113
|
+
| `onChangeDate` | `(date?: RangeInterface) => void` | — | Called when the date range picker value changes |
|
|
114
|
+
| `chartSize` | `number` | `400` | Chart height in pixels |
|
|
115
|
+
| `chartOnly` | `boolean` | `false` | Renders only the chart with no card wrapper. Use `containerStyle` to size the container. |
|
|
116
|
+
| `containerStyle` | `string` | — | Tailwind classes applied to the outer container |
|
|
117
|
+
| `tool` | `ReactElement` | — | Extra element rendered in the top-right of the chart header (e.g. an icon button) |
|
|
118
|
+
| `minInterval` | `number` | — | Minimum interval for the date range picker |
|
|
119
|
+
|
|
120
|
+
##### GanttTask
|
|
121
|
+
|
|
122
|
+
| Name | Type | Description |
|
|
123
|
+
| ------- | -------- | ---------------------------------------------- |
|
|
124
|
+
| `id` | `string` | Unique identifier for the task |
|
|
125
|
+
| `name` | `string` | Display name shown on the bar and in the table |
|
|
126
|
+
| `start` | `Date` | Task start date |
|
|
127
|
+
| `end` | `Date` | Task end date |
|
|
128
|
+
| `color` | `string` | Optional per-task color override |
|
|
@@ -1,138 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
|
-
import React, { useCallback, useState } from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
4
2
|
import { GanttChart } from ".";
|
|
5
|
-
import
|
|
3
|
+
import { StorySection } from "../../storyUtils";
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const meta = { title: "Chart/Gantt Chart" };
|
|
6
|
+
export default meta;
|
|
8
7
|
|
|
9
|
-
stories.addParameters({
|
|
10
|
-
readme: {
|
|
11
|
-
content: README,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
stories.add("Gantt Chart", () => {
|
|
16
|
-
const today = new Date();
|
|
17
|
-
const oneDay = 24 * 60 * 60 * 1000;
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
id: "task1",
|
|
22
|
-
name: "Project Planning",
|
|
23
|
-
start: new Date(today.getTime() - 5 * oneDay),
|
|
24
|
-
end: new Date(today.getTime() - 3 * oneDay),
|
|
25
|
-
duration: 2,
|
|
26
|
-
progress: 100,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "task2",
|
|
30
|
-
name: "Design Phase",
|
|
31
|
-
start: new Date(today.getTime() - 3 * oneDay),
|
|
32
|
-
end: new Date(today.getTime() + 2 * oneDay),
|
|
33
|
-
duration: 5,
|
|
34
|
-
progress: 75,
|
|
35
|
-
dependencies: ["task1"],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: "task3",
|
|
39
|
-
name: "Development",
|
|
40
|
-
start: new Date(today.getTime()),
|
|
41
|
-
end: new Date(today.getTime() + 10 * oneDay),
|
|
42
|
-
duration: 10,
|
|
43
|
-
progress: 40,
|
|
44
|
-
dependencies: ["task2"],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: "task4",
|
|
48
|
-
name: "Testing",
|
|
49
|
-
start: new Date(today.getTime() + 8 * oneDay),
|
|
50
|
-
end: new Date(today.getTime() + 12 * oneDay),
|
|
51
|
-
duration: 4,
|
|
52
|
-
progress: 0,
|
|
53
|
-
dependencies: ["task3"],
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: "task5",
|
|
57
|
-
name: "Deployment",
|
|
58
|
-
start: new Date(today.getTime() + 12 * oneDay),
|
|
59
|
-
end: new Date(today.getTime() + 14 * oneDay),
|
|
60
|
-
duration: 2,
|
|
61
|
-
progress: 0,
|
|
62
|
-
dependencies: ["task4"],
|
|
63
|
-
},
|
|
64
|
-
]);
|
|
9
|
+
const today = new Date();
|
|
10
|
+
const day = 24 * 60 * 60 * 1000;
|
|
65
11
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
12
|
+
const baseTasks = [
|
|
13
|
+
{
|
|
14
|
+
id: "task1",
|
|
15
|
+
name: "Planning",
|
|
16
|
+
start: new Date(today.getTime() - 5 * day),
|
|
17
|
+
end: new Date(today.getTime() - 3 * day),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "task2",
|
|
21
|
+
name: "Design",
|
|
22
|
+
start: new Date(today.getTime() - 3 * day),
|
|
23
|
+
end: new Date(today.getTime() + 2 * day),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "task3",
|
|
27
|
+
name: "Development",
|
|
28
|
+
start: new Date(today.getTime()),
|
|
29
|
+
end: new Date(today.getTime() + 10 * day),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "task4",
|
|
33
|
+
name: "Testing",
|
|
34
|
+
start: new Date(today.getTime() + 8 * day),
|
|
35
|
+
end: new Date(today.getTime() + 12 * day),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "task5",
|
|
39
|
+
name: "Deployment",
|
|
40
|
+
start: new Date(today.getTime() + 12 * day),
|
|
41
|
+
end: new Date(today.getTime() + 14 * day),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
69
44
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
console.log(`Tasks updated: ${tasks.length} tasks`);
|
|
73
|
-
}, []);
|
|
45
|
+
export const GanttChartStory = () => {
|
|
46
|
+
const [tasks, setTasks] = useState(baseTasks);
|
|
74
47
|
|
|
75
48
|
return (
|
|
76
49
|
<>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<
|
|
98
|
-
title="
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
50
|
+
<StorySection
|
|
51
|
+
title="Read Mode"
|
|
52
|
+
description="Default display mode. Renders a horizontal range bar chart. Each task in the tasks array becomes one bar. colors are applied per task in order."
|
|
53
|
+
>
|
|
54
|
+
<div className="w-full">
|
|
55
|
+
<GanttChart
|
|
56
|
+
title="Project Timeline"
|
|
57
|
+
tasks={tasks}
|
|
58
|
+
showGrid={true}
|
|
59
|
+
showTooltip={true}
|
|
60
|
+
showDataLabel={true}
|
|
61
|
+
showToolbar={true}
|
|
62
|
+
onClick={(taskId, taskName) =>
|
|
63
|
+
alert(`Clicked: ${taskName} (${taskId})`)
|
|
64
|
+
}
|
|
65
|
+
colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</StorySection>
|
|
69
|
+
|
|
70
|
+
<StorySection
|
|
71
|
+
title="Write Mode"
|
|
72
|
+
description="mode='write' renders an editable table above the chart. Tasks can be added, edited inline, and deleted. onTaskChange is called with the updated task array on every change."
|
|
73
|
+
>
|
|
74
|
+
<div className="w-full">
|
|
75
|
+
<GanttChart
|
|
76
|
+
title="Project Timeline"
|
|
77
|
+
label="Tasks"
|
|
78
|
+
tasks={tasks}
|
|
79
|
+
mode="write"
|
|
80
|
+
onTaskChange={(updated) => setTasks(updated)}
|
|
81
|
+
onClick={(taskId, taskName) =>
|
|
82
|
+
alert(`Clicked: ${taskName} (${taskId})`)
|
|
83
|
+
}
|
|
84
|
+
showGrid={true}
|
|
85
|
+
showTooltip={true}
|
|
86
|
+
showDataLabel={true}
|
|
87
|
+
colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</StorySection>
|
|
91
|
+
|
|
92
|
+
<StorySection
|
|
93
|
+
title="Date Range Picker"
|
|
94
|
+
description="dateRangeVisible=true shows a date range picker below the chart. Pass customDate to pre-select a range and onChangeDate to handle updates."
|
|
95
|
+
>
|
|
96
|
+
<div className="w-full">
|
|
97
|
+
<GanttChart
|
|
98
|
+
title="Project Timeline"
|
|
99
|
+
tasks={tasks}
|
|
100
|
+
dateRangeVisible={true}
|
|
101
|
+
showTooltip={true}
|
|
102
|
+
showDataLabel={true}
|
|
103
|
+
onChangeDate={(range) => console.log("Date range changed", range)}
|
|
104
|
+
colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</StorySection>
|
|
109
108
|
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
109
|
+
<StorySection
|
|
110
|
+
title="Dark Mode"
|
|
111
|
+
description="darkMode=true switches axis labels and text to white. darkModeBg sets the card background. enableGradient applies a gradient fill to bars."
|
|
112
|
+
dark
|
|
113
|
+
>
|
|
114
|
+
<div className="w-full">
|
|
115
|
+
<GanttChart
|
|
116
|
+
title="Development Sprint"
|
|
117
|
+
tasks={tasks.slice(1, 4)}
|
|
118
|
+
darkMode={true}
|
|
119
|
+
darkModeBg="bg-gray-900"
|
|
120
|
+
borderColor="#374151"
|
|
121
|
+
enableGradient={true}
|
|
122
|
+
showTooltip={true}
|
|
123
|
+
showDataLabel={true}
|
|
124
|
+
colors={["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6"]}
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</StorySection>
|
|
124
128
|
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
<StorySection
|
|
130
|
+
title="Chart Only"
|
|
131
|
+
description="chartOnly=true strips the card wrapper and renders just the chart. Use containerStyle to control the dimensions."
|
|
132
|
+
>
|
|
133
|
+
<div className="w-full h-64">
|
|
134
|
+
<GanttChart
|
|
135
|
+
title="Minimal"
|
|
136
|
+
tasks={tasks.slice(0, 3)}
|
|
137
|
+
chartOnly={true}
|
|
138
|
+
containerStyle="h-64 w-full"
|
|
139
|
+
showDataLabel={false}
|
|
140
|
+
showToolbar={false}
|
|
141
|
+
showTooltip={true}
|
|
142
|
+
colors={["#008FFB", "#00E396", "#FEB019"]}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</StorySection>
|
|
136
146
|
</>
|
|
137
147
|
);
|
|
138
|
-
}
|
|
148
|
+
}
|