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.
Files changed (135) hide show
  1. package/lib/components/action/button/README.md +12 -11
  2. package/lib/components/action/button/button.stories.tsx +4 -10
  3. package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
  4. package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
  5. package/lib/components/action/radioList/radioList.stories.tsx +4 -10
  6. package/lib/components/action/slider/slider.stories.tsx +4 -10
  7. package/lib/components/action/textButton/textButton.stories.tsx +4 -10
  8. package/lib/components/action/toggle/toggle.stories.tsx +4 -10
  9. package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
  10. package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
  11. package/lib/components/advanced/popUp/README.md +21 -7
  12. package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
  13. package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
  14. package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
  15. package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
  16. package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
  17. package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
  18. package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
  19. package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
  20. package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
  21. package/lib/components/chart/card/card.stories.tsx +4 -10
  22. package/lib/components/chart/ganttChart/README.md +96 -110
  23. package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
  24. package/lib/components/chart/heatmapChart/README.md +93 -82
  25. package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
  26. package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
  27. package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
  28. package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
  29. package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
  30. package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
  31. package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
  32. package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
  33. package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
  34. package/lib/components/chat/chatAnchor/README.md +61 -79
  35. package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
  36. package/lib/components/chat/chatBase/README.md +244 -196
  37. package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
  38. package/lib/components/chat/chatDashboard/README.md +89 -129
  39. package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
  40. package/lib/components/data/dataGraph/README.md +135 -1
  41. package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
  42. package/lib/components/data/dataReference/README.md +141 -43
  43. package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
  44. package/lib/components/data/dataTemplate/README.md +88 -61
  45. package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
  46. package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
  47. package/lib/components/data/dataWrapper/README.md +48 -46
  48. package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
  49. package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
  50. package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
  51. package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
  52. package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
  53. package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
  54. package/lib/components/design/banner/banner.stories.tsx +4 -10
  55. package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
  56. package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
  57. package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
  58. package/lib/components/design/designList/designList.stories.tsx +4 -10
  59. package/lib/components/design/faq/faq.stories.tsx +4 -10
  60. package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
  61. package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
  62. package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
  63. package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
  64. package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
  65. package/lib/components/design/iconList/iconList.stories.tsx +4 -10
  66. package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
  67. package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
  68. package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
  69. package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
  70. package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
  71. package/lib/components/design/pricing/pricing.stories.tsx +4 -10
  72. package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
  73. package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
  74. package/lib/components/design/teams/teams.stories.tsx +4 -10
  75. package/lib/components/display/alert/alert.stories.tsx +4 -10
  76. package/lib/components/display/calendar/README.md +49 -0
  77. package/lib/components/display/calendar/calendar.stories.tsx +71 -28
  78. package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
  79. package/lib/components/display/detailList/detailList.stories.tsx +5 -10
  80. package/lib/components/display/drawer/drawer.stories.tsx +5 -10
  81. package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
  82. package/lib/components/display/feeds/feeds.stories.tsx +4 -10
  83. package/lib/components/display/flexTable/README.md +11 -7
  84. package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
  85. package/lib/components/display/grid/README.md +28 -27
  86. package/lib/components/display/grid/grid.stories.tsx +4 -10
  87. package/lib/components/display/kanban/kanban.stories.tsx +14 -20
  88. package/lib/components/display/list/README.md +30 -29
  89. package/lib/components/display/list/list.stories.tsx +4 -10
  90. package/lib/components/display/loading/loading.stories.tsx +5 -10
  91. package/lib/components/display/mapView/mapView.stories.tsx +4 -10
  92. package/lib/components/display/modal/modal.stories.tsx +4 -11
  93. package/lib/components/display/notification/notification.stories.tsx +4 -10
  94. package/lib/components/display/progress/progress.stories.tsx +5 -10
  95. package/lib/components/display/stepper/stepper.stories.tsx +5 -10
  96. package/lib/components/display/table/README.md +38 -37
  97. package/lib/components/display/table/table.stories.tsx +8 -14
  98. package/lib/components/display/tag/tag.stories.tsx +4 -10
  99. package/lib/components/input/address/address.stories.tsx +4 -10
  100. package/lib/components/input/canvas/canvas.stories.tsx +4 -10
  101. package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
  102. package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
  103. package/lib/components/input/form/form.stories.tsx +4 -10
  104. package/lib/components/input/markdown/markdown.stories.tsx +5 -10
  105. package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
  106. package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
  107. package/lib/components/input/rating/rating.stories.tsx +4 -10
  108. package/lib/components/input/select/README.md +30 -29
  109. package/lib/components/input/select/select.stories.tsx +4 -10
  110. package/lib/components/input/signature/signature.stories.tsx +4 -10
  111. package/lib/components/input/textArea/textArea.stories.tsx +4 -10
  112. package/lib/components/input/textInput/textinput.stories.tsx +4 -10
  113. package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
  114. package/lib/components/navigation/bars/README.md +90 -17
  115. package/lib/components/navigation/bars/bars.stories.tsx +128 -60
  116. package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
  117. package/lib/components/navigation/breadcrumb/README.md +40 -20
  118. package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
  119. package/lib/components/navigation/header/README.md +67 -108
  120. package/lib/components/navigation/header/header.stories.tsx +165 -49
  121. package/lib/components/navigation/leftNav/README.md +121 -66
  122. package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
  123. package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
  124. package/lib/components/structure/column/column.stories.tsx +5 -10
  125. package/lib/components/structure/container/container.stories.tsx +5 -10
  126. package/lib/components/structure/link/link.stories.tsx +4 -10
  127. package/lib/components/structure/text/text.stories.tsx +5 -10
  128. package/lib/components/template/authPage/authPage.stories.tsx +6 -5
  129. package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
  130. package/lib/components/template/productListing/productListing.stories.tsx +7 -13
  131. package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
  132. package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
  133. package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
  134. package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
  135. package/package.json +1 -1
