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,134 @@
1
+ # Upload Input
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A file upload component supporting single and multi-file modes with drag-and-drop, image compression, HEIC/HEIF auto-conversion, and a mobile-responsive layout.
8
+
9
+ ### Import
10
+
11
+ ```js
12
+ import { UploadInput } from "blixify-ui-web/input/uploadInput";
13
+ ```
14
+
15
+ ### Usage — Single file
16
+
17
+ ```jsx
18
+ const [file, setFile] = useState(undefined);
19
+
20
+ <UploadInput
21
+ lib={{ axios }}
22
+ label="Profile Photo"
23
+ file={file}
24
+ accept=".png,.jpg,.jpeg,.heic,.heif"
25
+ compress={{ maxFileSize: 0.5, fileQuality: 0.8 }}
26
+ onChange={(e) => {
27
+ if (e.target.files.length > 0) setFile(e.target.files[0]);
28
+ else setFile(undefined);
29
+ }}
30
+ />;
31
+ ```
32
+
33
+ ### Usage — Multi file
34
+
35
+ ```jsx
36
+ const [files, setFiles] = useState({ data: [], upload: [], remove: [] });
37
+
38
+ <UploadInput
39
+ lib={{ axios }}
40
+ label="Gallery"
41
+ files={files}
42
+ type="multi"
43
+ onChange={({ value, action }) => {
44
+ if (action === "upload") {
45
+ setFiles((prev) => ({ ...prev, upload: [...prev.upload, ...value] }));
46
+ }
47
+ if (action === "remove") {
48
+ const inData = files.data.some((f) => f.token === value.token);
49
+ if (inData) {
50
+ setFiles((prev) => ({
51
+ ...prev,
52
+ data: prev.data.filter((f) => f.token !== value.token),
53
+ remove: [...prev.remove, value],
54
+ }));
55
+ } else {
56
+ setFiles((prev) => ({
57
+ ...prev,
58
+ upload: prev.upload.filter((f) => f.token !== value.token),
59
+ }));
60
+ }
61
+ }
62
+ }}
63
+ />;
64
+ ```
65
+
66
+ ### Validation via ref
67
+
68
+ ```jsx
69
+ const ref = useRef(null);
70
+
71
+ <UploadInput ref={ref} lib={{ axios }} label="Photo" file={file} onChange={...} />
72
+ <Button text="Submit" onClick={() => ref.current?.handleSubmit()} />
73
+ ```
74
+
75
+ `handleSubmit()` returns a `Promise<boolean>`. It validates that a file is present and that file sizes are within `maxFileSize`.
76
+
77
+ ### FilesObj
78
+
79
+ Used for `type="multi"`. Manage three arrays to track state across save/delete operations.
80
+
81
+ | Field | Type | Description |
82
+ | -------- | ----------- | ------------------------------------------------- |
83
+ | `data` | `FileObj[]` | Files already persisted (e.g. loaded from server) |
84
+ | `upload` | `FileObj[]` | Newly added files pending upload |
85
+ | `remove` | `FileObj[]` | Files marked for deletion |
86
+
87
+ ### FileObj
88
+
89
+ | Field | Type | Description |
90
+ | ---------- | ---------------- | ------------------------------------------------------- |
91
+ | `fileName` | `string \| File` | URL string (for `data`) or `File` object (for `upload`) |
92
+ | `token` | `string` | Unique identifier (use `uuidv4()` for new uploads) |
93
+
94
+ ### Required props
95
+
96
+ | Name | Type | Description |
97
+ | ------- | ---------------- | ------------------------------------- |
98
+ | `label` | `string` | Label displayed above the upload area |
99
+ | `lib` | `{ axios: any }` | Axios instance used for file download |
100
+
101
+ ### Optional props
102
+
103
+ | Name | Type | Default | Description |
104
+ | -------------------------- | ------------------------------------------------ | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
105
+ | `id` | `string` | — | HTML id for the file input |
106
+ | `labelExtra` | `ReactElement` | — | Extra element rendered inline with the label |
107
+ | `infoElement` | `ReactElement` | — | Content shown in an InfoWindow tooltip next to the label |
108
+ | `customElement` | `ReactElement` | — | Custom element rendered to the right of the label row |
109
+ | `optional` | `boolean` | `false` | Skips validation when `true` |
110
+ | `type` | `"multi"` | — | Enables multi-file mode; omit for single-file mode |
111
+ | `file` | `File \| string \| any` | — | Current file value (single mode) |
112
+ | `files` | `FilesObj` | — | Current files state (multi mode) |
113
+ | `accept` | `string` | — | Comma-separated accepted file extensions e.g. `".png,.jpg,.pdf"` |
114
+ | `capture` | `"environment" \| "user"` | — | Activates camera capture on mobile; disables drag-and-drop when set |
115
+ | `fileDescription` | `string` | `"PNG, JPG, JPEG, HEIC, TIFF up to 30MB"` | Hint text shown below the dropzone |
116
+ | `hidePreview` | `boolean` | `false` | Shows a generic icon instead of image/file preview |
117
+ | `disabled` | `boolean` | `false` | Disables all upload interactions |
118
+ | `maxFileSize` | `number` | `30` | Max file size in MB for validation (via `handleSubmit`) |
119
+ | `limit` | `number` | — | Max number of files shown in the preview grid (multi mode) |
120
+ | `showModal` | `boolean` | `false` | Opens a Camera / Gallery modal instead of a direct file picker |
121
+ | `confirmOnRemove` | `boolean` | `false` | Shows a confirmation modal before removing a file (multi mode) |
122
+ | `noDuplicateFileName` | `boolean` | `false` | Rejects files whose name already exists in `data` or `upload` (multi mode) |
123
+ | `compress` | `{ maxFileSize?: number; fileQuality?: number }` | — | Compresses images before upload. `maxFileSize` in MB, `fileQuality` 0–1. PNG files cannot be compressed and will error if they exceed `maxFileSize`. |
124
+ | `darkMode` | `boolean` | `false` | Applies dark colour scheme |
125
+ | `mobileView` | `boolean` | `false` | Renders a compact inline layout for mobile (label left, upload button right) |
126
+ | `className` | `tailwind class` | — | Class applied to the outer container |
127
+ | `onChange` | `(e: any) => void` | — | Called on file add/remove. Single: `e.target.files`. Multi: `{ value, action }` |
128
+ | `handleCustomDownloadFile` | `(url: string) => void` | — | Overrides the default axios download behaviour for image previews |
129
+
130
+ ### Notes
131
+
132
+ - HEIC/HEIF files are automatically converted to JPEG before upload.
133
+ - Drag-and-drop is disabled when `capture` or `showModal` is set.
134
+ - `compress` only applies to image formats (JPG, JPEG, GIF, BMP, TIFF, HEIC, HEIF). PNG files are not compressible — if a PNG exceeds `compress.maxFileSize` an error is shown.
@@ -0,0 +1,193 @@
1
+ import { storiesOf } from "@storybook/react";
2
+ import axios from "axios";
3
+ import React, { useRef, useState } from "react";
4
+ import { UploadInput } from ".";
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
+ const emptyFiles = { data: [], upload: [], remove: [] };
17
+
18
+ const preloadedImages = {
19
+ data: [
20
+ {
21
+ fileName:
22
+ "https://images.pexels.com/photos/2338407/pexels-photo-2338407.jpeg?auto=compress&cs=tinysrgb&w=400",
23
+ token: "A",
24
+ },
25
+ {
26
+ fileName:
27
+ "https://images.pexels.com/photos/60616/fried-chicken-chicken-fried-crunchy-60616.jpeg?auto=compress&cs=tinysrgb&w=400",
28
+ token: "B",
29
+ },
30
+ ],
31
+ upload: [],
32
+ remove: [],
33
+ };
34
+
35
+ stories.add("UploadInput", () => {
36
+ const refSingle = useRef<any>(null);
37
+
38
+ const [singleFile, setSingleFile] = useState<any>(undefined);
39
+ const [singlePdf, setSinglePdf] = useState<any>(undefined);
40
+ const [multiImages, setMultiImages] = useState<any>({ ...preloadedImages });
41
+ const [multiPdfs, setMultiPdfs] = useState<any>({ ...emptyFiles });
42
+ const [noDupFiles, setNoDupFiles] = useState<any>({ ...emptyFiles });
43
+
44
+ const handleMultiChange =
45
+ (setter: React.Dispatch<React.SetStateAction<any>>) =>
46
+ ({ value, action }: { value: any; action: string }) => {
47
+ setter((prev: any) => {
48
+ if (action === "upload") {
49
+ return { ...prev, upload: [...prev.upload, ...value] };
50
+ }
51
+ if (action === "remove") {
52
+ const inData = prev.data.some((f: any) => f.token === value.token);
53
+ if (inData) {
54
+ return {
55
+ ...prev,
56
+ data: prev.data.filter((f: any) => f.token !== value.token),
57
+ remove: [...prev.remove, value],
58
+ };
59
+ }
60
+ return {
61
+ ...prev,
62
+ upload: prev.upload.filter((f: any) => f.token !== value.token),
63
+ };
64
+ }
65
+ return prev;
66
+ });
67
+ };
68
+
69
+ return (
70
+ <>
71
+ <StorySection
72
+ title="Single Image Upload"
73
+ description="Default single-file mode. Accepts PNG, JPG, JPEG, HEIC, HEIF. HEIC/HEIF files are auto-converted to JPEG. compress reduces file size before upload."
74
+ >
75
+ <div className="w-full max-w-sm">
76
+ <UploadInput
77
+ ref={refSingle}
78
+ lib={{ axios }}
79
+ label="Profile Photo"
80
+ file={singleFile}
81
+ accept=".png,.jpg,.jpeg,.heic,.heif"
82
+ compress={{ maxFileSize: 0.5, fileQuality: 0.8 }}
83
+ onChange={(e) => {
84
+ if (e.target.files.length > 0) setSingleFile(e.target.files[0]);
85
+ else setSingleFile(undefined);
86
+ }}
87
+ />
88
+ </div>
89
+ </StorySection>
90
+
91
+ <StorySection
92
+ title="Single PDF Upload"
93
+ description="Restrict accepted files with accept='.pdf'. fileDescription overrides the default hint text."
94
+ >
95
+ <div className="w-full max-w-sm">
96
+ <UploadInput
97
+ lib={{ axios }}
98
+ label="Upload PDF"
99
+ file={singlePdf}
100
+ accept=".pdf"
101
+ fileDescription="PDF up to 10MB"
102
+ onChange={(e) => {
103
+ if (e.target.files.length > 0) setSinglePdf(e.target.files[0]);
104
+ else setSinglePdf(undefined);
105
+ }}
106
+ />
107
+ </div>
108
+ </StorySection>
109
+
110
+ <StorySection
111
+ title="Multi Image Upload (with compress)"
112
+ description="type='multi' manages a FilesObj with data/upload/remove arrays. compress applies to each uploaded image."
113
+ >
114
+ <div className="w-full max-w-sm">
115
+ <UploadInput
116
+ lib={{ axios }}
117
+ label="Gallery"
118
+ files={multiImages}
119
+ type="multi"
120
+ accept=".png,.jpg,.jpeg,.heic,.heif"
121
+ compress={{ maxFileSize: 0.5, fileQuality: 0.8 }}
122
+ onChange={handleMultiChange(setMultiImages)}
123
+ />
124
+ </div>
125
+ </StorySection>
126
+
127
+ <StorySection
128
+ title="Multi PDF Upload"
129
+ description="Multi-file mode restricted to PDFs. fileDescription customises the hint below the dropzone."
130
+ >
131
+ <div className="w-full max-w-sm">
132
+ <UploadInput
133
+ lib={{ axios }}
134
+ label="Documents"
135
+ files={multiPdfs}
136
+ type="multi"
137
+ accept=".pdf"
138
+ fileDescription="PDF files up to 10MB each"
139
+ onChange={handleMultiChange(setMultiPdfs)}
140
+ />
141
+ </div>
142
+ </StorySection>
143
+
144
+ <StorySection
145
+ title="Disabled"
146
+ description="disabled=true prevents any file interaction. Existing files are still displayed."
147
+ >
148
+ <div className="w-full max-w-sm">
149
+ <UploadInput
150
+ lib={{ axios }}
151
+ label="Disabled Upload"
152
+ files={preloadedImages}
153
+ type="multi"
154
+ disabled={true}
155
+ onChange={() => {}}
156
+ />
157
+ </div>
158
+ </StorySection>
159
+
160
+ <StorySection
161
+ title="Confirm on Remove"
162
+ description="confirmOnRemove=true shows a confirmation modal before removing a file from a multi upload."
163
+ >
164
+ <div className="w-full max-w-sm">
165
+ <UploadInput
166
+ lib={{ axios }}
167
+ label="With Removal Confirmation"
168
+ files={multiImages}
169
+ type="multi"
170
+ confirmOnRemove={true}
171
+ onChange={handleMultiChange(setMultiImages)}
172
+ />
173
+ </div>
174
+ </StorySection>
175
+
176
+ <StorySection
177
+ title="No Duplicate File Names"
178
+ description="noDuplicateFileName=true rejects any file whose name already exists in data or upload arrays."
179
+ >
180
+ <div className="w-full max-w-sm">
181
+ <UploadInput
182
+ lib={{ axios }}
183
+ label="No Duplicates"
184
+ files={noDupFiles}
185
+ type="multi"
186
+ noDuplicateFileName={true}
187
+ onChange={handleMultiChange(setNoDupFiles)}
188
+ />
189
+ </div>
190
+ </StorySection>
191
+ </>
192
+ );
193
+ });
@@ -0,0 +1,40 @@
1
+ # Bars
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Multiple bars selection for navigation
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { Bars } from "blixify-ui-web/components/navigation/bars";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ <Bars bars={navigation} selectedId={"reports"} />
19
+ ```
20
+
21
+ ##### Required props
22
+
23
+ | Name | Type | Description |
24
+ | ------------ | ------------ | --------------- |
25
+ | `bars` | `Bars Class` | Bar Class List |
26
+ | `selectedId` | `string` | Selected Tab ID |
27
+
28
+ ##### Optional props
29
+
30
+ | Name | Type | Default | Description |
31
+ | ------------------ | ------------------ | ---------------------------------------------- | -------------------------------------------- |
32
+ | `primaryColor` | `boolean` | `false` | |
33
+ | `draggable` | `boolean` | `false` | Make component items draggable |
34
+ | `collapse` | `boolean` | `false` | Required when leftNav transition is not null |
35
+ | `customColor` | `string` | `""` | Rainbow color for bar |
36
+ | `linkProps` | `Link Props Class` | Refer to Link Component for more documentation | |
37
+ | `onClick` | `function` | `() => {}` | |
38
+ | `handleChangeBars` | `function` | `(value) => {setBars(value)}` | Required when draggable is true |
39
+ | `handleDropEnd` | `function` | `() => {}` | Required when draggable is true |
40
+ | `horizontal` | `boolean` | `false` | When `true`, display horizontal bar |
@@ -0,0 +1,85 @@
1
+ import {
2
+ CalendarIcon,
3
+ ChartBarIcon,
4
+ FolderIcon,
5
+ HomeIcon,
6
+ InboxIcon,
7
+ UsersIcon,
8
+ } from "@heroicons/react/24/outline";
9
+ import { storiesOf } from "@storybook/react";
10
+ import React, { useState } from "react";
11
+ import { Bars } from ".";
12
+ import README from "./README.md";
13
+
14
+ const stories = storiesOf("Navigation", module);
15
+
16
+ stories.addParameters({
17
+ readme: {
18
+ content: README,
19
+ },
20
+ });
21
+
22
+ stories.add("Bars", () => {
23
+ const [selectedId, setSelectedId] = useState("reports");
24
+ const [navigation, setNavigation] = useState([
25
+ {
26
+ id: "dashboard",
27
+ name: "Dashboard",
28
+ href: "#",
29
+ icon: HomeIcon,
30
+ },
31
+ { id: "team", name: "Team", href: "#", icon: UsersIcon, current: false },
32
+ {
33
+ id: "projects",
34
+ name: "Projects",
35
+ href: "#",
36
+ icon: FolderIcon,
37
+ groupId: "Activity",
38
+ },
39
+ {
40
+ id: "calendar",
41
+ name: "Calendar",
42
+ href: "#",
43
+ icon: CalendarIcon,
44
+ groupId: "Activity",
45
+ },
46
+ {
47
+ id: "documents",
48
+ name: "Documents",
49
+ href: "#",
50
+ icon: InboxIcon,
51
+ },
52
+ {
53
+ id: "reports",
54
+ name: "Reports",
55
+ href: "#",
56
+ icon: ChartBarIcon,
57
+ },
58
+ ]);
59
+
60
+ return (
61
+ <>
62
+ <Bars
63
+ bars={navigation}
64
+ selectedId={"reports"}
65
+ primaryColor={true}
66
+ horizontal={false}
67
+ />
68
+ <div className="bg-gray-900">
69
+ <Bars
70
+ draggable={true}
71
+ bars={navigation}
72
+ selectedId={selectedId}
73
+ primaryColor={true}
74
+ darkMode={true}
75
+ onClick={(id) => {
76
+ setSelectedId(id);
77
+ }}
78
+ handleChangeBars={setNavigation}
79
+ handleDropEnd={() => {}}
80
+ horizontal={true}
81
+ />
82
+ </div>
83
+ </>
84
+ );
85
+ });
@@ -0,0 +1,53 @@
1
+ # Bottom Tab
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ BottomTab for mobile bottom tab navigation
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { BottomTab } from "blixify-ui-web/components/navigation/BottomTab";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ const tabs = [
19
+ { icon: HomeIcon, title: "Home", href: "/home" },
20
+ { icon: SunIcon, title: "Device", href: "/device" },
21
+ {
22
+ icon: ChatBubbleOvalLeftEllipsisIcon,
23
+ title: "Feedback",
24
+ href: "/feedback",
25
+ },
26
+ { icon: UserGroupIcon, title: "Referral", href: "/referral" },
27
+ ];
28
+
29
+ stories.add("BottomTab", () => {
30
+ return <BottomTab tabData={tabs} selectedTab="Home" />;
31
+ });
32
+ ```
33
+
34
+ ##### Required props
35
+
36
+ | Name | Type | Description |
37
+ | ------------- | -------------- | --------------------------- |
38
+ | `tabData` | `TabSelection` | Tab Selection List |
39
+ | `selectedTab` | `string` | The tab that being selected |
40
+
41
+ ##### Optional props
42
+
43
+ | Name | Type | Default | Description |
44
+ | --------------------- | ---------------- | ------- | ----------- |
45
+ | `bottomTabClassName?` | `tailwind class` | "" | |
46
+
47
+ ##### TabSelection props
48
+
49
+ | Name | Type | Default | Description |
50
+ | ------- | -------- | ------- | ----------- |
51
+ | `icon` | `any` | "" | |
52
+ | `title` | `string` | "" | |
53
+ | `href` | `string` | "" | |
@@ -0,0 +1,32 @@
1
+ import {
2
+ ChatBubbleOvalLeftEllipsisIcon,
3
+ HomeIcon,
4
+ SunIcon,
5
+ UserGroupIcon,
6
+ } from "@heroicons/react/24/solid";
7
+ import { storiesOf } from "@storybook/react";
8
+ import React from "react";
9
+ import { BottomTab } from ".";
10
+ import README from "./README.md";
11
+ const stories = storiesOf("Navigation", module);
12
+
13
+ stories.addParameters({
14
+ readme: {
15
+ content: README,
16
+ },
17
+ });
18
+
19
+ const tabs = [
20
+ { icon: HomeIcon, title: "Home", href: "/home" },
21
+ { icon: SunIcon, title: "Device", href: "/device" },
22
+ {
23
+ icon: ChatBubbleOvalLeftEllipsisIcon,
24
+ title: "Feedback",
25
+ href: "/feedback",
26
+ },
27
+ { icon: UserGroupIcon, title: "Referral", href: "/referral" },
28
+ ];
29
+
30
+ stories.add("BottomTab", () => {
31
+ return <BottomTab tabData={tabs} selectedTab="Home" />;
32
+ });
@@ -0,0 +1,48 @@
1
+ # Breadcrumb
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Breadcrumb for selected item navigation
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { Breadcrumb } from "blixify-ui-web/components/navigation/breadcrumb";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ const pages = [
19
+ { name: "Projects", href: "#", current: false },
20
+ { name: "Project Nero", href: "#", current: true },
21
+ ];
22
+
23
+ stories.add("Breadcrumb", () => {
24
+ return <Breadcrumb pages={pages} />;
25
+ });
26
+ ```
27
+
28
+ ##### Required props
29
+
30
+ | Name | Type | Description |
31
+ | ------- | ----------------- | --------------- |
32
+ | `pages` | `Page Class List` | Page Class List |
33
+
34
+ ##### Optional props
35
+
36
+ | Name | Type | Default | Description |
37
+ | ----------- | ---------------- | ---------- | ----------- |
38
+ | `className` | `tailwind class` | "" | |
39
+ | `onClick` | `function` | `() => {}` | |
40
+
41
+ ##### Page Class props
42
+
43
+ | Name | Type | Default | Description |
44
+ | ----------- | ------------------ | ---------------------------------------------- | ----------------------- |
45
+ | `name` | `string` | "" | |
46
+ | `href` | `string` | "" | |
47
+ | `current` | `boolean` | false | Whether page is current |
48
+ | `linkProps` | `Link Props Class` | Refer to Link Component for more documentation | |
@@ -0,0 +1,27 @@
1
+ import { storiesOf } from "@storybook/react";
2
+ import React from "react";
3
+ import { Breadcrumb } from ".";
4
+ import README from "./README.md";
5
+ const stories = storiesOf("Navigation", module);
6
+
7
+ stories.addParameters({
8
+ readme: {
9
+ content: README,
10
+ },
11
+ });
12
+
13
+ const pages = [
14
+ { name: "Projects", href: "#", current: false },
15
+ { name: "Project Nero", href: "#", current: true },
16
+ ];
17
+
18
+ stories.add("Breadcrumb", () => {
19
+ return (
20
+ <>
21
+ <Breadcrumb pages={pages} />
22
+ <div className="bg-gray-900 py-2">
23
+ <Breadcrumb pages={pages} darkMode={true} />
24
+ </div>
25
+ </>
26
+ );
27
+ });