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,165 @@
1
+ import { ArrowsPointingOutIcon, MapIcon } from "@heroicons/react/24/solid";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React, { useState } from "react";
4
+ import { Collapse } from ".";
5
+ import { Stepper } from "../../display/stepper";
6
+ import README from "./README.md";
7
+ import { StorySection } from "../../storyUtils";
8
+
9
+ const stories = storiesOf("Advanced", module);
10
+
11
+ stories.addParameters({
12
+ readme: {
13
+ content: README,
14
+ },
15
+ });
16
+
17
+ const loremContent = (
18
+ <div className="w-full p-3 text-sm text-gray-700">
19
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent quis urna
20
+ in nisl volutpat congue at id leo. Morbi porta lacus ex, a posuere urna
21
+ vulputate in. Nunc a nisi in est tempor mattis. Morbi finibus velit eget
22
+ eros maximus, in bibendum arcu maximus.
23
+ </div>
24
+ );
25
+
26
+ const stepperComp = (
27
+ <div className="my-8 bg-white">
28
+ <Stepper
29
+ steps={[
30
+ { title: "Deposit Status", description: "2024-07-12" },
31
+ { title: "Proposal Confirmation" },
32
+ { title: "Documents Collection" },
33
+ ]}
34
+ horizontal={true}
35
+ stepIndex={2}
36
+ onChange={() => {}}
37
+ />
38
+ </div>
39
+ );
40
+
41
+ stories.add("Collapse", () => {
42
+ const [collapse, setCollapse] = useState(true);
43
+ const toggle = () => setCollapse((prev) => !prev);
44
+
45
+ return (
46
+ <div className="font-sans max-w-2xl p-6">
47
+ <StorySection
48
+ title="Default"
49
+ description={
50
+ <>
51
+ Basic collapse with a title and icon. The header is clickable — pass{" "}
52
+ <code>handleCollapse</code> to control state externally, or omit it
53
+ to use internal state. <code>collapse=&#123;true&#125;</code> means
54
+ the content is visible (expanded).
55
+ </>
56
+ }
57
+ >
58
+ <div className="w-full rounded-lg border overflow-hidden">
59
+ <Collapse
60
+ title="Map View"
61
+ collapse={collapse}
62
+ defaultValue={false}
63
+ icon={<MapIcon className="w-5 h-5 text-primary-500" />}
64
+ content={loremContent}
65
+ handleCollapse={toggle}
66
+ />
67
+ </div>
68
+ </StorySection>
69
+
70
+ <StorySection
71
+ title="With Additional Header Component"
72
+ description={
73
+ <>
74
+ Use <code>additionalComp</code> to render an extra element in the
75
+ header row, to the left of the chevron. Call{" "}
76
+ <code>stopPropagation</code> on its click handler to prevent
77
+ toggling the collapse.
78
+ </>
79
+ }
80
+ >
81
+ <div className="w-full rounded-lg border overflow-hidden">
82
+ <Collapse
83
+ title="Map View"
84
+ collapse={collapse}
85
+ icon={<MapIcon className="w-5 h-5 text-primary-500" />}
86
+ additionalComp={
87
+ <ArrowsPointingOutIcon
88
+ className="w-5 h-5 text-primary-500 mr-2"
89
+ onClick={(e) => {
90
+ e?.stopPropagation();
91
+ e?.preventDefault();
92
+ }}
93
+ />
94
+ }
95
+ content={loremContent}
96
+ handleCollapse={toggle}
97
+ />
98
+ </div>
99
+ </StorySection>
100
+
101
+ <StorySection
102
+ title="Custom Header Styling"
103
+ description={
104
+ <>
105
+ Use <code>collapseContainerCss</code> and{" "}
106
+ <code>notCollapseContainerCss</code> to style the header when
107
+ expanded or collapsed. Combine with <code>titleClassName</code>,{" "}
108
+ <code>descClassName</code>, and <code>iconClassName</code> for full
109
+ control.
110
+ </>
111
+ }
112
+ >
113
+ <div className="w-full rounded-lg border overflow-hidden">
114
+ <Collapse
115
+ title="Map View"
116
+ desc="Lorem ipsum dolor sit amet"
117
+ collapse={collapse}
118
+ icon={<></>}
119
+ collapseContainerCss="bg-primary-600"
120
+ notCollapseContainerCss="bg-primary-600"
121
+ titleClassName="text-white text-2xl"
122
+ descClassName="text-white"
123
+ iconClassName="w-5 h-5 text-white"
124
+ content={loremContent}
125
+ handleCollapse={toggle}
126
+ />
127
+ </div>
128
+ </StorySection>
129
+
130
+ <StorySection
131
+ title="Collapse Additional Component + Expand Button"
132
+ description={
133
+ <>
134
+ <code>collapseAdditionalComp</code> renders below the header only
135
+ when the panel is collapsed (content hidden). <code>expandBtn</code>{" "}
136
+ adds a tag button at the bottom of the panel to toggle state.
137
+ </>
138
+ }
139
+ >
140
+ <div className="w-full rounded-lg border overflow-hidden">
141
+ <Collapse
142
+ title="Map View"
143
+ desc="Lorem ipsum dolor sit amet, consectetur adipiscing elit."
144
+ collapse={collapse}
145
+ icon={<></>}
146
+ collapseContainerCss="bg-primary-800"
147
+ notCollapseContainerCss="bg-primary-800"
148
+ titleClassName="text-white text-2xl"
149
+ descClassName="text-white"
150
+ iconClassName="w-5 h-5 text-white"
151
+ collapseAdditionalComp={stepperComp}
152
+ content={
153
+ <div className="flex flex-col">
154
+ {stepperComp}
155
+ {loremContent}
156
+ </div>
157
+ }
158
+ handleCollapse={toggle}
159
+ expandBtn
160
+ />
161
+ </div>
162
+ </StorySection>
163
+ </div>
164
+ );
165
+ });
@@ -0,0 +1,69 @@
1
+ # Info Window
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A popover that opens on hover (or click) to display contextual information next to a trigger icon.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { InfoWindow } from "blixify-ui-web/advanced/infoWindow";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Basic (opens on hover):
18
+
19
+ ```jsx
20
+ <InfoWindow
21
+ type="right"
22
+ content={
23
+ <div className="w-60 bg-gray-200 p-3 rounded-lg">Description here...</div>
24
+ }
25
+ icon={<QuestionMarkCircleIcon className="h-6 w-6 text-gray-400" />}
26
+ />
27
+ ```
28
+
29
+ Open on click only:
30
+
31
+ ```jsx
32
+ <InfoWindow
33
+ type="bottom end"
34
+ content={
35
+ <div className="w-60 bg-gray-200 p-3 rounded-lg">Description here...</div>
36
+ }
37
+ icon={<BoltIcon className="h-6 w-6 text-gray-400" />}
38
+ disableOpenOnHover
39
+ />
40
+ ```
41
+
42
+ Open by default on mount:
43
+
44
+ ```jsx
45
+ <InfoWindow
46
+ type="right"
47
+ defaultOpen={true}
48
+ content={
49
+ <div className="w-60 bg-gray-200 p-3 rounded-lg">Description here...</div>
50
+ }
51
+ icon={<QuestionMarkCircleIcon className="h-6 w-6 text-gray-400" />}
52
+ />
53
+ ```
54
+
55
+ ##### Required props
56
+
57
+ | Name | Type | Description |
58
+ | --------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ |
59
+ | `content` | `ReactElement` | Content rendered inside the popover panel |
60
+ | `icon` | `ReactElement` | Trigger element — clicking or hovering opens the panel |
61
+ | `type` | `"left" \| "right" \| "bottom" \| "bottom start" \| "bottom end" \| "top" \| "top start" \| "top end"` | Position of the panel relative to the icon |
62
+
63
+ ##### Optional props
64
+
65
+ | Name | Type | Default | Description |
66
+ | -------------------- | ------------ | ------- | ----------------------------------------------------------- |
67
+ | `defaultOpen` | `boolean` | `false` | When `true`, the panel is open on mount |
68
+ | `disableOpenOnHover` | `boolean` | `false` | When `true`, the panel only opens on click instead of hover |
69
+ | `onClick` | `() => void` | — | Additional callback fired when the trigger icon is clicked |
@@ -0,0 +1,112 @@
1
+ import { BoltIcon } from "@heroicons/react/24/outline";
2
+ import { QuestionMarkCircleIcon } from "@heroicons/react/24/solid";
3
+ import { storiesOf } from "@storybook/react";
4
+ import React from "react";
5
+ import { InfoWindow } from ".";
6
+ import README from "./README.md";
7
+ import { StorySection } from "../../storyUtils";
8
+
9
+ const stories = storiesOf("Advanced", module);
10
+
11
+ stories.addParameters({
12
+ readme: {
13
+ content: README,
14
+ },
15
+ });
16
+
17
+ const infoContent = (
18
+ <div className="w-60 bg-gray-200 p-3 rounded-lg text-sm text-gray-700">
19
+ Place your description here...
20
+ </div>
21
+ );
22
+
23
+ const iconClassName = "h-6 w-6 text-gray-400";
24
+
25
+ stories.add("Info Window", () => (
26
+ <div className="font-sans max-w-2xl p-6">
27
+ <StorySection
28
+ title="Position: Right"
29
+ description={
30
+ <>
31
+ Use <code>type="right"</code> to anchor the panel to the right of the
32
+ icon. Set <code>defaultOpen=&#123;true&#125;</code> to show the panel
33
+ on mount.
34
+ </>
35
+ }
36
+ >
37
+ <InfoWindow
38
+ type="right"
39
+ defaultOpen={true}
40
+ content={infoContent}
41
+ icon={<QuestionMarkCircleIcon className={iconClassName} />}
42
+ />
43
+ </StorySection>
44
+
45
+ <StorySection
46
+ title="Position: Left"
47
+ description={
48
+ <>
49
+ Use <code>type="left"</code> to anchor the panel to the left of the
50
+ icon.
51
+ </>
52
+ }
53
+ >
54
+ <InfoWindow
55
+ type="left"
56
+ content={infoContent}
57
+ icon={<QuestionMarkCircleIcon className={iconClassName} />}
58
+ />
59
+ </StorySection>
60
+
61
+ <StorySection
62
+ title="Position: Bottom Start"
63
+ description={
64
+ <>
65
+ Use <code>type="bottom start"</code> to open the panel below the icon,
66
+ aligned to the start (left) edge. Also available:{" "}
67
+ <code>"bottom"</code>, <code>"bottom end"</code>.
68
+ </>
69
+ }
70
+ >
71
+ <InfoWindow
72
+ type="bottom start"
73
+ content={infoContent}
74
+ icon={<BoltIcon className={iconClassName} />}
75
+ />
76
+ </StorySection>
77
+
78
+ <StorySection
79
+ title="Position: Top Start"
80
+ description={
81
+ <>
82
+ Use <code>type="top start"</code> to open the panel above the icon.
83
+ Also available: <code>"top"</code>, <code>"top end"</code>.
84
+ </>
85
+ }
86
+ >
87
+ <InfoWindow
88
+ type="top start"
89
+ content={infoContent}
90
+ icon={<BoltIcon className={iconClassName} />}
91
+ />
92
+ </StorySection>
93
+
94
+ <StorySection
95
+ title="Open on Click (disableOpenOnHover)"
96
+ description={
97
+ <>
98
+ By default the panel opens on hover. Set{" "}
99
+ <code>disableOpenOnHover=&#123;true&#125;</code> to require an
100
+ explicit click to open and close the panel instead.
101
+ </>
102
+ }
103
+ >
104
+ <InfoWindow
105
+ type="bottom end"
106
+ content={infoContent}
107
+ icon={<BoltIcon className={iconClassName} />}
108
+ disableOpenOnHover
109
+ />
110
+ </StorySection>
111
+ </div>
112
+ ));
@@ -0,0 +1,95 @@
1
+ # Pop Up
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ A floating panel anchored to a trigger element. Supports click or hover triggers, top/bottom direction, and left/right anchor alignment. Can be closed programmatically via a ref.
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { PopUp } from "blixify-ui-web/advanced/popUp";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ Basic click trigger:
18
+
19
+ ```jsx
20
+ import { Transition } from "@headlessui/react";
21
+
22
+ <PopUp
23
+ ctaComp={<ChevronDownIcon className="h-5 w-5" />}
24
+ renderComp={<div className="p-4 w-72">Popup content</div>}
25
+ lib={{ Transition }}
26
+ />;
27
+ ```
28
+
29
+ Close the popup from inside `renderComp` using a ref:
30
+
31
+ ```jsx
32
+ const ref = useRef(null);
33
+
34
+ <PopUp
35
+ ref={ref}
36
+ ctaComp={<ChevronDownIcon className="h-5 w-5" />}
37
+ renderComp={
38
+ <div className="p-4 w-72">
39
+ <button onClick={() => ref.current.handleOnClose()}>Close</button>
40
+ </div>
41
+ }
42
+ lib={{ Transition }}
43
+ />;
44
+ ```
45
+
46
+ Hover trigger:
47
+
48
+ ```jsx
49
+ <PopUp
50
+ ctaComp={<Card title="Hover me" />}
51
+ renderComp={<div className="p-4 w-72">Shown on hover</div>}
52
+ trigger="hover"
53
+ anchor="left"
54
+ className="w-full"
55
+ lib={{ Transition }}
56
+ />
57
+ ```
58
+
59
+ Top direction with left anchor:
60
+
61
+ ```jsx
62
+ <PopUp
63
+ ctaComp={<ChevronUpIcon className="h-5 w-5" />}
64
+ renderComp={<div className="p-4 w-72">Opens above</div>}
65
+ direction="top"
66
+ anchor="left"
67
+ lib={{ Transition }}
68
+ />
69
+ ```
70
+
71
+ ##### Required props
72
+
73
+ | Name | Type | Description |
74
+ | ------------ | --------------------- | ------------------------------------------------------------------------- |
75
+ | `ctaComp` | `ReactElement` | Trigger element — clicking (or hovering) this opens the panel |
76
+ | `renderComp` | `ReactElement` | Content rendered inside the floating panel |
77
+ | `lib` | `{ Transition: any }` | Pass `{ Transition }` from `@headlessui/react` for enter/leave animations |
78
+
79
+ ##### Optional props
80
+
81
+ | Name | Type | Default | Description |
82
+ | ----------- | -------------------- | ---------- | ------------------------------------------------------------------------- |
83
+ | `trigger` | `"click" \| "hover"` | `"click"` | How the panel is opened. `"hover"` opens on mouse enter, closes on leave |
84
+ | `direction` | `"top" \| "bottom"` | `"bottom"` | Whether the panel opens above or below the trigger |
85
+ | `anchor` | `"left" \| "right"` | `"right"` | Horizontal alignment of the panel relative to the trigger |
86
+ | `className` | `string` | `""` | Tailwind classes applied to the trigger wrapper `div` |
87
+ | `onClose` | `() => void` | — | Called whenever the panel closes (click outside, hover leave, or via ref) |
88
+
89
+ ##### Ref API
90
+
91
+ When a `ref` is attached, the following method is available:
92
+
93
+ | Method | Description |
94
+ | --------------- | ----------------------------------------------------------------- |
95
+ | `handleOnClose` | Programmatically closes the panel and fires `onClose` if provided |
@@ -0,0 +1,189 @@
1
+ import { Transition } from "@headlessui/react";
2
+ import {
3
+ ChevronDownIcon,
4
+ ChevronUpIcon,
5
+ ShoppingCartIcon,
6
+ UserGroupIcon,
7
+ } from "@heroicons/react/24/solid";
8
+ import { storiesOf } from "@storybook/react";
9
+ import React, { useRef } from "react";
10
+ import { PopUp } from ".";
11
+ import { TextButton } from "../../action/textButton";
12
+ import { Card } from "../../chart/card";
13
+ import README from "./README.md";
14
+ import { StorySection } from "../../storyUtils";
15
+
16
+ const stories = storiesOf("Advanced", module);
17
+
18
+ stories.addParameters({
19
+ readme: {
20
+ content: README,
21
+ },
22
+ });
23
+
24
+ const lib = { Transition };
25
+
26
+ stories.add("PopUp", () => {
27
+ const ref = useRef<any>(null);
28
+
29
+ const richContent = (
30
+ <div className="w-80">
31
+ <img
32
+ alt="preview"
33
+ className="w-full h-36 object-cover"
34
+ src="https://cf.shopee.com.my/file/fef57a9b0d40a0626def6fdc993c442a"
35
+ />
36
+ <div className="p-4 text-sm text-gray-600">
37
+ <p>
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent quis
39
+ urna in nisl volutpat congue at id leo.
40
+ </p>
41
+ {/*
42
+ Call ref.current.handleOnClose() from inside renderComp to
43
+ programmatically close the popup without clicking outside.
44
+ */}
45
+ <TextButton
46
+ text="Close from inside"
47
+ onClick={() => ref?.current?.handleOnClose()}
48
+ className="mt-4"
49
+ />
50
+ </div>
51
+ </div>
52
+ );
53
+
54
+ const simpleContent = (
55
+ <div className="p-4 text-sm text-gray-800 w-72">
56
+ <h4 className="mb-2 font-semibold">Lorem ipsum dolor</h4>
57
+ <p className="text-gray-600">
58
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
59
+ </p>
60
+ </div>
61
+ );
62
+
63
+ return (
64
+ <div className="font-sans max-w-2xl p-6">
65
+ <StorySection
66
+ title="Click Trigger (default)"
67
+ description={
68
+ <>
69
+ Default behaviour — clicking <code>ctaComp</code> toggles the popup.
70
+ Clicking outside closes it. Pass a <code>ref</code> to call{" "}
71
+ <code>ref.current.handleOnClose()</code> from inside{" "}
72
+ <code>renderComp</code>.
73
+ </>
74
+ }
75
+ >
76
+ <div className="p-4 rounded-lg bg-primary-700 text-white w-72">
77
+ <div className="flex justify-between items-center">
78
+ <h5 className="font-semibold text-sm">Click to open</h5>
79
+ <PopUp
80
+ ref={ref}
81
+ ctaComp={
82
+ <ChevronDownIcon className="h-5 w-5 text-white cursor-pointer" />
83
+ }
84
+ renderComp={richContent}
85
+ lib={lib}
86
+ />
87
+ </div>
88
+ <p className="mt-2 text-xs font-light opacity-80">
89
+ Click the chevron to toggle the popup.
90
+ </p>
91
+ </div>
92
+ </StorySection>
93
+
94
+ <StorySection
95
+ title="Direction: Top"
96
+ description={
97
+ <>
98
+ Use <code>direction="top"</code> to open the panel above the trigger
99
+ instead of below (default is <code>"bottom"</code>).
100
+ </>
101
+ }
102
+ >
103
+ <div className="p-4 rounded-lg bg-primary-700 text-white w-72">
104
+ <div className="flex justify-between items-center">
105
+ <h5 className="font-semibold text-sm">Opens above</h5>
106
+ <PopUp
107
+ ref={ref}
108
+ ctaComp={
109
+ <ChevronUpIcon className="h-5 w-5 text-white cursor-pointer" />
110
+ }
111
+ renderComp={simpleContent}
112
+ direction="top"
113
+ lib={lib}
114
+ />
115
+ </div>
116
+ <p className="mt-2 text-xs font-light opacity-80">
117
+ Click the chevron to open the panel above.
118
+ </p>
119
+ </div>
120
+ </StorySection>
121
+
122
+ <StorySection
123
+ title="Anchor: Left"
124
+ description={
125
+ <>
126
+ Use <code>anchor="left"</code> to align the panel to the left edge
127
+ of the trigger. Default is <code>"right"</code>. Useful when the
128
+ trigger is near the right side of the viewport. Pass{" "}
129
+ <code>className</code> to control the trigger wrapper width.
130
+ </>
131
+ }
132
+ >
133
+ <PopUp
134
+ ref={ref}
135
+ ctaComp={
136
+ <Card
137
+ icon={<UserGroupIcon className="h-5 w-5 text-white" />}
138
+ title="Completed Tasks"
139
+ description="Click card to open popup"
140
+ count={3684382}
141
+ />
142
+ }
143
+ anchor="left"
144
+ className="w-72"
145
+ renderComp={richContent}
146
+ lib={lib}
147
+ />
148
+ </StorySection>
149
+
150
+ <StorySection
151
+ title="Hover Trigger"
152
+ description={
153
+ <>
154
+ Set <code>trigger="hover"</code> to open the panel on mouse enter
155
+ and close on mouse leave. Works on any <code>ctaComp</code>,
156
+ including entire card components.
157
+ </>
158
+ }
159
+ >
160
+ <PopUp
161
+ ref={ref}
162
+ ctaComp={
163
+ <Card
164
+ icon={<ShoppingCartIcon className="h-5 w-5 text-white" />}
165
+ title="Total Orders"
166
+ description="Hover over this card"
167
+ count={1547}
168
+ />
169
+ }
170
+ anchor="left"
171
+ className="w-72"
172
+ trigger="hover"
173
+ renderComp={
174
+ <div className="p-4 text-sm text-gray-800 w-72">
175
+ <h4 className="mb-2 font-semibold">Order Details</h4>
176
+ <p className="text-gray-600">
177
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
178
+ </p>
179
+ <div className="mt-3 p-3 bg-gray-100 rounded text-xs text-gray-700">
180
+ Shown on hover — closes automatically on mouse leave.
181
+ </div>
182
+ </div>
183
+ }
184
+ lib={lib}
185
+ />
186
+ </StorySection>
187
+ </div>
188
+ );
189
+ });