@devxcrew/react-ui 0.0.0-stage → 0.1.7

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 (326) hide show
  1. package/README.md +85 -2
  2. package/package.json +105 -4
  3. package/src/blocks/agent-chat-workspace/agent-chat-workspace.tsx +162 -0
  4. package/src/blocks/agent-chat-workspace/index.ts +2 -0
  5. package/src/blocks/agent-provider-settings/agent-provider-settings.tsx +183 -0
  6. package/src/blocks/agent-provider-settings/index.ts +2 -0
  7. package/src/blocks/agent-task-workspace/agent-task-workspace.tsx +48 -0
  8. package/src/blocks/agent-task-workspace/index.ts +2 -0
  9. package/src/blocks/analysis-context/analysis-context.tsx +6 -0
  10. package/src/blocks/analysis-context/index.ts +1 -0
  11. package/src/blocks/app-header/app-header.tsx +159 -0
  12. package/src/blocks/app-header/index.ts +2 -0
  13. package/src/blocks/archived-chat-workspace/archived-chat-workspace.tsx +29 -0
  14. package/src/blocks/archived-chat-workspace/index.ts +2 -0
  15. package/src/blocks/auth/README.md +32 -0
  16. package/src/blocks/auth/admin-login-page.tsx +15 -0
  17. package/src/blocks/auth/admin-password-forgot-page.tsx +5 -0
  18. package/src/blocks/auth/auth-page-layout.tsx +90 -0
  19. package/src/blocks/auth/client-login-page.tsx +20 -0
  20. package/src/blocks/auth/client-password-forgot-page.tsx +5 -0
  21. package/src/blocks/auth/identity-management-desk.tsx +530 -0
  22. package/src/blocks/auth/index.ts +12 -0
  23. package/src/blocks/auth/login-page.tsx +206 -0
  24. package/src/blocks/auth/password-forgot-page.tsx +60 -0
  25. package/src/blocks/auth/portal-pages.tsx +32 -0
  26. package/src/blocks/auth/privileged-desk.tsx +55 -0
  27. package/src/blocks/auth/register-page.tsx +117 -0
  28. package/src/blocks/auth/session-boundary.tsx +296 -0
  29. package/src/blocks/auth/super-admin-login-page.tsx +15 -0
  30. package/src/blocks/auth/super-admin-password-forgot-page.tsx +5 -0
  31. package/src/blocks/blog/blog-card.tsx +156 -0
  32. package/src/blocks/blog/blog-reader.tsx +175 -0
  33. package/src/blocks/blog/blog-types.ts +47 -0
  34. package/src/blocks/blog/index.ts +3 -0
  35. package/src/blocks/chat-composer/chat-composer.tsx +140 -0
  36. package/src/blocks/chat-composer/index.ts +1 -0
  37. package/src/blocks/chat-history/chat-history.tsx +59 -0
  38. package/src/blocks/chat-history/index.ts +1 -0
  39. package/src/blocks/chat-response-progress/chat-response-progress.tsx +34 -0
  40. package/src/blocks/chat-response-progress/index.ts +2 -0
  41. package/src/blocks/chat-runtime-controls/chat-runtime-controls.tsx +56 -0
  42. package/src/blocks/chat-runtime-controls/index.ts +2 -0
  43. package/src/blocks/chat-runtime-trace/chat-runtime-trace.tsx +71 -0
  44. package/src/blocks/chat-runtime-trace/index.ts +2 -0
  45. package/src/blocks/codex-connection-settings/codex-connection-settings.tsx +42 -0
  46. package/src/blocks/codex-connection-settings/index.ts +1 -0
  47. package/src/blocks/dropzone/dropzone-file-item.tsx +113 -0
  48. package/src/blocks/dropzone/dropzone-types.ts +32 -0
  49. package/src/blocks/dropzone/dropzone.tsx +216 -0
  50. package/src/blocks/dropzone/index.ts +3 -0
  51. package/src/blocks/ecommerce/cart/cart-drawer.tsx +228 -0
  52. package/src/blocks/ecommerce/cart/cart-types.ts +27 -0
  53. package/src/blocks/ecommerce/cart/index.ts +2 -0
  54. package/src/blocks/ecommerce/categories/categories-types.ts +23 -0
  55. package/src/blocks/ecommerce/categories/category-showcase.tsx +125 -0
  56. package/src/blocks/ecommerce/categories/index.ts +2 -0
  57. package/src/blocks/ecommerce/checkout/checkout-types.ts +48 -0
  58. package/src/blocks/ecommerce/checkout/checkout-wizard.tsx +468 -0
  59. package/src/blocks/ecommerce/checkout/index.ts +2 -0
  60. package/src/blocks/ecommerce/comparison/comparison-types.ts +28 -0
  61. package/src/blocks/ecommerce/comparison/index.ts +2 -0
  62. package/src/blocks/ecommerce/comparison/product-comparison.tsx +174 -0
  63. package/src/blocks/ecommerce/coupon-wallet/coupon-wallet-types.ts +21 -0
  64. package/src/blocks/ecommerce/coupon-wallet/coupon-wallet.tsx +154 -0
  65. package/src/blocks/ecommerce/coupon-wallet/index.ts +2 -0
  66. package/src/blocks/ecommerce/delivery-tracker/delivery-tracker-types.ts +20 -0
  67. package/src/blocks/ecommerce/delivery-tracker/delivery-tracker.tsx +169 -0
  68. package/src/blocks/ecommerce/delivery-tracker/index.ts +2 -0
  69. package/src/blocks/ecommerce/index.ts +12 -0
  70. package/src/blocks/ecommerce/payment-methods/index.ts +2 -0
  71. package/src/blocks/ecommerce/payment-methods/payment-method-selector.tsx +224 -0
  72. package/src/blocks/ecommerce/payment-methods/payment-methods-types.ts +21 -0
  73. package/src/blocks/ecommerce/price-history/index.ts +2 -0
  74. package/src/blocks/ecommerce/price-history/price-history-chart.tsx +217 -0
  75. package/src/blocks/ecommerce/price-history/price-history-types.ts +16 -0
  76. package/src/blocks/ecommerce/reviews/index.ts +2 -0
  77. package/src/blocks/ecommerce/reviews/reviews-section.tsx +309 -0
  78. package/src/blocks/ecommerce/reviews/reviews-types.ts +26 -0
  79. package/src/blocks/ecommerce/wishlist/index.ts +2 -0
  80. package/src/blocks/ecommerce/wishlist/wishlist-grid.tsx +149 -0
  81. package/src/blocks/ecommerce/wishlist/wishlist-types.ts +19 -0
  82. package/src/blocks/execution-status/README.md +25 -0
  83. package/src/blocks/execution-status/execution-status.tsx +135 -0
  84. package/src/blocks/execution-status/index.ts +2 -0
  85. package/src/blocks/file-tree/file-icons.tsx +84 -0
  86. package/src/blocks/file-tree/file-tree-node.tsx +158 -0
  87. package/src/blocks/file-tree/file-tree-types.ts +33 -0
  88. package/src/blocks/file-tree/file-tree.tsx +163 -0
  89. package/src/blocks/file-tree/index.ts +5 -0
  90. package/src/blocks/filter-builder/filter-builder.tsx +169 -0
  91. package/src/blocks/filter-builder/filter-row.tsx +164 -0
  92. package/src/blocks/filter-builder/filter-types.ts +61 -0
  93. package/src/blocks/filter-builder/index.ts +12 -0
  94. package/src/blocks/footer/footer-types.ts +35 -0
  95. package/src/blocks/footer/index.ts +2 -0
  96. package/src/blocks/footer/site-footer.tsx +212 -0
  97. package/src/blocks/form/form-block.tsx +113 -0
  98. package/src/blocks/form/form-lookup-field.tsx +60 -0
  99. package/src/blocks/form/index.ts +4 -0
  100. package/src/blocks/handover-stack/handover-stack.tsx +41 -0
  101. package/src/blocks/handover-stack/index.ts +1 -0
  102. package/src/blocks/idea-handover/idea-handover-readiness.ts +41 -0
  103. package/src/blocks/idea-handover/idea-handover-workspace.tsx +150 -0
  104. package/src/blocks/idea-handover/index.ts +4 -0
  105. package/src/blocks/kanban/index.ts +11 -0
  106. package/src/blocks/kanban/kanban-board.tsx +146 -0
  107. package/src/blocks/kanban/kanban-card.tsx +149 -0
  108. package/src/blocks/kanban/kanban-column.tsx +102 -0
  109. package/src/blocks/kanban/kanban-types.ts +38 -0
  110. package/src/blocks/loader/global-loader.tsx +90 -0
  111. package/src/blocks/loader/index.ts +1 -0
  112. package/src/blocks/mascot/README.md +21 -0
  113. package/src/blocks/mascot/index.ts +2 -0
  114. package/src/blocks/mascot/mascot.tsx +202 -0
  115. package/src/blocks/master-list/README.md +21 -0
  116. package/src/blocks/master-list/index.ts +12 -0
  117. package/src/blocks/master-list/master-form.tsx +157 -0
  118. package/src/blocks/master-list/master-list-desk.tsx +370 -0
  119. package/src/blocks/master-list/master-list.tsx +189 -0
  120. package/src/blocks/master-list/types.ts +18 -0
  121. package/src/blocks/mermaid-preview/index.ts +1 -0
  122. package/src/blocks/mermaid-preview/mermaid-preview.tsx +164 -0
  123. package/src/blocks/notifications/README.md +7 -0
  124. package/src/blocks/notifications/index.ts +1 -0
  125. package/src/blocks/notifications/notification-center-page.tsx +73 -0
  126. package/src/blocks/pricing/index.ts +7 -0
  127. package/src/blocks/pricing/pricing-table.tsx +173 -0
  128. package/src/blocks/pricing/pricing-types.ts +34 -0
  129. package/src/blocks/product-card/index.ts +2 -0
  130. package/src/blocks/product-card/product-card-types.ts +35 -0
  131. package/src/blocks/product-card/product-card.tsx +183 -0
  132. package/src/blocks/table/data-table-block.tsx +313 -0
  133. package/src/blocks/table/data-table-filter-menu.tsx +48 -0
  134. package/src/blocks/table/data-table-icon-menu-trigger.tsx +44 -0
  135. package/src/blocks/table/data-table-menu-content.tsx +32 -0
  136. package/src/blocks/table/data-table-pagination.tsx +149 -0
  137. package/src/blocks/table/data-table-row-actions.tsx +53 -0
  138. package/src/blocks/table/data-table-status.tsx +42 -0
  139. package/src/blocks/table/data-table-toolbar.tsx +124 -0
  140. package/src/blocks/table/data-table-totals.tsx +31 -0
  141. package/src/blocks/table/index.ts +13 -0
  142. package/src/blocks/workspace/index.ts +19 -0
  143. package/src/blocks/workspace/workspace-action-card.tsx +73 -0
  144. package/src/blocks/workspace/workspace-application-header.tsx +67 -0
  145. package/src/blocks/workspace/workspace-entity-card.tsx +48 -0
  146. package/src/blocks/workspace/workspace-health-summary.tsx +15 -0
  147. package/src/blocks/workspace/workspace-metric-card.tsx +97 -0
  148. package/src/blocks/workspace/workspace-page-header.tsx +43 -0
  149. package/src/blocks/workspace/workspace-publish-status.tsx +15 -0
  150. package/src/blocks/workspace/workspace-route-checklist.tsx +28 -0
  151. package/src/blocks/workspace/workspace-runtime-status.tsx +48 -0
  152. package/src/blocks/workspace/workspace-section-card.tsx +42 -0
  153. package/src/components/accordion.tsx +65 -0
  154. package/src/components/alert-dialog.tsx +160 -0
  155. package/src/components/alert.tsx +68 -0
  156. package/src/components/aspect-ratio.tsx +22 -0
  157. package/src/components/attachment.tsx +195 -0
  158. package/src/components/avatar.tsx +90 -0
  159. package/src/components/badge.tsx +55 -0
  160. package/src/components/breadcrumb.tsx +100 -0
  161. package/src/components/bubble.tsx +123 -0
  162. package/src/components/button-group.tsx +79 -0
  163. package/src/components/button.tsx +71 -0
  164. package/src/components/calendar.tsx +185 -0
  165. package/src/components/card.tsx +100 -0
  166. package/src/components/carousel.tsx +229 -0
  167. package/src/components/chart.tsx +338 -0
  168. package/src/components/checkbox.tsx +27 -0
  169. package/src/components/collapsible.tsx +15 -0
  170. package/src/components/combobox.tsx +269 -0
  171. package/src/components/command.tsx +181 -0
  172. package/src/components/compact-model-switcher.tsx +128 -0
  173. package/src/components/context-menu.tsx +244 -0
  174. package/src/components/dialog.tsx +138 -0
  175. package/src/components/direction.tsx +1 -0
  176. package/src/components/drawer.tsx +208 -0
  177. package/src/components/dropdown-menu.tsx +257 -0
  178. package/src/components/empty.tsx +93 -0
  179. package/src/components/field.tsx +232 -0
  180. package/src/components/hover-card.tsx +45 -0
  181. package/src/components/input-group.tsx +146 -0
  182. package/src/components/input-otp.tsx +83 -0
  183. package/src/components/input.tsx +19 -0
  184. package/src/components/item.tsx +188 -0
  185. package/src/components/kbd.tsx +26 -0
  186. package/src/components/label.tsx +17 -0
  187. package/src/components/markdown-content.tsx +113 -0
  188. package/src/components/marker.tsx +67 -0
  189. package/src/components/menubar.tsx +267 -0
  190. package/src/components/message-scroller.tsx +91 -0
  191. package/src/components/message.tsx +84 -0
  192. package/src/components/native-select.tsx +54 -0
  193. package/src/components/navigation-menu.tsx +160 -0
  194. package/src/components/pagination.tsx +118 -0
  195. package/src/components/popover.tsx +74 -0
  196. package/src/components/progress.tsx +82 -0
  197. package/src/components/questionnaire.tsx +150 -0
  198. package/src/components/radio-group.tsx +35 -0
  199. package/src/components/resizable.tsx +41 -0
  200. package/src/components/rich-text-editor.tsx +604 -0
  201. package/src/components/scroll-area.tsx +47 -0
  202. package/src/components/select.tsx +189 -0
  203. package/src/components/separator.tsx +18 -0
  204. package/src/components/sheet.tsx +125 -0
  205. package/src/components/sidebar.tsx +693 -0
  206. package/src/components/skeleton.tsx +13 -0
  207. package/src/components/slider.tsx +51 -0
  208. package/src/components/sonner.tsx +45 -0
  209. package/src/components/sparkline.tsx +231 -0
  210. package/src/components/spinner.tsx +20 -0
  211. package/src/components/status-badge.tsx +114 -0
  212. package/src/components/switch.tsx +31 -0
  213. package/src/components/table.tsx +91 -0
  214. package/src/components/tabs.tsx +72 -0
  215. package/src/components/textarea.tsx +17 -0
  216. package/src/components/toast.tsx +222 -0
  217. package/src/components/toggle-group.tsx +85 -0
  218. package/src/components/toggle.tsx +42 -0
  219. package/src/components/tooltip.tsx +53 -0
  220. package/src/design-system/README.md +55 -0
  221. package/src/design-system/action-intents.ts +21 -0
  222. package/src/design-system/agent-manifest.ts +83 -0
  223. package/src/design-system/block-registry.ts +272 -0
  224. package/src/design-system/component-registry.ts +142 -0
  225. package/src/design-system/contracts.ts +69 -0
  226. package/src/design-system/defaults.ts +3 -0
  227. package/src/design-system/index.ts +29 -0
  228. package/src/design-system/mcp-server.ts +156 -0
  229. package/src/design-system/page-registry.ts +74 -0
  230. package/src/design-system/selection.ts +67 -0
  231. package/src/design-system/template-registry.ts +33 -0
  232. package/src/features/interface-topology/index.ts +14 -0
  233. package/src/features/interface-topology/interface-topology.types.ts +40 -0
  234. package/src/features/interface-topology/topology-control.tsx +18 -0
  235. package/src/features/interface-topology/topology-inspector.tsx +228 -0
  236. package/src/features/interface-topology/topology-marker.tsx +47 -0
  237. package/src/features/interface-topology/topology-region.tsx +44 -0
  238. package/src/features/interface-topology/use-interface-topology.ts +178 -0
  239. package/src/hooks/use-mobile.ts +19 -0
  240. package/src/hooks/use-scroll-follow.ts +22 -0
  241. package/src/index.ts +11 -0
  242. package/src/layouts/README.md +65 -0
  243. package/src/layouts/agent-workspace/agent-activity-rail.tsx +101 -0
  244. package/src/layouts/agent-workspace/agent-workspace.tsx +27 -0
  245. package/src/layouts/agent-workspace/agent-workspace.types.ts +28 -0
  246. package/src/layouts/agent-workspace/index.ts +7 -0
  247. package/src/layouts/blog-header/blog-header-types.ts +25 -0
  248. package/src/layouts/blog-header/blog-header.tsx +172 -0
  249. package/src/layouts/blog-header/index.ts +2 -0
  250. package/src/layouts/documentation-workspace/README.md +8 -0
  251. package/src/layouts/documentation-workspace/documentation-workspace.tsx +34 -0
  252. package/src/layouts/documentation-workspace/index.ts +1 -0
  253. package/src/layouts/ecommerce-header/ecommerce-actions.tsx +89 -0
  254. package/src/layouts/ecommerce-header/ecommerce-announcement.tsx +43 -0
  255. package/src/layouts/ecommerce-header/ecommerce-drawer.tsx +97 -0
  256. package/src/layouts/ecommerce-header/ecommerce-header-types.ts +59 -0
  257. package/src/layouts/ecommerce-header/ecommerce-header.tsx +47 -0
  258. package/src/layouts/ecommerce-header/ecommerce-navigation.tsx +98 -0
  259. package/src/layouts/ecommerce-header/ecommerce-search.tsx +86 -0
  260. package/src/layouts/ecommerce-header/index.ts +2 -0
  261. package/src/layouts/main-workspace/index.ts +28 -0
  262. package/src/layouts/mdi/index.ts +1 -0
  263. package/src/layouts/mdi/mdi.tsx +20 -0
  264. package/src/layouts/mdi-main/index.ts +27 -0
  265. package/src/layouts/mdi-main/mdi-app-catalog.generated.ts +159 -0
  266. package/src/layouts/mdi-main/mdi-app-catalog.ts +76 -0
  267. package/src/layouts/mdi-main/mdi-app-switcher.tsx +107 -0
  268. package/src/layouts/mdi-main/mdi-feature-settings.tsx +135 -0
  269. package/src/layouts/mdi-main/mdi-global-search.tsx +192 -0
  270. package/src/layouts/mdi-main/mdi-main.tsx +241 -0
  271. package/src/layouts/mdi-main/mdi-notifications-menu.tsx +197 -0
  272. package/src/layouts/mdi-main/mdi-profile-menu.tsx +79 -0
  273. package/src/layouts/mdi-main/mdi-sidebar-navigation.tsx +226 -0
  274. package/src/layouts/mdi-main/mdi-sidebar.tsx +110 -0
  275. package/src/layouts/mdi-main/mdi-status-bar.tsx +26 -0
  276. package/src/layouts/mdi-main/mdi-top-menu-control.ts +4 -0
  277. package/src/layouts/mdi-main/mdi-top-menu.tsx +117 -0
  278. package/src/layouts/mdi-main/mdi-topology.tsx +297 -0
  279. package/src/layouts/mdi-main/mdi-tweak-panel.tsx +104 -0
  280. package/src/layouts/mdi-main/mdi-types.ts +131 -0
  281. package/src/layouts/mdi-main/use-mdi-features.ts +36 -0
  282. package/src/layouts/mdi-main/use-mdi-sidebar-state.ts +59 -0
  283. package/src/layouts/site-header/announcement-bar.tsx +55 -0
  284. package/src/layouts/site-header/category-strip.tsx +41 -0
  285. package/src/layouts/site-header/index.ts +16 -0
  286. package/src/layouts/site-header/main-navbar.tsx +179 -0
  287. package/src/layouts/site-header/mobile-drawer.tsx +140 -0
  288. package/src/layouts/site-header/site-header-types.ts +63 -0
  289. package/src/layouts/site-header/site-header.tsx +58 -0
  290. package/src/lib/random-id.ts +19 -0
  291. package/src/lib/utils.ts +6 -0
  292. package/src/providers/pdf-provider.ts +137 -0
  293. package/src/styles/globals.css +374 -0
  294. package/src/templates/README.md +12 -0
  295. package/src/templates/dashboard-01/components/app-sidebar.tsx +177 -0
  296. package/src/templates/dashboard-01/components/chart-area-interactive.tsx +276 -0
  297. package/src/templates/dashboard-01/components/data-table-cell-viewer.tsx +213 -0
  298. package/src/templates/dashboard-01/components/data-table.tsx +577 -0
  299. package/src/templates/dashboard-01/components/nav-documents.tsx +79 -0
  300. package/src/templates/dashboard-01/components/nav-main.tsx +55 -0
  301. package/src/templates/dashboard-01/components/nav-secondary.tsx +39 -0
  302. package/src/templates/dashboard-01/components/nav-user.tsx +97 -0
  303. package/src/templates/dashboard-01/components/section-cards.tsx +99 -0
  304. package/src/templates/dashboard-01/components/site-header.tsx +14 -0
  305. package/src/templates/dashboard-01/data.json +614 -0
  306. package/src/templates/dashboard-01/index.ts +7 -0
  307. package/src/templates/documentation-sidebar/app-sidebar.tsx +95 -0
  308. package/src/templates/documentation-sidebar/index.ts +2 -0
  309. package/src/templates/sidebar-07/components/app-sidebar.tsx +175 -0
  310. package/src/templates/sidebar-07/components/nav-main.tsx +64 -0
  311. package/src/templates/sidebar-07/components/nav-projects.tsx +79 -0
  312. package/src/templates/sidebar-07/components/nav-user.tsx +105 -0
  313. package/src/templates/sidebar-07/components/team-switcher.tsx +94 -0
  314. package/src/templates/sidebar-07/index.ts +1 -0
  315. package/src/templates/ui-page/index.ts +7 -0
  316. package/src/templates/ui-page/ui-browser-frame.tsx +27 -0
  317. package/src/templates/ui-page/ui-template-code.tsx +48 -0
  318. package/src/templates/ui-page/ui-template-header.tsx +87 -0
  319. package/src/templates/ui-page/ui-template-navigation.tsx +60 -0
  320. package/src/templates/ui-page/ui-template-page.tsx +97 -0
  321. package/src/theme/index.ts +12 -0
  322. package/src/theme/theme-config.ts +30 -0
  323. package/src/theme/theme-provider.tsx +142 -0
  324. package/src/theme/theme-selector.tsx +75 -0
  325. package/src/tokens/index.ts +15 -0
  326. package/src/vite-env.d.ts +3 -0
