test-nucleoid 1.0.0

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 (458) hide show
  1. package/.babelrc +3 -0
  2. package/.browserslistrc +1 -0
  3. package/.env +2 -0
  4. package/.eslintignore +3 -0
  5. package/.eslintrc.json +58 -0
  6. package/.gitattributes +1 -0
  7. package/.github/workflows/publish.yml +66 -0
  8. package/.prettierignore +1 -0
  9. package/.prettierrc +10 -0
  10. package/.storybook/main.js +15 -0
  11. package/.storybook/preview.js +17 -0
  12. package/.storybook/vitest.setup.js +6 -0
  13. package/README.md +1 -0
  14. package/cypress.config.js +11 -0
  15. package/index.js +1 -0
  16. package/package.json +795 -0
  17. package/project/.eslintrc.cjs +22 -0
  18. package/project/config.js +18 -0
  19. package/project/config.menu.js +39 -0
  20. package/project/config.template.js +31 -0
  21. package/project/cypress/e2e/layouts.cy.js +170 -0
  22. package/project/cypress/e2e/login.cy.js +35 -0
  23. package/project/cypress/e2e/selectbar.cy.js +80 -0
  24. package/project/cypress/fixtures/CONFIG/MENU_CONFIG.js +39 -0
  25. package/project/cypress/fixtures/EMPEROR/EMPERORS_GET.json +51 -0
  26. package/project/cypress/fixtures/EMPEROR/EMPERORS_POST.json +9 -0
  27. package/project/cypress/fixtures/OAUTH/GITHUB/user.json +46 -0
  28. package/project/cypress/fixtures/example.json +5 -0
  29. package/project/cypress/support/commands.js +104 -0
  30. package/project/cypress/support/e2e.js +1 -0
  31. package/project/cypress.config.js +10 -0
  32. package/project/index.html +12 -0
  33. package/project/media/ProjectIcons/3d.png +0 -0
  34. package/project/media/ProjectIcons/box.png +0 -0
  35. package/project/media/ProjectIcons/cafe.png +0 -0
  36. package/project/media/ProjectIcons/cargo.png +0 -0
  37. package/project/media/ProjectIcons/cloud.png +0 -0
  38. package/project/media/ProjectIcons/code.png +0 -0
  39. package/project/media/ProjectIcons/company.png +0 -0
  40. package/project/media/ProjectIcons/conversation.png +0 -0
  41. package/project/media/ProjectIcons/distributed.png +0 -0
  42. package/project/media/ProjectIcons/fingerprint.png +0 -0
  43. package/project/media/ProjectIcons/forest.png +0 -0
  44. package/project/media/ProjectIcons/headphones.png +0 -0
  45. package/project/media/ProjectIcons/office.png +0 -0
  46. package/project/media/ProjectIcons/path.png +0 -0
  47. package/project/media/ProjectIcons/printer.png +0 -0
  48. package/project/media/ProjectIcons/project.png +0 -0
  49. package/project/media/ProjectIcons/resume.png +0 -0
  50. package/project/media/ProjectIcons/rocket.png +0 -0
  51. package/project/media/ProjectIcons/rtruck.png +0 -0
  52. package/project/media/ProjectIcons/sign.png +0 -0
  53. package/project/media/ProjectIcons/site.png +0 -0
  54. package/project/media/ProjectIcons/truck.png +0 -0
  55. package/project/media/logo.png +0 -0
  56. package/project/package-lock.json +22434 -0
  57. package/project/package.json +42 -0
  58. package/project/public/assets/background/overlay_2.jpg +0 -0
  59. package/project/public/assets/illustrations/illustration_dashboard.png +0 -0
  60. package/project/public/media/largeLogo.png +0 -0
  61. package/project/public/media/logo.png +0 -0
  62. package/project/public/vite.svg +1 -0
  63. package/project/routes.jsx +47 -0
  64. package/project/server/mock.json +110 -0
  65. package/project/server/oauthMock.js +27 -0
  66. package/project/server/package-lock.json +1505 -0
  67. package/project/server/package.json +20 -0
  68. package/project/server/server.js +127 -0
  69. package/project/src/Container.jsx +7 -0
  70. package/project/src/components/ActionButton.jsx +18 -0
  71. package/project/src/hooks/useEmperor.jsx +21 -0
  72. package/project/src/http/index.js +39 -0
  73. package/project/src/main.jsx +10 -0
  74. package/project/src/pages/Battles.jsx +16 -0
  75. package/project/src/pages/Emperor.jsx +50 -0
  76. package/project/src/pages/index.jsx +33 -0
  77. package/project/src/theme.js +151 -0
  78. package/project/src/widgets/ActionButton.jsx +68 -0
  79. package/project/src/widgets/AddNewEmperor.jsx +120 -0
  80. package/project/src/widgets/ProjectContainer.jsx +27 -0
  81. package/project/vite.config.js +6 -0
  82. package/project/vite.config.js.timestamp-1709564450418-45fdd27900806.mjs +341 -0
  83. package/public/assets/background/overlay_2.jpg +0 -0
  84. package/public/assets/illustrations/illustration_dashboard.png +0 -0
  85. package/public/vite.svg +1 -0
  86. package/src/ContextProvider/ContextProvider.jsx +19 -0
  87. package/src/GlobalSnackMessage/GlobalSnackMessage.jsx +45 -0
  88. package/src/GlobalSnackMessage/index.js +1 -0
  89. package/src/GlobalSnackMessage/styles.js +3 -0
  90. package/src/Platform.jsx +76 -0
  91. package/src/RouteManager/RouteManager.jsx +56 -0
  92. package/src/RouteManager/index.js +1 -0
  93. package/src/assets/illustrations/avatar-shape.jsx +31 -0
  94. package/src/assets/illustrations/background-shape.jsx +37 -0
  95. package/src/assets/illustrations/booking-illustration.jsx +335 -0
  96. package/src/assets/illustrations/check-in-illustration.jsx +96 -0
  97. package/src/assets/illustrations/check-out-illustration.jsx +69 -0
  98. package/src/assets/illustrations/coming-soon-illustration.jsx +125 -0
  99. package/src/assets/illustrations/forbidden-illustration.jsx +95 -0
  100. package/src/assets/illustrations/index.js +2 -0
  101. package/src/assets/illustrations/maintenance-illustration.jsx +228 -0
  102. package/src/assets/illustrations/motivation-illustration.jsx +74 -0
  103. package/src/assets/illustrations/order-complete-illustration.jsx +126 -0
  104. package/src/assets/illustrations/page-not-found-illustration.jsx +81 -0
  105. package/src/assets/illustrations/seo-illustration.jsx +244 -0
  106. package/src/assets/illustrations/sever-error-illustration.jsx +152 -0
  107. package/src/assets/illustrations/upgrade-storage-illustration.jsx +161 -0
  108. package/src/assets/illustrations/upload-illustration.jsx +622 -0
  109. package/src/components/Iconify/Iconify.jsx +18 -0
  110. package/src/components/Iconify/index.js +1 -0
  111. package/src/components/MiniTopBar/MiniTopBar.jsx +25 -0
  112. package/src/components/MiniTopBar/index.js +1 -0
  113. package/src/components/MiniTopBar/styles.js +6 -0
  114. package/src/components/NucleoidLoginForm/NucleoidLoginForm.jsx +69 -0
  115. package/src/components/NucleoidLoginForm/index.js +1 -0
  116. package/src/components/NucleoidLoginForm/styles.js +3 -0
  117. package/src/components/Sidebar/Sidebar.jsx +76 -0
  118. package/src/components/Sidebar/index.js +1 -0
  119. package/src/components/Sidebar/styles.js +25 -0
  120. package/src/components/SocialLoginButtons/SocialLoginButtons.jsx +55 -0
  121. package/src/components/SocialLoginButtons/index.js +1 -0
  122. package/src/components/SocialLoginButtons/styles.js +3 -0
  123. package/src/components/TopNavBar/TopNavBar.jsx +186 -0
  124. package/src/components/TopNavBar/index.js +1 -0
  125. package/src/components/TopNavBar/styles.js +7 -0
  126. package/src/components/animate/index.js +4 -0
  127. package/src/components/animate/motion-container.jsx +38 -0
  128. package/src/components/animate/motion-lazy.jsx +11 -0
  129. package/src/components/animate/motion-viewport.jsx +30 -0
  130. package/src/components/animate/variants/actions.js +4 -0
  131. package/src/components/animate/variants/background.js +97 -0
  132. package/src/components/animate/variants/bounce.js +107 -0
  133. package/src/components/animate/variants/container.js +20 -0
  134. package/src/components/animate/variants/fade.js +127 -0
  135. package/src/components/animate/variants/flip.js +54 -0
  136. package/src/components/animate/variants/index.js +12 -0
  137. package/src/components/animate/variants/path.js +12 -0
  138. package/src/components/animate/variants/rotate.js +33 -0
  139. package/src/components/animate/variants/scale.js +54 -0
  140. package/src/components/animate/variants/slide.js +65 -0
  141. package/src/components/animate/variants/transition.js +20 -0
  142. package/src/components/animate/variants/zoom.js +130 -0
  143. package/src/components/chart/chart.js +69 -0
  144. package/src/components/chart/index.js +5 -0
  145. package/src/components/chart/use-chart.js +215 -0
  146. package/src/components/custom-popover/custom-popover.jsx +46 -0
  147. package/src/components/custom-popover/index.js +3 -0
  148. package/src/components/custom-popover/styles.js +84 -0
  149. package/src/components/custom-popover/use-popover.js +22 -0
  150. package/src/components/custom-popover/utils.js +100 -0
  151. package/src/components/file-thumbnail/download-button.jsx +39 -0
  152. package/src/components/file-thumbnail/file-thumbnail.jsx +72 -0
  153. package/src/components/file-thumbnail/index.js +5 -0
  154. package/src/components/file-thumbnail/utils.js +148 -0
  155. package/src/components/image/image.jsx +119 -0
  156. package/src/components/image/index.js +1 -0
  157. package/src/components/image/utils.js +15 -0
  158. package/src/components/label/index.js +1 -0
  159. package/src/components/label/label.jsx +51 -0
  160. package/src/components/label/styles.js +78 -0
  161. package/src/components/loading-screen/index.js +2 -0
  162. package/src/components/loading-screen/loading-screen.jsx +23 -0
  163. package/src/components/loading-screen/splash-screen.jsx +95 -0
  164. package/src/components/logo/index.js +1 -0
  165. package/src/components/logo/logo.jsx +61 -0
  166. package/src/components/logo/styles.js +17 -0
  167. package/src/components/nav-section/horizontal/index.js +1 -0
  168. package/src/components/nav-section/horizontal/nav-item.jsx +224 -0
  169. package/src/components/nav-section/horizontal/nav-list.jsx +113 -0
  170. package/src/components/nav-section/horizontal/nav-section-horizontal.jsx +41 -0
  171. package/src/components/nav-section/index.js +3 -0
  172. package/src/components/nav-section/mini/index.js +1 -0
  173. package/src/components/nav-section/mini/nav-item.jsx +242 -0
  174. package/src/components/nav-section/mini/nav-list.jsx +107 -0
  175. package/src/components/nav-section/mini/nav-section-mini.jsx +35 -0
  176. package/src/components/nav-section/vertical/index.js +1 -0
  177. package/src/components/nav-section/vertical/nav-item.jsx +294 -0
  178. package/src/components/nav-section/vertical/nav-list.jsx +66 -0
  179. package/src/components/nav-section/vertical/nav-section-vertical.jsx +74 -0
  180. package/src/components/scrollbar/index.js +1 -0
  181. package/src/components/scrollbar/scrollbar.jsx +39 -0
  182. package/src/components/scrollbar/styles.js +27 -0
  183. package/src/components/search-not-found/index.js +1 -0
  184. package/src/components/search-not-found/search-not-found.jsx +29 -0
  185. package/src/components/settings/context/index.js +2 -0
  186. package/src/components/settings/context/settings-context.js +14 -0
  187. package/src/components/settings/context/settings-provider.jsx +46 -0
  188. package/src/components/settings/drawer/base-option.jsx +52 -0
  189. package/src/components/settings/drawer/fullscreen-option.jsx +58 -0
  190. package/src/components/settings/drawer/index.js +1 -0
  191. package/src/components/settings/drawer/layout-options.jsx +144 -0
  192. package/src/components/settings/drawer/presets-options.jsx +53 -0
  193. package/src/components/settings/drawer/settings-drawer.jsx +189 -0
  194. package/src/components/settings/drawer/stretch-options.jsx +67 -0
  195. package/src/components/settings/index.js +3 -0
  196. package/src/components/svg-color/index.js +1 -0
  197. package/src/components/svg-color/svg-color.jsx +23 -0
  198. package/src/config/config.js +47 -0
  199. package/src/config/schemas.js +148 -0
  200. package/src/context/Context.js +98 -0
  201. package/src/context/reducer.js +632 -0
  202. package/src/global.css +2 -0
  203. package/src/hooks/index.js +2 -0
  204. package/src/hooks/use-boolean.js +27 -0
  205. package/src/hooks/use-event-listener.js +34 -0
  206. package/src/hooks/use-local-storage.js +89 -0
  207. package/src/hooks/use-off-set-top.js +37 -0
  208. package/src/hooks/use-responsive.js +47 -0
  209. package/src/hooks/use-scroll-to-top.js +14 -0
  210. package/src/hooks/use-user.js +58 -0
  211. package/src/hooks/useApi.js +25 -0
  212. package/src/hooks/useItemsState.js +23 -0
  213. package/src/hooks/useProjects.js +24 -0
  214. package/src/hooks/useSettings.jsx +51 -0
  215. package/src/http/index.js +166 -0
  216. package/src/http/oauth.js +27 -0
  217. package/src/http/user.js +110 -0
  218. package/src/layouts/AppLayout.jsx +113 -0
  219. package/src/layouts/CompactLayout/CompactLayout.jsx +32 -0
  220. package/src/layouts/CompactLayout/index.js +1 -0
  221. package/src/layouts/DashboardLayout/DashboardLayout.jsx +87 -0
  222. package/src/layouts/DashboardLayout/config-navigation.jsx +0 -0
  223. package/src/layouts/DashboardLayout/header.jsx +104 -0
  224. package/src/layouts/DashboardLayout/index.js +2 -0
  225. package/src/layouts/DashboardLayout/main.jsx +64 -0
  226. package/src/layouts/DashboardLayout/nav-horizontal.jsx +62 -0
  227. package/src/layouts/DashboardLayout/nav-mini.jsx +99 -0
  228. package/src/layouts/DashboardLayout/nav-vertical.jsx +201 -0
  229. package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +101 -0
  230. package/src/layouts/FullScreenLayout/index.js +1 -0
  231. package/src/layouts/FullScreenLayout/nav-horizontal.jsx +50 -0
  232. package/src/layouts/FullScreenLayout/nav-vertical.jsx +136 -0
  233. package/src/layouts/MainLayout/MainLayout.jsx +21 -0
  234. package/src/layouts/MainLayout/footer.jsx +153 -0
  235. package/src/layouts/MainLayout/header.jsx +81 -0
  236. package/src/layouts/MainLayout/index.js +1 -0
  237. package/src/layouts/MainLayout/nav/desktop/index.jsx +20 -0
  238. package/src/layouts/MainLayout/nav/desktop/nav-item.jsx +186 -0
  239. package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +145 -0
  240. package/src/layouts/MainLayout/nav/mobile/index.jsx +60 -0
  241. package/src/layouts/MainLayout/nav/mobile/nav-item.jsx +90 -0
  242. package/src/layouts/MainLayout/nav/mobile/nav-list.jsx +72 -0
  243. package/src/layouts/Page.jsx +16 -0
  244. package/src/layouts/SimpleLayout/SimpleLayout.jsx +8 -0
  245. package/src/layouts/SimpleLayout/index.js +1 -0
  246. package/src/layouts/TwoSideLayout/TwoSideLayout.jsx +31 -0
  247. package/src/layouts/TwoSideLayout/index.js +1 -0
  248. package/src/layouts/auth/classic.jsx +95 -0
  249. package/src/layouts/auth/modern-compact.jsx +51 -0
  250. package/src/layouts/auth/modern.jsx +110 -0
  251. package/src/layouts/common/ProjectBar/index.jsx +338 -0
  252. package/src/layouts/common/ProjectBar/result-item.jsx +90 -0
  253. package/src/layouts/common/ProjectBar/utils.js +86 -0
  254. package/src/layouts/common/account-popover.jsx +119 -0
  255. package/src/layouts/common/header-shadow.jsx +26 -0
  256. package/src/layouts/common/header-sim.jsx +52 -0
  257. package/src/layouts/common/header-simple.jsx +76 -0
  258. package/src/layouts/common/nav-toggle-button.jsx +57 -0
  259. package/src/layouts/common/notifications-popover/index.jsx +177 -0
  260. package/src/layouts/common/notifications-popover/notification-item.jsx +252 -0
  261. package/src/layouts/common/settings-button.jsx +48 -0
  262. package/src/layouts/config-layout.js +12 -0
  263. package/src/layouts/index.js +7 -0
  264. package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
  265. package/src/lib/APIDialogAction/index.js +1 -0
  266. package/src/lib/APIDialogAction/styles.js +6 -0
  267. package/src/lib/APIParams/APIParams.jsx +57 -0
  268. package/src/lib/APIParams/index.js +1 -0
  269. package/src/lib/APIPath/APIPath.jsx +82 -0
  270. package/src/lib/APIPath/index.js +1 -0
  271. package/src/lib/APIPath/styles.js +19 -0
  272. package/src/lib/APITree/APITree.jsx +418 -0
  273. package/src/lib/APITree/Arrow.jsx +21 -0
  274. package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
  275. package/src/lib/APITree/index.js +1 -0
  276. package/src/lib/APITree/styles.js +19 -0
  277. package/src/lib/APITypes/APITypes.jsx +151 -0
  278. package/src/lib/APITypes/TypeEditor.jsx +46 -0
  279. package/src/lib/APITypes/TypeList.jsx +178 -0
  280. package/src/lib/APITypes/index.js +1 -0
  281. package/src/lib/AddItemWizard/AddItemWizard.jsx +211 -0
  282. package/src/lib/AddItemWizard/index.js +1 -0
  283. package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
  284. package/src/lib/BlankTreeMessage/index.js +1 -0
  285. package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +88 -0
  286. package/src/lib/CustomBreadcrumbs/index.js +1 -0
  287. package/src/lib/CustomBreadcrumbs/link-item.jsx +58 -0
  288. package/src/lib/CustomPopover/CustomPopover.jsx +46 -0
  289. package/src/lib/CustomPopover/index.js +3 -0
  290. package/src/lib/CustomPopover/styles.js +82 -0
  291. package/src/lib/CustomPopover/usePopover.js +20 -0
  292. package/src/lib/CustomPopover/utils.js +100 -0
  293. package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
  294. package/src/lib/DialogTootip/index.js +1 -0
  295. package/src/lib/DialogTootip/styles.js +9 -0
  296. package/src/lib/Flow/connectors/DynamicConnector.jsx +319 -0
  297. package/src/lib/Flow/core/Flow.jsx +79 -0
  298. package/src/lib/Flow/core/FlowNode.jsx +68 -0
  299. package/src/lib/Flow/core/FlowViewport.jsx +259 -0
  300. package/src/lib/Flow/graph/FloatingGraph.jsx +44 -0
  301. package/src/lib/Flow/hooks/useGraphOperations.js +362 -0
  302. package/src/lib/Flow/hooks/useNodeStyle.js +70 -0
  303. package/src/lib/Flow/index.js +1 -0
  304. package/src/lib/Flow/layouts/ActionNode.jsx +78 -0
  305. package/src/lib/Flow/layouts/AnimatedNode.jsx +22 -0
  306. package/src/lib/Flow/layouts/CardLayout.jsx +397 -0
  307. package/src/lib/Flow/layouts/InfoNode.jsx +255 -0
  308. package/src/lib/Flow/layouts/LoadingNode.jsx +37 -0
  309. package/src/lib/Flow/nodes/DefaultCard.jsx +107 -0
  310. package/src/lib/Flow/nodes/DraggableNode.jsx +162 -0
  311. package/src/lib/Flow/nodes/FlowNodeView.jsx +298 -0
  312. package/src/lib/Flow/selection/SelectionContext.jsx +259 -0
  313. package/src/lib/Flow/selection/SelectionOverlay.jsx +31 -0
  314. package/src/lib/Flow/styles.js +158 -0
  315. package/src/lib/Flow/utils/flowUtils.js +268 -0
  316. package/src/lib/FormProvider/FormProvider.jsx +16 -0
  317. package/src/lib/FormProvider/index.js +1 -0
  318. package/src/lib/IconSelector/IconSelector.jsx +89 -0
  319. package/src/lib/Iconify/Iconify.jsx +17 -0
  320. package/src/lib/Iconify/index.js +1 -0
  321. package/src/lib/Image/Image.jsx +116 -0
  322. package/src/lib/Image/index.js +1 -0
  323. package/src/lib/Image/utils.js +15 -0
  324. package/src/lib/ItemSummary/ItemSummary.jsx +78 -0
  325. package/src/lib/ItemSummary/ItemsSummary.jsx +164 -0
  326. package/src/lib/Label/Label.jsx +51 -0
  327. package/src/lib/Label/index.js +1 -0
  328. package/src/lib/Label/styles.js +76 -0
  329. package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
  330. package/src/lib/NewApiBody/ParamView.jsx +38 -0
  331. package/src/lib/NucDialog/NucDialog.jsx +108 -0
  332. package/src/lib/NucDialog/index.js +1 -0
  333. package/src/lib/ParamTable/ParamTable.jsx +133 -0
  334. package/src/lib/ParamTable/TypeMenu.jsx +102 -0
  335. package/src/lib/ParamTable/defaults.js +47 -0
  336. package/src/lib/ParamTable/index.js +1 -0
  337. package/src/lib/ParamTable/styles.js +12 -0
  338. package/src/lib/ProjectWizard.jsx +137 -0
  339. package/src/lib/RHFTextfield/RHFTextfield.jsx +40 -0
  340. package/src/lib/RHFTextfield/index.js +1 -0
  341. package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
  342. package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
  343. package/src/lib/ResourceMenu/ResourceMenu.jsx +165 -0
  344. package/src/lib/ResourceMenu/index.js +1 -0
  345. package/src/lib/ResourceMenu/styles.js +5 -0
  346. package/src/lib/Schema/Schema.jsx +204 -0
  347. package/src/lib/Schema/index.js +1 -0
  348. package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
  349. package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
  350. package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
  351. package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
  352. package/src/lib/SchemaEditor/index.js +1 -0
  353. package/src/lib/Scrollbar/Scrollbar.jsx +39 -0
  354. package/src/lib/Scrollbar/index.js +1 -0
  355. package/src/lib/Scrollbar/styles.js +27 -0
  356. package/src/lib/SearchNotFound/SearchNotFound.jsx +29 -0
  357. package/src/lib/SearchNotFound/index.js +1 -0
  358. package/src/lib/SparkleInput/SparkleInput.jsx +51 -0
  359. package/src/lib/StepComponent/StepComponent.jsx +98 -0
  360. package/src/lib/SvgColor/SvgColor.jsx +29 -0
  361. package/src/lib/SvgColor/index.js +1 -0
  362. package/src/lib/TableHeadCustom/TableHeadCustom.jsx +87 -0
  363. package/src/lib/TableHeadCustom/index.js +1 -0
  364. package/src/lib/TableSelectedAction/TableSelectedAction.jsx +72 -0
  365. package/src/lib/TableSelectedAction/index.js +1 -0
  366. package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
  367. package/src/lib/ToggleableMenu/index.js +1 -0
  368. package/src/lib/index.js +50 -0
  369. package/src/lib/lib/Icons.js +40 -0
  370. package/src/lib/lib/context.json +272 -0
  371. package/src/lib/useChart/useChart.js +180 -0
  372. package/src/lib/useTable/useTable.js +121 -0
  373. package/src/pages/404.jsx +17 -0
  374. package/src/pages/Callback.jsx +126 -0
  375. package/src/pages/ConfigError.jsx +49 -0
  376. package/src/pages/LoginPage.jsx +52 -0
  377. package/src/routes/components/index.js +1 -0
  378. package/src/routes/components/router-link.jsx +11 -0
  379. package/src/routes/hooks/index.js +4 -0
  380. package/src/routes/hooks/use-active-link.js +15 -0
  381. package/src/routes/hooks/use-pathname.js +10 -0
  382. package/src/routes/hooks/use-router.js +21 -0
  383. package/src/stories/APITree.stories.jsx +332 -0
  384. package/src/stories/FlowChart.stories.jsx +333 -0
  385. package/src/stories/Iconify.stories.jsx +183 -0
  386. package/src/stories/Label.stories.jsx +447 -0
  387. package/src/stories/Navbar.stories.jsx +588 -0
  388. package/src/templates/ActionTemplate.js +24 -0
  389. package/src/theme/css.js +152 -0
  390. package/src/theme/custom-shadows.js +47 -0
  391. package/src/theme/index.jsx +100 -0
  392. package/src/theme/options/contrast.js +34 -0
  393. package/src/theme/options/presets.js +89 -0
  394. package/src/theme/options/right-to-left.jsx +26 -0
  395. package/src/theme/overrides/components/accordion.js +43 -0
  396. package/src/theme/overrides/components/alert.js +69 -0
  397. package/src/theme/overrides/components/appbar.js +13 -0
  398. package/src/theme/overrides/components/autocomplete.js +44 -0
  399. package/src/theme/overrides/components/avatar.js +111 -0
  400. package/src/theme/overrides/components/backdrop.js +18 -0
  401. package/src/theme/overrides/components/badge.js +90 -0
  402. package/src/theme/overrides/components/breadcrumbs.js +21 -0
  403. package/src/theme/overrides/components/button-group.js +90 -0
  404. package/src/theme/overrides/components/button.js +145 -0
  405. package/src/theme/overrides/components/card.js +30 -0
  406. package/src/theme/overrides/components/checkbox.js +13 -0
  407. package/src/theme/overrides/components/chip.js +129 -0
  408. package/src/theme/overrides/components/css-baseline.js +48 -0
  409. package/src/theme/overrides/components/data-grid.js +94 -0
  410. package/src/theme/overrides/components/date-picker.jsx +94 -0
  411. package/src/theme/overrides/components/dialog.js +49 -0
  412. package/src/theme/overrides/components/drawer.js +39 -0
  413. package/src/theme/overrides/components/fab.js +165 -0
  414. package/src/theme/overrides/components/list.js +33 -0
  415. package/src/theme/overrides/components/loading-button.js +30 -0
  416. package/src/theme/overrides/components/menu.js +15 -0
  417. package/src/theme/overrides/components/pagination.js +81 -0
  418. package/src/theme/overrides/components/paper.js +18 -0
  419. package/src/theme/overrides/components/popover.js +20 -0
  420. package/src/theme/overrides/components/progress.js +40 -0
  421. package/src/theme/overrides/components/radio.js +22 -0
  422. package/src/theme/overrides/components/rating.js +40 -0
  423. package/src/theme/overrides/components/select.js +26 -0
  424. package/src/theme/overrides/components/skeleton.js +16 -0
  425. package/src/theme/overrides/components/slider.js +30 -0
  426. package/src/theme/overrides/components/stepper.js +13 -0
  427. package/src/theme/overrides/components/svg-icon.js +15 -0
  428. package/src/theme/overrides/components/switch.js +66 -0
  429. package/src/theme/overrides/components/table.js +79 -0
  430. package/src/theme/overrides/components/tabs.js +39 -0
  431. package/src/theme/overrides/components/textfield.js +146 -0
  432. package/src/theme/overrides/components/timeline.js +20 -0
  433. package/src/theme/overrides/components/toggle-button.js +70 -0
  434. package/src/theme/overrides/components/tooltip.js +18 -0
  435. package/src/theme/overrides/components/tree-view.js +16 -0
  436. package/src/theme/overrides/components/typography.js +16 -0
  437. package/src/theme/overrides/default-props.jsx +238 -0
  438. package/src/theme/overrides/index.js +100 -0
  439. package/src/theme/palette.js +144 -0
  440. package/src/theme/shadows.js +41 -0
  441. package/src/theme/typography.js +107 -0
  442. package/src/utils/flatten-array.js +16 -0
  443. package/src/utils/format-number.js +37 -0
  444. package/src/utils/format-time.js +27 -0
  445. package/src/utils/storage-available.js +24 -0
  446. package/src/widgets/Login/CognitoLogin.jsx +45 -0
  447. package/src/widgets/Login/DemoLogin.jsx +178 -0
  448. package/src/widgets/Login/Login.jsx +58 -0
  449. package/src/widgets/Login/cognitoAuth.jsx +44 -0
  450. package/src/widgets/LoginForm/LoginForm.jsx +87 -0
  451. package/src/widgets/LoginForm/LoginFormStyles.js +43 -0
  452. package/src/widgets/LoginForm/index.js +1 -0
  453. package/src/widgets/SettingsDialog.jsx +433 -0
  454. package/src/widgets/error/index.js +1 -0
  455. package/src/widgets/error/not-found-view.jsx +42 -0
  456. package/vite/vite.js +86 -0
  457. package/vite.config.js +7 -0
  458. package/vitest.config.js +32 -0