@@ -1,20 +1,14 @@
1
1
  import { PencilIcon } from "@heroicons/react/24/outline";
2
- import { storiesOf } from "@storybook/react";
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 stories = storiesOf("Chart", module);
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
- stories.add("Box Plot Chart", () => {
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(moment().toDate().getDate() - 7);
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: moment().toDate(),
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: moment().toDate(),
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 { storiesOf } from "@storybook/react";
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 stories = storiesOf("Chart", module);
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
- stories.add("Bubble Chart", () => {
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(moment().toDate().getDate() - 7);
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: moment().toDate(),
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: moment().toDate(),
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 stories = storiesOf("Chart", module);
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
- stories.add("Card", () => {
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 Gantt chart component for displaying project timelines and task management. e.g: Project schedules, task dependencies, and progress tracking
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/lib";
12
+ import { GanttChart } from "blixify-ui-web/components/chart/ganttChart";
13
13
  ```
14
14
 
15
15
  ##### Usage
16
16
 
17
- ```jsx
18
- const [ganttTasks, setGanttTasks] = useState<any[]>([]);
17
+ Read mode (display only):
19
18
 
20
- const sampleTasks = [
19
+ ```jsx
20
+ const [tasks, setTasks] = useState([
21
21
  {
22
22
  id: "task1",
23
- name: "Project Planning",
24
- start: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000),
25
- end: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000),
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(Date.now() + 10 * 24 * 60 * 60 * 1000),
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
- const handleTaskClick = useCallback((taskId: string, taskName: string) => {
53
- console.log(`Clicked task: ${taskName} (ID: ${taskId})`);
54
- }, []);
55
-
56
- useEffect(() => {
57
- setGanttTasks(sampleTasks);
58
- }, []);
59
-
60
- return (
61
- <>
62
- <div className="font-medium mb-5">Gantt Chart</div>
63
- <GanttChart
64
- title="Project Timeline"
65
- tasks={ganttTasks}
66
- tool={<CalendarIcon className="h-4 w-4 text-primary-600" />}
67
- dateRangeVisible={true}
68
- customDate={{
69
- startDate: sevenDaysAgo,
70
- endDate: fourteenDaysFromNow,
71
- isDuration: true,
72
- }}
73
- onChangeDate={handleDateRangeChange}
74
- onClick={handleTaskClick}
75
- showDataLabel={true}
76
- showTooltip={true}
77
- colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
78
- />
79
-
80
- {/*
81
- Color mapping:
82
- - Task 1 (Project Planning) → #008FFB (first color)
83
- - Task 2 (Design Phase) → #00E396 (second color)
84
- - Task 3 (Development) → #FEB019 (third color)
85
- - Task 4 (Testing) → #FF4560 (fourth color)
86
- - Task 5 (Deployment) → #775DD0 (fifth color)
87
- */}
88
-
89
- <div className="font-medium my-5">Dark Mode Gantt Chart</div>
90
- <GanttChart
91
- title="Development Sprint"
92
- tasks={ganttTasks.slice(1, 3)}
93
- onClick={handleTaskClick}
94
- darkMode={true}
95
- darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
96
- enableGradient={true}
97
- colors={["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6"]}
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 | Type | Default | Description |
112
- | --------------- | --------------- | ----------- | ---------------------------------------------------------------------------------- |
113
- | `tasks` | `GanttTask[]` | `[]` | Array of task objects for timeline visualization |
114
- | `series` | `GanttSeries[]` | `[]` | Alternative series format for advanced usage |
115
- | `duration` | `object` | `undefined` | Overall project duration with startDate and endDate |
116
- | `showGrid` | `boolean` | `true` | Show/hide grid lines |
117
- | `showTooltip` | `boolean` | `true` | Enable/disable tooltips |
118
- | `showDataLabel` | `boolean` | `true` | Show/hide data labels |
119
- | `showToolbar` | `boolean` | `true` | Show/hide chart toolbar |
120
- | `borderColor` | `string` | `#e7e7e7` | Custom border color |
121
- | `colors` | `string[]` | `undefined` | Array of colors - first task uses first color, second task uses second color, etc. |
122
- | `onClick` | `function` | `undefined` | Callback when task is clicked |
123
-
124
- ##### GanttTask props
125
-
126
- | Name | Type | Description |
127
- | -------------- | ---------- | ------------------------------------ |
128
- | `id` | `string` | Unique identifier for the task |
129
- | `name` | `string` | Display name of the task |
130
- | `start` | `Date` | Task start date |
131
- | `end` | `Date` | Task end date |
132
- | `duration` | `number` | Duration in days (optional) |
133
- | `progress` | `number` | Progress percentage 0-100 |
134
- | `dependencies` | `string[]` | Array of dependent task IDs |
135
- | `color` | `string` | Custom color for the task (optional) |
136
-
137
- ##### GanttSeries props
138
-
139
- | Name | Type | Description |
140
- | ------ | -------- | ----------------------------- |
141
- | `name` | `string` | Series name |
142
- | `data` | `array` | Array of timeline data points |
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 { CalendarIcon } from "@heroicons/react/24/outline";
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 README from "./README.md";
3
+ import { StorySection } from "../../storyUtils";
6
4
 
7
- const stories = storiesOf("Chart", module);
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
- const [ganttTasks, setGanttTasks] = useState<any[]>([
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
- const handleTaskClick = useCallback((taskId: string, taskName: string) => {
67
- console.log(`Clicked task: ${taskName} (ID: ${taskId})`);
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
- const handleTaskChange = useCallback((tasks: any[]) => {
71
- setGanttTasks(tasks);
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
- <div className="font-medium mb-5">
78
- Gantt Chart - Write Mode (Editable)
79
- </div>
80
- <GanttChart
81
- title="Project Management Dashboard"
82
- tasks={ganttTasks}
83
- mode="write"
84
- tool={<CalendarIcon className="h-4 w-4 text-primary-600" />}
85
- dateRangeVisible={true}
86
- onClick={handleTaskClick}
87
- onTaskChange={handleTaskChange}
88
- showDataLabel={true}
89
- showTooltip={true}
90
- showGrid={true}
91
- showToolbar={true}
92
- colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
93
- />
94
- <div className="font-medium mb-5">
95
- Gantt Chart (Individual Task Colors)
96
- </div>
97
- <GanttChart
98
- title="Project Timeline"
99
- tasks={ganttTasks}
100
- tool={<CalendarIcon className="h-4 w-4 text-primary-600" />}
101
- dateRangeVisible={true}
102
- onClick={handleTaskClick}
103
- showDataLabel={true}
104
- showTooltip={true}
105
- showGrid={true}
106
- showToolbar={true}
107
- colors={["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]}
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
- <div className="font-medium my-5">Dark Mode Gantt Chart</div>
111
- <GanttChart
112
- title="Development Sprint"
113
- tasks={ganttTasks.slice(1, 4)}
114
- tool={<CalendarIcon className="h-4 w-4 text-primary-600" />}
115
- onClick={handleTaskClick}
116
- showDataLabel={true}
117
- showTooltip={true}
118
- darkMode={true}
119
- darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
120
- borderColor="#374151"
121
- enableGradient={true}
122
- colors={["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6"]}
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
- <div className="font-medium my-5">Chart Only Mode</div>
126
- <GanttChart
127
- title="Minimal Gantt"
128
- tasks={ganttTasks.slice(0, 3)}
129
- chartOnly={true}
130
- containerStyle="h-64 w-full"
131
- showDataLabel={false}
132
- showToolbar={false}
133
- onClick={handleTaskClick}
134
- colors={["#3B82F6", "#10B981", "#F59E0B"]}
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
+ }