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,175 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Stepper } from ".";
|
|
4
|
+
import { Tag } from "../tag";
|
|
5
|
+
import README from "./README.md";
|
|
6
|
+
|
|
7
|
+
const stories = storiesOf("Display", module);
|
|
8
|
+
|
|
9
|
+
stories.addParameters({
|
|
10
|
+
readme: {
|
|
11
|
+
content: README,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
stories.add("Stepper", () => {
|
|
16
|
+
const [stepIndex, setStepIndex] = useState(2);
|
|
17
|
+
const steps = [
|
|
18
|
+
{
|
|
19
|
+
title: "Create account",
|
|
20
|
+
description: "Vitae sed mi luctus laoreet.",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "Profile information",
|
|
24
|
+
description: "Cursus semper viverra facilisis et et some more.",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: "Business information",
|
|
28
|
+
description: "Penatibus eu quis ante.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "Theme",
|
|
32
|
+
description: "Faucibus nec enim leo et.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Preview",
|
|
36
|
+
description: "Iusto et officia maiores porro ad non quas.",
|
|
37
|
+
icon: (
|
|
38
|
+
<Tag tagText={stepIndex < 4 ? "Pending" : "In Progress"} size="small" />
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const stepsWithSubSteps = [
|
|
44
|
+
{
|
|
45
|
+
title: "Create account",
|
|
46
|
+
description: "Vitae sed mi luctus laoreet.",
|
|
47
|
+
subSteps: [
|
|
48
|
+
{
|
|
49
|
+
title: "Verify email",
|
|
50
|
+
description: "Check your inbox",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: "Set password",
|
|
54
|
+
description: "Choose a strong password",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "Verify email",
|
|
58
|
+
description: "Check your inbox",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: "Set password",
|
|
62
|
+
description: "Choose a strong password",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: "Profile information",
|
|
68
|
+
description: "Cursus semper viverra facilisis et et some more.",
|
|
69
|
+
subSteps: [
|
|
70
|
+
{
|
|
71
|
+
title: "Personal details",
|
|
72
|
+
description: "Enter your name and contact",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: "Business information",
|
|
78
|
+
description: "Penatibus eu quis ante.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "Theme",
|
|
82
|
+
description: "Faucibus nec enim leo et.",
|
|
83
|
+
subSteps: [
|
|
84
|
+
{
|
|
85
|
+
title: "Select colors",
|
|
86
|
+
description: "Choose your brand colors",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: "Upload logo",
|
|
90
|
+
description: "Add your company logo",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: "Preview theme",
|
|
94
|
+
description: "See how it looks",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: "Preview",
|
|
100
|
+
description: "Iusto et officia maiores porro ad non quas.",
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
return (
|
|
104
|
+
<>
|
|
105
|
+
<div className="font-medium"> Vertical Stepper</div>
|
|
106
|
+
<Stepper
|
|
107
|
+
steps={steps}
|
|
108
|
+
className="mt-5"
|
|
109
|
+
stepIndex={stepIndex}
|
|
110
|
+
onChange={(index) => {
|
|
111
|
+
setStepIndex(index);
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
<div className="bg-primary-700 my-4 p-4">
|
|
115
|
+
<div className="font-medium text-white">Dark Mode Vertical Stepper</div>
|
|
116
|
+
<Stepper
|
|
117
|
+
steps={steps}
|
|
118
|
+
className="mt-5"
|
|
119
|
+
stepIndex={stepIndex}
|
|
120
|
+
light={true}
|
|
121
|
+
onChange={(index) => {
|
|
122
|
+
setStepIndex(index);
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div className="mt-5 font-medium"> Horizontal Stepper</div>
|
|
128
|
+
<Stepper
|
|
129
|
+
steps={steps}
|
|
130
|
+
className="mt-5"
|
|
131
|
+
horizontal={true}
|
|
132
|
+
stepIndex={stepIndex}
|
|
133
|
+
onChange={(index) => {
|
|
134
|
+
setStepIndex(index);
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
<div className="mt-10 font-medium"> Vertical Stepper with Sub-steps</div>
|
|
139
|
+
<Stepper
|
|
140
|
+
steps={stepsWithSubSteps}
|
|
141
|
+
className="mt-5"
|
|
142
|
+
stepIndex={stepIndex}
|
|
143
|
+
onChange={(index) => {
|
|
144
|
+
setStepIndex(index);
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<div className="bg-primary-700 my-4 p-4">
|
|
149
|
+
<div className="font-medium text-white">
|
|
150
|
+
Dark Mode Vertical Stepper with Sub-steps
|
|
151
|
+
</div>
|
|
152
|
+
<Stepper
|
|
153
|
+
steps={stepsWithSubSteps}
|
|
154
|
+
className="mt-5"
|
|
155
|
+
stepIndex={stepIndex}
|
|
156
|
+
light={true}
|
|
157
|
+
onChange={(index) => {
|
|
158
|
+
setStepIndex(index);
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div className="mt-5 font-medium"> Horizontal Stepper with Sub-steps</div>
|
|
164
|
+
<Stepper
|
|
165
|
+
steps={stepsWithSubSteps}
|
|
166
|
+
className="mt-5"
|
|
167
|
+
horizontal={true}
|
|
168
|
+
stepIndex={stepIndex}
|
|
169
|
+
onChange={(index) => {
|
|
170
|
+
setStepIndex(index);
|
|
171
|
+
}}
|
|
172
|
+
/>
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A data table with pagination, checkboxes, grouped headers, dark mode, inline editing, and row-level add/delete support.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { Table, TableHeader } from "blixify-ui-web/display/table";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Cursor pagination:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const [pageIndex, setPageIndex] = useState(0);
|
|
21
|
+
const [selectedIds, setSelectedIds] = useState<string[]>([]);
|
|
22
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
23
|
+
|
|
24
|
+
<Table
|
|
25
|
+
header={[
|
|
26
|
+
{ key: "id", title: "Id" },
|
|
27
|
+
{ key: "name", title: "Name" },
|
|
28
|
+
{ key: "age", title: "Age" },
|
|
29
|
+
]}
|
|
30
|
+
data={data}
|
|
31
|
+
loading={false}
|
|
32
|
+
checkbox={true}
|
|
33
|
+
selectedIds={selectedIds}
|
|
34
|
+
selectAll={selectAll}
|
|
35
|
+
paginationType="cursor"
|
|
36
|
+
cursor={cursor}
|
|
37
|
+
limit={10}
|
|
38
|
+
pageIndex={pageIndex}
|
|
39
|
+
handleUpdatePageIndex={(value) => {
|
|
40
|
+
if (typeof value === "number") setPageIndex(value);
|
|
41
|
+
else setPageIndex((p) => value === "next" ? p + 1 : p - 1);
|
|
42
|
+
}}
|
|
43
|
+
handleSelectedIds={setSelectedIds}
|
|
44
|
+
handleSelectAll={setSelectAll}
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Page pagination with grouped headers and dark mode:
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
<Table
|
|
52
|
+
header={[
|
|
53
|
+
{ key: "name", title: "Name" },
|
|
54
|
+
{ key: "remarks", title: "Remarks", width: "w-96" },
|
|
55
|
+
{
|
|
56
|
+
key: "course",
|
|
57
|
+
title: "Courses",
|
|
58
|
+
groupData: [
|
|
59
|
+
{ key: "english", title: "English Course", width: "w-96" },
|
|
60
|
+
{ key: "math", title: "Math Course" },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
]}
|
|
64
|
+
data={data}
|
|
65
|
+
loading={false}
|
|
66
|
+
paginationType="page"
|
|
67
|
+
size={data.length}
|
|
68
|
+
limit={10}
|
|
69
|
+
pageIndex={pageIndex}
|
|
70
|
+
darkMode={true}
|
|
71
|
+
darkModeBg="bg-slate-800"
|
|
72
|
+
disableEllipsisOnLongWord
|
|
73
|
+
handleUpdatePageIndex={handlePagination}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
##### Required props
|
|
78
|
+
|
|
79
|
+
| Name | Type | Description |
|
|
80
|
+
| --------- | --------------- | ----------------------------------------------- |
|
|
81
|
+
| `header` | `TableHeader[]` | Column definitions — see TableHeader below |
|
|
82
|
+
| `data` | `object[]` | Row data. Each object should have an `id` field |
|
|
83
|
+
| `loading` | `boolean` | Shows a loading state when `true` |
|
|
84
|
+
|
|
85
|
+
##### Optional props
|
|
86
|
+
|
|
87
|
+
| Name | Type | Default | Description |
|
|
88
|
+
| --------------------------- | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
89
|
+
| `checkbox` | `boolean` | `false` | Show a checkbox column for row selection |
|
|
90
|
+
| `singleSelect` | `boolean` | — | Restrict selection to one row at a time |
|
|
91
|
+
| `selectedIds` | `string[]` | — | Required when `checkbox` is `true` |
|
|
92
|
+
| `selectAll` | `boolean` | `false` | Required when `checkbox` is `true` |
|
|
93
|
+
| `selectAllText` | `string` | — | Text shown in the "select all pages" banner |
|
|
94
|
+
| `disableSelectFullData` | `boolean` | `false` | Hides the "select all pages" option |
|
|
95
|
+
| `paginationType` | `"cursor" \| "page"` | — | Enables pagination. `"cursor"` for token-based (e.g. Firestore), `"page"` for numbered pages |
|
|
96
|
+
| `limit` | `number` | `10` | Rows per page. Required when `paginationType` is set |
|
|
97
|
+
| `pageIndex` | `number` | — | Current page index (0-based). Required when `paginationType` is set |
|
|
98
|
+
| `cursor` | `string \| Date` | `""` | Pass a non-empty value while more pages exist; pass `""` on the last page. Required when `paginationType="cursor"` |
|
|
99
|
+
| `size` | `number` | — | Total record count. Required when `paginationType="page"` to calculate page count |
|
|
100
|
+
| `hidePagination` | `boolean` | `false` | Hide the pagination bar |
|
|
101
|
+
| `fixedPagination` | `boolean` | — | Fix the pagination bar to the bottom of the viewport |
|
|
102
|
+
| `showId` | `boolean` | — | Include the `id` field in rendered row data |
|
|
103
|
+
| `disableEllipsisOnLongWord` | `boolean` | — | When `true`, long text wraps instead of being truncated with an ellipsis |
|
|
104
|
+
| `className` | `string` | — | Tailwind classes applied to the outer container |
|
|
105
|
+
| `darkMode` | `boolean` | `false` | Switches the table to a dark theme |
|
|
106
|
+
| `darkModeBg` | `string` | — | Tailwind bg class for the dark mode table background, e.g. `"bg-slate-800"` |
|
|
107
|
+
| `tableHeaderBgColor` | `string` | — | Tailwind bg class for the header row |
|
|
108
|
+
| `tableHeaderTextColor` | `string` | — | Tailwind text class for the header row |
|
|
109
|
+
| `newTabUrl` | `string` | — | Prepends a link to each row. The row `id` is appended to this URL |
|
|
110
|
+
| `addNewTabUrl` | `string` | — | URL appended to the add-row action link |
|
|
111
|
+
| `multiActionButton` | `ReactElement` | — | Extra action buttons shown in the toolbar when rows are selected |
|
|
112
|
+
| `spaceData` | `any[]` | — | Parsed space data for use with the Data Template module |
|
|
113
|
+
| `devSettings` | `DevSettings` | — | Server/DB settings for the Data Template module |
|
|
114
|
+
| `bareSettings` | `BareSettings` | — | Bare settings variant for the Data Template module |
|
|
115
|
+
| `lib` | `{ axios?: any; firebase?: any }` | — | Pass `axios` (and optionally `firebase`) for data operations |
|
|
116
|
+
| `addable` | `AddableProps` | — | Enables an add-row form at the bottom of the table — see addable below |
|
|
117
|
+
| `editable` | `EditableProps` | — | Enables inline cell editing on click — see editable below |
|
|
118
|
+
| `deleteable` | `DeleteableProps` | — | Adds a delete button to each row — see deleteable below |
|
|
119
|
+
| `advSettings` | `AdvancedSettings` | — | Enables drag-to-reorder columns, sort, and filter features |
|
|
120
|
+
| `onClickRow` | `(id: string) => void` | — | Called with the row id when a row is clicked |
|
|
121
|
+
| `handleUpdatePageIndex` | `(value: string \| number) => void` | — | Called with `"next"`, `"prev"`, or a page number when the user navigates |
|
|
122
|
+
| `handleSelectedIds` | `(value: string[]) => void` | — | Called with the updated selection array when rows are checked |
|
|
123
|
+
| `handleSelectAll` | `(value: boolean) => void` | — | Called when the select-all checkbox is toggled |
|
|
124
|
+
|
|
125
|
+
##### TableHeader
|
|
126
|
+
|
|
127
|
+
| Name | Type | Description |
|
|
128
|
+
| ----------- | -------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
129
|
+
| `key` | `string` | Key in the row data object |
|
|
130
|
+
| `title` | `string` | Column header label |
|
|
131
|
+
| `type` | `DataType` | Optional — Data Template type for rendering typed cells (text, date, address, etc.) |
|
|
132
|
+
| `groupData` | `{ key: string; title: string; width?: string }[]` | Optional — renders sub-columns under this header |
|
|
133
|
+
| `width` | `string` | Optional — Tailwind width class for this column, e.g. `"w-96"` |
|
|
134
|
+
|
|
135
|
+
##### addable
|
|
136
|
+
|
|
137
|
+
Pass as `addable={{ active: true, onAddData: ... }}`.
|
|
138
|
+
|
|
139
|
+
| Name | Type | Description |
|
|
140
|
+
| ----------- | ---------------------------------------- | -------------------------------------------------- |
|
|
141
|
+
| `active` | `boolean` | Renders an add-row form at the bottom of the table |
|
|
142
|
+
| `onAddData` | `(data: { [key: string]: any }) => void` | Called with the new row data when submitted |
|
|
143
|
+
|
|
144
|
+
##### editable
|
|
145
|
+
|
|
146
|
+
Pass as `editable={{ active: true, onUpdateData: ... }}`.
|
|
147
|
+
|
|
148
|
+
| Name | Type | Description |
|
|
149
|
+
| -------------- | --------------------------------------------------------------- | ---------------------------------------------- |
|
|
150
|
+
| `active` | `boolean` | Makes cells clickable for inline editing |
|
|
151
|
+
| `onUpdateData` | `(rowId: string, columnId: string, data: any) => Promise<void>` | Called when a cell edit is committed (on blur) |
|
|
152
|
+
|
|
153
|
+
##### deleteable
|
|
154
|
+
|
|
155
|
+
Pass as `deleteable={{ active: true, onDeleteData: ... }}`.
|
|
156
|
+
|
|
157
|
+
| Name | Type | Description |
|
|
158
|
+
| -------------- | ------------------------- | --------------------------------------------- |
|
|
159
|
+
| `active` | `boolean` | Adds a delete button to each row |
|
|
160
|
+
| `onDeleteData` | `(rowId: string) => void` | Called with the row id when delete is clicked |
|
|
161
|
+
|
|
162
|
+
##### AdvancedSettings
|
|
163
|
+
|
|
164
|
+
| Name | Type | Description |
|
|
165
|
+
| ------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
166
|
+
| `dragEnabled` | `boolean` | Allow columns to be reordered by drag-and-drop |
|
|
167
|
+
| `sortEnabled` | `boolean` | Show sort controls on column headers |
|
|
168
|
+
| `filterEnabled` | `boolean` | Show filter controls on column headers |
|
|
169
|
+
| `addColumnEnabled` | `boolean` | Show an add-column button |
|
|
170
|
+
| `sortId` | `Sort` | Currently active sort |
|
|
171
|
+
| `sortOptions` | `Option[]` | Options for the sort dropdown |
|
|
172
|
+
| `filterOptions` | `Option[]` | Options for the filter dropdown |
|
|
173
|
+
| `renderFilterElements` | `(id: string) => any` | Custom filter UI for a given column id |
|
|
174
|
+
| `renderAddColumnElements` | `(id: string, onClose: any) => any` | Custom add-column UI |
|
|
175
|
+
| `onDragColumn` | `(dragId: string, dropId: string, newHeader: TableHeader[]) => void` | Called after a column is dropped with the updated header list |
|
|
176
|
+
| `onSortColumn` | `(sort: Sort) => void` | Called when a sort is applied |
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
import { Table, TableHeader } from ".";
|
|
5
|
+
import { StorySection } from "../../storyUtils";
|
|
6
|
+
import README from "./README.md";
|
|
7
|
+
|
|
8
|
+
const stories = storiesOf("Display", module);
|
|
9
|
+
|
|
10
|
+
stories.addParameters({
|
|
11
|
+
readme: {
|
|
12
|
+
content: README,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const data = [
|
|
17
|
+
{
|
|
18
|
+
id: "1",
|
|
19
|
+
name: "Andrew",
|
|
20
|
+
age: 10,
|
|
21
|
+
gender: "Male",
|
|
22
|
+
address: { lng: 0, lat: 0, name: "Gopeng" },
|
|
23
|
+
updatedAt: moment().toDate(),
|
|
24
|
+
course: {
|
|
25
|
+
english: "Immediate English class",
|
|
26
|
+
math: "Additional Mathematics",
|
|
27
|
+
},
|
|
28
|
+
remarks:
|
|
29
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam luctus ultricies ipsum id posuere.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "2",
|
|
33
|
+
name: "David",
|
|
34
|
+
age: 10,
|
|
35
|
+
gender: "Male",
|
|
36
|
+
address: { lng: 0, lat: 0, name: "Melaka" },
|
|
37
|
+
updatedAt: moment().toDate(),
|
|
38
|
+
course: {
|
|
39
|
+
english: "Immediate English class (Lorem ipsum dolor sit amet)",
|
|
40
|
+
math: "Additional Mathematics",
|
|
41
|
+
},
|
|
42
|
+
remarks:
|
|
43
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam luctus ultricies ipsum id posuere.",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "3",
|
|
47
|
+
name: "Celine",
|
|
48
|
+
age: 12,
|
|
49
|
+
gender: "Female",
|
|
50
|
+
address: { lng: 0, lat: 0, name: "Johor" },
|
|
51
|
+
updatedAt: moment().toDate(),
|
|
52
|
+
remarks:
|
|
53
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam luctus ultricies ipsum id posuere.",
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const basicHeader: TableHeader[] = [
|
|
58
|
+
{ key: "id", title: "Id" },
|
|
59
|
+
{ key: "name", title: "Name" },
|
|
60
|
+
{ key: "age", title: "Age" },
|
|
61
|
+
{ key: "gender", title: "Gender" },
|
|
62
|
+
{ key: "address", title: "Address" },
|
|
63
|
+
{ key: "updatedAt", title: "Updated At" },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const fullHeader: TableHeader[] = [
|
|
67
|
+
...basicHeader,
|
|
68
|
+
{ key: "remarks", title: "Remarks", width: "w-96" },
|
|
69
|
+
{
|
|
70
|
+
key: "course",
|
|
71
|
+
title: "Courses",
|
|
72
|
+
groupData: [
|
|
73
|
+
{ key: "english", title: "English Course", width: "w-96" },
|
|
74
|
+
{ key: "math", title: "Math Course" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
stories.add("Table", () => {
|
|
80
|
+
const [pageIndex, setPageIndex] = useState(0);
|
|
81
|
+
const [selectedIds, setSelectedIds] = useState<string[]>([]);
|
|
82
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
83
|
+
const limit = 10;
|
|
84
|
+
const cursor = "available";
|
|
85
|
+
|
|
86
|
+
const handlePagination = (value: string | number) => {
|
|
87
|
+
if (typeof value === "number") {
|
|
88
|
+
setPageIndex(value);
|
|
89
|
+
} else {
|
|
90
|
+
setPageIndex((prev) => (value === "next" ? prev + 1 : prev - 1));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<>
|
|
96
|
+
<StorySection
|
|
97
|
+
title="Cursor Pagination"
|
|
98
|
+
description="Use paginationType='cursor' when paginating via a cursor token (e.g. Firestore). Pass cursor='available' while more data exists, or '' when the last page is reached. Requires pageIndex, limit, and handleUpdatePageIndex."
|
|
99
|
+
>
|
|
100
|
+
<div className="w-full">
|
|
101
|
+
<Table
|
|
102
|
+
header={basicHeader}
|
|
103
|
+
data={data}
|
|
104
|
+
loading={false}
|
|
105
|
+
checkbox={true}
|
|
106
|
+
selectedIds={selectedIds}
|
|
107
|
+
selectAll={selectAll}
|
|
108
|
+
paginationType="cursor"
|
|
109
|
+
cursor={cursor}
|
|
110
|
+
limit={limit}
|
|
111
|
+
size={data.length}
|
|
112
|
+
pageIndex={pageIndex}
|
|
113
|
+
handleUpdatePageIndex={handlePagination}
|
|
114
|
+
handleSelectedIds={setSelectedIds}
|
|
115
|
+
handleSelectAll={setSelectAll}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</StorySection>
|
|
119
|
+
|
|
120
|
+
<StorySection
|
|
121
|
+
title="Page Pagination"
|
|
122
|
+
description="Use paginationType='page' for numbered page navigation. Pass size (total record count) so the component can calculate the page count. Supports grouped column headers via groupData."
|
|
123
|
+
>
|
|
124
|
+
<div className="w-full">
|
|
125
|
+
<Table
|
|
126
|
+
header={fullHeader}
|
|
127
|
+
data={data}
|
|
128
|
+
loading={false}
|
|
129
|
+
checkbox={true}
|
|
130
|
+
selectedIds={selectedIds}
|
|
131
|
+
selectAll={selectAll}
|
|
132
|
+
paginationType="page"
|
|
133
|
+
size={data.length}
|
|
134
|
+
limit={limit}
|
|
135
|
+
pageIndex={pageIndex}
|
|
136
|
+
handleUpdatePageIndex={handlePagination}
|
|
137
|
+
handleSelectedIds={setSelectedIds}
|
|
138
|
+
handleSelectAll={setSelectAll}
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</StorySection>
|
|
142
|
+
|
|
143
|
+
<StorySection
|
|
144
|
+
title="Dark Mode"
|
|
145
|
+
description="Pass darkMode=true and darkModeBg to customise the table background. tableHeaderBgColor and tableHeaderTextColor override the header row colours."
|
|
146
|
+
dark
|
|
147
|
+
>
|
|
148
|
+
<div className="w-full">
|
|
149
|
+
<Table
|
|
150
|
+
header={fullHeader}
|
|
151
|
+
data={data}
|
|
152
|
+
loading={false}
|
|
153
|
+
checkbox={true}
|
|
154
|
+
selectedIds={selectedIds}
|
|
155
|
+
selectAll={selectAll}
|
|
156
|
+
paginationType="page"
|
|
157
|
+
size={data.length}
|
|
158
|
+
limit={limit}
|
|
159
|
+
pageIndex={pageIndex}
|
|
160
|
+
darkMode={true}
|
|
161
|
+
darkModeBg="bg-slate-800"
|
|
162
|
+
handleUpdatePageIndex={handlePagination}
|
|
163
|
+
handleSelectedIds={setSelectedIds}
|
|
164
|
+
handleSelectAll={setSelectAll}
|
|
165
|
+
disableEllipsisOnLongWord
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
</StorySection>
|
|
169
|
+
|
|
170
|
+
<StorySection
|
|
171
|
+
title="Single Select"
|
|
172
|
+
description="singleSelect=true restricts selection to one row at a time. The checkbox column still renders but only one id is held in selectedIds."
|
|
173
|
+
>
|
|
174
|
+
<div className="w-full">
|
|
175
|
+
<Table
|
|
176
|
+
header={basicHeader}
|
|
177
|
+
data={data}
|
|
178
|
+
loading={false}
|
|
179
|
+
checkbox={true}
|
|
180
|
+
singleSelect={true}
|
|
181
|
+
selectedIds={selectedIds}
|
|
182
|
+
selectAll={selectAll}
|
|
183
|
+
paginationType="page"
|
|
184
|
+
size={data.length}
|
|
185
|
+
limit={limit}
|
|
186
|
+
pageIndex={pageIndex}
|
|
187
|
+
handleUpdatePageIndex={handlePagination}
|
|
188
|
+
handleSelectedIds={setSelectedIds}
|
|
189
|
+
handleSelectAll={setSelectAll}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</StorySection>
|
|
193
|
+
|
|
194
|
+
<StorySection
|
|
195
|
+
title="Grouped Column Headers"
|
|
196
|
+
description="Add groupData to a TableHeader to render sub-columns under a parent header. Each sub-column maps to a nested key in the row data object."
|
|
197
|
+
>
|
|
198
|
+
<div className="w-full">
|
|
199
|
+
<Table
|
|
200
|
+
header={[
|
|
201
|
+
{ key: "name", title: "Name" },
|
|
202
|
+
{ key: "gender", title: "Gender" },
|
|
203
|
+
{
|
|
204
|
+
key: "course",
|
|
205
|
+
title: "Courses",
|
|
206
|
+
groupData: [
|
|
207
|
+
{ key: "english", title: "English", width: "w-64" },
|
|
208
|
+
{ key: "math", title: "Math" },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
]}
|
|
212
|
+
data={data}
|
|
213
|
+
loading={false}
|
|
214
|
+
paginationType="page"
|
|
215
|
+
size={data.length}
|
|
216
|
+
limit={limit}
|
|
217
|
+
pageIndex={pageIndex}
|
|
218
|
+
handleUpdatePageIndex={handlePagination}
|
|
219
|
+
/>
|
|
220
|
+
</div>
|
|
221
|
+
</StorySection>
|
|
222
|
+
|
|
223
|
+
<StorySection
|
|
224
|
+
title="Row Click + New Tab URL"
|
|
225
|
+
description="onClickRow fires with the row id when a row is clicked. newTabUrl prepends a link to each row — the row id is appended to the URL."
|
|
226
|
+
>
|
|
227
|
+
<div className="w-full">
|
|
228
|
+
<Table
|
|
229
|
+
header={basicHeader}
|
|
230
|
+
data={data}
|
|
231
|
+
loading={false}
|
|
232
|
+
paginationType="page"
|
|
233
|
+
size={data.length}
|
|
234
|
+
limit={limit}
|
|
235
|
+
pageIndex={pageIndex}
|
|
236
|
+
onClickRow={(id) => alert(`Clicked row: ${id}`)}
|
|
237
|
+
handleUpdatePageIndex={handlePagination}
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
</StorySection>
|
|
241
|
+
|
|
242
|
+
<StorySection
|
|
243
|
+
title="Addable"
|
|
244
|
+
description="addable.active=true renders an add-row form at the bottom of the table. onAddData is called with the new row's data object when the user submits."
|
|
245
|
+
>
|
|
246
|
+
<div className="w-full">
|
|
247
|
+
<Table
|
|
248
|
+
header={basicHeader}
|
|
249
|
+
data={data}
|
|
250
|
+
loading={false}
|
|
251
|
+
paginationType="page"
|
|
252
|
+
size={data.length}
|
|
253
|
+
limit={limit}
|
|
254
|
+
pageIndex={pageIndex}
|
|
255
|
+
handleUpdatePageIndex={handlePagination}
|
|
256
|
+
addable={{
|
|
257
|
+
active: true,
|
|
258
|
+
onAddData: (newRow) =>
|
|
259
|
+
alert(`New row: ${JSON.stringify(newRow)}`),
|
|
260
|
+
}}
|
|
261
|
+
/>
|
|
262
|
+
</div>
|
|
263
|
+
</StorySection>
|
|
264
|
+
|
|
265
|
+
<StorySection
|
|
266
|
+
title="Editable"
|
|
267
|
+
description="editable.active=true makes cells clickable for inline editing. onUpdateData is called with (rowId, columnId, newValue) when the user commits a change."
|
|
268
|
+
>
|
|
269
|
+
<div className="w-full">
|
|
270
|
+
<Table
|
|
271
|
+
header={basicHeader}
|
|
272
|
+
data={data}
|
|
273
|
+
loading={false}
|
|
274
|
+
paginationType="page"
|
|
275
|
+
size={data.length}
|
|
276
|
+
limit={limit}
|
|
277
|
+
pageIndex={pageIndex}
|
|
278
|
+
handleUpdatePageIndex={handlePagination}
|
|
279
|
+
editable={{
|
|
280
|
+
active: true,
|
|
281
|
+
onUpdateData: async (rowId, columnId, value) => {
|
|
282
|
+
alert(`Update row ${rowId}, col ${columnId}: ${value}`);
|
|
283
|
+
},
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
</div>
|
|
287
|
+
</StorySection>
|
|
288
|
+
|
|
289
|
+
<StorySection
|
|
290
|
+
title="Deleteable"
|
|
291
|
+
description="deleteable.active=true adds a delete button to each row. onDeleteData is called with the row id when the user clicks delete."
|
|
292
|
+
>
|
|
293
|
+
<div className="w-full">
|
|
294
|
+
<Table
|
|
295
|
+
header={basicHeader}
|
|
296
|
+
data={data}
|
|
297
|
+
loading={false}
|
|
298
|
+
paginationType="page"
|
|
299
|
+
size={data.length}
|
|
300
|
+
limit={limit}
|
|
301
|
+
pageIndex={pageIndex}
|
|
302
|
+
handleUpdatePageIndex={handlePagination}
|
|
303
|
+
deleteable={{
|
|
304
|
+
active: true,
|
|
305
|
+
onDeleteData: (rowId) => alert(`Delete row: ${rowId}`),
|
|
306
|
+
}}
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
</StorySection>
|
|
310
|
+
|
|
311
|
+
<StorySection
|
|
312
|
+
title="Loading State"
|
|
313
|
+
description="Pass loading=true to show a skeleton/loading indicator while data is being fetched."
|
|
314
|
+
>
|
|
315
|
+
<div className="w-full">
|
|
316
|
+
<Table
|
|
317
|
+
header={basicHeader}
|
|
318
|
+
data={[]}
|
|
319
|
+
loading={true}
|
|
320
|
+
paginationType="page"
|
|
321
|
+
size={0}
|
|
322
|
+
limit={limit}
|
|
323
|
+
pageIndex={0}
|
|
324
|
+
handleUpdatePageIndex={handlePagination}
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
</StorySection>
|
|
328
|
+
</>
|
|
329
|
+
);
|
|
330
|
+
});
|