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,188 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useRef, useState } from "react";
|
|
3
|
+
import { Signature } from ".";
|
|
4
|
+
import { Button } from "../../action/button";
|
|
5
|
+
import { Modal } from "../../display/modal";
|
|
6
|
+
import { Form } from "../form";
|
|
7
|
+
import { StorySection } from "../../storyUtils";
|
|
8
|
+
import README from "./README.md";
|
|
9
|
+
|
|
10
|
+
const stories = storiesOf("Input", module);
|
|
11
|
+
|
|
12
|
+
stories.addParameters({
|
|
13
|
+
readme: {
|
|
14
|
+
content: README,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const sampleDataURL =
|
|
19
|
+
"https://upload.wikimedia.org/wikipedia/commons/2/2d/Sample_SVG_file%2C_signature.svg";
|
|
20
|
+
|
|
21
|
+
stories.add("Signature", () => {
|
|
22
|
+
const signatureRef = useRef<any>(null);
|
|
23
|
+
const modalSignatureRef = useRef<any>(null);
|
|
24
|
+
const modalFormRef = useRef<any>(null);
|
|
25
|
+
|
|
26
|
+
const [signing, setSigning] = useState(false);
|
|
27
|
+
const [modalSigning, setModalSigning] = useState(false);
|
|
28
|
+
const [signaturePreview, setSignaturePreview] = useState("");
|
|
29
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
30
|
+
const [modalKey, setModalKey] = useState(0);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<StorySection
|
|
35
|
+
title="Default (with existing dataURL)"
|
|
36
|
+
description="Pass dataURL to pre-load an existing signature image. The canvas fills its parent container — give the parent a fixed height. signatureClear shows a Clear button; a Reset button appears automatically when dataURL is set."
|
|
37
|
+
>
|
|
38
|
+
<div className="w-full max-w-md">
|
|
39
|
+
<div className="h-[280px]">
|
|
40
|
+
<Signature
|
|
41
|
+
id="signature-default"
|
|
42
|
+
ref={signatureRef}
|
|
43
|
+
dataURL={sampleDataURL}
|
|
44
|
+
signing={signing}
|
|
45
|
+
label="Signature"
|
|
46
|
+
penColor="black"
|
|
47
|
+
signatureClear={true}
|
|
48
|
+
onChange={setSigning}
|
|
49
|
+
onSubmit={(_, dataURL) => setSignaturePreview(dataURL ?? "")}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<Button
|
|
53
|
+
className="mt-3"
|
|
54
|
+
size="small"
|
|
55
|
+
text="Submit"
|
|
56
|
+
type="normal"
|
|
57
|
+
onClick={() => signatureRef.current?.handleSubmit()}
|
|
58
|
+
/>
|
|
59
|
+
{signaturePreview && (
|
|
60
|
+
<div className="mt-3">
|
|
61
|
+
<p className="text-sm font-medium text-gray-700 mb-1">Preview</p>
|
|
62
|
+
<img
|
|
63
|
+
src={signaturePreview}
|
|
64
|
+
alt="signature preview"
|
|
65
|
+
className="border rounded max-h-24"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
</StorySection>
|
|
71
|
+
|
|
72
|
+
<StorySection
|
|
73
|
+
title="Blank canvas (required)"
|
|
74
|
+
description="No dataURL — user must draw a signature. Without optional, handleSubmit will fail if the canvas is empty."
|
|
75
|
+
>
|
|
76
|
+
<div className="w-full max-w-md">
|
|
77
|
+
<div className="h-[280px]">
|
|
78
|
+
<Signature
|
|
79
|
+
id="signature-blank"
|
|
80
|
+
signing={false}
|
|
81
|
+
label="Sign Here"
|
|
82
|
+
penColor="blue"
|
|
83
|
+
signatureClear={true}
|
|
84
|
+
onChange={() => {}}
|
|
85
|
+
onSubmit={() => {}}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</StorySection>
|
|
90
|
+
|
|
91
|
+
<StorySection
|
|
92
|
+
title="With description text"
|
|
93
|
+
description="description renders formatted text above the pad. Wrap text in *asterisks* for bold. Blank lines create paragraph breaks."
|
|
94
|
+
>
|
|
95
|
+
<div className="w-full max-w-md">
|
|
96
|
+
<div className="h-[320px]">
|
|
97
|
+
<Signature
|
|
98
|
+
id="signature-desc"
|
|
99
|
+
signing={false}
|
|
100
|
+
label="Authorisation Signature"
|
|
101
|
+
optional
|
|
102
|
+
description={`*By signing below you agree to the terms and conditions.*\n\nThis signature will be used as your legal authorisation for this document.`}
|
|
103
|
+
penColor="black"
|
|
104
|
+
signatureClear={true}
|
|
105
|
+
onChange={() => {}}
|
|
106
|
+
onSubmit={() => {}}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</StorySection>
|
|
111
|
+
|
|
112
|
+
<StorySection
|
|
113
|
+
title="Dark mode"
|
|
114
|
+
description="darkMode=true switches label colours to suit a dark background."
|
|
115
|
+
dark
|
|
116
|
+
>
|
|
117
|
+
<div className="w-full max-w-md">
|
|
118
|
+
<div className="h-[280px]">
|
|
119
|
+
<Signature
|
|
120
|
+
id="signature-dark"
|
|
121
|
+
signing={false}
|
|
122
|
+
label="Signature"
|
|
123
|
+
optional
|
|
124
|
+
darkMode={true}
|
|
125
|
+
penColor="white"
|
|
126
|
+
signatureClear={true}
|
|
127
|
+
onChange={() => {}}
|
|
128
|
+
onSubmit={() => {}}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</StorySection>
|
|
133
|
+
|
|
134
|
+
<StorySection
|
|
135
|
+
title="Inside a Modal with Form validation"
|
|
136
|
+
description="Use a key prop to force remount when the modal opens so the canvas resizes correctly. Wrap in Form and pass the ref to refList for coordinated validation."
|
|
137
|
+
>
|
|
138
|
+
<div className="w-full max-w-md">
|
|
139
|
+
<Button
|
|
140
|
+
size="small"
|
|
141
|
+
text="Open Signature Modal"
|
|
142
|
+
type="normal"
|
|
143
|
+
onClick={() => {
|
|
144
|
+
setIsModalOpen(true);
|
|
145
|
+
setModalKey((k) => k + 1);
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
<Modal
|
|
149
|
+
title="Signature"
|
|
150
|
+
open={isModalOpen}
|
|
151
|
+
maxWidth="2xl"
|
|
152
|
+
onClose={() => setIsModalOpen(false)}
|
|
153
|
+
renderContent={() => (
|
|
154
|
+
<Form refList={[modalSignatureRef]} ref={modalFormRef}>
|
|
155
|
+
<div className="w-full h-[280px]">
|
|
156
|
+
<Signature
|
|
157
|
+
key={modalKey}
|
|
158
|
+
id="signature-modal"
|
|
159
|
+
ref={modalSignatureRef}
|
|
160
|
+
dataURL={sampleDataURL}
|
|
161
|
+
signing={modalSigning}
|
|
162
|
+
label="Signature"
|
|
163
|
+
penColor="red"
|
|
164
|
+
signatureClear={true}
|
|
165
|
+
onChange={setModalSigning}
|
|
166
|
+
onSubmit={(_, dataURL) =>
|
|
167
|
+
setSignaturePreview(dataURL ?? "")
|
|
168
|
+
}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
<Button
|
|
172
|
+
className="mt-6"
|
|
173
|
+
size="small"
|
|
174
|
+
text="Submit"
|
|
175
|
+
type="normal"
|
|
176
|
+
onClick={async () => {
|
|
177
|
+
const valid = await modalFormRef.current?.handleSubmit();
|
|
178
|
+
if (valid) setIsModalOpen(false);
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
</Form>
|
|
182
|
+
)}
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
</StorySection>
|
|
186
|
+
</>
|
|
187
|
+
);
|
|
188
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# TextArea
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
Text Area to insert block value
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { TextArea } from "blixify-ui-web/components/input/textArea";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [value, setValue] = useState("");
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<TextArea
|
|
22
|
+
id="comments"
|
|
23
|
+
value={value}
|
|
24
|
+
label="Comments"
|
|
25
|
+
placeholder="Description"
|
|
26
|
+
subLabel="Enter your comments below"
|
|
27
|
+
rows={4}
|
|
28
|
+
onChange={(e) => {
|
|
29
|
+
setValue(e);
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
##### Required props
|
|
36
|
+
|
|
37
|
+
| Name | Type | Description |
|
|
38
|
+
| ------------- | -------- | ------------------------ |
|
|
39
|
+
| `value` | `any` | Value of the data |
|
|
40
|
+
| `label` | `string` | Label of the input |
|
|
41
|
+
| `rows` | `number` | Number of rows |
|
|
42
|
+
| `placeholder` | `string` | Placeholder of the input |
|
|
43
|
+
|
|
44
|
+
##### Optional props
|
|
45
|
+
|
|
46
|
+
| Name | Type | Default | Description |
|
|
47
|
+
| -------------------- | ---------------- | ---------- | ----------- |
|
|
48
|
+
| `id` | `string` | "" | |
|
|
49
|
+
| `subLabel` | `string` | "" | |
|
|
50
|
+
| `maxLength` | `number` | "" | |
|
|
51
|
+
| `optional` | boolean | null | |
|
|
52
|
+
| `disabled` | boolean | null | |
|
|
53
|
+
| `className` | `tailwind class` | "" | |
|
|
54
|
+
| `containerClassName` | `tailwind class` | "" | |
|
|
55
|
+
| `onChange` | `function` | `() => {}` | |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { TextArea } 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("TextArea", () => {
|
|
15
|
+
const [value, setValue] = useState("");
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<TextArea
|
|
19
|
+
id="comments"
|
|
20
|
+
value={value}
|
|
21
|
+
label="Comments"
|
|
22
|
+
placeholder="Description"
|
|
23
|
+
subLabel="Enter your comments below"
|
|
24
|
+
rows={4}
|
|
25
|
+
onChange={(e) => {
|
|
26
|
+
setValue(e.target.value);
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Text Input
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A versatile text input supporting email, password, number, mobile (with country picker), and plain text modes. Includes built-in validation, suggestions dropdown, capitalize mode, and mobile-responsive layout.
|
|
8
|
+
|
|
9
|
+
### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { TextInput } from "blixify-ui-web/input/textInput";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [value, setValue] = useState("");
|
|
19
|
+
|
|
20
|
+
<TextInput
|
|
21
|
+
id="email"
|
|
22
|
+
value={value}
|
|
23
|
+
type="email"
|
|
24
|
+
label="Email"
|
|
25
|
+
placeholder="test@gmail.com"
|
|
26
|
+
onChange={(e) => setValue(e.target.value)}
|
|
27
|
+
showMagnifyIcon={true}
|
|
28
|
+
/>;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Validation via ref
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
|
|
36
|
+
<TextInput ref={ref} id="email" value={value} type="email" label="Email" placeholder="..." onChange={...} />
|
|
37
|
+
<Button text="Submit" onClick={() => ref.current?.handleSubmit()} />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`handleSubmit()` returns a `Promise<boolean>` — `true` if valid, `false` if not. It sets an inline error message automatically.
|
|
41
|
+
|
|
42
|
+
### Required props
|
|
43
|
+
|
|
44
|
+
| Name | Type | Description |
|
|
45
|
+
| ------------- | -------- | --------------------------------------------------------------------- |
|
|
46
|
+
| `value` | `any` | Controlled value |
|
|
47
|
+
| `label` | `string` | Label displayed above the input |
|
|
48
|
+
| `type` | `string` | Input type: `"email"`, `"text"`, `"password"`, `"number"`, `"mobile"` |
|
|
49
|
+
| `placeholder` | `string` | Placeholder text |
|
|
50
|
+
|
|
51
|
+
### Optional props
|
|
52
|
+
|
|
53
|
+
| Name | Type | Default | Description |
|
|
54
|
+
| ----------------------- | ------------------ | ---------- | ---------------------------------------------------------------------------- |
|
|
55
|
+
| `id` | `string` | — | HTML id attribute |
|
|
56
|
+
| `subLabel` | `string` | — | Secondary label shown below the main label |
|
|
57
|
+
| `size` | `string` | — | `"small"` (px-3 py-2) or `"mini"` (p-2); default is standard (px-5 py-3) |
|
|
58
|
+
| `labelExtra` | `ReactElement` | — | Extra element rendered inline with the label |
|
|
59
|
+
| `infoElement` | `ReactElement` | — | Content shown in an InfoWindow tooltip next to the label |
|
|
60
|
+
| `customElement` | `ReactElement` | — | Custom element rendered to the right of the label row |
|
|
61
|
+
| `pattern` | `string` | — | Regex string applied on submit (overrides type-based validation) |
|
|
62
|
+
| `customErrMsg` | `string` | — | Overrides the default validation error message |
|
|
63
|
+
| `minNumber` | `number` | — | Minimum value (type `"number"` only) |
|
|
64
|
+
| `maxNumber` | `number` | — | Maximum value (type `"number"` only) |
|
|
65
|
+
| `maxLength` | `number` | — | Max character length |
|
|
66
|
+
| `optional` | `boolean` | `false` | Skips validation when `true` |
|
|
67
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
68
|
+
| `autoFocus` | `boolean` | `false` | Focuses the input on mount |
|
|
69
|
+
| `autoComplete` | `"on"` \| `"off"` | — | HTML autocomplete attribute |
|
|
70
|
+
| `capitalize` | `boolean` | `false` | Converts all input to uppercase (type `"text"` only) |
|
|
71
|
+
| `showMagnifyIcon` | `boolean` | `false` | Shows a magnifying glass icon on the right |
|
|
72
|
+
| `strSuggestions` | `string[]` | — | List of suggestions shown in a dropdown as the user types |
|
|
73
|
+
| `mobilePicker` | `boolean` | `false` | Shows a country flag/code selector (type `"mobile"` only) |
|
|
74
|
+
| `mobileCountryEditable` | `boolean` | `false` | Allows changing the country code (type `"mobile"` + `mobilePicker` only) |
|
|
75
|
+
| `mobileWhitelist` | `("BN" \| "MY")[]` | — | Restricts mobile validation to specific countries |
|
|
76
|
+
| `mobileView` | `boolean` | `false` | Renders a compact inline layout for mobile screens (label left, input right) |
|
|
77
|
+
| `darkMode` | `boolean` | `false` | Applies dark colour scheme to labels |
|
|
78
|
+
| `containerClassName` | `tailwind class` | — | Class applied to the outer container |
|
|
79
|
+
| `inputClassName` | `tailwind class` | — | Additional class applied to the `<input>` element |
|
|
80
|
+
| `onChange` | `(e: any) => void` | `() => {}` | Called on every change; `e.target.value` contains the new value |
|
|
81
|
+
| `cellInput` | `CellInput` | — | Refer to Input Utils — enables cell/table editing mode |
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React, { useRef, useState } from "react";
|
|
3
|
+
import { TextInput } from ".";
|
|
4
|
+
import { Button } from "../../action/button";
|
|
5
|
+
import { StorySection } from "../../storyUtils";
|
|
6
|
+
import README from "./README.md";
|
|
7
|
+
|
|
8
|
+
const stories = storiesOf("Input", module);
|
|
9
|
+
|
|
10
|
+
stories.addParameters({
|
|
11
|
+
readme: {
|
|
12
|
+
content: README,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
stories.add("TextInput", () => {
|
|
17
|
+
const refEmail = useRef<any>(null);
|
|
18
|
+
const refPassword = useRef<any>(null);
|
|
19
|
+
const refNumber = useRef<any>(null);
|
|
20
|
+
const refMobile = useRef<any>(null);
|
|
21
|
+
const refCap = useRef<any>(null);
|
|
22
|
+
const refSuggest = useRef<any>(null);
|
|
23
|
+
const refRegex = useRef<any>(null);
|
|
24
|
+
|
|
25
|
+
const [email, setEmail] = useState("");
|
|
26
|
+
const [password, setPassword] = useState("");
|
|
27
|
+
const [number, setNumber] = useState("");
|
|
28
|
+
const [mobile, setMobile] = useState("");
|
|
29
|
+
const [capText, setCapText] = useState("");
|
|
30
|
+
const [suggestText, setSuggestText] = useState("");
|
|
31
|
+
const [regexText, setRegexText] = useState("");
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<StorySection
|
|
36
|
+
title="Email (with magnify icon)"
|
|
37
|
+
description="type='email' with showMagnifyIcon renders a search icon on the right. Validates email format on submit."
|
|
38
|
+
>
|
|
39
|
+
<div className="w-full max-w-sm">
|
|
40
|
+
<TextInput
|
|
41
|
+
ref={refEmail}
|
|
42
|
+
id="email"
|
|
43
|
+
value={email}
|
|
44
|
+
type="email"
|
|
45
|
+
label="Email"
|
|
46
|
+
placeholder="test@gmail.com"
|
|
47
|
+
subLabel="Enter your email below"
|
|
48
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
49
|
+
showMagnifyIcon={true}
|
|
50
|
+
/>
|
|
51
|
+
<Button
|
|
52
|
+
type="normal"
|
|
53
|
+
text="Validate"
|
|
54
|
+
onClick={() => refEmail?.current?.handleSubmit()}
|
|
55
|
+
className="mt-3"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</StorySection>
|
|
59
|
+
|
|
60
|
+
<StorySection
|
|
61
|
+
title="Password (show/hide toggle)"
|
|
62
|
+
description="type='password' renders an eye icon to toggle visibility. Validates 6–30 characters, no spaces."
|
|
63
|
+
>
|
|
64
|
+
<div className="w-full max-w-sm">
|
|
65
|
+
<TextInput
|
|
66
|
+
ref={refPassword}
|
|
67
|
+
id="password"
|
|
68
|
+
value={password}
|
|
69
|
+
type="password"
|
|
70
|
+
label="Password"
|
|
71
|
+
placeholder="Enter password"
|
|
72
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
73
|
+
/>
|
|
74
|
+
<Button
|
|
75
|
+
type="normal"
|
|
76
|
+
text="Validate"
|
|
77
|
+
onClick={() => refPassword?.current?.handleSubmit()}
|
|
78
|
+
className="mt-3"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</StorySection>
|
|
82
|
+
|
|
83
|
+
<StorySection
|
|
84
|
+
title="Number (with min/max)"
|
|
85
|
+
description="type='number' prevents scroll-to-change. minNumber and maxNumber enforce range on submit."
|
|
86
|
+
>
|
|
87
|
+
<div className="w-full max-w-sm">
|
|
88
|
+
<TextInput
|
|
89
|
+
ref={refNumber}
|
|
90
|
+
id="number"
|
|
91
|
+
value={number}
|
|
92
|
+
type="number"
|
|
93
|
+
label="Age"
|
|
94
|
+
placeholder="Enter age"
|
|
95
|
+
subLabel="Must be between 18 and 99"
|
|
96
|
+
minNumber={18}
|
|
97
|
+
maxNumber={99}
|
|
98
|
+
onChange={(e) => setNumber(e.target.value)}
|
|
99
|
+
/>
|
|
100
|
+
<Button
|
|
101
|
+
type="normal"
|
|
102
|
+
text="Validate"
|
|
103
|
+
onClick={() => refNumber?.current?.handleSubmit()}
|
|
104
|
+
className="mt-3"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</StorySection>
|
|
108
|
+
|
|
109
|
+
<StorySection
|
|
110
|
+
title="Mobile (with country picker)"
|
|
111
|
+
description="type='mobile' with mobilePicker shows a country flag/code selector. mobileCountryEditable allows changing the country."
|
|
112
|
+
>
|
|
113
|
+
<div className="w-full max-w-sm">
|
|
114
|
+
<TextInput
|
|
115
|
+
ref={refMobile}
|
|
116
|
+
id="mobile"
|
|
117
|
+
value={mobile}
|
|
118
|
+
type="mobile"
|
|
119
|
+
label="Mobile"
|
|
120
|
+
placeholder="+60123456789"
|
|
121
|
+
mobilePicker={true}
|
|
122
|
+
mobileCountryEditable={true}
|
|
123
|
+
onChange={(e) => setMobile(e.target.value)}
|
|
124
|
+
/>
|
|
125
|
+
<Button
|
|
126
|
+
type="normal"
|
|
127
|
+
text="Validate"
|
|
128
|
+
onClick={() => refMobile?.current?.handleSubmit()}
|
|
129
|
+
className="mt-3"
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
</StorySection>
|
|
133
|
+
|
|
134
|
+
<StorySection
|
|
135
|
+
title="Capitalize Text"
|
|
136
|
+
description="capitalize=true forces all input to uppercase as the user types."
|
|
137
|
+
>
|
|
138
|
+
<div className="w-full max-w-sm">
|
|
139
|
+
<TextInput
|
|
140
|
+
ref={refCap}
|
|
141
|
+
id="capitalizeText"
|
|
142
|
+
value={capText}
|
|
143
|
+
type="text"
|
|
144
|
+
label="Capitalize Text"
|
|
145
|
+
placeholder="Type anything..."
|
|
146
|
+
subLabel="All characters will be uppercased"
|
|
147
|
+
capitalize={true}
|
|
148
|
+
onChange={(e) => setCapText(e.target.value)}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</StorySection>
|
|
152
|
+
|
|
153
|
+
<StorySection
|
|
154
|
+
title="With Suggestions"
|
|
155
|
+
description="strSuggestions provides a dropdown of matching options as the user types."
|
|
156
|
+
>
|
|
157
|
+
<div className="w-full max-w-sm">
|
|
158
|
+
<TextInput
|
|
159
|
+
ref={refSuggest}
|
|
160
|
+
id="withSuggestions"
|
|
161
|
+
value={suggestText}
|
|
162
|
+
type="text"
|
|
163
|
+
label="With Suggestions"
|
|
164
|
+
placeholder="Start typing..."
|
|
165
|
+
subLabel="Pre-defined suggestions will appear"
|
|
166
|
+
strSuggestions={[
|
|
167
|
+
"The quick brown fox jumps",
|
|
168
|
+
"How much wood would a woodchuck chuck",
|
|
169
|
+
"Peter Piper picked peppers",
|
|
170
|
+
"She sells seashells by the sea",
|
|
171
|
+
"All work and no play",
|
|
172
|
+
]}
|
|
173
|
+
onChange={(e) => setSuggestText(e.target.value)}
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</StorySection>
|
|
177
|
+
|
|
178
|
+
<StorySection
|
|
179
|
+
title="Custom Regex Pattern + Form Validation"
|
|
180
|
+
description="pattern accepts a regex string. customErrMsg overrides the default error message. Call handleSubmit() via ref to trigger validation."
|
|
181
|
+
>
|
|
182
|
+
<div className="w-full max-w-sm">
|
|
183
|
+
<TextInput
|
|
184
|
+
ref={refRegex}
|
|
185
|
+
id="alphaNumericOnly"
|
|
186
|
+
value={regexText}
|
|
187
|
+
type="text"
|
|
188
|
+
label="Alphanumeric Only"
|
|
189
|
+
placeholder="Letters and numbers only"
|
|
190
|
+
subLabel="No special characters allowed"
|
|
191
|
+
pattern="^[a-zA-Z0-9]+$"
|
|
192
|
+
customErrMsg="Only alphabets and numbers are allowed"
|
|
193
|
+
onChange={(e) => setRegexText(e.target.value)}
|
|
194
|
+
/>
|
|
195
|
+
<Button
|
|
196
|
+
type="normal"
|
|
197
|
+
text="Submit"
|
|
198
|
+
onClick={() => refRegex?.current?.handleSubmit()}
|
|
199
|
+
className="mt-3"
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
</StorySection>
|
|
203
|
+
|
|
204
|
+
<StorySection
|
|
205
|
+
title="Small & Mini sizes"
|
|
206
|
+
description="size='small' reduces padding to px-3 py-2. size='mini' reduces further to p-2."
|
|
207
|
+
>
|
|
208
|
+
<div className="w-full max-w-sm space-y-3">
|
|
209
|
+
<TextInput
|
|
210
|
+
id="small"
|
|
211
|
+
value=""
|
|
212
|
+
type="text"
|
|
213
|
+
label="Small"
|
|
214
|
+
placeholder="size='small'"
|
|
215
|
+
size="small"
|
|
216
|
+
onChange={() => {}}
|
|
217
|
+
/>
|
|
218
|
+
<TextInput
|
|
219
|
+
id="mini"
|
|
220
|
+
value=""
|
|
221
|
+
type="text"
|
|
222
|
+
label="Mini"
|
|
223
|
+
placeholder="size='mini'"
|
|
224
|
+
size="mini"
|
|
225
|
+
onChange={() => {}}
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
</StorySection>
|
|
229
|
+
</>
|
|
230
|
+
);
|
|
231
|
+
});
|