@@ -0,0 +1,82 @@
1
+ import { alpha, styled } from "@mui/material/styles";
2
+
3
+ import { bgBlur } from "../../theme/css";
4
+
5
+ export const StyledArrow = styled("span")(({ arrow, theme }) => {
6
+ const SIZE = 14;
7
+
8
+ const POSITION = -(SIZE / 2) + 0.5;
9
+
10
+ const topStyle = {
11
+ top: POSITION,
12
+ transform: "rotate(135deg)",
13
+ };
14
+
15
+ const bottomStyle = {
16
+ bottom: POSITION,
17
+ transform: "rotate(-45deg)",
18
+ };
19
+
20
+ const leftStyle = {
21
+ left: POSITION,
22
+ transform: "rotate(45deg)",
23
+ };
24
+
25
+ const rightStyle = {
26
+ right: POSITION,
27
+ transform: "rotate(-135deg)",
28
+ };
29
+
30
+ return {
31
+ width: SIZE,
32
+ height: SIZE,
33
+ position: "absolute",
34
+ borderBottomLeftRadius: SIZE / 4,
35
+ clipPath: "polygon(0% 0%, 100% 100%, 0% 100%)",
36
+ border: `solid 1px ${alpha(
37
+ theme.palette.mode === "light"
38
+ ? theme.palette.grey[500]
39
+ : theme.palette.common.black,
40
+ 0.12
41
+ )}`,
42
+ ...bgBlur({
43
+ color: theme.palette.background.paper,
44
+ }),
45
+ // Top
46
+ ...(arrow === "top-left" && { ...topStyle, left: 20 }),
47
+ ...(arrow === "top-center" && {
48
+ ...topStyle,
49
+ left: 0,
50
+ right: 0,
51
+ margin: "auto",
52
+ }),
53
+ ...(arrow === "top-right" && { ...topStyle, right: 20 }),
54
+ // Bottom
55
+ ...(arrow === "bottom-left" && { ...bottomStyle, left: 20 }),
56
+ ...(arrow === "bottom-center" && {
57
+ ...bottomStyle,
58
+ left: 0,
59
+ right: 0,
60
+ margin: "auto",
61
+ }),
62
+ ...(arrow === "bottom-right" && { ...bottomStyle, right: 20 }),
63
+ // Left
64
+ ...(arrow === "left-top" && { ...leftStyle, top: 20 }),
65
+ ...(arrow === "left-center" && {
66
+ ...leftStyle,
67
+ top: 0,
68
+ bottom: 0,
69
+ margin: "auto",
70
+ }),
71
+ ...(arrow === "left-bottom" && { ...leftStyle, bottom: 20 }),
72
+ // Right
73
+ ...(arrow === "right-top" && { ...rightStyle, top: 20 }),
74
+ ...(arrow === "right-center" && {
75
+ ...rightStyle,
76
+ top: 0,
77
+ bottom: 0,
78
+ margin: "auto",
79
+ }),
80
+ ...(arrow === "right-bottom" && { ...rightStyle, bottom: 20 }),
81
+ };
82
+ });
@@ -0,0 +1,20 @@
1
+ import React, { useCallback, useState } from "react";
2
+
3
+ export default function usePopover() {
4
+ const [open, setOpen] = useState(null);
5
+
6
+ const onOpen = useCallback((event) => {
7
+ setOpen(event.currentTarget);
8
+ }, []);
9
+
10
+ const onClose = useCallback(() => {
11
+ setOpen(null);
12
+ }, []);
13
+
14
+ return {
15
+ open,
16
+ onOpen,
17
+ onClose,
18
+ setOpen,
19
+ };
20
+ }
@@ -0,0 +1,100 @@
1
+ export function getPosition(arrow) {
2
+ let props;
3
+
4
+ switch (arrow) {
5
+ case "top-left":
6
+ props = {
7
+ style: { ml: -0.75 },
8
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
9
+ transformOrigin: { vertical: "top", horizontal: "left" },
10
+ };
11
+ break;
12
+ case "top-center":
13
+ props = {
14
+ style: {},
15
+ anchorOrigin: { vertical: "bottom", horizontal: "center" },
16
+ transformOrigin: { vertical: "top", horizontal: "center" },
17
+ };
18
+ break;
19
+ case "top-right":
20
+ props = {
21
+ style: { ml: 0.75 },
22
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
23
+ transformOrigin: { vertical: "top", horizontal: "right" },
24
+ };
25
+ break;
26
+ case "bottom-left":
27
+ props = {
28
+ style: { ml: -0.75 },
29
+ anchorOrigin: { vertical: "top", horizontal: "left" },
30
+ transformOrigin: { vertical: "bottom", horizontal: "left" },
31
+ };
32
+ break;
33
+ case "bottom-center":
34
+ props = {
35
+ style: {},
36
+ anchorOrigin: { vertical: "top", horizontal: "center" },
37
+ transformOrigin: { vertical: "bottom", horizontal: "center" },
38
+ };
39
+ break;
40
+ case "bottom-right":
41
+ props = {
42
+ style: { ml: 0.75 },
43
+ anchorOrigin: { vertical: "top", horizontal: "right" },
44
+ transformOrigin: { vertical: "bottom", horizontal: "right" },
45
+ };
46
+ break;
47
+ case "left-top":
48
+ props = {
49
+ style: { mt: -0.75 },
50
+ anchorOrigin: { vertical: "top", horizontal: "right" },
51
+ transformOrigin: { vertical: "top", horizontal: "left" },
52
+ };
53
+ break;
54
+ case "left-center":
55
+ props = {
56
+ style: {},
57
+ anchorOrigin: { vertical: "center", horizontal: "right" },
58
+ transformOrigin: { vertical: "center", horizontal: "left" },
59
+ };
60
+ break;
61
+ case "left-bottom":
62
+ props = {
63
+ style: { mt: 0.75 },
64
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
65
+ transformOrigin: { vertical: "bottom", horizontal: "left" },
66
+ };
67
+ break;
68
+ case "right-top":
69
+ props = {
70
+ style: { mt: -0.75 },
71
+ anchorOrigin: { vertical: "top", horizontal: "left" },
72
+ transformOrigin: { vertical: "top", horizontal: "right" },
73
+ };
74
+ break;
75
+ case "right-center":
76
+ props = {
77
+ style: {},
78
+ anchorOrigin: { vertical: "center", horizontal: "left" },
79
+ transformOrigin: { vertical: "center", horizontal: "right" },
80
+ };
81
+ break;
82
+ case "right-bottom":
83
+ props = {
84
+ style: { mt: 0.75 },
85
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
86
+ transformOrigin: { vertical: "bottom", horizontal: "right" },
87
+ };
88
+ break;
89
+
90
+ // top-right
91
+ default:
92
+ props = {
93
+ style: { ml: 0.75 },
94
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
95
+ transformOrigin: { vertical: "top", horizontal: "right" },
96
+ };
97
+ }
98
+
99
+ return props;
100
+ }
@@ -0,0 +1,67 @@
1
+ import CloseIcon from "@mui/icons-material/Close";
2
+ import IconButton from "@mui/material/IconButton";
3
+ import { styled } from "@mui/material/styles";
4
+
5
+ import { Grid, Tooltip, Typography, tooltipClasses } from "@mui/material";
6
+
7
+ const DialogTooltip = styled(
8
+ ({
9
+ className,
10
+ open,
11
+ handleTooltipClose,
12
+ title,
13
+ message,
14
+ footer,
15
+ ...props
16
+ }) => (
17
+ <Tooltip
18
+ open={open}
19
+ onClose={handleTooltipClose}
20
+ disableFocusListener
21
+ disableHoverListener
22
+ disableTouchListener
23
+ title={
24
+ <>
25
+ <Grid
26
+ container
27
+ sx={{
28
+ display: "flex",
29
+ justifyContent: "space-between",
30
+ alignItems: "center",
31
+ backgroundColor: (theme) => theme.palette.background.paper,
32
+ }}
33
+ >
34
+ <Typography variant="subtitle1" sx={{ flexGrow: 1, marginLeft: 2 }}>
35
+ {title}
36
+ </Typography>
37
+ <IconButton onClick={handleTooltipClose} size="small">
38
+ <CloseIcon />
39
+ </IconButton>
40
+ </Grid>
41
+ <Grid sx={{ padding: 2 }}>
42
+ <Typography
43
+ variant="body2"
44
+ sx={{ color: (theme) => theme.palette.text.primary }}
45
+ >
46
+ {message}
47
+ </Typography>
48
+ {footer}
49
+ </Grid>
50
+ </>
51
+ }
52
+ {...props}
53
+ classes={{ popper: className }}
54
+ />
55
+ )
56
+ )(({ theme }) => ({
57
+ [`& .${tooltipClasses.tooltip}`]: {
58
+ backgroundColor: theme.palette.background.paper,
59
+ color: theme.palette.text.primary,
60
+ width: 600,
61
+ fontSize: theme.typography.pxToRem(12),
62
+ border: `1px solid ${theme.palette.divider}`,
63
+ boxShadow: theme.shadows[1],
64
+ },
65
+ }));
66
+
67
+ export default DialogTooltip;
@@ -0,0 +1 @@
1
+ export { default } from "./DialogTooltip";
@@ -0,0 +1,9 @@
1
+ const styles = {
2
+ header: {
3
+ flexDirection: "row",
4
+ justifyContent: "space-between",
5
+ alignItems: "center",
6
+ },
7
+ };
8
+
9
+ export default styles;
@@ -0,0 +1,319 @@
1
+ import { Box } from "@mui/material";
2
+
3
+ import React, { useId, useLayoutEffect, useMemo, useState } from "react";
4
+
5
+ const DynamicConnector = ({
6
+ containerEl,
7
+ parentEl,
8
+ childEls,
9
+ stroke = "#b1b1b7",
10
+ strokeWidth = 2,
11
+ lineStyle = "solid",
12
+ tick = 0,
13
+ orientation = "vertical",
14
+ showDots = false,
15
+ dotRadius = 4,
16
+ dotColor,
17
+ showArrow = true,
18
+ arrowSize = 6,
19
+ animated = false,
20
+ animationSpeed = 1,
21
+ gradient = null,
22
+ curvature = 0.5,
23
+ connectorType = "curved",
24
+ label = null,
25
+ labelStyle = {},
26
+ labelPosition = 0.5,
27
+ labelOffsetX = 0,
28
+ labelOffsetY = -10,
29
+ }) => {
30
+ const uniqueId = useId();
31
+ const [dims, setDims] = useState(null);
32
+ const [points, setPoints] = useState({
33
+ parent: null,
34
+ children: [],
35
+ });
36
+
37
+ const isHorizontal = orientation === "horizontal";
38
+
39
+ useLayoutEffect(() => {
40
+ if (!containerEl || !parentEl || !childEls?.length) return;
41
+
42
+ const update = () => {
43
+ const cRect = containerEl.getBoundingClientRect();
44
+ const pRect = parentEl.getBoundingClientRect();
45
+
46
+ let parentPoint;
47
+ let childPoints = [];
48
+
49
+ if (isHorizontal) {
50
+ parentPoint = {
51
+ x: pRect.right - cRect.left,
52
+ y: pRect.top + pRect.height / 2 - cRect.top,
53
+ };
54
+
55
+ childPoints = childEls.map((el) => {
56
+ if (!el) return { x: parentPoint.x + 100, y: parentPoint.y };
57
+ const r = el.getBoundingClientRect();
58
+ return {
59
+ x: r.left - cRect.left,
60
+ y: r.top + r.height / 2 - cRect.top,
61
+ };
62
+ });
63
+ } else {
64
+ parentPoint = {
65
+ x: pRect.left + pRect.width / 2 - cRect.left,
66
+ y: pRect.bottom - cRect.top,
67
+ };
68
+
69
+ childPoints = childEls.map((el) => {
70
+ if (!el) return { x: parentPoint.x, y: parentPoint.y + 100 };
71
+ const r = el.getBoundingClientRect();
72
+ return {
73
+ x: r.left + r.width / 2 - cRect.left,
74
+ y: r.top - cRect.top,
75
+ };
76
+ });
77
+ }
78
+
79
+ setPoints({ parent: parentPoint, children: childPoints });
80
+ setDims({ w: cRect.width, h: cRect.height });
81
+ };
82
+
83
+ update();
84
+
85
+ const ro = new ResizeObserver(update);
86
+ ro.observe(containerEl);
87
+ ro.observe(parentEl);
88
+ childEls.forEach((el) => el && ro.observe(el));
89
+
90
+ return () => ro.disconnect();
91
+ }, [containerEl, parentEl, childEls, tick, isHorizontal]);
92
+
93
+ const ids = useMemo(
94
+ () => ({
95
+ gradient: `gradient-${uniqueId}`,
96
+ arrow: `arrow-${uniqueId}`,
97
+ }),
98
+ [uniqueId]
99
+ );
100
+
101
+ const getPath = (from, to) => {
102
+ const isCornered =
103
+ connectorType === "cornered" || connectorType === "normal";
104
+
105
+ if (isCornered) {
106
+ if (isHorizontal) {
107
+ const midX = from.x + (to.x - from.x) / 2;
108
+ return `M ${from.x} ${from.y} L ${midX} ${from.y} L ${midX} ${to.y} L ${to.x} ${to.y}`;
109
+ }
110
+
111
+ const midY = from.y + (to.y - from.y) / 2;
112
+ return `M ${from.x} ${from.y} L ${from.x} ${midY} L ${to.x} ${midY} L ${to.x} ${to.y}`;
113
+ }
114
+
115
+ const dx = Math.abs(to.x - from.x);
116
+ const dy = Math.abs(to.y - from.y);
117
+ const distance = Math.sqrt(dx * dx + dy * dy);
118
+
119
+ const baseCurvature = Math.max(40, Math.min(distance * curvature, 150));
120
+
121
+ if (isHorizontal) {
122
+ const cp1x = from.x + baseCurvature;
123
+ const cp2x = to.x - baseCurvature;
124
+ return `M ${from.x} ${from.y} C ${cp1x} ${from.y}, ${cp2x} ${to.y}, ${to.x} ${to.y}`;
125
+ } else {
126
+ const cp1y = from.y + baseCurvature;
127
+ const cp2y = to.y - baseCurvature;
128
+ return `M ${from.x} ${from.y} C ${from.x} ${cp1y}, ${to.x} ${cp2y}, ${to.x} ${to.y}`;
129
+ }
130
+ };
131
+
132
+ const getDashArray = () => {
133
+ if (lineStyle === "dashed") return `${strokeWidth * 4},${strokeWidth * 3}`;
134
+ if (lineStyle === "dotted") return `${strokeWidth},${strokeWidth * 2}`;
135
+ return undefined;
136
+ };
137
+
138
+ const animationStyle = animated
139
+ ? `
140
+ @keyframes flowAnimation {
141
+ from { stroke-dashoffset: 24; }
142
+ to { stroke-dashoffset: 0; }
143
+ }
144
+ `
145
+ : "";
146
+
147
+ if (!dims || !points.parent || !points.children.length) return null;
148
+
149
+ const effectiveDotColor = dotColor || stroke;
150
+ const dashArray = getDashArray();
151
+
152
+ return (
153
+ <>
154
+ <svg
155
+ style={{
156
+ position: "absolute",
157
+ inset: 0,
158
+ pointerEvents: "none",
159
+ overflow: "visible",
160
+ zIndex: 0,
161
+ }}
162
+ width="100%"
163
+ height="100%"
164
+ viewBox={`0 0 ${dims.w} ${dims.h}`}
165
+ >
166
+ <defs>
167
+ {gradient && (
168
+ <linearGradient
169
+ id={ids.gradient}
170
+ gradientUnits="userSpaceOnUse"
171
+ x1={points.parent.x}
172
+ y1={points.parent.y}
173
+ x2={points.children[0]?.x || points.parent.x}
174
+ y2={points.children[0]?.y || points.parent.y}
175
+ >
176
+ <stop offset="0%" stopColor={gradient.from} />
177
+ <stop offset="100%" stopColor={gradient.to} />
178
+ </linearGradient>
179
+ )}
180
+
181
+ {showArrow && (
182
+ <marker
183
+ id={ids.arrow}
184
+ viewBox="0 0 10 10"
185
+ refX="9"
186
+ refY="5"
187
+ markerWidth={arrowSize}
188
+ markerHeight={arrowSize}
189
+ orient="auto-start-reverse"
190
+ >
191
+ <path
192
+ d="M 0 0 L 10 5 L 0 10 z"
193
+ fill={gradient ? `url(#${ids.gradient})` : stroke}
194
+ />
195
+ </marker>
196
+ )}
197
+
198
+ {animated && <style>{animationStyle}</style>}
199
+ </defs>
200
+
201
+ {points.children.map((child, i) => {
202
+ const pathD = getPath(points.parent, child);
203
+ const pathStroke = gradient ? `url(#${ids.gradient})` : stroke;
204
+
205
+ const labelX =
206
+ points.parent.x +
207
+ (child.x - points.parent.x) * labelPosition +
208
+ labelOffsetX;
209
+ const labelY =
210
+ points.parent.y +
211
+ (child.y - points.parent.y) * labelPosition +
212
+ labelOffsetY;
213
+
214
+ return (
215
+ <g key={i}>
216
+ <path
217
+ d={pathD}
218
+ fill="none"
219
+ stroke={pathStroke}
220
+ strokeWidth={strokeWidth}
221
+ strokeDasharray={animated ? "8,4" : dashArray}
222
+ strokeLinecap="round"
223
+ strokeLinejoin="round"
224
+ markerEnd={showArrow ? `url(#${ids.arrow})` : undefined}
225
+ style={{
226
+ transition: "stroke 0.2s ease, stroke-width 0.2s ease",
227
+ ...(animated
228
+ ? {
229
+ animation: `flowAnimation ${
230
+ 0.5 / animationSpeed
231
+ }s linear infinite`,
232
+ }
233
+ : {}),
234
+ }}
235
+ />
236
+ </g>
237
+ );
238
+ })}
239
+
240
+ {showDots && (
241
+ <>
242
+ <circle
243
+ cx={points.parent.x}
244
+ cy={points.parent.y}
245
+ r={dotRadius}
246
+ fill={gradient ? gradient.from : effectiveDotColor}
247
+ stroke="#fff"
248
+ strokeWidth={1.5}
249
+ style={{
250
+ filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.15))",
251
+ }}
252
+ />
253
+
254
+ {points.children.map((child, i) => {
255
+ const dotFill = gradient ? gradient.to : effectiveDotColor;
256
+
257
+ return (
258
+ <circle
259
+ key={i}
260
+ cx={child.x}
261
+ cy={child.y}
262
+ r={dotRadius}
263
+ fill={dotFill}
264
+ stroke="#fff"
265
+ strokeWidth={1.5}
266
+ style={{
267
+ filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.15))",
268
+ }}
269
+ />
270
+ );
271
+ })}
272
+ </>
273
+ )}
274
+ </svg>
275
+
276
+ {label &&
277
+ points.children.map((child, i) => {
278
+ const labelX =
279
+ points.parent.x +
280
+ (child.x - points.parent.x) * labelPosition +
281
+ labelOffsetX;
282
+ const labelY =
283
+ points.parent.y +
284
+ (child.y - points.parent.y) * labelPosition +
285
+ labelOffsetY;
286
+
287
+ return (
288
+ <Box
289
+ key={`label-${i}`}
290
+ sx={{
291
+ position: "absolute",
292
+ left: labelX,
293
+ top: labelY,
294
+ transform: "translate(-50%, -50%)",
295
+ px: 1,
296
+ py: 0.5,
297
+ borderRadius: 1,
298
+ backgroundColor: "background.paper",
299
+ border: 1,
300
+ borderColor: labelStyle.color || stroke,
301
+ fontSize: labelStyle.fontSize || "12px",
302
+ fontWeight: labelStyle.fontWeight || 600,
303
+ color: labelStyle.textColor || stroke,
304
+ pointerEvents: "none",
305
+ userSelect: "none",
306
+ zIndex: 10,
307
+ boxShadow: 1,
308
+ whiteSpace: "nowrap",
309
+ }}
310
+ >
311
+ {label}
312
+ </Box>
313
+ );
314
+ })}
315
+ </>
316
+ );
317
+ };
318
+
319
+ export default DynamicConnector;
@@ -0,0 +1,79 @@
1
+ import FlowNode from "./FlowNode";
2
+ import { useGraphOperations } from "../hooks/useGraphOperations";
3
+
4
+ import React, { useMemo, useState } from "react";
5
+ import { assertLinkedGraph, buildTreeFromLinked } from "../utils/flowUtils";
6
+
7
+ export const Flow = ({
8
+ data,
9
+ variant = "simple",
10
+ style,
11
+ plugin,
12
+ editable = false,
13
+ onChange,
14
+ }) => {
15
+ const [floatingNodes, setFloatingNodes] = useState([]);
16
+
17
+ const { nodesById, roots } = useMemo(() => assertLinkedGraph(data), [data]);
18
+
19
+ const { handleCut, handlePaste, handleConnect } = useGraphOperations({
20
+ nodesById,
21
+ roots,
22
+ onChange,
23
+ floatingNodes,
24
+ setFloatingNodes,
25
+ editable,
26
+ });
27
+
28
+ const allNodesById = useMemo(() => {
29
+ if (!floatingNodes.length) return nodesById;
30
+
31
+ const merged = { ...nodesById };
32
+
33
+ for (const structure of floatingNodes) {
34
+ if (structure?.nodes) {
35
+ Object.assign(merged, structure.nodes);
36
+ }
37
+ }
38
+
39
+ return merged;
40
+ }, [nodesById, floatingNodes]);
41
+
42
+ const treeData = useMemo(() => {
43
+ if (!roots?.length) return null;
44
+
45
+ if (roots.length === 1) {
46
+ return (
47
+ buildTreeFromLinked(roots[0], nodesById) || {
48
+ id: roots[0],
49
+ children: [],
50
+ }
51
+ );
52
+ }
53
+
54
+ const children = roots
55
+ .map((r) => buildTreeFromLinked(r, nodesById))
56
+ .filter(Boolean);
57
+
58
+ return children.length > 0
59
+ ? { id: "__root__", label: "Start", children }
60
+ : null;
61
+ }, [nodesById, roots]);
62
+
63
+ return (
64
+ <FlowNode
65
+ node={treeData}
66
+ variant={variant}
67
+ style={style}
68
+ plugin={plugin}
69
+ isRoot={true}
70
+ nodesById={allNodesById}
71
+ onPaste={editable ? handlePaste : undefined}
72
+ onCut={editable ? handleCut : undefined}
73
+ onConnect={editable ? handleConnect : undefined}
74
+ floatingNodes={floatingNodes}
75
+ />
76
+ );
77
+ };
78
+
79
+ export default Flow;