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,181 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { RadioList, RadioListItem } from ".";
|
|
4
|
+
import { TextButton } from "../textButton";
|
|
5
|
+
import README from "./README.md";
|
|
6
|
+
import { StorySection } from "../../storyUtils";
|
|
7
|
+
|
|
8
|
+
const stories = storiesOf("Action", module);
|
|
9
|
+
|
|
10
|
+
stories.addParameters({
|
|
11
|
+
readme: {
|
|
12
|
+
content: README,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const baseList: RadioListItem[] = [
|
|
17
|
+
{
|
|
18
|
+
id: "vegan",
|
|
19
|
+
label: "Vegan",
|
|
20
|
+
content:
|
|
21
|
+
"I follow a plant-based diet, avoiding all animal products including meat, dairy, and eggs.",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "vegetarian",
|
|
25
|
+
label: "Vegetarian",
|
|
26
|
+
content: "I don't eat meat or fish, but dairy and eggs are fine.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "pesca",
|
|
30
|
+
label: "Pescatarian",
|
|
31
|
+
content: "I don't eat meat, but I enjoy fish and seafood.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "glutenFree",
|
|
35
|
+
label: "Gluten-free",
|
|
36
|
+
content:
|
|
37
|
+
"I avoid gluten — no wheat, barley, rye, or anything containing gluten.",
|
|
38
|
+
addContent: <TextButton text="More info" />,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "omni",
|
|
42
|
+
label: "Omnivore (Regular)",
|
|
43
|
+
content:
|
|
44
|
+
"No dietary restrictions — comfortable with meat, dairy, grains, and vegetables.",
|
|
45
|
+
addContent: (
|
|
46
|
+
<img
|
|
47
|
+
alt="omnivore diet"
|
|
48
|
+
src="https://organi.pt/wp-content/uploads/2022/04/dieta-vegan-vegetariana-ou-omnivora-qual-a-mais-saudavel.png"
|
|
49
|
+
className="my-4 rounded-lg h-24"
|
|
50
|
+
/>
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
stories.add("Radio List", () => {
|
|
56
|
+
const [singleValue, setSingleValue] = useState("");
|
|
57
|
+
const [multiValue, setMultiValue] = useState<string[]>([]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className="font-sans max-w-2xl p-6">
|
|
61
|
+
<StorySection
|
|
62
|
+
title="Single Select (Vertical)"
|
|
63
|
+
description={
|
|
64
|
+
<>
|
|
65
|
+
Default radio list. Pass a <code>string</code> to <code>value</code>{" "}
|
|
66
|
+
for single selection. Set <code>optional</code> to allow deselecting
|
|
67
|
+
the current choice.
|
|
68
|
+
</>
|
|
69
|
+
}
|
|
70
|
+
>
|
|
71
|
+
<div className="w-full">
|
|
72
|
+
<RadioList
|
|
73
|
+
id="single-vertical"
|
|
74
|
+
list={baseList}
|
|
75
|
+
value={singleValue}
|
|
76
|
+
optional
|
|
77
|
+
horizontal={false}
|
|
78
|
+
onSelect={(val) => setSingleValue(val)}
|
|
79
|
+
/>
|
|
80
|
+
<p className="mt-4 text-sm text-primary-500 font-semibold">
|
|
81
|
+
Selected:{" "}
|
|
82
|
+
{baseList.find((i) => i.id === singleValue)?.label ?? "None"}
|
|
83
|
+
</p>
|
|
84
|
+
</div>
|
|
85
|
+
</StorySection>
|
|
86
|
+
|
|
87
|
+
<StorySection
|
|
88
|
+
title="Single Select (Horizontal)"
|
|
89
|
+
description={
|
|
90
|
+
<>
|
|
91
|
+
Set <code>horizontal={true}</code> to lay items out in a
|
|
92
|
+
wrapping row instead of a vertical list. Useful for compact option
|
|
93
|
+
sets.
|
|
94
|
+
</>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<div className="w-full">
|
|
98
|
+
<RadioList
|
|
99
|
+
id="single-horizontal"
|
|
100
|
+
list={baseList}
|
|
101
|
+
value={singleValue}
|
|
102
|
+
optional
|
|
103
|
+
horizontal
|
|
104
|
+
onSelect={(val) => setSingleValue(val)}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</StorySection>
|
|
108
|
+
|
|
109
|
+
<StorySection
|
|
110
|
+
title="Multi Select (Checkbox)"
|
|
111
|
+
description={
|
|
112
|
+
<>
|
|
113
|
+
Pass a <code>string[]</code> to <code>value</code> to enable
|
|
114
|
+
multi-select mode. Items render as checkboxes instead of radio
|
|
115
|
+
buttons.
|
|
116
|
+
</>
|
|
117
|
+
}
|
|
118
|
+
>
|
|
119
|
+
<div className="w-full">
|
|
120
|
+
<RadioList
|
|
121
|
+
id="multi"
|
|
122
|
+
list={baseList}
|
|
123
|
+
value={multiValue}
|
|
124
|
+
optional
|
|
125
|
+
onSelect={(val) => setMultiValue(val)}
|
|
126
|
+
/>
|
|
127
|
+
<p className="mt-4 text-sm text-primary-500 font-semibold">
|
|
128
|
+
Selected: {multiValue.length > 0 ? multiValue.join(", ") : "None"}
|
|
129
|
+
</p>
|
|
130
|
+
</div>
|
|
131
|
+
</StorySection>
|
|
132
|
+
|
|
133
|
+
<StorySection
|
|
134
|
+
title="New Value Input"
|
|
135
|
+
description={
|
|
136
|
+
<>
|
|
137
|
+
Set <code>newValue={true}</code> to show an "+ Add new
|
|
138
|
+
value" button. The user can type a custom option which gets added to
|
|
139
|
+
the list and selected. Use <code>placeholder</code> to customise the
|
|
140
|
+
input hint text.
|
|
141
|
+
</>
|
|
142
|
+
}
|
|
143
|
+
>
|
|
144
|
+
<div className="w-full">
|
|
145
|
+
<RadioList
|
|
146
|
+
id="new-value"
|
|
147
|
+
list={baseList}
|
|
148
|
+
value={multiValue}
|
|
149
|
+
optional
|
|
150
|
+
newValue
|
|
151
|
+
placeholder="Enter a custom diet..."
|
|
152
|
+
onSelect={(val) => setMultiValue(val)}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</StorySection>
|
|
156
|
+
|
|
157
|
+
<StorySection
|
|
158
|
+
title="Disabled Items"
|
|
159
|
+
description={
|
|
160
|
+
<>
|
|
161
|
+
Set <code>disabled: true</code> on individual{" "}
|
|
162
|
+
<code>RadioListItem</code> entries to prevent interaction with
|
|
163
|
+
specific options.
|
|
164
|
+
</>
|
|
165
|
+
}
|
|
166
|
+
>
|
|
167
|
+
<div className="w-full">
|
|
168
|
+
<RadioList
|
|
169
|
+
id="disabled-items"
|
|
170
|
+
list={baseList.map((item, i) =>
|
|
171
|
+
i === 1 || i === 3 ? { ...item, disabled: true } : item
|
|
172
|
+
)}
|
|
173
|
+
value={singleValue}
|
|
174
|
+
optional
|
|
175
|
+
onSelect={(val) => setSingleValue(val)}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
</StorySection>
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A slider for selecting a single value or a range. Supports step intervals and enforces a minimum gap between range handles.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { Slider } from "blixify-ui-web/action/slider";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Single value:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const [value, setValue] = useState("50");
|
|
21
|
+
|
|
22
|
+
<Slider
|
|
23
|
+
value={value}
|
|
24
|
+
minValue="0"
|
|
25
|
+
maxValue="100"
|
|
26
|
+
onChangeValue={(val) => setValue(val)}
|
|
27
|
+
/>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Single value with step:
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
<Slider
|
|
34
|
+
value={value}
|
|
35
|
+
minValue="0"
|
|
36
|
+
maxValue="100"
|
|
37
|
+
step="10"
|
|
38
|
+
onChangeValue={(val) => setValue(val)}
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Range:
|
|
43
|
+
|
|
44
|
+
```jsx
|
|
45
|
+
const [min, setMin] = useState("20");
|
|
46
|
+
const [max, setMax] = useState("80");
|
|
47
|
+
|
|
48
|
+
<Slider
|
|
49
|
+
type="range"
|
|
50
|
+
min={min}
|
|
51
|
+
max={max}
|
|
52
|
+
minValue="0"
|
|
53
|
+
maxValue="100"
|
|
54
|
+
onChangeValue={(min, max) => {
|
|
55
|
+
setMin(min);
|
|
56
|
+
setMax(max);
|
|
57
|
+
}}
|
|
58
|
+
/>;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
##### Required props
|
|
62
|
+
|
|
63
|
+
Single value mode (`type="single"` or omitted):
|
|
64
|
+
|
|
65
|
+
| Name | Type | Description |
|
|
66
|
+
| --------------- | ------------------------- | ------------------------------------ |
|
|
67
|
+
| `value` | `string` | Current value of the slider |
|
|
68
|
+
| `onChangeValue` | `(value: string) => void` | Called when the slider value changes |
|
|
69
|
+
|
|
70
|
+
Range mode (`type="range"`):
|
|
71
|
+
|
|
72
|
+
| Name | Type | Description |
|
|
73
|
+
| --------------- | ------------------------------------ | ------------------------------------- |
|
|
74
|
+
| `type` | `"range"` | Must be set to `"range"` |
|
|
75
|
+
| `min` | `string` | Current minimum of the selected range |
|
|
76
|
+
| `max` | `string` | Current maximum of the selected range |
|
|
77
|
+
| `onChangeValue` | `(min: string, max: string) => void` | Called when either handle moves |
|
|
78
|
+
|
|
79
|
+
##### Optional props
|
|
80
|
+
|
|
81
|
+
| Name | Type | Default | Description |
|
|
82
|
+
| ----------- | -------- | ------- | ------------------------------------------------------------- |
|
|
83
|
+
| `minValue` | `string` | `"0"` | Lower bound of the track |
|
|
84
|
+
| `maxValue` | `string` | `"100"` | Upper bound of the track |
|
|
85
|
+
| `step` | `string` | `"1"` | Snap interval for the thumb(s) |
|
|
86
|
+
| `className` | `string` | `""` | Additional Tailwind classes applied to the single-value input |
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Slider } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
import { StorySection } from "../../storyUtils";
|
|
6
|
+
|
|
7
|
+
const stories = storiesOf("Action", module);
|
|
8
|
+
|
|
9
|
+
stories.addParameters({
|
|
10
|
+
readme: {
|
|
11
|
+
content: README,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
stories.add("Slider", () => {
|
|
16
|
+
const [single, setSingle] = useState("50");
|
|
17
|
+
const [steppedValue, setSteppedValue] = useState("50");
|
|
18
|
+
const [rangeMin, setRangeMin] = useState("20");
|
|
19
|
+
const [rangeMax, setRangeMax] = useState("80");
|
|
20
|
+
const [invalidMin, setInvalidMin] = useState("50");
|
|
21
|
+
const [invalidMax, setInvalidMax] = useState("50");
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="font-sans max-w-2xl p-6">
|
|
25
|
+
<StorySection
|
|
26
|
+
title="Single Value"
|
|
27
|
+
description={
|
|
28
|
+
<>
|
|
29
|
+
Default mode. Pass a <code>string</code> to <code>value</code> and
|
|
30
|
+
handle updates via <code>onChangeValue</code>. Use{" "}
|
|
31
|
+
<code>minValue</code> and <code>maxValue</code> to set the track
|
|
32
|
+
bounds.
|
|
33
|
+
</>
|
|
34
|
+
}
|
|
35
|
+
>
|
|
36
|
+
<div className="w-full space-y-2">
|
|
37
|
+
<Slider
|
|
38
|
+
value={single}
|
|
39
|
+
minValue="0"
|
|
40
|
+
maxValue="100"
|
|
41
|
+
onChangeValue={(val) => setSingle(val)}
|
|
42
|
+
/>
|
|
43
|
+
<p className="text-sm text-gray-600">
|
|
44
|
+
Value: <span className="font-medium">{single}</span>
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
</StorySection>
|
|
48
|
+
|
|
49
|
+
<StorySection
|
|
50
|
+
title="Single Value with Step"
|
|
51
|
+
description={
|
|
52
|
+
<>
|
|
53
|
+
Use <code>step</code> to control the increment interval. Here{" "}
|
|
54
|
+
<code>step="10"</code> snaps the thumb to multiples of 10.
|
|
55
|
+
</>
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
<div className="w-full space-y-2">
|
|
59
|
+
<Slider
|
|
60
|
+
value={steppedValue}
|
|
61
|
+
minValue="0"
|
|
62
|
+
maxValue="100"
|
|
63
|
+
step="10"
|
|
64
|
+
onChangeValue={(val) => setSteppedValue(val)}
|
|
65
|
+
/>
|
|
66
|
+
<p className="text-sm text-gray-600">
|
|
67
|
+
Value: <span className="font-medium">{steppedValue}</span>
|
|
68
|
+
</p>
|
|
69
|
+
</div>
|
|
70
|
+
</StorySection>
|
|
71
|
+
|
|
72
|
+
<StorySection
|
|
73
|
+
title="Range"
|
|
74
|
+
description={
|
|
75
|
+
<>
|
|
76
|
+
Set <code>type="range"</code> and provide <code>min</code> /{" "}
|
|
77
|
+
<code>max</code> for the current selection.{" "}
|
|
78
|
+
<code>onChangeValue</code> receives both values as{" "}
|
|
79
|
+
<code>(min, max)</code>. The component enforces a minimum gap
|
|
80
|
+
between handles.
|
|
81
|
+
</>
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
<div className="w-full space-y-2">
|
|
85
|
+
<Slider
|
|
86
|
+
type="range"
|
|
87
|
+
min={rangeMin}
|
|
88
|
+
max={rangeMax}
|
|
89
|
+
minValue="0"
|
|
90
|
+
maxValue="100"
|
|
91
|
+
onChangeValue={(min, max) => {
|
|
92
|
+
setRangeMin(min);
|
|
93
|
+
setRangeMax(max);
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<p className="text-sm text-gray-600">
|
|
97
|
+
Range: <span className="font-medium">{rangeMin}</span> –{" "}
|
|
98
|
+
<span className="font-medium">{rangeMax}</span>
|
|
99
|
+
</p>
|
|
100
|
+
</div>
|
|
101
|
+
</StorySection>
|
|
102
|
+
|
|
103
|
+
<StorySection
|
|
104
|
+
title="Range — Invalid Initial State"
|
|
105
|
+
description={
|
|
106
|
+
<>
|
|
107
|
+
When <code>min</code> equals <code>max</code> on mount, the
|
|
108
|
+
component automatically adjusts the values to maintain the minimum
|
|
109
|
+
gap and shows an inline error message.
|
|
110
|
+
</>
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<div className="w-full space-y-2">
|
|
114
|
+
<Slider
|
|
115
|
+
type="range"
|
|
116
|
+
min={invalidMin}
|
|
117
|
+
max={invalidMax}
|
|
118
|
+
minValue="0"
|
|
119
|
+
maxValue="100"
|
|
120
|
+
onChangeValue={(min, max) => {
|
|
121
|
+
setInvalidMin(min);
|
|
122
|
+
setInvalidMax(max);
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
<p className="text-sm text-gray-600">
|
|
126
|
+
Range: <span className="font-medium">{invalidMin}</span> –{" "}
|
|
127
|
+
<span className="font-medium">{invalidMax}</span>
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
</StorySection>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Text Button
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A text component for triggering a user action. e.g: a submit button in a form
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { TextButton } from "blixify-ui-web/action/textButton";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<TextButton text="Click Me" onClick={() => {}} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
##### Required props
|
|
22
|
+
|
|
23
|
+
| Name | Type | Description |
|
|
24
|
+
| ------ | -------- | --------------------- |
|
|
25
|
+
| `text` | `string` | Content of the button |
|
|
26
|
+
|
|
27
|
+
##### Optional props
|
|
28
|
+
|
|
29
|
+
| Name | Type | Default | Description |
|
|
30
|
+
| ----------- | ---------------- | ---------- | ----------- |
|
|
31
|
+
| `icon` | `React Element` | null | |
|
|
32
|
+
| `disabled` | `boolean` | `false` | |
|
|
33
|
+
| `className` | `tailwind class` | "" |
|
|
34
|
+
| `onClick` | `function` | `() => {}` | |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TextButton } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Action", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("Text Button", () => {
|
|
15
|
+
return <TextButton text="Click Me" onClick={() => {}} />;
|
|
16
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Toggle Button
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
Toggle Component to change between false & true
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { ToggleButton } from "blixify-ui-web/action/toggleButton";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<Toggle
|
|
19
|
+
direction="right"
|
|
20
|
+
text="Toggle Sample"
|
|
21
|
+
value={true}
|
|
22
|
+
onClick={() => {}}
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
##### Required props
|
|
27
|
+
|
|
28
|
+
| Name | Type | Description |
|
|
29
|
+
| ----------- | -------------- | --------------------------- |
|
|
30
|
+
| `text` | `string` | Description of the toggle |
|
|
31
|
+
| `direction` | `left / right` | Placement of the toggle |
|
|
32
|
+
| `value` | `boolean` | Whether toggle is activated |
|
|
33
|
+
|
|
34
|
+
##### Optional props
|
|
35
|
+
|
|
36
|
+
| Name | Type | Default | Description |
|
|
37
|
+
| ----------- | ---------------- | ---------- | ----------- |
|
|
38
|
+
| `className` | `tailwind class` | "" | |
|
|
39
|
+
| `onClick` | `function` | `() => {}` | |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Toggle } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Action", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("Toggle", () => {
|
|
15
|
+
return (
|
|
16
|
+
<Toggle
|
|
17
|
+
direction="right"
|
|
18
|
+
text="Toggle Sample"
|
|
19
|
+
value={true}
|
|
20
|
+
onClick={() => {}}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Collapse
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
An expandable/collapsible panel with a clickable header. Supports external or internal state control, custom header styling, and an optional expand button.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { Collapse } from "blixify-ui-web/advanced/collapse";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Basic (external state):
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const [collapse, setCollapse] = useState(true);
|
|
21
|
+
|
|
22
|
+
<Collapse
|
|
23
|
+
title="Section Title"
|
|
24
|
+
icon={<MapIcon className="w-5 h-5 text-primary-500" />}
|
|
25
|
+
content={<div className="p-3">Content goes here</div>}
|
|
26
|
+
collapse={collapse}
|
|
27
|
+
handleCollapse={() => setCollapse((prev) => !prev)}
|
|
28
|
+
/>;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Internal state (no `handleCollapse`):
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
<Collapse
|
|
35
|
+
title="Section Title"
|
|
36
|
+
icon={<MapIcon className="w-5 h-5 text-primary-500" />}
|
|
37
|
+
content={<div className="p-3">Content goes here</div>}
|
|
38
|
+
defaultValue={false}
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Custom header styling:
|
|
43
|
+
|
|
44
|
+
```jsx
|
|
45
|
+
<Collapse
|
|
46
|
+
title="Section Title"
|
|
47
|
+
desc="Optional subtitle"
|
|
48
|
+
icon={<></>}
|
|
49
|
+
collapseContainerCss="bg-primary-600"
|
|
50
|
+
notCollapseContainerCss="bg-primary-600"
|
|
51
|
+
titleClassName="text-white text-2xl"
|
|
52
|
+
descClassName="text-white"
|
|
53
|
+
iconClassName="w-5 h-5 text-white"
|
|
54
|
+
content={content}
|
|
55
|
+
collapse={collapse}
|
|
56
|
+
handleCollapse={() => setCollapse((prev) => !prev)}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
With additional header component and expand button:
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
<Collapse
|
|
64
|
+
title="Section Title"
|
|
65
|
+
icon={<MapIcon className="w-5 h-5" />}
|
|
66
|
+
additionalComp={
|
|
67
|
+
<SomeIcon
|
|
68
|
+
onClick={(e) => {
|
|
69
|
+
e.stopPropagation(); // prevent toggling collapse
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
}
|
|
73
|
+
collapseAdditionalComp={<SummaryWidget />}
|
|
74
|
+
content={content}
|
|
75
|
+
collapse={collapse}
|
|
76
|
+
handleCollapse={() => setCollapse((prev) => !prev)}
|
|
77
|
+
expandBtn
|
|
78
|
+
/>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
##### Required props
|
|
82
|
+
|
|
83
|
+
| Name | Type | Description |
|
|
84
|
+
| --------- | -------------- | ------------------------------------------------------------------------ |
|
|
85
|
+
| `title` | `string` | Header title text |
|
|
86
|
+
| `icon` | `ReactElement` | Icon displayed at the left of the header. Pass `<></>` to render nothing |
|
|
87
|
+
| `content` | `ReactElement` | Content shown when panel is expanded |
|
|
88
|
+
|
|
89
|
+
##### Optional props
|
|
90
|
+
|
|
91
|
+
| Name | Type | Default | Description |
|
|
92
|
+
| ------------------------- | -------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
+
| `collapse` | `boolean` | — | Controlled expanded state. `true` = expanded (content visible). Omit to use internal state |
|
|
94
|
+
| `defaultValue` | `boolean` | `false` | Initial expanded state when using internal state (no `handleCollapse`) |
|
|
95
|
+
| `handleCollapse` | `() => void` | — | Called when the header is clicked. Omit to let the component manage its own state |
|
|
96
|
+
| `desc` | `string` | — | Subtitle text rendered below the title |
|
|
97
|
+
| `additionalComp` | `ReactElement` | — | Extra element rendered in the header row, left of the chevron. Use `stopPropagation` on its click to avoid toggling |
|
|
98
|
+
| `collapseAdditionalComp` | `ReactElement` | — | Component rendered below the header only when the panel is collapsed (content hidden) |
|
|
99
|
+
| `expandBtn` | `boolean` | `false` | Shows a tag button at the bottom of the panel to toggle expanded state |
|
|
100
|
+
| `containerClassName` | `string` | — | Tailwind classes for the outer wrapper |
|
|
101
|
+
| `collapseContainerCss` | `string` | — | Tailwind classes for the header when the panel is expanded |
|
|
102
|
+
| `notCollapseContainerCss` | `string` | — | Tailwind classes for the header when the panel is collapsed |
|
|
103
|
+
| `titleClassName` | `string` | — | Tailwind classes for the title text |
|
|
104
|
+
| `descClassName` | `string` | — | Tailwind classes for the description text |
|
|
105
|
+
| `iconClassName` | `string` | `"w-5 h-5 text-gray-400"` | Tailwind classes for the chevron icon |
|
|
106
|
+
| `formInputRefList` | `any[]` | — | Refs to child form inputs. When provided, collapsing validates all inputs before closing |
|