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,74 @@
1
+ # Tag
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Tag to be displayed for data filter.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { Tag } from "blixify-ui-web/lib";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ return (
19
+ return (
20
+ <div className="flex">
21
+ <Tag
22
+ tagText="React"
23
+ action={
24
+ <XMarkIcon
25
+ className="cursor-pointer mx-auto h-4 w-4 text-white ml-2 mt-1"
26
+ onClick={() => {}}
27
+ />
28
+ }
29
+ />
30
+ <Tag tagText="Clickable Tag" onClick={() => {}} />
31
+ <Tag tagText="Disabled Tag" disabled />
32
+ <Tag tagText="Small" size="small" />
33
+ <Tag tagText="React" variant="outline" />
34
+ <Tag tagText="React" rounded="lg" variant="outline" />
35
+ <Tag tagText="React" rounded="md" variant="outline" />
36
+ <Tag tagText="React" rounded="none" variant="outline" />
37
+ <Tag tagText="React" color="red" />
38
+ <Tag tagText="React" color="blue" />
39
+ <Tag tagText="React" color="green" />
40
+ <Tag tagText="React" color="yellow" />
41
+ <Tag tagText="React" color="indigo" />
42
+ <Tag tagText="React" color="dark" />
43
+ <Tag tagText="React" color="red" variant="flat" />
44
+ <Tag tagText="React" color="blue" variant="flat" />
45
+ <Tag tagText="React" color="green" variant="flat" />
46
+ <Tag tagText="React" color="yellow" variant="flatOutline" />
47
+ <Tag tagText="React" color="indigo" variant="flatOutline" />
48
+ <Tag tagText="React" color="dark" variant="flatOutline" />
49
+ </div>
50
+ );
51
+ );
52
+ ```
53
+
54
+ ##### Required props
55
+
56
+ | Name | Type | Description |
57
+ | --------- | -------- | -------------------- |
58
+ | `tagText` | `string` | `Content of the tag` |
59
+
60
+ ##### Optional props
61
+
62
+ | Name | Type | Description |
63
+ | ---------------- | --------------------------------------------- | ----------------------------- |
64
+ | `id` | `string` | `id` |
65
+ | `action` | `React Element` | `Icon or Action` |
66
+ | `size` | `small` | |
67
+ | `className` | `string` | Additional classname |
68
+ | `disabled` | `boolean` | |
69
+ | `rounded` | `none / md /lg` | Border with |
70
+ | `variant` | `flat / outline /flatOutline` | |
71
+ | `color` | `red / blue / green / yellow / indigo / dark` | Background color & text color |
72
+ | `customFontSize` | `string` | Tailwind font class name |
73
+ | `customPadding` | `string` | Tailwind padding class name |
74
+ | `onClick` | `(value: string) => void` | Value is tagText |
@@ -0,0 +1,79 @@
1
+ import { XMarkIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React from "react";
4
+ import { Tag } from ".";
5
+ import README from "./README.md";
6
+
7
+ const stories = storiesOf("Display", module);
8
+
9
+ stories.addParameters({
10
+ readme: {
11
+ content: README,
12
+ },
13
+ });
14
+
15
+ stories.add("Tag", () => {
16
+ return (
17
+ <div>
18
+ <div className="flex flex-wrap gap-4">
19
+ <Tag
20
+ tagText="React"
21
+ action={
22
+ <XMarkIcon
23
+ className="cursor-pointer mx-auto h-4 w-4 text-white ml-2"
24
+ onClick={() => {}}
25
+ />
26
+ }
27
+ />
28
+ <Tag tagText="Clickable" onClick={() => {}} />
29
+ <Tag tagText="Disabled" disabled />
30
+ </div>
31
+ <div className="mt-4 p-4 flex flex-col space-y-2 border rounded-md">
32
+ <h1 className="font-semibold">Small</h1>
33
+ <Tag tagText="Small" size="small" />
34
+ </div>
35
+ <div className="mt-4 p-4 flex flex-col space-y-2 border rounded-md">
36
+ <h1 className="font-semibold">Rounded</h1>
37
+ <div className="flex flex-wrap gap-4">
38
+ <Tag tagText="React" variant="outline" />
39
+ <Tag tagText="React" rounded="lg" variant="outline" />
40
+ <Tag tagText="React" rounded="md" variant="outline" />
41
+ <Tag tagText="React" rounded="none" variant="outline" />
42
+ </div>
43
+ </div>
44
+ <div className="mt-4 p-4 flex flex-col space-y-2 border rounded-md">
45
+ <h1 className="mb-4 font-semibold">Color Variant</h1>
46
+ <h1 className="text-sm font-medium">Color</h1>
47
+ <div className="flex flex-wrap gap-4">
48
+ <Tag tagText="React" color="red" />
49
+ <Tag tagText="React" color="blue" />
50
+ <Tag tagText="React" color="green" />
51
+ <Tag tagText="React" color="yellow" />
52
+ <Tag tagText="React" color="indigo" />
53
+ <Tag tagText="React" color="dark" />
54
+ <Tag tagText="Default" color="default" />
55
+ </div>
56
+ <h1 className="text-sm font-medium">Outline</h1>
57
+ <div className="flex flex-wrap gap-4">
58
+ <Tag tagText="React" color="red" variant="outline" />
59
+ <Tag tagText="React" color="blue" variant="outline" />
60
+ <Tag tagText="React" color="green" variant="outline" />
61
+ <Tag tagText="React" color="yellow" variant="outline" />
62
+ <Tag tagText="React" color="indigo" variant="outline" />
63
+ <Tag tagText="React" color="dark" variant="outline" />
64
+ <Tag tagText="Default" color="default" variant="outline" />
65
+ </div>
66
+ <h1 className="text-sm font-medium">Flat & Flat Outline</h1>
67
+ <div className="flex flex-wrap gap-4">
68
+ <Tag tagText="React" color="red" variant="flat" />
69
+ <Tag tagText="React" color="blue" variant="flat" />
70
+ <Tag tagText="React" color="green" variant="flat" />
71
+ <Tag tagText="React" color="yellow" variant="flatOutline" />
72
+ <Tag tagText="React" color="indigo" variant="flatOutline" />
73
+ <Tag tagText="React" color="dark" variant="flatOutline" />
74
+ <Tag tagText="Default" color="default" variant="flatOutline" />
75
+ </div>
76
+ </div>
77
+ </div>
78
+ );
79
+ });
@@ -0,0 +1,132 @@
1
+ # Address Input
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ An address autocomplete input backed by the Google Places API. Supports current location detection, lat/lng editing via modal, drag-marker map selection, and custom action buttons.
8
+
9
+ ### Setup
10
+
11
+ Load the Google Maps JS script before the component mounts. Include the `places`, `drawing`, and `geometry` libraries:
12
+
13
+ ```html
14
+ <script
15
+ async
16
+ src="https://maps.googleapis.com/maps/api/js?key=[YOUR_API_KEY]&libraries=places,drawing,geometry"
17
+ ></script>
18
+ ```
19
+
20
+ Or inject it programmatically:
21
+
22
+ ```js
23
+ const script = document.createElement("script");
24
+ script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places,drawing,geometry`;
25
+ document.head.appendChild(script);
26
+ ```
27
+
28
+ ##### Import
29
+
30
+ ```js
31
+ import { Address, AddressClass } from "blixify-ui-web/input/address";
32
+ ```
33
+
34
+ ##### Usage
35
+
36
+ Basic:
37
+
38
+ ```jsx
39
+ const [value, setValue] =
40
+ useState < AddressClass > { name: "", lat: 0, lng: 0 };
41
+
42
+ <Address
43
+ id="address"
44
+ value={value}
45
+ label="Address"
46
+ onChange={setValue}
47
+ delayInit={true}
48
+ />;
49
+ ```
50
+
51
+ With map features:
52
+
53
+ ```jsx
54
+ <Address
55
+ id="address"
56
+ value={value}
57
+ label="Address"
58
+ onChange={setValue}
59
+ getCurrentLocation={true}
60
+ latLngEditModal={true}
61
+ enableDragMarker={true}
62
+ delayInit={true}
63
+ />
64
+ ```
65
+
66
+ With custom buttons:
67
+
68
+ ```jsx
69
+ <Address
70
+ id="address"
71
+ value={value}
72
+ label="Address"
73
+ onChange={setValue}
74
+ delayInit={true}
75
+ customBtn={[
76
+ {
77
+ text: "Copy",
78
+ onClick: (val, text) => console.log(text, val),
79
+ },
80
+ ]}
81
+ />
82
+ ```
83
+
84
+ ##### Required props
85
+
86
+ | Name | Type | Description |
87
+ | ------- | -------------- | ----------------------- |
88
+ | `id` | `string` | Unique field identifier |
89
+ | `value` | `AddressClass` | Current address value |
90
+ | `label` | `string` | Field label |
91
+
92
+ ##### Optional props
93
+
94
+ | Name | Type | Default | Description |
95
+ | -------------------- | --------------------------- | ------- | --------------------------------------------------------------------------------------------------------- |
96
+ | `onChange` | `(e: AddressClass) => void` | — | Called with the updated address when the user selects a place |
97
+ | `placeholder` | `string` | — | Input placeholder text |
98
+ | `optional` | `boolean` | — | Marks the field as optional (skips required validation) |
99
+ | `disabled` | `boolean` | — | Makes the field read-only |
100
+ | `autoFocus` | `boolean` | — | Focus the input on mount |
101
+ | `hideMetadata` | `boolean` | — | Hide the lat/lng display shown below the address field |
102
+ | `getCurrentLocation` | `boolean` | — | Show a button that fills the field from the browser's geolocation API |
103
+ | `latLngEditModal` | `boolean` | — | Show a button that opens a modal to manually edit the lat and lng values |
104
+ | `enableDragMarker` | `boolean` | — | Show a button that opens a map modal where the user can drag a pin to set location |
105
+ | `mobileView` | `boolean` | — | Switch to a mobile-optimised autocomplete layout |
106
+ | `delayInit` | `boolean` | — | Delay initialising the Google Places autocomplete service. Use when the Maps script may not be loaded yet |
107
+ | `customBtn` | `AddressCustomBtn[]` | — | Extra action buttons rendered above the input |
108
+ | `labelExtra` | `ReactElement` | — | Extra element rendered next to the label |
109
+ | `infoElement` | `ReactElement` | — | Info element rendered in the label area |
110
+ | `className` | `string` | — | Tailwind classes for the input element |
111
+ | `containerClassName` | `string` | — | Tailwind classes for the outer container, e.g. `"col-span-2"` |
112
+ | `darkMode` | `boolean` | — | Enable dark mode styling |
113
+ | `cellInput` | `CellInput` | — | Cell input config for use inside a Table component |
114
+
115
+ ##### AddressClass
116
+
117
+ | Name | Type | Required | Description |
118
+ | ---------- | -------- | -------- | ----------------------------- |
119
+ | `name` | `string` | yes | Human-readable address string |
120
+ | `lat` | `number` | yes | Latitude |
121
+ | `lng` | `number` | yes | Longitude |
122
+ | `poi` | `string` | no | Point of interest name |
123
+ | `district` | `string` | no | District |
124
+ | `state` | `string` | no | State / province |
125
+ | `country` | `string` | no | Country |
126
+
127
+ ##### AddressCustomBtn
128
+
129
+ | Name | Type | Description |
130
+ | --------- | ------------------------------------------------ | --------------------------------------------------------- |
131
+ | `text` | `string` | Button label |
132
+ | `onClick` | `(value: AddressClass, btnText: string) => void` | Called with the current address value and the button text |
@@ -0,0 +1,147 @@
1
+ import { storiesOf } from "@storybook/react";
2
+ import React, { useEffect, useState } from "react";
3
+ import { Address, AddressClass } from ".";
4
+ import { StorySection } from "../../storyUtils";
5
+ import README from "./README.md";
6
+
7
+ const stories = storiesOf("Input", module);
8
+
9
+ stories.addParameters({
10
+ readme: {
11
+ content: README,
12
+ },
13
+ });
14
+
15
+ const emptyAddress: AddressClass = { name: "", lat: 0, lng: 0 };
16
+
17
+ // Google Maps must be loaded before Address mounts
18
+ const injectGoogleMaps = () => {
19
+ if (document.getElementById("googleMaps")) return;
20
+ const script = document.createElement("script");
21
+ script.id = "googleMaps";
22
+ script.type = "text/javascript";
23
+ script.src = `https://maps.googleapis.com/maps/api/js?key=&libraries=places,drawing,geometry`;
24
+ script.async = true;
25
+ script.defer = true;
26
+ document.head.appendChild(script);
27
+ };
28
+
29
+ stories.add("Address", () => {
30
+ const [value, setValue] = useState<AddressClass>(emptyAddress);
31
+
32
+ useEffect(() => {
33
+ injectGoogleMaps();
34
+ }, []);
35
+
36
+ return (
37
+ <>
38
+ <StorySection
39
+ title="Default"
40
+ description="Basic address autocomplete backed by the Google Places API. Requires the Google Maps JS script to be loaded before the component mounts."
41
+ >
42
+ <div className="w-full">
43
+ <Address
44
+ id="address-default"
45
+ value={value}
46
+ label="Address"
47
+ onChange={setValue}
48
+ delayInit={true}
49
+ />
50
+ </div>
51
+ </StorySection>
52
+
53
+ <StorySection
54
+ title="With Map Features"
55
+ description="getCurrentLocation adds a button to fill the field from the browser's geolocation. latLngEditModal adds a button to manually edit lat/lng. enableDragMarker opens a map modal where the user can drag a pin to set the location."
56
+ >
57
+ <div className="w-full">
58
+ <Address
59
+ id="address-map"
60
+ value={value}
61
+ label="Address"
62
+ onChange={setValue}
63
+ getCurrentLocation={true}
64
+ latLngEditModal={true}
65
+ enableDragMarker={true}
66
+ delayInit={true}
67
+ />
68
+ </div>
69
+ </StorySection>
70
+
71
+ <StorySection
72
+ title="Custom Buttons"
73
+ description="Pass customBtn to render extra action buttons above the input. Each button receives the current AddressClass value and its own label text in the onClick callback."
74
+ >
75
+ <div className="w-full">
76
+ <Address
77
+ id="address-custom-btn"
78
+ value={value}
79
+ label="Address"
80
+ onChange={setValue}
81
+ delayInit={true}
82
+ customBtn={[
83
+ {
84
+ text: "Copy",
85
+ onClick: (val, text) =>
86
+ window.alert(`${text}: ${JSON.stringify(val)}`),
87
+ },
88
+ {
89
+ text: "Verify",
90
+ onClick: (val, text) =>
91
+ window.alert(`${text}: ${JSON.stringify(val)}`),
92
+ },
93
+ ]}
94
+ />
95
+ </div>
96
+ </StorySection>
97
+
98
+ <StorySection
99
+ title="Mobile View"
100
+ description="mobileView=true switches the autocomplete to a mobile-optimised layout."
101
+ >
102
+ <div className="w-full">
103
+ <Address
104
+ id="address-mobile"
105
+ value={value}
106
+ label="Address"
107
+ onChange={setValue}
108
+ delayInit={true}
109
+ mobileView={true}
110
+ />
111
+ </div>
112
+ </StorySection>
113
+
114
+ <StorySection
115
+ title="Disabled"
116
+ description="disabled=true makes the field read-only."
117
+ >
118
+ <div className="w-full">
119
+ <Address
120
+ id="address-disabled"
121
+ value={{ name: "Kuala Lumpur, Malaysia", lat: 3.14, lng: 101.69 }}
122
+ label="Address"
123
+ onChange={setValue}
124
+ disabled={true}
125
+ delayInit={true}
126
+ />
127
+ </div>
128
+ </StorySection>
129
+
130
+ <StorySection
131
+ title="Hide Metadata"
132
+ description="hideMetadata=true hides the lat/lng display below the address field."
133
+ >
134
+ <div className="w-full">
135
+ <Address
136
+ id="address-no-meta"
137
+ value={value}
138
+ label="Address"
139
+ onChange={setValue}
140
+ hideMetadata={true}
141
+ delayInit={true}
142
+ />
143
+ </div>
144
+ </StorySection>
145
+ </>
146
+ );
147
+ });
@@ -0,0 +1,131 @@
1
+ # Canvas
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ An interactive canvas for placing text and freehand drawings over an optional background image. Supports draw mode, erase mode, image upload, and form validation.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { Canvas } from "blixify-ui-web/input/canvas";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Basic text canvas:
18
+
19
+ ```jsx
20
+ <Canvas
21
+ id="canvas"
22
+ label="Annotation"
23
+ canvasHeight={300}
24
+ onChange={(texts) => setTexts(texts)}
25
+ />
26
+ ```
27
+
28
+ Draw mode with background image:
29
+
30
+ ```jsx
31
+ <Canvas
32
+ id="canvas"
33
+ label="Annotation"
34
+ canvasHeight={300}
35
+ backgroundImageUrl="https://example.com/image.jpg"
36
+ enableDraw
37
+ drawings={drawings}
38
+ onChange={(texts) => setTexts(texts)}
39
+ onDrawingsChange={(d) => setDrawings(d)}
40
+ />
41
+ ```
42
+
43
+ With form validation:
44
+
45
+ ```jsx
46
+ const formRef = useRef(null);
47
+ const canvasRef = useRef(null);
48
+
49
+ <Form ref={formRef} refList={[canvasRef]}>
50
+ <Canvas
51
+ ref={canvasRef}
52
+ id="canvas"
53
+ label="Annotation (Required)"
54
+ canvasHeight={300}
55
+ enableDraw
56
+ onSubmit={(texts, drawings) => console.log(texts, drawings)}
57
+ />
58
+ </Form>
59
+ <Button text="Submit" onClick={() => formRef.current?.handleSubmit()} />
60
+ ```
61
+
62
+ ##### Required props
63
+
64
+ | Name | Type | Description |
65
+ | ------- | -------- | ---------------------------- |
66
+ | `label` | `string` | Label shown above the canvas |
67
+
68
+ ##### Optional props
69
+
70
+ | Name | Type | Default | Description |
71
+ | -------------------------- | --------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
72
+ | `id` | `string` | — | Field identifier. Required when used as a form input ref |
73
+ | `backgroundImageUrl` | `string` | — | URL of an image to load as the canvas background. Fetched via axios |
74
+ | `texts` | `TextEntry[]` | `[]` | Pre-populated text entries |
75
+ | `drawings` | `DrawingPath[]` | `[]` | Pre-populated drawing paths |
76
+ | `enableDraw` | `boolean` | `false` | Show Draw, Erase, and Clear All toolbar buttons |
77
+ | `enableImageUpload` | `boolean` | `false` | Show an Images button that lets the user upload a local image and set it as the canvas background |
78
+ | `optional` | `boolean` | `false` | Skip required validation when used inside a Form |
79
+ | `disabled` | `boolean` | `false` | Disable all interactions, show not-allowed cursor, and reduce opacity |
80
+ | `readOnly` | `boolean` | `false` | Disable all interactions but keep the default cursor and full opacity |
81
+ | `cursor` | `string` | — | Override the canvas cursor style |
82
+ | `canvasWidth` | `number` | `500` | Canvas element width in pixels |
83
+ | `canvasHeight` | `number` | `300` | Canvas element height in pixels |
84
+ | `darkMode` | `boolean` | `false` | Enable dark mode label styling |
85
+ | `subLabel` | `string` | — | Secondary label shown below the main label |
86
+ | `labelExtra` | `ReactElement` | — | Extra element rendered inline with the label |
87
+ | `infoElement` | `ReactElement` | — | Info element rendered in the label area |
88
+ | `customElement` | `ReactElement` | — | Extra element rendered in the toolbar area |
89
+ | `className` | `string` | — | Tailwind classes for the outer container |
90
+ | `containerClassName` | `string` | — | Tailwind classes for the container wrapping label and canvas |
91
+ | `canvasContainerClassName` | `string` | — | Tailwind classes for the canvas wrapper div |
92
+ | `onChange` | `(texts: TextEntry[]) => void` | — | Called when text entries change |
93
+ | `onDrawingsChange` | `(drawings: DrawingPath[]) => void` | — | Called when drawing paths change |
94
+ | `onBackgroundImageChange` | `(image: File \| null) => void` | — | Called when the background image changes via upload. Receives `null` when using an image from `backgroundImageUrl` |
95
+ | `onSubmit` | `(texts: TextEntry[], drawings: DrawingPath[], backgroundImage?: File \| null) => void` | — | Called when the form is submitted successfully |
96
+
97
+ ##### TextEntry
98
+
99
+ | Name | Type | Description |
100
+ | ------- | -------- | --------------------------------------------- |
101
+ | `id` | `string` | Unique identifier |
102
+ | `text` | `string` | Text content |
103
+ | `color` | `string` | CSS color string, e.g. `"black"`, `"#ff0000"` |
104
+ | `size` | `number` | Font size in pixels |
105
+ | `x` | `number` | X position on the canvas |
106
+ | `y` | `number` | Y position on the canvas |
107
+
108
+ ##### DrawingPath
109
+
110
+ | Name | Type | Description |
111
+ | ----------- | ---------------------------- | --------------------------------------- |
112
+ | `id` | `string` | Unique identifier |
113
+ | `points` | `{ x: number; y: number }[]` | Ordered list of points forming the path |
114
+ | `color` | `string` | Stroke color |
115
+ | `lineWidth` | `number` | Stroke width in pixels |
116
+
117
+ ##### Using with Form
118
+
119
+ `Canvas` implements the form input ref interface. When `optional=false` (default), `handleSubmit` validates that:
120
+
121
+ - At least one text entry exists (when `enableDraw` is false)
122
+ - At least one drawing exists (when `enableDraw` is true)
123
+
124
+ ```jsx
125
+ const formRef = useRef(null);
126
+ const canvasRef = useRef(null);
127
+
128
+ <Form ref={formRef} refList={[canvasRef]}>
129
+ <Canvas ref={canvasRef} id="canvas" label="Annotation" enableDraw />
130
+ </Form>;
131
+ ```