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,143 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import React, { useRef, useState } from "react";
|
|
4
|
+
import { Form } from ".";
|
|
5
|
+
import { Button } from "../../action/button";
|
|
6
|
+
import { RadioList } from "../../action/radioList";
|
|
7
|
+
import { StorySection } from "../../storyUtils";
|
|
8
|
+
import { TextInput } from "../textInput";
|
|
9
|
+
import { UploadInput } from "../uploadInput";
|
|
10
|
+
import README from "./README.md";
|
|
11
|
+
|
|
12
|
+
const stories = storiesOf("Input", module);
|
|
13
|
+
|
|
14
|
+
stories.addParameters({
|
|
15
|
+
readme: {
|
|
16
|
+
content: README,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
stories.add("Form", () => {
|
|
21
|
+
const formRef = useRef<any>(null);
|
|
22
|
+
const input1 = useRef<any>(null);
|
|
23
|
+
const input2 = useRef<any>(null);
|
|
24
|
+
const uploadRef = useRef<any>(null);
|
|
25
|
+
|
|
26
|
+
const [radioValue, setRadioValue] = useState("");
|
|
27
|
+
const [textValue, setTextValue] = useState("");
|
|
28
|
+
const [file, setFile] = useState<any>(undefined);
|
|
29
|
+
const [result, setResult] = useState<string | null>(null);
|
|
30
|
+
|
|
31
|
+
const failFormRef = useRef<any>(null);
|
|
32
|
+
const failInput1 = useRef<any>(null);
|
|
33
|
+
const failInput2 = useRef<any>(null);
|
|
34
|
+
const [failText1, setFailText1] = useState("");
|
|
35
|
+
const [failText2, setFailText2] = useState("");
|
|
36
|
+
const [failedFields, setFailedFields] = useState<string[]>([]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<StorySection
|
|
41
|
+
title="Basic Form Validation"
|
|
42
|
+
description="Wrap inputs in Form and pass their refs to refList. Calling formRef.current.handleSubmit() validates all inputs in parallel and calls handleComplete only if all pass."
|
|
43
|
+
>
|
|
44
|
+
<div className="w-full max-w-sm">
|
|
45
|
+
<Form
|
|
46
|
+
ref={formRef}
|
|
47
|
+
refList={[input1, input2, uploadRef]}
|
|
48
|
+
handleComplete={() => setResult("All valid — form submitted!")}
|
|
49
|
+
>
|
|
50
|
+
<RadioList
|
|
51
|
+
ref={input1}
|
|
52
|
+
horizontal={true}
|
|
53
|
+
list={[
|
|
54
|
+
{ id: "approved", label: "✔️ Approve" },
|
|
55
|
+
{ id: "rejected", label: "✖️ Reject" },
|
|
56
|
+
]}
|
|
57
|
+
value={radioValue}
|
|
58
|
+
onSelect={setRadioValue}
|
|
59
|
+
/>
|
|
60
|
+
<TextInput
|
|
61
|
+
ref={input2}
|
|
62
|
+
id="name"
|
|
63
|
+
value={textValue}
|
|
64
|
+
type="text"
|
|
65
|
+
label="Full Name"
|
|
66
|
+
placeholder="Enter your name"
|
|
67
|
+
containerClassName="mt-3"
|
|
68
|
+
onChange={(e) => setTextValue(e.target.value)}
|
|
69
|
+
/>
|
|
70
|
+
<UploadInput
|
|
71
|
+
ref={uploadRef}
|
|
72
|
+
id="file-upload"
|
|
73
|
+
label="Supporting Document"
|
|
74
|
+
file={file}
|
|
75
|
+
lib={{ axios }}
|
|
76
|
+
accept="image/*"
|
|
77
|
+
fileDescription="Upload an image file"
|
|
78
|
+
className="mt-3"
|
|
79
|
+
onChange={(e) => {
|
|
80
|
+
if (e.target.files.length > 0) setFile(e.target.files[0]);
|
|
81
|
+
else setFile(undefined);
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
<Button
|
|
85
|
+
className="mt-4"
|
|
86
|
+
text="Submit"
|
|
87
|
+
size="small"
|
|
88
|
+
type="normal"
|
|
89
|
+
onClick={() => formRef.current?.handleSubmit()}
|
|
90
|
+
/>
|
|
91
|
+
</Form>
|
|
92
|
+
{result && <p className="mt-3 text-sm text-green-600">{result}</p>}
|
|
93
|
+
</div>
|
|
94
|
+
</StorySection>
|
|
95
|
+
|
|
96
|
+
<StorySection
|
|
97
|
+
title="handleOnFailValidation"
|
|
98
|
+
description="handleOnFailValidation receives an array of failed input ids so you can highlight or scroll to them."
|
|
99
|
+
>
|
|
100
|
+
<div className="w-full max-w-sm">
|
|
101
|
+
<Form
|
|
102
|
+
ref={failFormRef}
|
|
103
|
+
refList={[failInput1, failInput2]}
|
|
104
|
+
handleOnFailValidation={(ids) => setFailedFields(ids)}
|
|
105
|
+
handleComplete={() => setFailedFields([])}
|
|
106
|
+
>
|
|
107
|
+
<TextInput
|
|
108
|
+
ref={failInput1}
|
|
109
|
+
id="email"
|
|
110
|
+
value={failText1}
|
|
111
|
+
type="email"
|
|
112
|
+
label="Email"
|
|
113
|
+
placeholder="test@example.com"
|
|
114
|
+
onChange={(e) => setFailText1(e.target.value)}
|
|
115
|
+
/>
|
|
116
|
+
<TextInput
|
|
117
|
+
ref={failInput2}
|
|
118
|
+
id="password"
|
|
119
|
+
value={failText2}
|
|
120
|
+
type="password"
|
|
121
|
+
label="Password"
|
|
122
|
+
placeholder="Min 6 characters"
|
|
123
|
+
containerClassName="mt-3"
|
|
124
|
+
onChange={(e) => setFailText2(e.target.value)}
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
className="mt-4"
|
|
128
|
+
text="Submit"
|
|
129
|
+
size="small"
|
|
130
|
+
type="normal"
|
|
131
|
+
onClick={() => failFormRef.current?.handleSubmit()}
|
|
132
|
+
/>
|
|
133
|
+
</Form>
|
|
134
|
+
{failedFields.length > 0 && (
|
|
135
|
+
<p className="mt-3 text-sm text-red-500">
|
|
136
|
+
Failed: {failedFields.join(", ")}
|
|
137
|
+
</p>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
</StorySection>
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Markdown Input
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
Markdown input to enter markdown value with rich text editing. Supports images, videos, tables, task lists, and various text formatting options. Press `/` to see available commands.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { MarkdownInput } from "blixify-ui-web/components/input/markdown";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
const markdownRef: any = useRef(null);
|
|
19
|
+
const [value, setValue] = useState<string | undefined>("");
|
|
20
|
+
const handleOnChange = (id: string, value?: string) => setValue(value);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<MarkdownInput
|
|
24
|
+
ref={markdownRef}
|
|
25
|
+
id="markdown"
|
|
26
|
+
label="Markdown Editor"
|
|
27
|
+
subLabel="Enter your markdown content below"
|
|
28
|
+
value={value ?? ""}
|
|
29
|
+
onChange={handleOnChange}
|
|
30
|
+
placeholder="Start typing your markdown content here..."
|
|
31
|
+
enableImageUpload={true}
|
|
32
|
+
enableVideoUpload={true}
|
|
33
|
+
darkMode={false}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
##### With Image/Video Upload Handler
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
const markdownRef: any = useRef(null);
|
|
42
|
+
const [value, setValue] = useState<string | undefined>("");
|
|
43
|
+
|
|
44
|
+
// Upload handler for Firebase or custom storage
|
|
45
|
+
const handleUpload = async (file: File, path: string): Promise<string> => {
|
|
46
|
+
const storageRef = ref(storage, path);
|
|
47
|
+
await uploadBytes(storageRef, file);
|
|
48
|
+
return await getDownloadURL(storageRef);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Upload pending images after form submission
|
|
52
|
+
const handleSubmit = async () => {
|
|
53
|
+
if (markdownRef.current) {
|
|
54
|
+
const updatedHtml = await markdownRef.current.uploadPendingImages(
|
|
55
|
+
"collectionId",
|
|
56
|
+
"dataId",
|
|
57
|
+
"fieldId",
|
|
58
|
+
handleUpload
|
|
59
|
+
);
|
|
60
|
+
// Now save the data with updated URLs
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<MarkdownInput
|
|
66
|
+
ref={markdownRef}
|
|
67
|
+
label="Markdown Editor"
|
|
68
|
+
value={value ?? ""}
|
|
69
|
+
onChange={handleOnChange}
|
|
70
|
+
placeholder="Type here..."
|
|
71
|
+
enableImageUpload={true}
|
|
72
|
+
enableVideoUpload={true}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
##### With Image Compression
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<MarkdownInput
|
|
81
|
+
label="Markdown Editor"
|
|
82
|
+
value={value ?? ""}
|
|
83
|
+
onChange={handleOnChange}
|
|
84
|
+
placeholder="Type here..."
|
|
85
|
+
enableImageUpload={true}
|
|
86
|
+
compress={{
|
|
87
|
+
maxFileSize: 10, // Max 10MB
|
|
88
|
+
fileQuality: 0.8, // 80% quality
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
##### Read-Only Mode (Preview)
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<MarkdownInput
|
|
97
|
+
label="Markdown Preview"
|
|
98
|
+
value={value ?? ""}
|
|
99
|
+
onChange={handleOnChange}
|
|
100
|
+
placeholder=""
|
|
101
|
+
readOnly={true}
|
|
102
|
+
/>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
##### Required props
|
|
106
|
+
|
|
107
|
+
| Name | Type | Description |
|
|
108
|
+
| ------------- | ------------------------------------ | -------------------------------------- |
|
|
109
|
+
| `value` | `string` | `The markdown input value` |
|
|
110
|
+
| `label` | `string` | `Label of the input` |
|
|
111
|
+
| `placeholder` | `string` | `Placeholder of the input` |
|
|
112
|
+
| `onChange` | `(id: string, value?: string) => {}` | `Event handler for the onChange event` |
|
|
113
|
+
|
|
114
|
+
##### Optional props
|
|
115
|
+
|
|
116
|
+
| Name | Type | Default | Description |
|
|
117
|
+
| -------------------- | ----------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
118
|
+
| `id` | `string` | "" | |
|
|
119
|
+
| `ref` | `Ref` | `null` | Access to methods like `handleSubmit`, `getMarkdown`, `setMarkdown`, `uploadPendingImages`, `clearPendingImages` |
|
|
120
|
+
| `subLabel` | `string` | `null` | Secondary label text below the main label |
|
|
121
|
+
| `labelExtra` | `ReactElement` | `null` | Extra element to display next to the label |
|
|
122
|
+
| `infoElement` | `ReactElement` | `null` | Info icon with content to display |
|
|
123
|
+
| `optional` | `boolean` | `false` | If true, validation allows empty content |
|
|
124
|
+
| `disabled` | `boolean` | `false` | `Disable clicking and typing on Markdown Input` |
|
|
125
|
+
| `containerClassName` | `string` | `null` | `Tailwind classname for container that wraps around the Markdown Input` |
|
|
126
|
+
| `heightClassName` | `string` | `h-72` | `Tailwind classname for editor height (e.g., "h-96", "h-screen")` |
|
|
127
|
+
| `darkMode` | `boolean` | `false` | Enable dark mode styling |
|
|
128
|
+
| `readOnly` | `boolean` | `false` | `For uneditable Markdown Preview (hides toolbar and disables editing)` |
|
|
129
|
+
| `enableImageUpload` | `boolean` | `false` | Enable image upload functionality (drag-and-drop, paste, click to upload) |
|
|
130
|
+
| `enableVideoUpload` | `boolean` | `false` | Enable video upload functionality (supports MP4, MOV, WebM, AVI, MKV, etc.) |
|
|
131
|
+
| `compress` | `{ maxFileSize?: number, fileQuality?: number}` | `null` | Image compression settings. `maxFileSize` in MB (default: 30), `fileQuality` 0.0-1.0 (default: 0.8) |
|
|
132
|
+
| `lib` | `{ axios: any }` | `null` | External libraries (e.g., axios for API calls) |
|
|
133
|
+
| `uploadEndpoint` | `string` | `null` | API endpoint for uploading media files |
|
|
134
|
+
|
|
135
|
+
##### Ref Methods
|
|
136
|
+
|
|
137
|
+
When using `ref`, you have access to the following methods:
|
|
138
|
+
|
|
139
|
+
| Method | Parameters | Returns | Description |
|
|
140
|
+
| --------------------- | ---------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------- |
|
|
141
|
+
| `handleSubmit` | `()` | `Promise<bool>` | Validates the markdown input (checks if required field is filled) |
|
|
142
|
+
| `getMarkdown` | `()` | `string` | Returns the current markdown content |
|
|
143
|
+
| `setMarkdown` | `(markdown: string)` | `void` | Sets the markdown content programmatically |
|
|
144
|
+
| `getPendingImages` | `()` | `Map` | Returns map of blob URLs to File objects that haven't been uploaded yet |
|
|
145
|
+
| `uploadPendingImages` | `(collectionId: string, dataId: string, fieldId: string, uploadHandler: Function)` | `Promise<html>` | Uploads all pending images/videos and replaces blob URLs with permanent URLs |
|
|
146
|
+
| `clearPendingImages` | `()` | `void` | Clears all pending images and revokes blob URLs |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { MarkdownInput } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
const stories = storiesOf("Input", module);
|
|
6
|
+
|
|
7
|
+
stories.addParameters({
|
|
8
|
+
readme: {
|
|
9
|
+
content: README,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
stories.add("Markdown Input", () => {
|
|
14
|
+
const [value, setValue] = useState<string | undefined>("");
|
|
15
|
+
const handleOnChange = (id: string, value?: string) => setValue(value);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<MarkdownInput
|
|
20
|
+
label="Markdown Editor"
|
|
21
|
+
subLabel="Enter your markdown content below, press / to see the available commands, press esc to close the menu. Images will show blob URL previews in Storybook."
|
|
22
|
+
value={value ?? ""}
|
|
23
|
+
onChange={handleOnChange}
|
|
24
|
+
placeholder="Start typing our markdown content here... You can use basic markdown syntax like **bold**, *italic*, # headings, - bullet points, 1. numbered lists, [links](url), and more. The editor provides a live preview of your formatted content."
|
|
25
|
+
darkMode={false}
|
|
26
|
+
enableImageUpload={true}
|
|
27
|
+
enableVideoUpload={true}
|
|
28
|
+
/>
|
|
29
|
+
{/* //INFO: Test View */}
|
|
30
|
+
{/* <MarkdownInput
|
|
31
|
+
label="Markdown Viewer"
|
|
32
|
+
value={value ?? ""}
|
|
33
|
+
onChange={handleOnChange}
|
|
34
|
+
placeholder=""
|
|
35
|
+
darkMode={false}
|
|
36
|
+
readOnly={true}
|
|
37
|
+
/> */}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Month Year Picker
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
Month Year Picker to insert date
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { MonthYearPicker } from "blixify-ui-web/components/input/monthYearPicker";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const currentDate = new Date();
|
|
19
|
+
const [date, setDate] = (useState < Date) | (undefined > currentDate);
|
|
20
|
+
|
|
21
|
+
const handleOnChange = (id: string, value: Date | undefined, type?: string) => {
|
|
22
|
+
if (type === "months") {
|
|
23
|
+
setMonthDate(value);
|
|
24
|
+
} else if (type === "year") {
|
|
25
|
+
setYearDate(value);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<MonthYearPicker
|
|
32
|
+
title="Month Picker"
|
|
33
|
+
type={"month"}
|
|
34
|
+
value={date}
|
|
35
|
+
onChange={handleOnChange}
|
|
36
|
+
minDate={new Date()}
|
|
37
|
+
/>
|
|
38
|
+
<MonthYearPicker
|
|
39
|
+
type={"year"}
|
|
40
|
+
value={date}
|
|
41
|
+
onChange={handleOnChange}
|
|
42
|
+
className="mt-5"
|
|
43
|
+
/>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
##### Optional props
|
|
49
|
+
|
|
50
|
+
| Name | Type | Default | Description |
|
|
51
|
+
| ---------------- | ------------------ | ------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
52
|
+
| `id` | `string` | "" | |
|
|
53
|
+
| `range` | `boolean` | null | Determine wheter is date picker is range or normal |
|
|
54
|
+
| `title` | `string` | "" | Required when range is false , label of Date Picker |
|
|
55
|
+
| `labelExtra` | ReactElement | null | |
|
|
56
|
+
| `value` | `Date` | null | Required when range is false, value of the date picker |
|
|
57
|
+
| `minDate` | `Date` | null | Required when range is true, minimum date that is able to be selected |
|
|
58
|
+
| `maxDate` | `Date` | null | Required when range is true, maximum date that is able to be selected |
|
|
59
|
+
| `yearDate` | `Date` | null | Required when range is true, value of year date picker |
|
|
60
|
+
| `monthDate` | `Date` | null | Required when range is true , value of month date picker |
|
|
61
|
+
| `filterMonth` | `Array number ` | null | Array of number |
|
|
62
|
+
| `filterYear` | `Array number ` | null | Array of number |
|
|
63
|
+
| `showTime` | `boolean` | null | Option to select and display time |
|
|
64
|
+
| `optional` | `boolean` | null | Whether date is required to be selected |
|
|
65
|
+
| `className` | `tailwind class` | null | Tailwind Class |
|
|
66
|
+
| `onChange` | `function` | `(id : string, value:Date, type? : string) => {}` | When range is true, will return type of "month/year" |
|
|
67
|
+
| `cellInput` | `Cell Input Class` | | Refer to Input Utils |
|
|
68
|
+
| `hideLabel` | `boolean` | null | When `true`, label will be hidden. |
|
|
69
|
+
| `staticDropdown` | `boolean` | null | When `true`, the parent container's height will expand to fit this component. |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { MonthYearPicker } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Input", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("Month Year Picker", () => {
|
|
15
|
+
const currentDate = new Date();
|
|
16
|
+
const [date, setDate] = useState<Date | undefined>(currentDate);
|
|
17
|
+
|
|
18
|
+
const handleOnChange = (
|
|
19
|
+
id: string,
|
|
20
|
+
value: Date | undefined,
|
|
21
|
+
type?: string
|
|
22
|
+
) => {
|
|
23
|
+
if (type === "month") {
|
|
24
|
+
setDate(value);
|
|
25
|
+
} else if (type === "year") {
|
|
26
|
+
setDate(value);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<MonthYearPicker
|
|
33
|
+
title="Month Picker"
|
|
34
|
+
type={"month"}
|
|
35
|
+
value={date}
|
|
36
|
+
onChange={handleOnChange}
|
|
37
|
+
minDate={new Date()}
|
|
38
|
+
/>
|
|
39
|
+
<MonthYearPicker
|
|
40
|
+
type={"year"}
|
|
41
|
+
value={date}
|
|
42
|
+
onChange={handleOnChange}
|
|
43
|
+
className="mt-5"
|
|
44
|
+
/>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# NetPromoterScore
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
NetPromoterScore component for entering NPS (Net Promoter Score) value from 0-10.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { NetPromoterScore } from "blixify-ui-web/components/input/netPromoterScore";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [score, setScore] = useState(null);
|
|
19
|
+
|
|
20
|
+
const handleOnChangeScore = (value: number) => {
|
|
21
|
+
setScore(value);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<NetPromoterScore
|
|
27
|
+
id="nps"
|
|
28
|
+
label="How likely are you to recommend us to a friend or colleague?"
|
|
29
|
+
value={score}
|
|
30
|
+
onChange={handleOnChangeScore}
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
##### Required props
|
|
37
|
+
|
|
38
|
+
| Name | Type | Description |
|
|
39
|
+
| ------- | --------------- | ----------------- |
|
|
40
|
+
| `id` | `string` | Id of the input |
|
|
41
|
+
| `label` | `string` | Label of the data |
|
|
42
|
+
| `value` | `number \| null` | Value of the data (0-10) |
|
|
43
|
+
|
|
44
|
+
##### Optional props
|
|
45
|
+
|
|
46
|
+
| Name | Type | Default | Description |
|
|
47
|
+
| ----------- | ---------- | ------- | --------------------- |
|
|
48
|
+
| `subLabel` | `string` | | Set score subLabel |
|
|
49
|
+
| `optional` | `boolean` | | Set data optional |
|
|
50
|
+
| `className` | `string` | | Set container style |
|
|
51
|
+
| `onChange` | `function` | | Callback on value change |
|
|
52
|
+
| `darkMode` | `boolean` | `false` | Enable dark mode |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { NetPromoterScore } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Input", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("NetPromoterScore", () => {
|
|
15
|
+
const [score, setScore] = useState<number | null>(null);
|
|
16
|
+
|
|
17
|
+
const handleOnChangeScore = (value: number) => {
|
|
18
|
+
setScore(value);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<NetPromoterScore
|
|
23
|
+
id="nps"
|
|
24
|
+
label="How likely are you to recommend us to a friend or colleague?"
|
|
25
|
+
value={score}
|
|
26
|
+
onChange={handleOnChangeScore}
|
|
27
|
+
darkMode={false}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Rating
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
Rating component for enter rating value.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { Rating } from "blixify-ui-web/components/input/rating";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [rating, setRating] = useState(0);
|
|
19
|
+
|
|
20
|
+
const handleOnChangeRating = (value: number) => {
|
|
21
|
+
setRating(value);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<Rating
|
|
27
|
+
id="rating"
|
|
28
|
+
label="Enter your rating below"
|
|
29
|
+
value={rating}
|
|
30
|
+
onChange={handleOnChangeRating}
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
##### Required props
|
|
37
|
+
|
|
38
|
+
| Name | Type | Description |
|
|
39
|
+
| ------- | -------- | ----------------- |
|
|
40
|
+
| `id` | `string` | Id of the input |
|
|
41
|
+
| `label` | `string` | Label of the data |
|
|
42
|
+
| `value` | `number` | Value of the data |
|
|
43
|
+
|
|
44
|
+
##### Optional props
|
|
45
|
+
|
|
46
|
+
| Name | Type | Default | Description |
|
|
47
|
+
| ----------- | ---------- | ------- | ------------------- |
|
|
48
|
+
| `subLabel` | `string` | | Set rating subLabel |
|
|
49
|
+
| `optional` | `boolean` | | Set data optional |
|
|
50
|
+
| `className` | `string` | | Set container style |
|
|
51
|
+
| `onChange` | `function` | | Type of the input |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Rating } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Input", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("Rating", () => {
|
|
15
|
+
const [rating, setRating] = useState(0);
|
|
16
|
+
|
|
17
|
+
const handleOnChangeRating = (value: number) => {
|
|
18
|
+
setRating(value);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Rating
|
|
23
|
+
id="rating"
|
|
24
|
+
label="Enter your rating below"
|
|
25
|
+
value={rating}
|
|
26
|
+
onChange={handleOnChangeRating}
|
|
27
|
+
darkMode={false}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
});
|