@@ -0,0 +1,530 @@
1
+ import { useEffect, useMemo, useState } from "react";
2
+ import { KeyRoundIcon, ShieldCheckIcon, UsersIcon } from "lucide-react";
3
+ import { MainWorkspace, useMdiTopology, type MdiNavigationSection } from "../../layouts/main-workspace";
4
+ import { Input } from "../../components/input";
5
+ import { FormBlock } from "../form";
6
+ import { MasterList, type MasterField, type MasterRecord } from "../master-list";
7
+ import { getStatusBadgeValue, StatusBadge } from "../../components/status-badge";
8
+ import type { AuthenticatedRequest } from "./session-boundary";
9
+
10
+ type IdentityUser = {
11
+ id: string;
12
+ login: string;
13
+ name: string;
14
+ protected: boolean;
15
+ roles: string[];
16
+ state: "active" | "disabled";
17
+ username: string;
18
+ };
19
+ type Identifier = { id: string };
20
+ type UserRole = { roleId: string; userId: string };
21
+ type RolePermission = { permissionId: string; roleId: string };
22
+ type Resource = "permissions" | "role-permissions" | "roles" | "user-roles" | "users";
23
+
24
+ const identityStatusFields: MasterField[] = [
25
+ {
26
+ id: "state",
27
+ label: "State",
28
+ type: "select",
29
+ options: [
30
+ { label: "Active", value: "active" },
31
+ { label: "Suspended", value: "disabled" },
32
+ ],
33
+ format: (value) => (
34
+ <StatusBadge
35
+ label={value === "disabled" ? "Suspended" : "Active"}
36
+ status={getStatusBadgeValue(value === "disabled" ? "Suspended" : "Active")}
37
+ />
38
+ ),
39
+ },
40
+ ];
41
+
42
+ const masterListTopologyIds = {
43
+ columnFilter: "27.1.2.2",
44
+ content: "27.1.3",
45
+ header: "27.1.1",
46
+ pageNavigation: "27.1.4.2",
47
+ pageSize: "27.1.4.1",
48
+ pagination: "27.1.4",
49
+ rowHeader: "27.1.3.1",
50
+ rows: "27.1.3.2",
51
+ search: "27.1.2",
52
+ searchBar: "27.1.2.1",
53
+ };
54
+
55
+ const resources: { readonly label: string; readonly path: Resource }[] = [
56
+ { label: "Users", path: "users" },
57
+ { label: "Roles", path: "roles" },
58
+ { label: "Permissions", path: "permissions" },
59
+ { label: "User roles", path: "user-roles" },
60
+ { label: "Role permissions", path: "role-permissions" },
61
+ ];
62
+
63
+ export function IdentityManagementDesk({
64
+ applicationId,
65
+ applicationName,
66
+ logout,
67
+ request,
68
+ }: {
69
+ applicationId: string;
70
+ applicationName: string;
71
+ logout(): void;
72
+ request: AuthenticatedRequest;
73
+ }) {
74
+ const [location, setLocation] = useState(() => window.location.pathname);
75
+ useEffect(() => {
76
+ const update = () => setLocation(window.location.pathname);
77
+ window.addEventListener("popstate", update);
78
+ return () => window.removeEventListener("popstate", update);
79
+ }, []);
80
+
81
+ const resource = resourceFromPath(location);
82
+ const navigation = useMemo(() => identityNavigation(location), [location]);
83
+ const content =
84
+ resource === "users" ? (
85
+ <UsersPage applicationId={applicationId} request={request} />
86
+ ) : resource === "roles" || resource === "permissions" ? (
87
+ <IdentifiersPage applicationId={applicationId} request={request} resource={resource} />
88
+ ) : (
89
+ <AssignmentsPage applicationId={applicationId} request={request} resource={resource} />
90
+ );
91
+
92
+ useEffect(() => {
93
+ document.title = `${applicationName} | Identity`;
94
+ }, [applicationName]);
95
+ return (
96
+ <MainWorkspace
97
+ applicationId={applicationId}
98
+ applicationName={applicationName}
99
+ navigation={navigation}
100
+ primaryAction={null}
101
+ user={{ initials: "SA", name: "Super administrator", onSignOut: logout }}
102
+ workspaceTitle="Identity and access"
103
+ >
104
+ <main className="p-6">{content}</main>
105
+ </MainWorkspace>
106
+ );
107
+ }
108
+
109
+ function UsersPage({ applicationId, request }: { applicationId: string; request: AuthenticatedRequest }) {
110
+ const topology = useMdiTopology();
111
+ const [users, setUsers] = useState<IdentityUser[]>([]);
112
+ const [editing, setEditing] = useState<IdentityUser>();
113
+ const [error, setError] = useState<string>();
114
+ const reload = () =>
115
+ void readJson<IdentityUser[]>(request, apiPath(applicationId, "users"))
116
+ .then(setUsers)
117
+ .catch((reason) => setError(messageOf(reason)));
118
+ useEffect(reload, [applicationId]);
119
+ if (editing)
120
+ return (
121
+ <UserForm
122
+ applicationId={applicationId}
123
+ request={request}
124
+ user={editing}
125
+ onBack={() => setEditing(undefined)}
126
+ onSaved={() => {
127
+ setEditing(undefined);
128
+ reload();
129
+ }}
130
+ />
131
+ );
132
+ const suspend = (user: IdentityUser) =>
133
+ void request(apiPath(applicationId, `users/${user.id}`), {
134
+ body: JSON.stringify({ login: user.login, name: user.name, state: "disabled", username: user.username }),
135
+ headers: { "content-type": "application/json" },
136
+ method: "PUT",
137
+ })
138
+ .then(async (response) => {
139
+ if (!response.ok)
140
+ throw new Error(
141
+ ((await response.json().catch(() => ({}))) as { error?: string }).error ?? "Could not suspend user.",
142
+ );
143
+ reload();
144
+ })
145
+ .catch((reason) => setError(messageOf(reason)));
146
+ const forceDelete = (user: IdentityUser) =>
147
+ void request(apiPath(applicationId, `users/${user.id}`), { method: "DELETE" })
148
+ .then(async (response) => {
149
+ if (!response.ok)
150
+ throw new Error(
151
+ ((await response.json().catch(() => ({}))) as { error?: string }).error ?? "Could not delete user.",
152
+ );
153
+ reload();
154
+ })
155
+ .catch((reason) => setError(messageOf(reason)));
156
+ const fields: MasterField[] = [
157
+ {
158
+ id: "name",
159
+ label: "Name",
160
+ required: true,
161
+ format: (value, record) => (
162
+ <span className="inline-flex items-center gap-1.5">
163
+ {String(value ?? "")}
164
+ {record.protected ? (
165
+ <ShieldCheckIcon aria-label="Default protected record" className="size-4 text-amber-600" />
166
+ ) : null}
167
+ </span>
168
+ ),
169
+ },
170
+ { id: "username", label: "Username", required: true },
171
+ { id: "login", label: "Email", type: "email", required: true },
172
+ { id: "roles", label: "Roles", format: (value) => String(value ?? "") || "—" },
173
+ ...identityStatusFields,
174
+ ];
175
+ const records: MasterRecord[] = users.map((user) => ({ ...user, roles: user.roles.join(", ") }));
176
+ return (
177
+ <>
178
+ <MasterList
179
+ createLabel="New user"
180
+ description="Create, update, suspend, and remove application-local accounts."
181
+ fields={fields}
182
+ onCreate={() =>
183
+ setEditing({ id: "", login: "", name: "", protected: false, roles: [], state: "active", username: "" })
184
+ }
185
+ onDelete={(record) => {
186
+ const user = users.find((candidate) => candidate.id === record.id);
187
+ if (user) forceDelete(user);
188
+ }}
189
+ onEdit={(record) => {
190
+ const user = users.find((candidate) => candidate.id === record.id);
191
+ if (user) setEditing(user);
192
+ }}
193
+ onSuspend={(record) => {
194
+ const user = users.find((candidate) => candidate.id === record.id);
195
+ if (user && user.state !== "disabled") suspend(user);
196
+ }}
197
+ records={records}
198
+ searchTopSpacing
199
+ showHeaderDivider={false}
200
+ title="Users"
201
+ topology={topology}
202
+ topologyIds={masterListTopologyIds}
203
+ />
204
+ {error ? <p className="mt-3 text-sm text-destructive">{error}</p> : null}
205
+ </>
206
+ );
207
+ }
208
+
209
+ function UserForm({
210
+ applicationId,
211
+ onBack,
212
+ onSaved,
213
+ request,
214
+ user,
215
+ }: {
216
+ applicationId: string;
217
+ onBack(): void;
218
+ onSaved(): void;
219
+ request: AuthenticatedRequest;
220
+ user: IdentityUser;
221
+ }) {
222
+ const [value, setValue] = useState({ ...user, password: "" });
223
+ const [error, setError] = useState<string>();
224
+ const isNew = !user.id;
225
+ const submit = () =>
226
+ void request(apiPath(applicationId, `users${isNew ? "" : `/${user.id}`}`), {
227
+ body: JSON.stringify({
228
+ login: value.login,
229
+ name: value.name,
230
+ password: value.password || undefined,
231
+ state: value.state,
232
+ username: value.username,
233
+ }),
234
+ headers: { "content-type": "application/json" },
235
+ method: isNew ? "POST" : "PUT",
236
+ })
237
+ .then(async (response) => {
238
+ if (!response.ok)
239
+ throw new Error(
240
+ ((await response.json().catch(() => ({}))) as { error?: string }).error ?? "Could not save user.",
241
+ );
242
+ onSaved();
243
+ })
244
+ .catch((reason) => setError(messageOf(reason)));
245
+ return (
246
+ <FormBlock
247
+ active={value.state === "active"}
248
+ activeLabel="Account active"
249
+ description="A user must have a unique email and username."
250
+ onActiveChange={(active) => setValue({ ...value, state: active ? "active" : "disabled" })}
251
+ onBack={onBack}
252
+ onCancel={onBack}
253
+ onSubmit={submit}
254
+ submitLabel={isNew ? "Create user" : "Save user"}
255
+ tabs={[
256
+ {
257
+ id: "details",
258
+ label: "Details",
259
+ content: (
260
+ <div className="grid gap-4 md:grid-cols-2">
261
+ <Field label="Name" value={value.name} onChange={(name) => setValue({ ...value, name })} />
262
+ <Field
263
+ label="Username"
264
+ value={value.username}
265
+ onChange={(username) => setValue({ ...value, username })}
266
+ />
267
+ <Field
268
+ label="Email"
269
+ type="email"
270
+ value={value.login}
271
+ onChange={(login) => setValue({ ...value, login })}
272
+ />
273
+ <Field
274
+ label={isNew ? "Password" : "New password (optional)"}
275
+ type="password"
276
+ value={value.password}
277
+ onChange={(password) => setValue({ ...value, password })}
278
+ />
279
+ {error ? <p className="text-sm text-destructive md:col-span-2">{error}</p> : null}
280
+ </div>
281
+ ),
282
+ },
283
+ ]}
284
+ title={isNew ? "New user" : `Edit ${user.name}`}
285
+ />
286
+ );
287
+ }
288
+
289
+ function IdentifiersPage({
290
+ applicationId,
291
+ request,
292
+ resource,
293
+ }: {
294
+ applicationId: string;
295
+ request: AuthenticatedRequest;
296
+ resource: "permissions" | "roles";
297
+ }) {
298
+ const topology = useMdiTopology();
299
+ const [records, setRecords] = useState<Identifier[]>([]);
300
+ const [draft, setDraft] = useState("");
301
+ const [creating, setCreating] = useState(false);
302
+ const [error, setError] = useState<string>();
303
+ const reload = () =>
304
+ void readJson<Identifier[]>(request, apiPath(applicationId, resource))
305
+ .then(setRecords)
306
+ .catch((reason) => setError(messageOf(reason)));
307
+ useEffect(reload, [applicationId, resource]);
308
+ const label = resource === "roles" ? "Role" : "Permission";
309
+ const create = () =>
310
+ void request(apiPath(applicationId, resource), {
311
+ body: JSON.stringify({ id: draft }),
312
+ headers: { "content-type": "application/json" },
313
+ method: "POST",
314
+ })
315
+ .then(async (response) => {
316
+ if (!response.ok)
317
+ throw new Error(
318
+ ((await response.json().catch(() => ({}))) as { error?: string }).error ??
319
+ `Could not create ${label.toLowerCase()}.`,
320
+ );
321
+ setDraft("");
322
+ setCreating(false);
323
+ reload();
324
+ })
325
+ .catch((reason) => setError(messageOf(reason)));
326
+ if (creating)
327
+ return (
328
+ <FormBlock
329
+ active
330
+ activeLabel="Available for assignment"
331
+ description="Role and permission IDs are stable contracts."
332
+ onActiveChange={() => undefined}
333
+ onBack={() => setCreating(false)}
334
+ onCancel={() => setCreating(false)}
335
+ onSubmit={create}
336
+ submitLabel={`Create ${label.toLowerCase()}`}
337
+ tabs={[
338
+ {
339
+ id: "details",
340
+ label: "Details",
341
+ content: (
342
+ <>
343
+ <Field label={`${label} ID`} value={draft} onChange={setDraft} />
344
+ {error ? <p className="mt-3 text-sm text-destructive">{error}</p> : null}
345
+ </>
346
+ ),
347
+ },
348
+ ]}
349
+ title={`New ${label.toLowerCase()}`}
350
+ />
351
+ );
352
+ const fields: MasterField[] = [{ id: "code", label: `${label} ID`, required: true }];
353
+ const masterRecords: MasterRecord[] = records.map((record) => ({ id: record.id, code: record.id }));
354
+ return (
355
+ <MasterList
356
+ createLabel={`New ${label.toLowerCase()}`}
357
+ description={`Application-local ${resource} used by access policies.`}
358
+ fields={fields}
359
+ onCreate={() => setCreating(true)}
360
+ records={masterRecords}
361
+ searchTopSpacing
362
+ showHeaderDivider={false}
363
+ title={`${label}s`}
364
+ topology={topology}
365
+ topologyIds={masterListTopologyIds}
366
+ />
367
+ );
368
+ }
369
+
370
+ function AssignmentsPage({
371
+ applicationId,
372
+ request,
373
+ resource,
374
+ }: {
375
+ applicationId: string;
376
+ request: AuthenticatedRequest;
377
+ resource: "role-permissions" | "user-roles";
378
+ }) {
379
+ const topology = useMdiTopology();
380
+ const [records, setRecords] = useState<(UserRole | RolePermission)[]>([]);
381
+ const [target, setTarget] = useState("");
382
+ const [ids, setIds] = useState("");
383
+ const [editing, setEditing] = useState(false);
384
+ const [error, setError] = useState<string>();
385
+ const reload = () =>
386
+ void readJson<(UserRole | RolePermission)[]>(request, apiPath(applicationId, resource))
387
+ .then(setRecords)
388
+ .catch((reason) => setError(messageOf(reason)));
389
+ useEffect(reload, [applicationId, resource]);
390
+ const isUserRoles = resource === "user-roles";
391
+ const rows: MasterRecord[] = records.map((record) =>
392
+ isUserRoles
393
+ ? {
394
+ id: `${(record as UserRole).userId}:${(record as UserRole).roleId}`,
395
+ target: (record as UserRole).userId,
396
+ assignment: (record as UserRole).roleId,
397
+ }
398
+ : {
399
+ id: `${(record as RolePermission).roleId}:${(record as RolePermission).permissionId}`,
400
+ target: (record as RolePermission).roleId,
401
+ assignment: (record as RolePermission).permissionId,
402
+ },
403
+ );
404
+ const save = () =>
405
+ void request(apiPath(applicationId, `${resource}/${target}`), {
406
+ body: JSON.stringify({
407
+ ids: ids
408
+ .split(",")
409
+ .map((item) => item.trim())
410
+ .filter(Boolean),
411
+ }),
412
+ headers: { "content-type": "application/json" },
413
+ method: "PUT",
414
+ })
415
+ .then(async (response) => {
416
+ if (!response.ok)
417
+ throw new Error(
418
+ ((await response.json().catch(() => ({}))) as { error?: string }).error ?? "Could not save assignments.",
419
+ );
420
+ setTarget("");
421
+ setIds("");
422
+ setEditing(false);
423
+ reload();
424
+ })
425
+ .catch((reason) => setError(messageOf(reason)));
426
+ const title = isUserRoles ? "User roles" : "Role permissions";
427
+ const targetLabel = isUserRoles ? "User ID" : "Role ID";
428
+ const assignmentLabel = isUserRoles ? "Role ID" : "Permission ID";
429
+ if (editing)
430
+ return (
431
+ <FormBlock
432
+ active
433
+ activeLabel="Assignment enabled"
434
+ description="Saving replaces all assignments for this target."
435
+ onActiveChange={() => undefined}
436
+ onBack={() => setEditing(false)}
437
+ onCancel={() => setEditing(false)}
438
+ onSubmit={save}
439
+ submitLabel="Save assignments"
440
+ tabs={[
441
+ {
442
+ id: "assignments",
443
+ label: "Assignments",
444
+ content: (
445
+ <div className="grid gap-4">
446
+ <Field label={targetLabel} value={target} onChange={setTarget} />
447
+ <Field label={`${assignmentLabel}s (comma separated)`} value={ids} onChange={setIds} />
448
+ {error ? <p className="text-sm text-destructive">{error}</p> : null}
449
+ </div>
450
+ ),
451
+ },
452
+ ]}
453
+ title={`Edit ${title.toLowerCase()}`}
454
+ />
455
+ );
456
+ const fields: MasterField[] = [
457
+ { id: "target", label: targetLabel },
458
+ { id: "assignment", label: assignmentLabel },
459
+ ];
460
+ return (
461
+ <MasterList
462
+ createLabel="Edit assignments"
463
+ description="Assign roles to users and permissions to roles."
464
+ fields={fields}
465
+ onCreate={() => setEditing(true)}
466
+ records={rows}
467
+ searchTopSpacing
468
+ showHeaderDivider={false}
469
+ title={title}
470
+ topology={topology}
471
+ topologyIds={masterListTopologyIds}
472
+ />
473
+ );
474
+ }
475
+
476
+ function Field({
477
+ label,
478
+ onChange,
479
+ type = "text",
480
+ value,
481
+ }: {
482
+ label: string;
483
+ onChange(value: string): void;
484
+ type?: string;
485
+ value: string;
486
+ }) {
487
+ return (
488
+ <label className="grid gap-1.5 text-sm font-medium">
489
+ <span>{label}</span>
490
+ <Input
491
+ onChange={(event) => onChange(event.target.value)}
492
+ required={label !== "New password (optional)"}
493
+ type={type}
494
+ value={value}
495
+ />
496
+ </label>
497
+ );
498
+ }
499
+
500
+ function identityNavigation(pathname: string): MdiNavigationSection[] {
501
+ return [
502
+ {
503
+ label: "Identity",
504
+ icon: ShieldCheckIcon,
505
+ defaultOpen: true,
506
+ items: resources.map((resource) => ({
507
+ active: pathname.includes(`/identity/${resource.path}`),
508
+ href: `/sa/identity/${resource.path}`,
509
+ icon: resource.path === "users" ? UsersIcon : KeyRoundIcon,
510
+ label: resource.label,
511
+ })),
512
+ },
513
+ ];
514
+ }
515
+
516
+ function resourceFromPath(pathname: string): Resource {
517
+ return resources.find((resource) => pathname.includes(`/identity/${resource.path}`))?.path ?? "users";
518
+ }
519
+
520
+ function apiPath(applicationId: string, path: string): string {
521
+ return `/api/v1/${applicationId}/identity/${path}`;
522
+ }
523
+ async function readJson<T>(request: AuthenticatedRequest, path: string): Promise<T> {
524
+ const response = await request(path);
525
+ if (!response.ok) throw new Error("Could not load identity data.");
526
+ return response.json() as Promise<T>;
527
+ }
528
+ function messageOf(reason: unknown): string {
529
+ return reason instanceof Error ? reason.message : "An unexpected error occurred.";
530
+ }
@@ -0,0 +1,12 @@
1
+ export { AdminLoginPage } from './admin-login-page'
2
+ export { AdminPasswordForgotPage } from './admin-password-forgot-page'
3
+ export { AdminPortalPage, ClientPortalPage, SuperAdminPortalPage } from './portal-pages'
4
+ export { ClientLoginPage } from './client-login-page'
5
+ export { ClientPasswordForgotPage } from './client-password-forgot-page'
6
+ export { PasswordForgotPage, type PasswordForgotPageProps } from './password-forgot-page'
7
+ export { RegisterPage } from './register-page'
8
+ export { LoginPage, type LoginPageProps } from './login-page'
9
+ export { type AuthPageVariant } from './auth-page-layout'
10
+ export { SuperAdminLoginPage } from './super-admin-login-page'
11
+ export { SuperAdminPasswordForgotPage } from './super-admin-password-forgot-page'
12
+ export { SessionBoundary, type AuthenticatedRequest, type AuthenticatedSession } from './session-boundary'