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.
Files changed (245) hide show
  1. package/README.md +5 -0
  2. package/lib/components/action/button/README.md +75 -0
  3. package/lib/components/action/button/button.stories.tsx +138 -0
  4. package/lib/components/action/buttonGroup/README.md +79 -0
  5. package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
  6. package/lib/components/action/iconButton/README.md +39 -0
  7. package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
  8. package/lib/components/action/radioList/README.md +98 -0
  9. package/lib/components/action/radioList/radioList.stories.tsx +181 -0
  10. package/lib/components/action/slider/README.md +86 -0
  11. package/lib/components/action/slider/slider.stories.tsx +133 -0
  12. package/lib/components/action/textButton/README.md +34 -0
  13. package/lib/components/action/textButton/textButton.stories.tsx +16 -0
  14. package/lib/components/action/toggle/README.md +39 -0
  15. package/lib/components/action/toggle/toggle.stories.tsx +23 -0
  16. package/lib/components/advanced/collapse/README.md +106 -0
  17. package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
  18. package/lib/components/advanced/infoWindow/README.md +69 -0
  19. package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
  20. package/lib/components/advanced/popUp/README.md +95 -0
  21. package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
  22. package/lib/components/auth/bareSignIn/README.md +78 -0
  23. package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
  24. package/lib/components/auth/bareSignUp/README.md +130 -0
  25. package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
  26. package/lib/components/auth/signIn/README.md +53 -0
  27. package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
  28. package/lib/components/auth/signUp/README.md +136 -0
  29. package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
  30. package/lib/components/chart/README.md +13 -0
  31. package/lib/components/chart/areaChart/README.md +133 -0
  32. package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
  33. package/lib/components/chart/barChart/README.md +193 -0
  34. package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
  35. package/lib/components/chart/boxPlotChart/README.md +124 -0
  36. package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
  37. package/lib/components/chart/bubbleChart/README.md +166 -0
  38. package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
  39. package/lib/components/chart/card/README.md +107 -0
  40. package/lib/components/chart/card/card.stories.tsx +89 -0
  41. package/lib/components/chart/ganttChart/README.md +142 -0
  42. package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
  43. package/lib/components/chart/heatmapChart/README.md +125 -0
  44. package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
  45. package/lib/components/chart/lineChart/README.md +140 -0
  46. package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
  47. package/lib/components/chart/pieChart/README.md +117 -0
  48. package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
  49. package/lib/components/chart/polarAreaChart/README.md +126 -0
  50. package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
  51. package/lib/components/chart/radarChart/README.md +57 -0
  52. package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
  53. package/lib/components/chart/radialBar/README.md +152 -0
  54. package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
  55. package/lib/components/chart/rangeBarChart/README.md +323 -0
  56. package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
  57. package/lib/components/chart/statsCard/README.md +97 -0
  58. package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
  59. package/lib/components/chart/treemapChart/README.md +142 -0
  60. package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
  61. package/lib/components/chat/chatAnchor/README.md +113 -0
  62. package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
  63. package/lib/components/chat/chatBase/README.md +223 -0
  64. package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
  65. package/lib/components/chat/chatDashboard/README.md +161 -0
  66. package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
  67. package/lib/components/data/dataGraph/README.md +13 -0
  68. package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
  69. package/lib/components/data/dataReference/README.md +62 -0
  70. package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
  71. package/lib/components/data/dataTemplate/README.md +903 -0
  72. package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
  73. package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
  74. package/lib/components/data/dataWrapper/README.md +1077 -0
  75. package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
  76. package/lib/components/data/queryForm/README.md +56 -0
  77. package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
  78. package/lib/components/data/readQuery/README.md +282 -0
  79. package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
  80. package/lib/components/data/readQueryHoc/README.md +89 -0
  81. package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
  82. package/lib/components/data/writeQuery/README.md +178 -0
  83. package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
  84. package/lib/components/design/actionSection/README.md +47 -0
  85. package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
  86. package/lib/components/design/banner/README.md +43 -0
  87. package/lib/components/design/banner/banner.stories.tsx +34 -0
  88. package/lib/components/design/bannerAction/README.md +44 -0
  89. package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
  90. package/lib/components/design/blogSection/README.md +111 -0
  91. package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
  92. package/lib/components/design/carouselSection/README.md +82 -0
  93. package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
  94. package/lib/components/design/designList/README.md +60 -0
  95. package/lib/components/design/designList/designList.stories.tsx +44 -0
  96. package/lib/components/design/faq/README.md +121 -0
  97. package/lib/components/design/faq/faq.stories.tsx +103 -0
  98. package/lib/components/design/fileGrid/README.md +87 -0
  99. package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
  100. package/lib/components/design/fileViewer/README.md +40 -0
  101. package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
  102. package/lib/components/design/footerSection/README.md +62 -0
  103. package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
  104. package/lib/components/design/googleReview/README.md +45 -0
  105. package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
  106. package/lib/components/design/heroSection/README.md +48 -0
  107. package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
  108. package/lib/components/design/iconList/README.md +60 -0
  109. package/lib/components/design/iconList/iconList.stories.tsx +41 -0
  110. package/lib/components/design/imageGallery/README.md +56 -0
  111. package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
  112. package/lib/components/design/imageZoom/README.md +47 -0
  113. package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
  114. package/lib/components/design/leftContent/README.md +47 -0
  115. package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
  116. package/lib/components/design/logoCloud/README.md +42 -0
  117. package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
  118. package/lib/components/design/onboarding/README.md +100 -0
  119. package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
  120. package/lib/components/design/pricing/README.md +112 -0
  121. package/lib/components/design/pricing/pricing.stories.tsx +86 -0
  122. package/lib/components/design/rightContent/README.md +47 -0
  123. package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
  124. package/lib/components/design/sectionList/README.md +51 -0
  125. package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
  126. package/lib/components/design/teams/README.md +62 -0
  127. package/lib/components/design/teams/teams.stories.tsx +61 -0
  128. package/lib/components/display/alert/README.md +82 -0
  129. package/lib/components/display/alert/alert.stories.tsx +71 -0
  130. package/lib/components/display/calendar/README.md +113 -0
  131. package/lib/components/display/calendar/calendar.stories.tsx +159 -0
  132. package/lib/components/display/clipboard/README.md +36 -0
  133. package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
  134. package/lib/components/display/detailList/README.md +61 -0
  135. package/lib/components/display/detailList/detailList.stories.tsx +131 -0
  136. package/lib/components/display/drawer/README.md +74 -0
  137. package/lib/components/display/drawer/drawer.stories.tsx +66 -0
  138. package/lib/components/display/emptyState/README.md +38 -0
  139. package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
  140. package/lib/components/display/feeds/README.md +80 -0
  141. package/lib/components/display/feeds/feeds.stories.tsx +75 -0
  142. package/lib/components/display/flexTable/README.md +160 -0
  143. package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
  144. package/lib/components/display/grid/README.md +121 -0
  145. package/lib/components/display/grid/grid.stories.tsx +234 -0
  146. package/lib/components/display/kanban/README.md +78 -0
  147. package/lib/components/display/kanban/kanban.stories.tsx +133 -0
  148. package/lib/components/display/list/README.md +109 -0
  149. package/lib/components/display/list/list.stories.tsx +188 -0
  150. package/lib/components/display/loading/README.md +25 -0
  151. package/lib/components/display/loading/loading.stories.tsx +15 -0
  152. package/lib/components/display/mapView/README.md +99 -0
  153. package/lib/components/display/mapView/mapView.stories.tsx +225 -0
  154. package/lib/components/display/modal/README.md +43 -0
  155. package/lib/components/display/modal/modal.stories.tsx +81 -0
  156. package/lib/components/display/notification/README.md +43 -0
  157. package/lib/components/display/notification/notification.stories.tsx +30 -0
  158. package/lib/components/display/progress/README.md +25 -0
  159. package/lib/components/display/progress/progress.stories.tsx +15 -0
  160. package/lib/components/display/stepper/README.md +96 -0
  161. package/lib/components/display/stepper/stepper.stories.tsx +175 -0
  162. package/lib/components/display/table/README.md +176 -0
  163. package/lib/components/display/table/table.stories.tsx +330 -0
  164. package/lib/components/display/tag/README.md +74 -0
  165. package/lib/components/display/tag/tag.stories.tsx +79 -0
  166. package/lib/components/input/address/README.md +132 -0
  167. package/lib/components/input/address/address.stories.tsx +147 -0
  168. package/lib/components/input/canvas/README.md +131 -0
  169. package/lib/components/input/canvas/canvas.stories.tsx +165 -0
  170. package/lib/components/input/checkbox/README.md +61 -0
  171. package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
  172. package/lib/components/input/datePicker/README.md +124 -0
  173. package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
  174. package/lib/components/input/form/README.md +55 -0
  175. package/lib/components/input/form/form.stories.tsx +143 -0
  176. package/lib/components/input/markdown/README.md +146 -0
  177. package/lib/components/input/markdown/markdown.stories.tsx +40 -0
  178. package/lib/components/input/monthYearPicker/README.md +69 -0
  179. package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
  180. package/lib/components/input/netPromoterScore/README.md +52 -0
  181. package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
  182. package/lib/components/input/rating/README.md +51 -0
  183. package/lib/components/input/rating/rating.stories.tsx +30 -0
  184. package/lib/components/input/select/README.md +108 -0
  185. package/lib/components/input/select/select.stories.tsx +286 -0
  186. package/lib/components/input/signature/README.md +106 -0
  187. package/lib/components/input/signature/signature.stories.tsx +188 -0
  188. package/lib/components/input/textArea/README.md +55 -0
  189. package/lib/components/input/textArea/textArea.stories.tsx +30 -0
  190. package/lib/components/input/textInput/README.md +81 -0
  191. package/lib/components/input/textInput/textinput.stories.tsx +231 -0
  192. package/lib/components/input/uploadInput/README.md +134 -0
  193. package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
  194. package/lib/components/navigation/bars/README.md +40 -0
  195. package/lib/components/navigation/bars/bars.stories.tsx +85 -0
  196. package/lib/components/navigation/bottomTab/README.md +53 -0
  197. package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
  198. package/lib/components/navigation/breadcrumb/README.md +48 -0
  199. package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
  200. package/lib/components/navigation/header/README.md +149 -0
  201. package/lib/components/navigation/header/header.stories.tsx +107 -0
  202. package/lib/components/navigation/leftNav/README.md +91 -0
  203. package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
  204. package/lib/components/navigation/tabs/README.md +75 -0
  205. package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
  206. package/lib/components/structure/column/README.md +40 -0
  207. package/lib/components/structure/column/column.stories.tsx +26 -0
  208. package/lib/components/structure/container/README.md +34 -0
  209. package/lib/components/structure/container/container.stories.tsx +19 -0
  210. package/lib/components/structure/link/README.md +55 -0
  211. package/lib/components/structure/link/link.stories.tsx +30 -0
  212. package/lib/components/structure/text/README.md +42 -0
  213. package/lib/components/structure/text/text.stories.tsx +39 -0
  214. package/lib/components/template/authPage/authPage.stories.tsx +68 -0
  215. package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
  216. package/lib/components/template/productListing/productListing.stories.tsx +297 -0
  217. package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
  218. package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
  219. package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
  220. package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
  221. package/lib/mcp/server.d.ts +2 -0
  222. package/lib/mcp/server.d.ts.map +1 -0
  223. package/lib/mcp/server.js +33 -0
  224. package/lib/mcp/server.js.map +1 -0
  225. package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
  226. package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
  227. package/lib/mcp/tools/getBackendComponent.js +119 -0
  228. package/lib/mcp/tools/getBackendComponent.js.map +1 -0
  229. package/lib/mcp/tools/getComponent.d.ts +17 -0
  230. package/lib/mcp/tools/getComponent.d.ts.map +1 -0
  231. package/lib/mcp/tools/getComponent.js +118 -0
  232. package/lib/mcp/tools/getComponent.js.map +1 -0
  233. package/lib/mcp/tools/listComponents.d.ts +13 -0
  234. package/lib/mcp/tools/listComponents.d.ts.map +1 -0
  235. package/lib/mcp/tools/listComponents.js +113 -0
  236. package/lib/mcp/tools/listComponents.js.map +1 -0
  237. package/lib/mcp/tools/listTemplates.d.ts +13 -0
  238. package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
  239. package/lib/mcp/tools/listTemplates.js +68 -0
  240. package/lib/mcp/tools/listTemplates.js.map +1 -0
  241. package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
  242. package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
  243. package/lib/mcp/tools/suggestTemplate.js +212 -0
  244. package/lib/mcp/tools/suggestTemplate.js.map +1 -0
  245. 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
+ });