@alepha/ui 0.18.3 → 0.19.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.
- package/dist/admin/{AdminApiKeys-Dy_k-4Vd.js → AdminApiKeys-C2ze85eD.js} +3 -4
- package/dist/admin/{AdminApiKeys-Dy_k-4Vd.js.map → AdminApiKeys-C2ze85eD.js.map} +1 -1
- package/dist/admin/{AdminAudits-CKiFMSSU.js → AdminAudits-BIj81e4k.js} +3 -4
- package/dist/admin/{AdminAudits-CKiFMSSU.js.map → AdminAudits-BIj81e4k.js.map} +1 -1
- package/dist/admin/{AdminDashboard-PhC_dZqo.js → AdminDashboard-PMVzrwSu.js} +3 -4
- package/dist/admin/{AdminDashboard-PhC_dZqo.js.map → AdminDashboard-PMVzrwSu.js.map} +1 -1
- package/dist/admin/AdminFiles-Bq03BLt-.js +189 -0
- package/dist/admin/AdminFiles-Bq03BLt-.js.map +1 -0
- package/dist/admin/{AdminJobExecutions-D9E-CS-U.js → AdminJobs-D1_QGCDy.js} +401 -358
- package/dist/admin/AdminJobs-D1_QGCDy.js.map +1 -0
- package/dist/admin/{AdminLayout-I6TlUMPc.js → AdminLayout-BNiwiw2D.js} +8 -25
- package/dist/admin/AdminLayout-BNiwiw2D.js.map +1 -0
- package/dist/admin/{AdminNotifications-ZPHCYrv7.js → AdminNotifications-DSKQtUfn.js} +85 -124
- package/dist/admin/AdminNotifications-DSKQtUfn.js.map +1 -0
- package/dist/admin/{AdminParameters-CqgvhRsb.js → AdminParameters-CoB7EhyM.js} +3 -12
- package/dist/admin/{AdminParameters-CqgvhRsb.js.map → AdminParameters-CoB7EhyM.js.map} +1 -1
- package/dist/admin/{AdminSessions-Bz5NRuoW.js → AdminSessions-DFbFcrJQ.js} +3 -4
- package/dist/admin/{AdminSessions-Bz5NRuoW.js.map → AdminSessions-DFbFcrJQ.js.map} +1 -1
- package/dist/admin/{AdminUserLayout-lXT6I0Qq.js → AdminUserLayout-fSfi3KMm.js} +72 -111
- package/dist/admin/AdminUserLayout-fSfi3KMm.js.map +1 -0
- package/dist/admin/{AdminUserProfile-vFBLoJ3h.js → AdminUserProfile-_C-h8vUK.js} +7 -6
- package/dist/admin/AdminUserProfile-_C-h8vUK.js.map +1 -0
- package/dist/admin/{AdminUserSessions-CT_YDim0.js → AdminUserSessions-KpJHIeQo.js} +3 -4
- package/dist/admin/{AdminUserSessions-CT_YDim0.js.map → AdminUserSessions-KpJHIeQo.js.map} +1 -1
- package/dist/admin/{AdminUsers-D1UfGya9.js → AdminUsers-DcVrzdQP.js} +4 -4
- package/dist/admin/AdminUsers-DcVrzdQP.js.map +1 -0
- package/dist/admin/{AuthLayout-_frhdgOO.js → AuthLayout-CazfLzcf.js} +3 -4
- package/dist/admin/{AuthLayout-_frhdgOO.js.map → AuthLayout-CazfLzcf.js.map} +1 -1
- package/dist/{demo/IconGoogle-CSQLPYwX.js → admin/IconGoogle-8Nkx6yax.js} +2 -4
- package/dist/admin/{IconGoogle-Ch1m3Uzl.js.map → IconGoogle-8Nkx6yax.js.map} +1 -1
- package/dist/admin/{Login-xtNmQtGh.js → Login-CaMjUrDP.js} +5 -6
- package/dist/{auth/Login-BA1E8IZl.js.map → admin/Login-CaMjUrDP.js.map} +1 -1
- package/dist/admin/{Profile-_AtPUwAP.js → Profile-Ca4fZX15.js} +3 -5
- package/dist/{demo/Profile-DS5q4vOh.js.map → admin/Profile-Ca4fZX15.js.map} +1 -1
- package/dist/admin/{Register-JcCjHUUn.js → Register-C5DyKWPO.js} +5 -6
- package/dist/{demo/Register-B4hLBeEv.js.map → admin/Register-C5DyKWPO.js.map} +1 -1
- package/dist/admin/{ResetPassword-CwGBPLJO.js → ResetPassword-BA5sAgXo.js} +4 -5
- package/dist/{auth/ResetPassword-DCtGcneA.js.map → admin/ResetPassword-BA5sAgXo.js.map} +1 -1
- package/dist/admin/{VerifyEmail-hNxWejWf.js → VerifyEmail-DKNXROj_.js} +4 -5
- package/dist/{auth/VerifyEmail-DkH7NBfn.js.map → admin/VerifyEmail-DKNXROj_.js.map} +1 -1
- package/dist/admin/adminUserAtom-BLNc7XbT.js +11 -0
- package/dist/admin/adminUserAtom-BLNc7XbT.js.map +1 -0
- package/dist/admin/{core-CYaRQ8O-.js → core-CJCEx18C.js} +132 -86
- package/dist/admin/core-CJCEx18C.js.map +1 -0
- package/dist/admin/index.d.ts +80 -13
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +38 -68
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/{demo/AuthLayout-Brri4A-L.js → auth/AuthLayout-vXPcCVzp.js} +3 -4
- package/dist/auth/{AuthLayout-AvLlcLjS.js.map → AuthLayout-vXPcCVzp.js.map} +1 -1
- package/dist/{admin/IconGoogle-Ch1m3Uzl.js → auth/IconGoogle-8Nkx6yax.js} +2 -4
- package/dist/auth/{IconGoogle-Ch1m3Uzl.js.map → IconGoogle-8Nkx6yax.js.map} +1 -1
- package/dist/auth/{Login-BA1E8IZl.js → Login-Dg08QR20.js} +5 -6
- package/dist/{demo/Login-C12N4oGs.js.map → auth/Login-Dg08QR20.js.map} +1 -1
- package/dist/{demo/Profile-DS5q4vOh.js → auth/Profile-Bb5O1yeh.js} +3 -5
- package/dist/auth/{Profile-YcWdeuFz.js.map → Profile-Bb5O1yeh.js.map} +1 -1
- package/dist/auth/{Register-CPhEO5MG.js → Register-B2AN71NC.js} +5 -6
- package/dist/{admin/Register-JcCjHUUn.js.map → auth/Register-B2AN71NC.js.map} +1 -1
- package/dist/{demo/ResetPassword-D8g9ha1N.js → auth/ResetPassword-BLxwzbDj.js} +4 -5
- package/dist/{admin/ResetPassword-CwGBPLJO.js.map → auth/ResetPassword-BLxwzbDj.js.map} +1 -1
- package/dist/auth/{VerifyEmail-DkH7NBfn.js → VerifyEmail-CSDOk3Zm.js} +4 -5
- package/dist/{admin/VerifyEmail-hNxWejWf.js.map → auth/VerifyEmail-CSDOk3Zm.js.map} +1 -1
- package/dist/auth/{core-D5jIAVF2.js → core-DuGkjPiU.js} +23 -54
- package/dist/auth/core-DuGkjPiU.js.map +1 -0
- package/dist/auth/index.d.ts +20 -6
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +13 -18
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/core/index.d.ts +78 -20
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +130 -98
- package/dist/core/index.js.map +1 -1
- package/dist/{auth/AuthLayout-AvLlcLjS.js → demo/AuthLayout-DPsOOG4u.js} +3 -4
- package/dist/demo/{AuthLayout-Brri4A-L.js.map → AuthLayout-DPsOOG4u.js.map} +1 -1
- package/dist/demo/{DemoButton-wiCxZZ_L.js → DemoButton-wzcqGk4u.js} +4 -5
- package/dist/demo/{DemoButton-wiCxZZ_L.js.map → DemoButton-wzcqGk4u.js.map} +1 -1
- package/dist/demo/{DemoControlSelect-D7ILObVg.js → DemoControlSelect-CMWvQ6Gm.js} +4 -5
- package/dist/demo/{DemoControlSelect-D7ILObVg.js.map → DemoControlSelect-CMWvQ6Gm.js.map} +1 -1
- package/dist/demo/{DemoDataTable-DZ5Y8pFX.js → DemoDataTable-CHsAP3e2.js} +4 -5
- package/dist/demo/{DemoDataTable-DZ5Y8pFX.js.map → DemoDataTable-CHsAP3e2.js.map} +1 -1
- package/dist/demo/{DemoDialog-CUWdLHim.js → DemoDialog-Co2IePxX.js} +3 -4
- package/dist/demo/{DemoDialog-CUWdLHim.js.map → DemoDialog-Co2IePxX.js.map} +1 -1
- package/dist/demo/{DemoFlex-a8OhMMvq.js → DemoFlex-OEwQt5do.js} +4 -5
- package/dist/demo/{DemoFlex-a8OhMMvq.js.map → DemoFlex-OEwQt5do.js.map} +1 -1
- package/dist/demo/DemoHeading-Db-XkQIK.js +69 -0
- package/dist/demo/DemoHeading-Db-XkQIK.js.map +1 -0
- package/dist/demo/{DemoHome-D_De3UiT.js → DemoHome-Cyp29ygy.js} +4 -5
- package/dist/demo/{DemoHome-D_De3UiT.js.map → DemoHome-Cyp29ygy.js.map} +1 -1
- package/dist/demo/{DemoJsonViewer-B50s9aGM.js → DemoJsonViewer-DXtCeMzH.js} +4 -5
- package/dist/demo/{DemoJsonViewer-B50s9aGM.js.map → DemoJsonViewer-DXtCeMzH.js.map} +1 -1
- package/dist/demo/{DemoLayout-CHU8WTwO.js → DemoLayout-hh9VmZQP.js} +4 -5
- package/dist/demo/DemoLayout-hh9VmZQP.js.map +1 -0
- package/dist/demo/{DemoLogin-BBlrWpml.js → DemoLogin-DX7mnmkh.js} +15 -11
- package/dist/demo/{DemoLogin-BBlrWpml.js.map → DemoLogin-DX7mnmkh.js.map} +1 -1
- package/dist/demo/{DemoRegister-BuNE3_-f.js → DemoRegister-DVcZl04m.js} +15 -11
- package/dist/demo/{DemoRegister-BuNE3_-f.js.map → DemoRegister-DVcZl04m.js.map} +1 -1
- package/dist/demo/{DemoResetPassword-D_IjjjOJ.js → DemoResetPassword-CPENlZH5.js} +15 -11
- package/dist/demo/{DemoResetPassword-D_IjjjOJ.js.map → DemoResetPassword-CPENlZH5.js.map} +1 -1
- package/dist/demo/{DemoSidebar-Giy2HRBD.js → DemoSidebar-CGu7DZeM.js} +4 -5
- package/dist/demo/{DemoSidebar-Giy2HRBD.js.map → DemoSidebar-CGu7DZeM.js.map} +1 -1
- package/dist/demo/{DemoText-ubcw-vog.js → DemoText-DYUJ7bY_.js} +4 -5
- package/dist/demo/{DemoText-ubcw-vog.js.map → DemoText-DYUJ7bY_.js.map} +1 -1
- package/dist/demo/{DemoToast-9die_dYT.js → DemoToast-CgdnZNvx.js} +3 -4
- package/dist/demo/{DemoToast-9die_dYT.js.map → DemoToast-CgdnZNvx.js.map} +1 -1
- package/dist/demo/{DemoTypeForm-D_d6OVKL.js → DemoTypeForm-Pims-cGa.js} +4 -5
- package/dist/demo/{DemoTypeForm-D_d6OVKL.js.map → DemoTypeForm-Pims-cGa.js.map} +1 -1
- package/dist/demo/{DemoVerifyEmail-B43KlF4F.js → DemoVerifyEmail-C7B3xxch.js} +10 -11
- package/dist/demo/{DemoVerifyEmail-B43KlF4F.js.map → DemoVerifyEmail-C7B3xxch.js.map} +1 -1
- package/dist/{auth/IconGoogle-Ch1m3Uzl.js → demo/IconGoogle-CwQy4G9y.js} +2 -4
- package/dist/demo/{IconGoogle-CSQLPYwX.js.map → IconGoogle-CwQy4G9y.js.map} +1 -1
- package/dist/demo/{Login-C12N4oGs.js → Login-pwMF4TUj.js} +5 -6
- package/dist/{admin/Login-xtNmQtGh.js.map → demo/Login-pwMF4TUj.js.map} +1 -1
- package/dist/{auth/Profile-YcWdeuFz.js → demo/Profile-BliZapZS.js} +3 -5
- package/dist/{admin/Profile-_AtPUwAP.js.map → demo/Profile-BliZapZS.js.map} +1 -1
- package/dist/demo/{Register-B4hLBeEv.js → Register-CiwAT7Hy.js} +5 -6
- package/dist/{auth/Register-CPhEO5MG.js.map → demo/Register-CiwAT7Hy.js.map} +1 -1
- package/dist/{auth/ResetPassword-DCtGcneA.js → demo/ResetPassword-l9Vg4JE-.js} +4 -5
- package/dist/demo/{ResetPassword-D8g9ha1N.js.map → ResetPassword-l9Vg4JE-.js.map} +1 -1
- package/dist/demo/{Showcase-D6Fxt4X4.js → Showcase-CX6bDgwe.js} +3 -5
- package/dist/demo/{Showcase-D6Fxt4X4.js.map → Showcase-CX6bDgwe.js.map} +1 -1
- package/dist/demo/{VerifyEmail-BjDo0cZA.js → VerifyEmail-CAB-OS7i.js} +4 -5
- package/dist/demo/{VerifyEmail-BjDo0cZA.js.map → VerifyEmail-CAB-OS7i.js.map} +1 -1
- package/dist/demo/{auth-ByVTreDl.js → auth-uegJAdKu.js} +18 -35
- package/dist/demo/{auth-ByVTreDl.js.map → auth-uegJAdKu.js.map} +1 -1
- package/dist/demo/{core-DFgB3yU4.js → core-B4LVHzPn.js} +132 -93
- package/dist/demo/core-B4LVHzPn.js.map +1 -0
- package/dist/demo/index.js +20 -23
- package/dist/demo/index.js.map +1 -1
- package/dist/demo/rolldown-runtime-CiIaOW0V.js +13 -0
- package/package.json +17 -20
- package/src/admin/AdminRouter.tsx +23 -38
- package/src/admin/atoms/adminUserAtom.ts +7 -0
- package/src/admin/components/AdminLayout.tsx +2 -14
- package/src/admin/components/files/AdminFiles.tsx +123 -1
- package/src/admin/components/jobs/{AdminJobExecutions.tsx → AdminJobs.tsx} +450 -317
- package/src/admin/components/notifications/AdminNotifications.tsx +11 -25
- package/src/admin/components/users/AdminUserLayout.tsx +84 -127
- package/src/admin/components/users/AdminUserProfile.tsx +5 -2
- package/src/admin/components/users/AdminUsers.tsx +1 -1
- package/src/core/components/Flex.tsx +24 -0
- package/src/core/components/Section.tsx +109 -0
- package/src/core/components/SectionHeader.tsx +106 -0
- package/src/core/components/buttons/ActionButton.tsx +1 -0
- package/src/core/components/dialogs/PromptDialog.tsx +1 -1
- package/src/core/components/layout/Breadcrumb.tsx +2 -2
- package/src/core/components/layout/DashboardShell.tsx +1 -1
- package/src/core/index.ts +4 -1
- package/src/core/services/DialogService.tsx +2 -2
- package/src/core/styles.css +2 -1
- package/src/core/table/components/DataTable.tsx +5 -2
- package/src/demo/DemoRouter.ts +1 -1
- package/src/demo/components/auth/DemoLogin.tsx +5 -0
- package/src/demo/components/auth/DemoRegister.tsx +5 -0
- package/src/demo/components/auth/DemoResetPassword.tsx +5 -0
- package/src/demo/components/core/DemoHeading.tsx +56 -3
- package/dist/admin/AdminFiles-DFTjijGp.js +0 -111
- package/dist/admin/AdminFiles-DFTjijGp.js.map +0 -1
- package/dist/admin/AdminJobDashboard-BL8gGPDp.js +0 -354
- package/dist/admin/AdminJobDashboard-BL8gGPDp.js.map +0 -1
- package/dist/admin/AdminJobExecutions-D9E-CS-U.js.map +0 -1
- package/dist/admin/AdminJobRegistry-Ci9ue1zC.js +0 -270
- package/dist/admin/AdminJobRegistry-Ci9ue1zC.js.map +0 -1
- package/dist/admin/AdminLayout-I6TlUMPc.js.map +0 -1
- package/dist/admin/AdminNotifications-ZPHCYrv7.js.map +0 -1
- package/dist/admin/AdminUserLayout-lXT6I0Qq.js.map +0 -1
- package/dist/admin/AdminUserProfile-vFBLoJ3h.js.map +0 -1
- package/dist/admin/AdminUsers-D1UfGya9.js.map +0 -1
- package/dist/admin/core-CYaRQ8O-.js.map +0 -1
- package/dist/admin/rolldown-runtime-CjeV3_4I.js +0 -18
- package/dist/auth/core-D5jIAVF2.js.map +0 -1
- package/dist/auth/rolldown-runtime-CjeV3_4I.js +0 -18
- package/dist/demo/DemoHeading-C13OVDfS.js +0 -18
- package/dist/demo/DemoHeading-C13OVDfS.js.map +0 -1
- package/dist/demo/DemoLayout-CHU8WTwO.js.map +0 -1
- package/dist/demo/core-DFgB3yU4.js.map +0 -1
- package/dist/demo/rolldown-runtime-CjeV3_4I.js +0 -18
- package/src/admin/components/jobs/AdminJobDashboard.tsx +0 -349
- package/src/admin/components/jobs/AdminJobRegistry.tsx +0 -301
- package/src/core/components/Heading.tsx +0 -19
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Text","Flex","Text","Flex","Text","Flex","Flex","Flex","Text","Flex","Text","Flex","Text","Flex","Text","Flex","Text","MantineFlex","Container","MantineContainer","MantineText","SidebarCollapseButton","Fragment","Flex","Text","Flex","Text","Flex","Text","Flex","Flex","Flex","Text","Flex","Text","Flex","Flex","Text","Flex","Text"],"sources":["../../src/core/atoms/alephaSidebarAtom.ts","../../src/core/atoms/alephaThemeAtom.ts","../../src/core/atoms/alephaThemeOverridesAtom.ts","../../src/core/atoms/themes/default.ts","../../src/core/atoms/themes/editorial.ts","../../src/core/atoms/themes/midnight.ts","../../src/core/atoms/themes/monochrome.ts","../../src/core/atoms/themes/rosePine.ts","../../src/core/atoms/themes/softBrutalism.ts","../../src/core/atoms/themes/terminal.ts","../../src/core/atoms/alephaThemeListAtom.ts","../../src/core/providers/ThemeProvider.ts","../../src/core/components/dialogs/AlertDialog.tsx","../../src/core/components/dialogs/ConfirmDialog.tsx","../../src/core/components/dialogs/PromptDialog.tsx","../../src/core/services/DialogService.tsx","../../src/core/services/ToastService.tsx","../../src/core/UiRouter.ts","../../src/core/hooks/useTheme.ts","../../src/core/hooks/useToast.ts","../../src/core/components/layout/Omnibar.tsx","../../src/core/components/AlephaMantineProvider.tsx","../../src/core/constants/ui.ts","../../src/core/helpers/isComponentType.ts","../../src/core/components/buttons/ActionButton.tsx","../../src/core/components/buttons/BurgerButton.tsx","../../src/core/components/buttons/ClipboardButton.tsx","../../src/core/components/buttons/DarkModeButton.tsx","../../src/core/components/buttons/LanguageButton.tsx","../../src/core/components/buttons/OmnibarButton.tsx","../../src/core/hooks/useDialog.ts","../../src/core/components/buttons/ThemeExpertModal.tsx","../../src/core/components/buttons/ThemeButton.tsx","../../src/core/components/buttons/ToggleSidebarButton.tsx","../../src/core/components/data/DetailDrawer.tsx","../../src/core/components/data/DetailList.tsx","../../src/core/components/data/StatCards.tsx","../../src/core/components/Flex.tsx","../../src/core/components/Heading.tsx","../../src/core/components/layout/AppBar.tsx","../../src/core/components/layout/Breadcrumb.tsx","../../src/core/components/layout/Container.tsx","../../src/core/helpers/renderIcon.tsx","../../src/core/components/Text.tsx","../../src/core/components/layout/SidebarCollapsedItem.tsx","../../src/core/components/layout/SidebarItem.tsx","../../src/core/components/layout/Sidebar.tsx","../../src/core/components/layout/DashboardShell.tsx","../../src/core/form/utils/parseInput.ts","../../src/core/form/components/ControlArray.tsx","../../src/core/form/components/ControlDate.tsx","../../src/core/form/components/ControlNumber.tsx","../../src/core/form/components/ControlObject.tsx","../../src/core/form/components/ControlQueryBuilderHelp.tsx","../../src/core/form/components/ControlQueryBuilder.tsx","../../src/core/form/components/ControlSelect.tsx","../../src/core/form/components/Control.tsx","../../src/core/form/components/TypeForm.tsx","../../src/core/form/factories/dialogForm.tsx","../../src/core/json/components/JsonViewerCopyButton.tsx","../../src/core/json/components/JsonViewerShared.ts","../../src/core/json/components/JsonViewerRowNode.tsx","../../src/core/json/components/JsonViewer.tsx","../../src/core/json/factories/dialogJson.tsx","../../src/core/primitives/$ui.ts","../../src/core/table/interfaces/types.ts","../../src/core/table/components/DataTableFilters.tsx","../../src/core/table/components/DataTablePagination.tsx","../../src/core/table/components/ColumnPicker.tsx","../../src/core/table/components/FilterPicker.tsx","../../src/core/table/components/DataTableToolbar.tsx","../../src/core/table/components/useTableSelection.ts","../../src/core/table/components/DataTable.tsx","../../src/core/utils/extractSchemaFields.ts","../../src/core/utils/icons.tsx","../../src/core/utils/string.ts","../../src/core/index.ts"],"sourcesContent":["import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaSidebarAtom = $atom({\n name: \"alepha.ui.sidebar\",\n schema: t.object({\n /**\n * Whether the sidebar drawer is closed (mobile).\n */\n closed: t.boolean(),\n /**\n * Whether the sidebar is collapsed (desktop icon-only mode).\n */\n collapsed: t.boolean(),\n /**\n * Width of the sidebar when expanded.\n * @default 300\n */\n expandedWidth: t.number(),\n /**\n * Width of the sidebar when collapsed.\n * @default 78\n */\n collapsedWidth: t.number(),\n }),\n default: {\n closed: true,\n collapsed: false,\n expandedWidth: 300,\n collapsedWidth: 72,\n },\n});\n\nexport type AlephaSidebarState = Static<typeof alephaSidebarAtom.schema>;\n","import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaThemeAtom = $atom({\n name: \"alepha.ui.theme\",\n schema: t.object({\n index: t.integer(),\n }),\n default: {\n index: 0,\n },\n});\n\nexport type CurrentAlephaTheme = Static<typeof alephaThemeAtom.schema>;\n","import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaThemeOverridesAtom = $atom({\n name: \"alepha.ui.themeOverrides\",\n schema: t.object({\n primaryColor: t.optional(t.text()),\n radius: t.optional(t.text()),\n fontFamily: t.optional(t.text()),\n fontSize: t.optional(t.text()),\n scale: t.optional(t.text()),\n }),\n default: {},\n});\n\nexport type AlephaThemeOverrides = Static<\n typeof alephaThemeOverridesAtom.schema\n>;\n","import type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\nexport const defaultTheme: AlephaTheme = {\n name: \"Default\",\n description: \"Default Alepha Theme\",\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Editorial theme.\n *\n * Serif typography, high contrast black and white, thin borders, generous whitespace.\n * Newspaper/magazine aesthetic — elegant restraint.\n */\nexport const editorialTheme: AlephaTheme = {\n name: \"Editorial\",\n description: \"Serif typography with newspaper elegance\",\n defaultColorScheme: \"light\",\n head: {\n link: [\n { rel: \"preconnect\", href: \"https://fonts.googleapis.com\" },\n {\n rel: \"preconnect\",\n href: \"https://fonts.gstatic.com\",\n crossorigin: \"\",\n },\n {\n rel: \"stylesheet\",\n href: \"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap\",\n },\n ],\n },\n primaryColor: \"ink\",\n primaryShade: { light: 7, dark: 3 },\n autoContrast: true,\n fontFamily: '\"Source Serif 4\", \"Georgia\", \"Times New Roman\", serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily: '\"Playfair Display\", \"Georgia\", \"Times New Roman\", serif',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2.5rem\", lineHeight: \"1.15\" },\n h2: { fontSize: \"1.75rem\", lineHeight: \"1.2\" },\n h3: { fontSize: \"1.375rem\", lineHeight: \"1.3\" },\n h4: { fontSize: \"1.125rem\", lineHeight: \"1.4\" },\n h5: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"sm\",\n radius: {\n xs: \"2px\",\n sm: \"3px\",\n md: \"4px\",\n lg: \"6px\",\n xl: \"8px\",\n },\n shadows: {\n xs: \"0 1px 2px rgba(0, 0, 0, 0.06)\",\n sm: \"0 1px 3px rgba(0, 0, 0, 0.08)\",\n md: \"0 2px 6px rgba(0, 0, 0, 0.08)\",\n lg: \"0 4px 12px rgba(0, 0, 0, 0.1)\",\n xl: \"0 8px 24px rgba(0, 0, 0, 0.1)\",\n },\n colors: {\n // Primary — ink black with warm tint\n ink: [\n \"#f5f3f0\",\n \"#e8e4de\",\n \"#d4cec5\",\n \"#b5ad9f\",\n \"#8c8272\",\n \"#6b6050\",\n \"#4a4035\",\n \"#332b22\",\n \"#1f1812\",\n \"#0d0a07\",\n ],\n // Accent — muted burgundy\n burgundy: [\n \"#faf0f0\",\n \"#f0d4d4\",\n \"#e0adad\",\n \"#cc8585\",\n \"#b35e5e\",\n \"#944545\",\n \"#763636\",\n \"#5a2828\",\n \"#3d1b1b\",\n \"#220f0f\",\n ],\n // Warm grays — paper-tinted\n gray: [\n \"#faf9f7\",\n \"#f0eee9\",\n \"#e0dcd5\",\n \"#c8c2b8\",\n \"#a8a194\",\n \"#8a8273\",\n \"#6b6456\",\n \"#504a3f\",\n \"#36322b\",\n \"#1e1b17\",\n ],\n // Dark palette — warm charcoal\n dark: [\n \"#d5d2cd\",\n \"#aba59c\",\n \"#817a6e\",\n \"#5e584e\",\n \"#46413a\",\n \"#36322c\",\n \"#2a2721\",\n \"#201d19\",\n \"#171411\",\n \"#0d0b09\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n letterSpacing: \"0.02em\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n variant: \"outline\",\n },\n styles: {\n root: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',\n letterSpacing: \"0.04em\",\n textTransform: \"uppercase\" as const,\n fontSize: \"0.65rem\",\n },\n },\n }),\n },\n};\n","import type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\nexport const midnightTheme: AlephaTheme = {\n name: \"Midnight\",\n description: \"Clean, developer-focused design\",\n primaryColor: \"pink\",\n primaryShade: { light: 7, dark: 8 },\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\"',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"600\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n radius: {\n xs: \"3px\",\n sm: \"6px\",\n md: \"6px\",\n lg: \"8px\",\n xl: \"12px\",\n },\n defaultRadius: \"sm\",\n colors: {\n dark: [\n \"#d0d7de\",\n \"#8b949e\",\n \"#6e7681\",\n \"#484f58\",\n \"#30363d\",\n \"#21262d\",\n \"#161b22\",\n \"#151b23\",\n \"#0d1117\",\n \"#010409\",\n ],\n gray: [\n \"#f6f8fa\",\n \"#eaeef2\",\n \"#d0d7de\",\n \"#afb8c1\",\n \"#8c959f\",\n \"#6e7781\",\n \"#57606a\",\n \"#424a53\",\n \"#32383f\",\n \"#24292f\",\n ],\n blue: [\n \"#ddf4ff\",\n \"#b6e3ff\",\n \"#80ccff\",\n \"#54aeff\",\n \"#218bff\",\n \"#0969da\",\n \"#0550ae\",\n \"#033d8b\",\n \"#0a3069\",\n \"#002155\",\n ],\n green: [\n \"#dafbe1\",\n \"#aceebb\",\n \"#6fdd8b\",\n \"#4ac26b\",\n \"#2da44e\",\n \"#1a7f37\",\n \"#116329\",\n \"#044f1e\",\n \"#003d16\",\n \"#002d11\",\n ],\n red: [\n \"#ffebe9\",\n \"#ffcecb\",\n \"#ffaba8\",\n \"#ff8182\",\n \"#fa4549\",\n \"#cf222e\",\n \"#a40e26\",\n \"#82071e\",\n \"#660018\",\n \"#4c0014\",\n ],\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Monochrome theme.\n *\n * Pure black and white. No color. Bold typography does all the heavy lifting.\n * A design-school statement piece — minimalist color, maximalist type.\n */\nexport const monochromeTheme: AlephaTheme = {\n name: \"Monochrome\",\n description: \"Pure black and white — zero color, maximum typography\",\n primaryColor: \"mono\",\n primaryShade: { light: 8, dark: 1 },\n autoContrast: true,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"800\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2.25rem\", lineHeight: \"1.15\" },\n h2: { fontSize: \"1.625rem\", lineHeight: \"1.25\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.35\" },\n h4: { fontSize: \"1.0625rem\", lineHeight: \"1.45\" },\n h5: { fontSize: \"0.9375rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.8125rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"0\",\n radius: {\n xs: \"0\",\n sm: \"0\",\n md: \"0\",\n lg: \"0\",\n xl: \"2px\",\n },\n shadows: {\n xs: \"0 1px 2px rgba(0, 0, 0, 0.08)\",\n sm: \"0 1px 4px rgba(0, 0, 0, 0.1)\",\n md: \"0 2px 8px rgba(0, 0, 0, 0.12)\",\n lg: \"0 4px 16px rgba(0, 0, 0, 0.14)\",\n xl: \"0 8px 32px rgba(0, 0, 0, 0.16)\",\n },\n colors: {\n // Primary — pure grayscale\n mono: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n // Gray — identical to mono for consistency\n gray: [\n \"#f5f5f5\",\n \"#e5e5e5\",\n \"#cccccc\",\n \"#b0b0b0\",\n \"#909090\",\n \"#707070\",\n \"#555555\",\n \"#3a3a3a\",\n \"#252525\",\n \"#121212\",\n ],\n // \"Colors\" are all grayscale — no hue anywhere\n blue: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n green: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n red: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n // Dark palette — true blacks\n dark: [\n \"#d0d0d0\",\n \"#a0a0a0\",\n \"#707070\",\n \"#505050\",\n \"#383838\",\n \"#282828\",\n \"#1c1c1c\",\n \"#141414\",\n \"#0a0a0a\",\n \"#000000\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 700,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n letterSpacing: \"0.03em\",\n textTransform: \"uppercase\" as const,\n fontSize: \"0.8125rem\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"2px solid currentColor\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 700,\n variant: \"outline\",\n },\n styles: {\n root: {\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.06em\",\n fontSize: \"0.65rem\",\n border: \"2px solid currentColor\",\n },\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Rosé Pine theme.\n *\n * Muted pinks, golds, and subtle greens on warm dark backgrounds.\n * Cozy, low-contrast, easy on the eyes.\n * Based on the Rosé Pine color philosophy.\n */\nexport const rosePineTheme: AlephaTheme = {\n name: \"Rosé Pine\",\n description: \"Muted pinks and golds on warm dark backgrounds\",\n defaultColorScheme: \"dark\",\n primaryColor: \"rose\",\n primaryShade: { light: 5, dark: 4 },\n autoContrast: true,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"600\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"md\",\n radius: {\n xs: \"4px\",\n sm: \"6px\",\n md: \"8px\",\n lg: \"12px\",\n xl: \"16px\",\n },\n shadows: {\n xs: \"0 1px 3px rgba(0, 0, 0, 0.2)\",\n sm: \"0 2px 6px rgba(0, 0, 0, 0.2)\",\n md: \"0 4px 12px rgba(0, 0, 0, 0.25)\",\n lg: \"0 8px 24px rgba(0, 0, 0, 0.3)\",\n xl: \"0 12px 36px rgba(0, 0, 0, 0.35)\",\n },\n colors: {\n // Primary — rose\n rose: [\n \"#faf0f4\",\n \"#f2d8e3\",\n \"#eabdd0\",\n \"#e0a0bb\",\n \"#d4849f\",\n \"#c4748f\",\n \"#b06282\",\n \"#9a5275\",\n \"#7a3f5e\",\n \"#5c2e47\",\n ],\n // Accent — gold\n gold: [\n \"#fdf8ec\",\n \"#f8ecc8\",\n \"#f2dda0\",\n \"#eacb72\",\n \"#e0b94d\",\n \"#c9a33e\",\n \"#a98830\",\n \"#866b24\",\n \"#634f1a\",\n \"#403310\",\n ],\n // Pine — muted green\n pine: [\n \"#ecf5f0\",\n \"#d0e6da\",\n \"#add4be\",\n \"#86c0a0\",\n \"#62ac84\",\n \"#4e9670\",\n \"#3e7a5a\",\n \"#2f5e44\",\n \"#20412f\",\n \"#12251b\",\n ],\n // Foam — muted teal\n foam: [\n \"#edf6f7\",\n \"#d2e9eb\",\n \"#b0d9dd\",\n \"#8bc6cc\",\n \"#6ab3bb\",\n \"#569da5\",\n \"#438088\",\n \"#33636a\",\n \"#23454a\",\n \"#14292c\",\n ],\n // Love — muted red\n red: [\n \"#f9eef0\",\n \"#efd3d8\",\n \"#e3b2bb\",\n \"#d68e9b\",\n \"#c86c7c\",\n \"#b25566\",\n \"#944454\",\n \"#733442\",\n \"#52252f\",\n \"#33161d\",\n ],\n // Warm grays — subtle mauve tint\n gray: [\n \"#f4f0f2\",\n \"#e4dde1\",\n \"#cec5cb\",\n \"#b5aab2\",\n \"#9a8e96\",\n \"#7e737a\",\n \"#635a60\",\n \"#4a4248\",\n \"#332d31\",\n \"#1e1a1c\",\n ],\n // Dark palette — Rosé Pine base/surface/overlay\n dark: [\n \"#e0d8e0\",\n \"#b0a6b2\",\n \"#817786\",\n \"#615768\",\n \"#4a3f54\",\n \"#3a3044\",\n \"#2a2436\",\n \"#211e2e\",\n \"#1a1724\",\n \"#110f1a\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 500,\n },\n styles: {\n root: {\n transition: \"background-color 0.15s ease, opacity 0.15s ease\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n transition: \"background-color 0.15s ease, opacity 0.15s ease\",\n },\n },\n }),\n\n Paper: Paper.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 500,\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Soft Brutalism theme.\n *\n * Pastel pop palette with solid offset shadows, rounded corners, and bold borders.\n * A friendlier take on neubrutalism — playful but production-ready.\n */\nexport const softBrutalismTheme: AlephaTheme = {\n name: \"Soft Brutalism\",\n description: \"Pastel pop with bold borders and offset shadows\",\n head: {\n link: [\n { rel: \"preconnect\", href: \"https://fonts.googleapis.com\" },\n {\n rel: \"preconnect\",\n href: \"https://fonts.gstatic.com\",\n crossorigin: \"\",\n },\n {\n rel: \"stylesheet\",\n href: \"https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap\",\n },\n ],\n },\n primaryColor: \"lavender\",\n primaryShade: { light: 5, dark: 7 },\n autoContrast: true,\n cursorType: \"pointer\",\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"md\",\n radius: {\n xs: \"6px\",\n sm: \"8px\",\n md: \"12px\",\n lg: \"16px\",\n xl: \"24px\",\n },\n shadows: {\n xs: \"2px 2px 0 0 rgba(100, 80, 140, 0.15)\",\n sm: \"3px 3px 0 0 rgba(100, 80, 140, 0.2)\",\n md: \"4px 4px 0 0 rgba(100, 80, 140, 0.2)\",\n lg: \"6px 6px 0 0 rgba(100, 80, 140, 0.25)\",\n xl: \"8px 8px 0 0 rgba(100, 80, 140, 0.3)\",\n },\n colors: {\n // Primary — lavender\n lavender: [\n \"#f3f0fa\",\n \"#e4dcf4\",\n \"#d1c4e9\",\n \"#b4a7d6\",\n \"#9a8bc4\",\n \"#7f6cb0\",\n \"#6a549e\",\n \"#543f87\",\n \"#3d2d6b\",\n \"#2a1d52\",\n ],\n // Accent — peach\n peach: [\n \"#fef3ec\",\n \"#fce4d0\",\n \"#f9d0ae\",\n \"#f4b886\",\n \"#f4a261\",\n \"#e68a42\",\n \"#c67234\",\n \"#a35a28\",\n \"#6b3a1a\",\n \"#4a2710\",\n ],\n // Success — mint\n mint: [\n \"#ecfaf0\",\n \"#d4f2dc\",\n \"#b3e8c2\",\n \"#8edba4\",\n \"#81c995\",\n \"#5ab874\",\n \"#42a05c\",\n \"#2e8548\",\n \"#1a5c2e\",\n \"#0f3f1e\",\n ],\n // Danger — coral\n coral: [\n \"#fef0ef\",\n \"#fcd9d7\",\n \"#f8b8b4\",\n \"#f29490\",\n \"#e97171\",\n \"#d65454\",\n \"#b83e3e\",\n \"#962d2d\",\n \"#6b1f1f\",\n \"#4a1414\",\n ],\n // Warm grays — cream-shifted\n gray: [\n \"#faf8f6\",\n \"#f0ece8\",\n \"#ddd7d0\",\n \"#c4bbb2\",\n \"#a89e95\",\n \"#8c8279\",\n \"#6e655d\",\n \"#524b44\",\n \"#3a342f\",\n \"#24211e\",\n ],\n // Warm dark palette — lavender-tinted blacks\n dark: [\n \"#d4d0dc\",\n \"#a9a2b5\",\n \"#7e7690\",\n \"#5c546e\",\n \"#443c56\",\n \"#342d45\",\n \"#2a2339\",\n \"#1e1a2e\",\n \"#161224\",\n \"#0f0c1a\",\n ],\n },\n\n // ---------------------------------------------------------------------------\n // Component overrides\n // ---------------------------------------------------------------------------\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n boxShadow: \"3px 3px 0 0 rgba(100, 80, 140, 0.2)\",\n transition: \"box-shadow 0.15s ease, transform 0.15s ease\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"2px solid currentColor\",\n boxShadow: \"2px 2px 0 0 rgba(100, 80, 140, 0.15)\",\n },\n },\n }),\n\n Paper: Paper.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"2px solid var(--mantine-color-default-border)\",\n transition: \"box-shadow 0.15s ease, border-color 0.15s ease\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n },\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Terminal theme.\n *\n * Monospace everything, green-on-black, zero radius.\n * CRT/hacker aesthetic for developer tools and dashboards.\n */\nexport const terminalTheme: AlephaTheme = {\n name: \"Terminal\",\n description: \"Green phosphor on black — monospace hacker aesthetic\",\n defaultColorScheme: \"dark\",\n primaryColor: \"terminal\",\n primaryShade: { light: 5, dark: 4 },\n autoContrast: true,\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"1.75rem\", lineHeight: \"1.3\" },\n h2: { fontSize: \"1.375rem\", lineHeight: \"1.35\" },\n h3: { fontSize: \"1.125rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"0\",\n radius: {\n xs: \"0\",\n sm: \"0\",\n md: \"0\",\n lg: \"2px\",\n xl: \"4px\",\n },\n shadows: {\n xs: \"none\",\n sm: \"none\",\n md: \"0 0 8px rgba(0, 255, 65, 0.08)\",\n lg: \"0 0 16px rgba(0, 255, 65, 0.1)\",\n xl: \"0 0 24px rgba(0, 255, 65, 0.12)\",\n },\n colors: {\n // Primary — phosphor green\n terminal: [\n \"#e6fff0\",\n \"#b3ffd1\",\n \"#80ffb3\",\n \"#4dff94\",\n \"#00ff41\",\n \"#00d636\",\n \"#00ad2b\",\n \"#008521\",\n \"#005c17\",\n \"#00330d\",\n ],\n // Amber accent\n amber: [\n \"#fff8e6\",\n \"#ffecb3\",\n \"#ffe080\",\n \"#ffd54d\",\n \"#ffca28\",\n \"#d4a520\",\n \"#aa8418\",\n \"#806310\",\n \"#554208\",\n \"#2b2104\",\n ],\n // Danger — red\n red: [\n \"#ffe6e6\",\n \"#ffb3b3\",\n \"#ff8080\",\n \"#ff4d4d\",\n \"#ff1a1a\",\n \"#d41515\",\n \"#aa1010\",\n \"#800c0c\",\n \"#550808\",\n \"#2b0404\",\n ],\n // Cool grays\n gray: [\n \"#e8eaed\",\n \"#c8cdd3\",\n \"#a4aab3\",\n \"#808892\",\n \"#5f6872\",\n \"#474f58\",\n \"#363c44\",\n \"#282d33\",\n \"#1c2026\",\n \"#12151a\",\n ],\n // True black darks\n dark: [\n \"#c9cdd2\",\n \"#8b9198\",\n \"#5c636b\",\n \"#3d444c\",\n \"#2b3138\",\n \"#1e242b\",\n \"#151a20\",\n \"#0e1216\",\n \"#080c0f\",\n \"#020303\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"1px solid currentColor\",\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.05em\",\n fontSize: \"0.8125rem\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"1px solid currentColor\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n fontFamily: \"inherit\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"1px solid currentColor\",\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.05em\",\n },\n },\n }),\n },\n};\n","import { $atom, type Static, t } from \"alepha\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\nimport { defaultTheme } from \"./themes/default.ts\";\nimport { editorialTheme } from \"./themes/editorial.ts\";\nimport { midnightTheme } from \"./themes/midnight.ts\";\nimport { monochromeTheme } from \"./themes/monochrome.ts\";\nimport { rosePineTheme } from \"./themes/rosePine.ts\";\nimport { softBrutalismTheme } from \"./themes/softBrutalism.ts\";\nimport { terminalTheme } from \"./themes/terminal.ts\";\n\nexport const alephaThemeListAtom = $atom({\n name: \"alepha.ui.themeList\",\n schema: t.array(t.json<AlephaTheme>()), // TODO: translate to proper schema\n default: [\n defaultTheme,\n midnightTheme,\n softBrutalismTheme,\n terminalTheme,\n editorialTheme,\n rosePineTheme,\n monochromeTheme,\n ],\n});\n\nexport type AlephaThemeListAtom = Static<typeof alephaThemeListAtom.schema>;\n","import { $inject, Alepha, AlephaError } from \"alepha\";\nimport { $head, BrowserHeadProvider } from \"alepha/react/head\";\nimport { $cookie } from \"alepha/server/cookies\";\nimport { alephaThemeAtom } from \"../atoms/alephaThemeAtom.ts\";\nimport { alephaThemeListAtom } from \"../atoms/alephaThemeListAtom.ts\";\nimport {\n type AlephaThemeOverrides,\n alephaThemeOverridesAtom,\n} from \"../atoms/alephaThemeOverridesAtom.ts\";\nimport { defaultTheme } from \"../atoms/themes/default.ts\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\n\nexport class ThemeProvider {\n protected readonly alepha = $inject(Alepha);\n protected readonly cookie = $cookie({\n name: \"theme\",\n schema: alephaThemeAtom.schema,\n ttl: [1, \"year\"],\n });\n\n protected readonly overridesCookie = $cookie({\n name: \"themeOverrides\",\n schema: alephaThemeOverridesAtom.schema,\n ttl: [1, \"year\"],\n });\n\n protected readonly head = $head(() => {\n const theme = this.getTheme();\n if (!theme || !theme.name) {\n return {};\n }\n return {\n htmlAttributes: {\n \"data-theme\": this.slugify(theme.name),\n },\n ...theme.head,\n };\n });\n\n public setTheme(index: number) {\n const newTheme = this.alepha.store.get(alephaThemeListAtom)[\n index\n ] as AlephaTheme;\n\n if (!newTheme) {\n throw new AlephaError(`Theme with index ${index} not found`);\n }\n\n this.cookie.set({ index });\n this.alepha.store.set(alephaThemeAtom, { index });\n\n if (!this.alepha.isBrowser()) {\n return;\n }\n\n this.alepha.inject(BrowserHeadProvider).refreshGlobalHead();\n }\n\n protected slugify(name: string): string {\n return name.toLowerCase().replace(/\\s+/g, \"-\");\n }\n\n protected static readonly FONT_SIZE_MULTIPLIERS: Record<string, number> = {\n xs: 0.85,\n sm: 0.925,\n md: 1,\n lg: 1.1,\n xl: 1.25,\n };\n\n protected static readonly SCALE_VALUES: Record<string, number> = {\n xs: 0.85,\n sm: 0.925,\n md: 1,\n lg: 1.1,\n xl: 1.25,\n };\n\n protected static readonly DEFAULT_FONT_SIZES: Record<string, string> = {\n xs: \"0.75rem\",\n sm: \"0.875rem\",\n md: \"1rem\",\n lg: \"1.125rem\",\n xl: \"1.25rem\",\n };\n\n public getTheme() {\n const index = this.getThemeIndex();\n const list = this.alepha.store.get(\n alephaThemeListAtom,\n ) as Array<AlephaTheme>;\n const base = list[index] || list[0] || defaultTheme;\n const overrides = this.getThemeOverrides();\n\n if (\n !overrides.primaryColor &&\n !overrides.radius &&\n !overrides.fontFamily &&\n !overrides.fontSize &&\n !overrides.scale\n ) {\n return base;\n }\n\n const merged = {\n ...base,\n ...(overrides.primaryColor && { primaryColor: overrides.primaryColor }),\n ...(overrides.radius && { defaultRadius: overrides.radius }),\n ...(overrides.fontFamily && { fontFamily: overrides.fontFamily }),\n ...(overrides.scale &&\n overrides.scale !== \"md\" && {\n scale: ThemeProvider.SCALE_VALUES[overrides.scale] ?? 1,\n }),\n };\n\n if (overrides.fontSize && overrides.fontSize !== \"md\") {\n const multiplier =\n ThemeProvider.FONT_SIZE_MULTIPLIERS[overrides.fontSize] ?? 1;\n const baseSizes =\n (base.fontSizes as Record<string, string> | undefined) ??\n ThemeProvider.DEFAULT_FONT_SIZES;\n merged.fontSizes = Object.fromEntries(\n Object.entries(baseSizes).map(([key, val]) => [\n key,\n `${(Number.parseFloat(String(val)) * multiplier).toFixed(4)}rem`,\n ]),\n ) as typeof merged.fontSizes;\n }\n\n return merged;\n }\n\n public setThemeOverrides(overrides: AlephaThemeOverrides) {\n this.overridesCookie.set(overrides);\n this.alepha.store.set(alephaThemeOverridesAtom, overrides);\n\n if (!this.alepha.isBrowser()) {\n return;\n }\n\n this.alepha.inject(BrowserHeadProvider).refreshGlobalHead();\n }\n\n public getThemeOverrides(): AlephaThemeOverrides {\n try {\n return (\n this.overridesCookie.get() ??\n this.alepha.store.get(alephaThemeOverridesAtom) ??\n {}\n );\n } catch {\n return this.alepha.store.get(alephaThemeOverridesAtom) ?? {};\n }\n }\n\n public resetThemeOverrides() {\n this.setThemeOverrides({});\n }\n\n protected getThemeIndex() {\n // TODO: make a safe cookie getter, today it crash when Cookie Server is called inside vite pre-render\n try {\n return (\n this.cookie.get()?.index ??\n this.alepha.store.get(alephaThemeAtom)?.index ??\n 0\n );\n } catch {\n return this.alepha.store.get(alephaThemeAtom)?.index ?? 0;\n }\n }\n}\n","import { Button, Flex, Text } from \"@mantine/core\";\nimport type { AlertDialogProps } from \"../../services/DialogService.tsx\";\n\nconst AlertDialog = ({ options, onClose }: AlertDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Flex justify=\"flex-end\">\n <Button onClick={onClose}>{options?.okLabel || \"OK\"}</Button>\n </Flex>\n </>\n);\n\nexport default AlertDialog;\n","import { Button, Flex, Text } from \"@mantine/core\";\nimport type { ConfirmDialogProps } from \"../../services/DialogService.tsx\";\n\nconst ConfirmDialog = ({ options, onConfirm }: ConfirmDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Flex justify=\"flex-end\">\n <Button variant=\"subtle\" onClick={() => onConfirm(false)}>\n {options?.cancelLabel || \"Cancel\"}\n </Button>\n <Button\n color={options?.confirmColor || \"blue\"}\n onClick={() => onConfirm(true)}\n >\n {options?.confirmLabel || \"Confirm\"}\n </Button>\n </Flex>\n </>\n);\n\nexport default ConfirmDialog;\n","import { Button, Flex, Text, TextInput } from \"@mantine/core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { PromptDialogProps } from \"../../services/DialogService.tsx\";\n\nconst PromptDialog = ({ options, onSubmit }: PromptDialogProps) => {\n const [value, setValue] = useState(options?.defaultValue || \"\");\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n // autofocus the input when the dialog opens\n inputRef.current?.focus();\n }, []);\n\n const handleSubmit = () => {\n if (!options?.required || value.trim()) {\n onSubmit(value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\") {\n handleSubmit();\n }\n };\n\n return (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <TextInput\n ref={inputRef}\n label={options?.label}\n placeholder={options?.placeholder}\n value={value}\n onChange={(event) => setValue(event.currentTarget.value)}\n onKeyDown={handleKeyDown}\n required={options?.required}\n mb=\"md\"\n />\n <Flex justify=\"flex-end\">\n <Button variant=\"subtle\" onClick={() => onSubmit(null)}>\n {options?.cancelLabel || \"Cancel\"}\n </Button>\n <Button\n onClick={handleSubmit}\n disabled={options?.required && !value.trim()}\n >\n {options?.submitLabel || \"OK\"}\n </Button>\n </Flex>\n </>\n );\n};\n\nexport default PromptDialog;\n","import type { ModalProps } from \"@mantine/core\";\nimport { modals } from \"@mantine/modals\";\nimport type { ReactNode } from \"react\";\nimport AlertDialog from \"../components/dialogs/AlertDialog.tsx\";\nimport ConfirmDialog from \"../components/dialogs/ConfirmDialog.tsx\";\nimport PromptDialog from \"../components/dialogs/PromptDialog.tsx\";\n\n// Base interfaces\nexport interface BaseDialogOptions extends Partial<ModalProps> {\n title?: ReactNode;\n message?: ReactNode;\n content?: any; // weird typing for mantine modals content\n}\n\nexport interface AlertDialogOptions extends BaseDialogOptions {\n okLabel?: string;\n}\n\nexport interface ConfirmDialogOptions extends BaseDialogOptions {\n confirmLabel?: string;\n cancelLabel?: string;\n confirmColor?: string;\n}\n\nexport interface PromptDialogOptions extends BaseDialogOptions {\n placeholder?: string;\n defaultValue?: string;\n label?: string;\n required?: boolean;\n submitLabel?: string;\n cancelLabel?: string;\n}\n\n// Component prop interfaces\nexport interface AlertDialogProps {\n options?: AlertDialogOptions;\n onClose: () => void;\n}\n\nexport interface ConfirmDialogProps {\n options?: ConfirmDialogOptions;\n onConfirm: (confirmed: boolean) => void;\n}\n\nexport interface PromptDialogProps {\n options?: PromptDialogOptions;\n onSubmit: (value: string | null) => void;\n}\n\nexport interface DialogServiceOptions {\n default?: Partial<BaseDialogOptions>;\n}\n\nexport class DialogService {\n public readonly options: DialogServiceOptions = {\n default: {\n centered: true,\n withCloseButton: true,\n size: \"md\",\n overlayProps: {\n backgroundOpacity: 0.55,\n blur: 3,\n },\n transitionProps: {\n transition: \"pop\",\n duration: 200,\n },\n },\n };\n\n /**\n * Show an alert dialog with a message\n */\n public alert(options?: AlertDialogOptions): Promise<void> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = () => {\n if (resolved) return;\n resolved = true;\n resolve();\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Alert\",\n onClose: done,\n content: (\n <AlertDialog\n options={options}\n onClose={() => {\n this.close(modalId);\n done();\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Show a confirmation dialog that returns a promise\n */\n public confirm(options?: ConfirmDialogOptions): Promise<boolean> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = (confirmed: boolean) => {\n if (resolved) return;\n resolved = true;\n resolve(confirmed);\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Confirm\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n onClose: () => done(false),\n content: (\n <ConfirmDialog\n options={options}\n onConfirm={(confirmed) => {\n this.close(modalId);\n done(confirmed);\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Show a prompt dialog to get user input\n */\n public prompt(options?: PromptDialogOptions): Promise<string | null> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = (value: string | null) => {\n if (resolved) return;\n resolved = true;\n resolve(value);\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Input\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n onClose: () => done(null),\n content: (\n <PromptDialog\n options={options}\n onSubmit={(value) => {\n this.close(modalId);\n done(value);\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Open a custom dialog with provided content\n */\n public open(options?: BaseDialogOptions): string {\n return modals.open({\n ...this.options.default,\n ...options,\n children: options?.content || options?.message,\n });\n }\n\n /**\n * Close the currently open dialog or a specific dialog by ID\n */\n public close(modalId?: string): void {\n if (modalId) {\n modals.close(modalId);\n } else {\n modals.closeAll();\n }\n }\n}\n","import type { NotificationData } from \"@mantine/notifications\";\nimport { notifications } from \"@mantine/notifications\";\nimport {\n IconAlertTriangle,\n IconCheck,\n IconInfoCircle,\n IconX,\n} from \"@tabler/icons-react\";\n\nexport interface ToastServiceOptions {\n default?: Partial<NotificationData>;\n}\n\nexport class ToastService {\n protected readonly raw = notifications;\n\n public readonly options: ToastServiceOptions = {\n default: {\n radius: \"md\",\n withBorder: true,\n withCloseButton: true,\n autoClose: 5000,\n position: \"top-center\",\n },\n };\n\n public show(options: NotificationData) {\n notifications.show({\n ...this.options.default,\n ...options,\n });\n }\n\n public info(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"blue\",\n icon: <IconInfoCircle size={20} />,\n title: \"Info\",\n message: \"Information notification\",\n ...options,\n });\n }\n\n public success(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"green\",\n icon: <IconCheck size={16} />,\n title: \"Success\",\n message: \"Operation completed successfully\",\n ...options,\n });\n }\n\n public warning(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"yellow\",\n icon: <IconAlertTriangle size={20} />,\n title: \"Warning\",\n message: \"Please review this warning\",\n ...options,\n });\n }\n\n public danger(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"red\",\n icon: <IconX size={20} />,\n title: \"Error\",\n message: \"An error occurred\",\n ...options,\n });\n }\n}\n","import { AlephaMantineProvider } from \"@alepha/ui\";\nimport { $page } from \"alepha/react/router\";\n\n/**\n * UI Router defining the root page with AlephaMantineProvider.\n *\n * - Use UiRouter when you need Alepha's Mantine-based UI components and theming.\n * - Prefer to use $ui() for convenience. (Custom Factory of UiRouter)\n */\nexport class UiRouter {\n public readonly root = $page({\n path: \"/\",\n component: AlephaMantineProvider,\n });\n}\n","import { useInject, useStore } from \"alepha/react\";\nimport {\n alephaThemeAtom,\n type CurrentAlephaTheme,\n} from \"../atoms/alephaThemeAtom.ts\";\nimport {\n type AlephaThemeOverrides,\n alephaThemeOverridesAtom,\n} from \"../atoms/alephaThemeOverridesAtom.ts\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\nimport { ThemeProvider } from \"../providers/ThemeProvider.ts\";\n\nexport interface ThemeExpert {\n overrides: AlephaThemeOverrides;\n setOverrides: (overrides: AlephaThemeOverrides) => void;\n resetOverrides: () => void;\n}\n\n/**\n * Hook to get and set the current theme.\n *\n * Returns a tuple with the current theme, a function to set the theme,\n * and expert mode controls for fine-grained customization.\n *\n * ```tsx\n * const [theme, setTheme, expert] = useTheme();\n * ```\n */\nexport const useTheme = (): [\n AlephaTheme,\n (theme: CurrentAlephaTheme) => void,\n ThemeExpert,\n] => {\n useStore(alephaThemeAtom);\n useStore(alephaThemeOverridesAtom);\n\n const themeProvider = useInject(ThemeProvider);\n const theme = themeProvider.getTheme();\n const setTheme = (theme: CurrentAlephaTheme) => {\n themeProvider.setTheme(theme.index);\n };\n\n const expert: ThemeExpert = {\n overrides: themeProvider.getThemeOverrides(),\n setOverrides: (overrides: AlephaThemeOverrides) => {\n themeProvider.setThemeOverrides(overrides);\n },\n resetOverrides: () => {\n themeProvider.resetThemeOverrides();\n },\n };\n\n return [theme, setTheme, expert] as const;\n};\n","import { useInject } from \"alepha/react\";\nimport { ToastService } from \"../services/ToastService.tsx\";\n\n/**\n * Use this hook to access the Toast Service for showing notifications.\n *\n * @example\n * ```tsx\n * const toast = useToast();\n * toast.success({ message: \"Operation completed successfully!\" });\n * toast.error({ title: \"Error\", message: \"Something went wrong\" });\n * ```\n */\nexport const useToast = (): ToastService => {\n return useInject(ToastService);\n};\n","import { renderIcon, ui } from \"@alepha/ui\";\nimport { Spotlight, type SpotlightActionData } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { currentUserAtom } from \"alepha/security\";\nimport { type ReactNode, useMemo } from \"react\";\n\nexport interface OmnibarProps {\n shortcut?: string | string[];\n searchPlaceholder?: string;\n nothingFound?: ReactNode;\n}\n\nconst Omnibar = (props: OmnibarProps) => {\n const shortcut = props.shortcut ?? \"mod+K\";\n const searchPlaceholder = props.searchPlaceholder ?? \"Search...\";\n const nothingFound = props.nothingFound ?? \"Nothing found...\";\n const router = useRouter();\n\n // watch user to re-render on permission changes\n const [user] = useStore(currentUserAtom);\n\n const actions: SpotlightActionData[] = useMemo(\n () =>\n router.concretePages\n .filter((page) => {\n if (page.can && !page.can()) return false;\n\n return true;\n })\n .map((page) => ({\n id: page.name,\n label: page.label ?? page.name,\n description: page.description,\n onClick: () => {\n if (page.staticName) {\n return router.push(page.staticName, { params: page.params });\n }\n return router.push(page.name);\n },\n leftSection: renderIcon(page.icon),\n })),\n [user],\n );\n\n return (\n <Spotlight\n actions={actions}\n shortcut={shortcut}\n limit={10}\n searchProps={{\n leftSection: <IconSearch size={ui.sizes.icon.md} />,\n placeholder: searchPlaceholder,\n }}\n nothingFound={nothingFound}\n />\n );\n};\n\nexport default Omnibar;\n","import {\n ColorSchemeScript,\n type ColorSchemeScriptProps,\n MantineProvider,\n type MantineProviderProps,\n} from \"@mantine/core\";\nimport { ModalsProvider, type ModalsProviderProps } from \"@mantine/modals\";\nimport { Notifications, type NotificationsProps } from \"@mantine/notifications\";\nimport type { NavigationProgressProps } from \"@mantine/nprogress\";\nimport { NavigationProgress, nprogress } from \"@mantine/nprogress\";\nimport { TypeBoxError } from \"alepha\";\nimport { useEvents } from \"alepha/react\";\nimport { FormValidationError } from \"alepha/react/form\";\nimport { NestedView } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useTheme } from \"../hooks/useTheme.ts\";\nimport { useToast } from \"../hooks/useToast.ts\";\nimport Omnibar, { type OmnibarProps } from \"./layout/Omnibar.tsx\";\n\nexport interface AlephaMantineProviderProps {\n children?: ReactNode;\n mantine?: MantineProviderProps;\n colorSchemeScript?: ColorSchemeScriptProps;\n navigationProgress?: NavigationProgressProps;\n notifications?: NotificationsProps;\n modals?: ModalsProviderProps;\n omnibar?: OmnibarProps | false;\n}\n\nconst AlephaMantineProvider = (props: AlephaMantineProviderProps) => {\n const toast = useToast();\n const [theme] = useTheme();\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n nprogress.start();\n },\n \"react:transition:end\": () => {\n nprogress.complete();\n },\n \"react:action:error\": ({ error, type }) => {\n if (\n type === \"transition\" ||\n error instanceof FormValidationError ||\n error instanceof TypeBoxError\n ) {\n // Validation errors are handled by the form component\n return;\n }\n\n toast.danger({\n title: error.name || \"Error\",\n message:\n error.message ?? \"An error occurred while processing your action.\",\n });\n },\n },\n [],\n );\n\n const defaultColorScheme =\n props.mantine?.defaultColorScheme ?? theme.defaultColorScheme;\n\n return (\n <>\n <ColorSchemeScript\n defaultColorScheme={defaultColorScheme}\n {...props.colorSchemeScript}\n />\n <MantineProvider\n {...props.mantine}\n defaultColorScheme={defaultColorScheme}\n theme={{\n // Spread all theme properties from the selected theme\n ...theme,\n // User overrides take precedence\n ...props.mantine?.theme,\n }}\n >\n <Notifications {...props.notifications} />\n <NavigationProgress {...props.navigationProgress} />\n <ModalsProvider {...props.modals}>\n {props.omnibar !== false && <Omnibar {...props.omnibar} />}\n {props.children ?? <NestedView />}\n </ModalsProvider>\n </MantineProvider>\n </>\n );\n};\n\nexport default AlephaMantineProvider;\n","export const ui = {\n colors: {\n transparent: \"transparent\",\n background: \"var(--alepha-ground)\",\n surface: \"var(--alepha-surface)\",\n elevated: \"var(--alepha-elevated)\",\n border: \"var(--alepha-border)\",\n },\n sizes: {\n icon: {\n xs: 16,\n sm: 20,\n md: 24,\n lg: 28,\n xl: 32,\n },\n },\n};\n","import { type ComponentType, isValidElement } from \"react\";\n\nexport function isComponentType(param: any): param is ComponentType<any> {\n if (isValidElement(param)) return false;\n return (\n typeof param === \"function\" ||\n (typeof param === \"object\" && param !== null && \"$$typeof\" in param)\n );\n}\n","import {\n Anchor,\n type AnchorProps,\n Button,\n type ButtonProps,\n Flex,\n Menu,\n type MenuItemProps,\n type MenuProps,\n type MenuTargetProps,\n type ThemeIconProps,\n Tooltip,\n type TooltipProps,\n useMantineTheme,\n} from \"@mantine/core\";\nimport { IconCheck, IconChevronRight } from \"@tabler/icons-react\";\nimport { type UseActionReturn, useAction } from \"alepha/react\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport {\n type RouterPushOptions,\n type UseActiveOptions,\n useActive,\n useRouter,\n} from \"alepha/react/router\";\nimport {\n type ButtonHTMLAttributes,\n Children,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { isComponentType } from \"../../helpers/isComponentType.ts\";\n\nexport interface ActionMenuItem {\n /**\n * Menu item type\n */\n type?: \"item\" | \"divider\" | \"label\";\n\n /**\n * Label text for the menu item\n */\n label?: string | ReactNode;\n\n /**\n * Icon element to display before the label\n */\n icon?: ReactNode;\n\n /**\n * Click handler for menu items\n */\n onClick?: () => void;\n\n /**\n * Href for navigation menu items\n */\n href?: string;\n\n /**\n * Color for the menu item (e.g., \"red\" for danger actions)\n */\n color?: string;\n\n /**\n * Nested submenu items\n */\n children?: ActionMenuItem[];\n\n /**\n * Whether the menu item is active\n */\n active?: boolean;\n}\n\nexport interface ActionMenuConfig {\n /**\n * Array of menu items to display\n */\n items: ActionMenuItem[];\n\n /**\n * Menu position relative to the button\n */\n position?:\n | \"bottom\"\n | \"bottom-start\"\n | \"bottom-end\"\n | \"top\"\n | \"top-start\"\n | \"top-end\"\n | \"left\"\n | \"right\";\n\n /**\n * Menu width\n */\n width?: number | string;\n\n /**\n * Menu shadow\n */\n shadow?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n on?: \"hover\" | \"click\";\n\n targetProps?: MenuTargetProps;\n\n menuProps?: MenuProps;\n}\n\nexport interface ActionCommonProps extends ButtonProps {\n children?: ReactNode;\n\n /**\n * If set, the button will show only the icon on smaller screens and reveal the text from the specified breakpoint and up.\n */\n textVisibleFrom?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n /**\n * Tooltip to display on hover. Can be a string for simple tooltips\n * or a TooltipProps object for advanced configuration.\n */\n tooltip?: string | number | TooltipProps;\n\n /**\n * Menu configuration. When provided, the action will display a dropdown menu.\n */\n menu?: ActionMenuConfig;\n\n /**\n * If set, a confirmation dialog will be shown before performing the action.\n * If `true`, a default title and message will be used.\n * If a string, it will be used as the message with a default title.\n * If an object, it can contain `title` and `message` properties to customize the dialog.\n */\n confirm?: boolean | string | { title?: string; message: string };\n\n /**\n * Icon to display on the left side of the button.\n * If no children are provided, the button will be styled as an icon-only button.\n */\n icon?: ReactNode | ComponentType;\n\n /**\n * Size of the icon. Can be a number (pixels) or a string (e.g., \"1em\", \"20px\").\n */\n iconSize?: number | string;\n\n /**\n * Additional props to pass to the ThemeIcon wrapping the icon.\n */\n themeIconProps?: ThemeIconProps;\n\n /**\n * Visual intent of the action button.\n */\n intent?: \"primary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"none\";\n\n /**\n * Active state styling for navigation actions. When set, the button will apply active styles based on the current route.\n */\n variant?: ButtonProps[\"variant\"] | \"minimal\";\n}\n\nexport type ActionProps = ActionCommonProps &\n (\n | ActionNavigationButtonProps\n | ActionClickButtonProps\n | ActionSubmitButtonProps\n | ActionHookButtonProps\n | {}\n );\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nconst ActionButton = (_props: ActionProps) => {\n const theme = useMantineTheme();\n const props = { ..._props };\n\n if (props.variant === \"minimal\") {\n //props.variant = \"default\";\n //props.bd = 0;\n }\n\n const { tooltip, menu, icon, iconSize, ...restProps } = props;\n\n if (props.intent) {\n if (props.intent === \"primary\") {\n restProps.color ??= theme.primaryColor;\n } else if (props.intent === \"success\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"green\";\n } else if (props.intent === \"danger\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"red\";\n } else if (props.intent === \"warning\") {\n restProps.color ??= \"yellow\";\n } else if (props.intent === \"info\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"blue\";\n }\n }\n\n if (props.icon) {\n const sizes = ui.sizes.icon as Record<string, number>;\n const iconSize = props.iconSize ?? sizes[props.size || \"sm\"];\n const icon = isComponentType(props.icon) ? (\n <props.icon size={iconSize} />\n ) : (\n <span>{props.icon as ReactNode}</span>\n );\n\n if (!props.children) {\n restProps.children = Children.only(icon);\n restProps.p ??= 8;\n } else {\n restProps.leftSection = icon;\n }\n }\n\n if (props.leftSection && !props.children) {\n restProps.px ??= \"xs\";\n }\n\n if (props.textVisibleFrom) {\n const { children, textVisibleFrom, leftSection, ...rest } = restProps;\n return (\n <>\n <Flex w={\"100%\"} visibleFrom={textVisibleFrom}>\n <ActionButton\n flex={1}\n {...rest}\n leftSection={leftSection}\n tooltip={tooltip}\n menu={menu}\n >\n {children}\n </ActionButton>\n </Flex>\n <Flex w={\"100%\"} hiddenFrom={textVisibleFrom}>\n <ActionButton\n px={\"xs\"}\n {...rest}\n aria-label={typeof children === \"string\" ? children : undefined}\n tooltip={tooltip}\n menu={menu}\n >\n {leftSection}\n </ActionButton>\n </Flex>\n </>\n );\n }\n\n const renderAction = () => {\n if (\"href\" in restProps && restProps.href) {\n if (restProps.href.startsWith(\"http\") || restProps.target) {\n return (\n <ActionHrefButton {...restProps} href={restProps.href}>\n {restProps.children}\n </ActionHrefButton>\n );\n }\n return (\n <ActionNavigationButton {...restProps} href={restProps.href}>\n {restProps.children}\n </ActionNavigationButton>\n );\n }\n\n delete (restProps as any).classNameActive;\n delete (restProps as any).variantActive;\n delete (restProps as any).propsActive;\n\n if (\"action\" in restProps && restProps.action) {\n return (\n <ActionHookButton {...restProps} action={restProps.action}>\n {restProps.children}\n </ActionHookButton>\n );\n }\n\n if (\"onClick\" in restProps && restProps.onClick) {\n return (\n <ActionClickButton {...restProps} onClick={restProps.onClick}>\n {restProps.children}\n </ActionClickButton>\n );\n }\n\n if (\"form\" in restProps && restProps.form) {\n if (restProps.type === \"reset\") {\n return (\n <ActionResetButton {...restProps} form={restProps.form}>\n {restProps.children}\n </ActionResetButton>\n );\n }\n return (\n <ActionSubmitButton {...restProps} form={restProps.form}>\n {restProps.children}\n </ActionSubmitButton>\n );\n }\n\n return <Button {...(restProps as any)}>{restProps.children}</Button>;\n };\n\n let actionElement = renderAction();\n\n // wrap with Menu if provided\n if (menu) {\n actionElement = (\n <Menu\n position={menu.position || \"bottom-start\"}\n width={menu.width || 200}\n shadow={menu.shadow || \"md\"}\n trigger={menu.on === \"hover\" ? \"hover\" : \"click\"}\n {...menu.menuProps}\n >\n <Menu.Target {...menu.targetProps}>{actionElement}</Menu.Target>\n <Menu.Dropdown>\n {menu.items.map((item, index) => (\n <ActionMenuItem item={item} index={index} key={index} />\n ))}\n </Menu.Dropdown>\n </Menu>\n );\n }\n\n // Wrap with Tooltip if provided\n if (tooltip) {\n // openDelay: 1000 -> like HTML title attribute\n const defaultTooltipProps: Partial<TooltipProps> = {\n openDelay: 1000,\n };\n const tooltipProps: TooltipProps =\n typeof tooltip === \"string\" || typeof tooltip === \"number\"\n ? {\n ...defaultTooltipProps,\n label: tooltip,\n children: actionElement,\n }\n : { ...defaultTooltipProps, ...tooltip, children: actionElement };\n\n return <Tooltip {...tooltipProps} />;\n }\n\n return actionElement;\n};\n\nexport default ActionButton;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Submit\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionSubmitButtonProps extends ButtonProps {\n form: FormModel<any>;\n type?: \"submit\" | \"reset\";\n}\n\n/**\n * Action button that submits a form with loading and disabled state handling.\n */\nconst ActionSubmitButton = (props: ActionSubmitButtonProps) => {\n const { form, ...buttonProps } = props;\n const state = useFormState(form);\n return (\n <Button\n {...buttonProps}\n loading={state.loading}\n disabled={state.loading}\n type={\"submit\"}\n >\n {props.children}\n </Button>\n );\n};\n\nconst ActionResetButton = (props: ActionSubmitButtonProps) => {\n const { form, ...buttonProps } = props;\n const state = useFormState(form);\n return (\n <Button {...buttonProps} disabled={state.loading} type={\"reset\"}>\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action with useAction Hook\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionHookButtonProps extends ButtonProps {\n action: UseActionReturn<any[], any>;\n}\n\n/**\n * Action button that integrates with useAction hook return value.\n * Automatically handles loading state and executes the action on click.\n *\n * @example\n * ```tsx\n * const saveAction = useAction({\n * handler: async (data) => {\n * await api.save(data);\n * }\n * }, []);\n *\n * <ActionButton action={saveAction}>\n * Save\n * </ActionButton>\n * ```\n */\nconst ActionHookButton = (props: ActionHookButtonProps) => {\n const { action, ...buttonProps } = props;\n\n return (\n <Button\n {...buttonProps}\n disabled={action.loading || props.disabled}\n loading={action.loading}\n onClick={() => action.run()}\n >\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Click\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionClickButtonProps extends ButtonProps {\n onClick: (e: any) => any;\n preventDefault?: boolean;\n}\n\n/**\n * Basic action button that handles click events with loading and error handling.\n *\n * @example\n * ```tsx\n * <ActionButton onClick={() => api.doSomething()}>\n * Do Something\n * </ActionButton>\n * ```\n */\nconst ActionClickButton = ({\n preventDefault,\n ...props\n}: ActionClickButtonProps) => {\n const action = useAction(\n {\n handler: async (e: any) => {\n if (preventDefault) {\n e.preventDefault();\n }\n await props.onClick(e);\n },\n },\n [props.onClick, preventDefault],\n );\n\n return (\n <Button\n {...props}\n disabled={action.loading || props.disabled}\n loading={action.loading}\n onClick={action.run}\n >\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Navigation\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionNavigationButtonProps extends ButtonProps {\n href: string;\n active?: Partial<UseActiveOptions> | false;\n routerGoOptions?: RouterPushOptions;\n classNameActive?: string;\n variantActive?: ButtonProps[\"variant\"];\n propsActive?: ButtonProps;\n target?: string;\n anchorProps?: AnchorProps;\n anchor?: boolean;\n}\n\n/**\n * Action for navigation with active state support.\n */\nconst ActionNavigationButton = (props: ActionNavigationButtonProps) => {\n const {\n active: options,\n classNameActive,\n variantActive,\n propsActive,\n routerGoOptions,\n onClick: propsOnClick,\n anchorProps: buttonAnchorProps,\n anchor,\n ...buttonProps\n } = props as ActionNavigationButtonProps & { onClick?: (e: any) => void };\n const router = useRouter();\n const { isPending, isActive } = useActive(\n options ? { href: props.href, ...options } : { href: props.href },\n );\n const anchorProps = router.anchor(props.href, routerGoOptions);\n\n if (propsActive && isActive) {\n Object.assign(buttonProps, propsActive);\n }\n\n // Combine passed onClick with router's onClick\n const combinedOnClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n propsOnClick?.(e as any);\n anchorProps.onClick?.(e);\n };\n\n const className = buttonProps.className || \"\";\n if (isActive && options !== false && classNameActive) {\n buttonProps.className = `${className} ${classNameActive}`.trim();\n }\n\n if (buttonAnchorProps || anchor) {\n return (\n <Anchor\n component={\"a\"}\n {...anchorProps}\n {...(buttonProps as AnchorProps)}\n {...buttonAnchorProps}\n onClick={combinedOnClick}\n >\n {props.children}\n </Anchor>\n );\n }\n\n return (\n <Button\n component={\"a\"}\n loading={isPending}\n {...buttonProps}\n {...anchorProps}\n onClick={combinedOnClick}\n variant={\n isActive && options !== false\n ? (variantActive ?? \"filled\")\n : (buttonProps.variant ?? \"subtle\")\n }\n >\n {props.children}\n </Button>\n );\n};\n\nconst ActionHrefButton = (props: ActionNavigationButtonProps) => {\n const {\n active: options,\n classNameActive,\n variantActive,\n propsActive,\n routerGoOptions,\n target,\n ...buttonProps\n } = props;\n\n return (\n <Button component={\"a\"} target={target} {...buttonProps}>\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Helper function to render menu items recursively\nconst ActionMenuItem = (props: {\n item: ActionMenuItem;\n index: number;\n}): ReactNode => {\n const { item, index } = props;\n\n const router = useRouter();\n const action = useAction(\n {\n handler: async (e: any) => {\n await item.onClick?.();\n },\n },\n [item.onClick],\n );\n\n // Render divider\n if (item.type === \"divider\") {\n return <Menu.Divider key={index} />;\n }\n\n // Render label\n if (item.type === \"label\") {\n return <Menu.Label key={index}>{item.label}</Menu.Label>;\n }\n\n // Render submenu if it has children\n if (item.children && item.children.length > 0) {\n return (\n <Menu key={index} trigger=\"hover\" position=\"right-start\" offset={2}>\n <Menu.Target>\n <Menu.Item\n leftSection={item.icon}\n rightSection={<IconChevronRight size={14} />}\n >\n {item.label}\n </Menu.Item>\n </Menu.Target>\n <Menu.Dropdown>\n {item.children.map((child, childIndex) => (\n <ActionMenuItem item={child} index={childIndex} key={childIndex} />\n ))}\n </Menu.Dropdown>\n </Menu>\n );\n }\n\n const menuItemProps: MenuItemProps & ButtonHTMLAttributes<unknown> = {};\n if (props.item.onClick) {\n menuItemProps.onClick = action.run;\n } else if (props.item.href) {\n Object.assign(menuItemProps, router.anchor(props.item.href));\n }\n\n // render regular menu item\n return (\n <Menu.Item\n key={index}\n leftSection={\n item.icon ??\n (item.active ? (\n <IconCheck size={ui.sizes.icon.sm} />\n ) : (\n <Flex w={ui.sizes.icon.sm} />\n ))\n }\n onClick={item.onClick}\n color={item.color}\n {...menuItemProps}\n >\n {item.label}\n </Menu.Item>\n );\n};\n","import { Burger, type BurgerProps } from \"@mantine/core\";\nimport { useStore } from \"alepha/react\";\nimport { alephaSidebarAtom } from \"../../atoms/alephaSidebarAtom.ts\";\n\nexport interface BurgerButtonProps extends BurgerProps {}\n\nconst BurgerButton = (props: BurgerButtonProps) => {\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n\n return (\n <Burger\n opened={!sidebar.closed}\n onClick={() => setSidebar({ ...sidebar, closed: !sidebar.closed })}\n hiddenFrom=\"md\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport default BurgerButton;\n","import { CopyButton, Tooltip } from \"@mantine/core\";\nimport { IconCheck, IconCopy } from \"@tabler/icons-react\";\nimport ActionButton, { type ActionCommonProps } from \"./ActionButton.tsx\";\n\nexport interface ClipboardButtonProps\n extends Omit<ActionCommonProps, \"onClick\" | \"icon\"> {\n /**\n * The value to copy to the clipboard\n */\n value: string;\n\n /**\n * Timeout in ms to show the \"Copied\" state (default: 2000)\n */\n timeout?: number;\n\n /**\n * Label to show in tooltip when not copied (default: \"Copy\")\n */\n copyLabel?: string;\n\n /**\n * Label to show in tooltip when copied (default: \"Copied\")\n */\n copiedLabel?: string;\n}\n\nconst ClipboardButton = (props: ClipboardButtonProps) => {\n const {\n value,\n timeout = 2000,\n copyLabel = \"Copy\",\n copiedLabel = \"Copied\",\n children,\n ...buttonProps\n } = props;\n\n return (\n <CopyButton value={value} timeout={timeout}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? copiedLabel : copyLabel} openDelay={500}>\n <ActionButton\n color={copied ? \"teal\" : undefined}\n onClick={copy}\n icon={copied ? IconCheck : IconCopy}\n {...buttonProps}\n >\n {children}\n </ActionButton>\n </Tooltip>\n )}\n </CopyButton>\n );\n};\n\nexport default ClipboardButton;\n","import { useMantineColorScheme } from \"@mantine/core\";\nimport { IconMoon, IconSun } from \"@tabler/icons-react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\n/**\n * SSR-safe dark mode toggle button.\n *\n * Uses CSS-based icon switching to avoid hydration mismatches.\n * Both icons are rendered, CSS hides the wrong one based on\n * `data-mantine-color-scheme` attribute.\n */\nconst DarkModeButton = (props: Partial<ActionProps>) => {\n const { setColorScheme } = useMantineColorScheme();\n\n const toggleColorScheme = () => {\n const current =\n document.documentElement.getAttribute(\"data-mantine-color-scheme\") ??\n \"light\";\n setColorScheme(current === \"dark\" ? \"light\" : \"dark\");\n };\n\n const size = props.size ?? \"sm\";\n const iconSize =\n (ui.sizes.icon as Record<string, number>)[size] ?? ui.sizes.icon.sm;\n\n return (\n <ActionButton\n onClick={toggleColorScheme}\n variant={props.variant ?? \"default\"}\n size={size}\n aria-label=\"Toggle color scheme\"\n icon={\n <>\n <IconSun size={iconSize} className=\"alepha-light-hidden\" />\n <IconMoon size={iconSize} className=\"alepha-dark-hidden\" />\n </>\n }\n {...props}\n />\n );\n};\n\nexport default DarkModeButton;\n","import { IconLanguage } from \"@tabler/icons-react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nconst LanguageButton = (props: Partial<ActionProps>) => {\n const i18n = useI18n();\n return (\n <ActionButton\n variant={\"default\"}\n icon={IconLanguage}\n menu={{\n items: i18n.languages.map((lang) => ({\n label: i18n.tr(lang),\n onClick: () => i18n.setLang(lang),\n active: i18n.lang === lang,\n })),\n }}\n {...props}\n />\n );\n};\n\nexport default LanguageButton;\n","import { Flex, Kbd, Text } from \"@mantine/core\";\nimport { useOs } from \"@mantine/hooks\";\nimport { spotlight } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { ClientOnly } from \"alepha/react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface OmnibarButtonProps {\n actionProps?: ActionProps;\n collapsed?: boolean;\n}\n\nconst OmnibarButton = (props: OmnibarButtonProps) => {\n const os = useOs();\n const isMac = os === \"macos\" || os === \"ios\";\n const shortcut = isMac ? \"⌘\" : \"Ctrl\";\n\n if (props.collapsed) {\n return (\n <ActionButton\n variant={\"subtle\"}\n onClick={spotlight.open}\n icon={IconSearch}\n tooltip={{ label: \"Search\", position: \"right\" }}\n {...props.actionProps}\n />\n );\n }\n\n return (\n <ActionButton\n variant={\"default\"}\n onClick={spotlight.open}\n justify={\"space-between\"}\n rightSection={\n <Kbd visibleFrom={\"sm\"} size={\"sm\"}>\n <ClientOnly>{shortcut}</ClientOnly>+K\n </Kbd>\n }\n radius={\"md\"}\n {...props.actionProps}\n >\n <Flex align={\"center\"} gap={\"xs\"}>\n <IconSearch size={16} color={\"gray\"} />\n <Flex visibleFrom={\"sm\"} miw={192}>\n <Text size={\"xs\"} c={\"dimmed\"}>\n Search...\n </Text>\n </Flex>\n </Flex>\n </ActionButton>\n );\n};\n\nexport default OmnibarButton;\n","import { useInject } from \"alepha/react\";\nimport { DialogService } from \"../services/DialogService.tsx\";\n\n/**\n * Use this hook to access the Dialog Service for showing various dialog types.\n *\n * @example\n * ```tsx\n * const dialog = useDialog();\n * await dialog.alert({ title: \"Alert\", message: \"This is an alert message\" });\n * const confirmed = await dialog.confirm({ title: \"Confirm\", message: \"Are you sure?\" });\n * const input = await dialog.prompt({ title: \"Input\", message: \"Enter your name:\" });\n * ```\n */\nexport const useDialog = (): DialogService => {\n return useInject(DialogService);\n};\n","import {\n ColorSwatch,\n Flex,\n Select,\n SimpleGrid,\n Text,\n useMantineTheme,\n} from \"@mantine/core\";\nimport { IconCheck } from \"@tabler/icons-react\";\nimport type { AlephaThemeOverrides } from \"../../atoms/alephaThemeOverridesAtom.ts\";\nimport { useDialog } from \"../../hooks/useDialog.ts\";\nimport { useTheme } from \"../../hooks/useTheme.ts\";\nimport ActionButton from \"./ActionButton.tsx\";\n\nconst MANTINE_COLORS = [\n \"red\",\n \"pink\",\n \"grape\",\n \"violet\",\n \"indigo\",\n \"blue\",\n \"cyan\",\n \"teal\",\n \"green\",\n \"lime\",\n \"yellow\",\n \"orange\",\n];\n\nconst RADIUS_OPTIONS = [\n { label: \"xs\", value: \"xs\" },\n { label: \"sm\", value: \"sm\" },\n { label: \"md\", value: \"md\" },\n { label: \"lg\", value: \"lg\" },\n { label: \"xl\", value: \"xl\" },\n];\n\nconst SIZE_OPTIONS = [\n { label: \"xs\", value: \"xs\" },\n { label: \"sm\", value: \"sm\" },\n { label: \"md\", value: \"md\" },\n { label: \"lg\", value: \"lg\" },\n { label: \"xl\", value: \"xl\" },\n];\n\nconst FONT_OPTIONS = [\n { label: \"System\", value: \"\" },\n { label: \"Inter\", value: \"Inter, sans-serif\" },\n { label: \"Mono\", value: \"ui-monospace, SFMono-Regular, Menlo, monospace\" },\n { label: \"Serif\", value: \"Georgia, 'Times New Roman', serif\" },\n];\n\nconst ThemeExpertModal = () => {\n const [, , expert] = useTheme();\n const dialog = useDialog();\n const mantineTheme = useMantineTheme();\n const { overrides, setOverrides } = expert;\n\n const currentColor = overrides.primaryColor || mantineTheme.primaryColor;\n const currentRadius = overrides.radius || mantineTheme.defaultRadius || \"md\";\n const currentFont = overrides.fontFamily || \"\";\n const currentFontSize = overrides.fontSize || \"md\";\n const currentScale = overrides.scale || \"md\";\n\n const updateOverrides = (patch: Partial<AlephaThemeOverrides>) => {\n setOverrides({ ...overrides, ...patch });\n };\n\n return (\n <Flex direction=\"column\" gap=\"lg\">\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Primary Color\n </Text>\n <SimpleGrid cols={6} spacing=\"xs\">\n {MANTINE_COLORS.map((color) => (\n <Flex key={color} justify=\"center\">\n <ColorSwatch\n color={mantineTheme.colors[color]?.[6] ?? color}\n onClick={() => updateOverrides({ primaryColor: color })}\n style={{ cursor: \"pointer\" }}\n size={32}\n >\n {currentColor === color && (\n <IconCheck size={14} color=\"white\" />\n )}\n </ColorSwatch>\n </Flex>\n ))}\n </SimpleGrid>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Border Radius\n </Text>\n <Flex gap=\"xs\">\n {RADIUS_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={\n String(currentRadius) === opt.value ? \"filled\" : \"default\"\n }\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ radius: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Font Family\n </Text>\n <Select\n data={FONT_OPTIONS}\n value={currentFont}\n onChange={(value) => updateOverrides({ fontFamily: value ?? \"\" })}\n allowDeselect={false}\n />\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Font Size\n </Text>\n <Flex gap=\"xs\">\n {SIZE_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={currentFontSize === opt.value ? \"filled\" : \"default\"}\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ fontSize: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Scale\n </Text>\n <Flex gap=\"xs\">\n {SIZE_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={currentScale === opt.value ? \"filled\" : \"default\"}\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ scale: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex justify=\"space-between\">\n <ActionButton\n variant=\"subtle\"\n color=\"red\"\n onClick={() => expert.resetOverrides()}\n >\n Reset\n </ActionButton>\n <ActionButton\n variant={\"default\"}\n px={\"xl\"}\n onClick={() => dialog.close()}\n >\n OK\n </ActionButton>\n </Flex>\n </Flex>\n );\n};\n\nexport default ThemeExpertModal;\n","import { IconPalette } from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { alephaThemeListAtom } from \"../../atoms/alephaThemeListAtom.ts\";\nimport { useDialog } from \"../../hooks/useDialog.ts\";\nimport { useTheme } from \"../../hooks/useTheme.ts\";\nimport type { ActionMenuItem } from \"./ActionButton.tsx\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\nimport ThemeExpertModal from \"./ThemeExpertModal.tsx\";\n\ntype ThemeButtonProps = Partial<ActionProps> & {\n /**\n * Enable expert mode with color, radius, and font customization.\n */\n expert?: boolean;\n};\n\nconst ThemeButton = (props: ThemeButtonProps) => {\n const { expert, ...actionProps } = props;\n const [theme, setTheme] = useTheme();\n const themeList = useStore(alephaThemeListAtom)[0];\n const dialog = useDialog();\n\n const items: ActionMenuItem[] = themeList.map((it, index) => ({\n label: it.name,\n onClick: () =>\n setTheme({\n index,\n }),\n active: theme.name === it.name,\n }));\n\n if (expert) {\n items.push(\n { type: \"divider\" },\n {\n label: \"Customize...\",\n onClick: () => {\n dialog.open({\n title: \"Customize Theme\",\n content: <ThemeExpertModal />,\n });\n },\n },\n );\n }\n\n return (\n <ActionButton\n variant=\"default\"\n icon={IconPalette}\n menu={{\n items,\n }}\n {...actionProps}\n />\n );\n};\n\nexport default ThemeButton;\n","import {\n IconLayoutSidebarLeftCollapse,\n IconLayoutSidebarRightCollapse,\n} from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { alephaSidebarAtom } from \"../../atoms/alephaSidebarAtom.ts\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\ntype Props = ActionProps;\n\nconst ToggleSidebarButton = (props: Props) => {\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n\n return (\n <ActionButton\n icon={\n sidebar.collapsed\n ? IconLayoutSidebarRightCollapse\n : IconLayoutSidebarLeftCollapse\n }\n visibleFrom={\"md\"}\n variant={\"default\"}\n onClick={() => {\n setSidebar({\n ...sidebar,\n collapsed: !sidebar.collapsed,\n });\n }}\n tooltip={{\n position: \"right\",\n label: sidebar.collapsed ? \"Show sidebar\" : \"Hide sidebar\",\n }}\n {...props}\n />\n );\n};\n\nexport default ToggleSidebarButton;\n","import {\n Drawer,\n type DrawerProps,\n Flex,\n Loader,\n Tabs,\n Text,\n} from \"@mantine/core\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport type { ActionMenuItem } from \"../buttons/ActionButton.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\n\nexport interface DetailDrawerTab {\n value: string;\n label: string;\n icon?: ComponentType<{ size?: number }>;\n content: ReactNode;\n}\n\nexport interface DetailDrawerStatus {\n label: string;\n active: boolean;\n}\n\nexport interface DetailDrawerProps {\n opened: boolean;\n onClose: () => void;\n title: ReactNode;\n subtitle?: ReactNode;\n status?: DetailDrawerStatus;\n actions?: ActionMenuItem[];\n tabs?: DetailDrawerTab[];\n children?: ReactNode;\n loading?: boolean;\n size?: DrawerProps[\"size\"];\n defaultTab?: string;\n}\n\nconst DetailDrawer = (props: DetailDrawerProps) => {\n const {\n opened,\n onClose,\n title,\n subtitle,\n status,\n actions,\n tabs,\n children,\n loading,\n size = \"xl\",\n defaultTab,\n } = props;\n\n return (\n <Drawer\n opened={opened}\n onClose={onClose}\n position=\"right\"\n size={size}\n withCloseButton={false}\n padding={0}\n >\n {/* Header */}\n <Flex\n p=\"md\"\n justify=\"space-between\"\n align=\"flex-start\"\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n >\n <Flex direction=\"column\" gap={2} style={{ minWidth: 0, flex: 1 }}>\n <Flex gap=\"xs\" align=\"center\">\n {status && (\n <Flex\n w={8}\n h={8}\n style={{\n borderRadius: \"50%\",\n backgroundColor: status.active\n ? \"var(--mantine-color-green-6)\"\n : \"var(--mantine-color-red-6)\",\n flexShrink: 0,\n }}\n />\n )}\n <Text size=\"lg\" fw={600} truncate>\n {title}\n </Text>\n </Flex>\n {subtitle && (\n <Text size=\"sm\" c=\"dimmed\" truncate>\n {subtitle}\n </Text>\n )}\n </Flex>\n <Flex gap=\"xs\" align=\"center\" style={{ flexShrink: 0 }}>\n {actions && actions.length > 0 && (\n <ActionButton\n variant=\"default\"\n size=\"xs\"\n menu={{\n items: actions,\n position: \"bottom-end\",\n width: 200,\n }}\n >\n Actions\n </ActionButton>\n )}\n <ActionButton variant=\"subtle\" size=\"xs\" c=\"dimmed\" onClick={onClose}>\n Close\n </ActionButton>\n </Flex>\n </Flex>\n\n {/* Content */}\n {loading ? (\n <Flex flex={1} justify=\"center\" align=\"center\" py=\"xl\">\n <Loader />\n </Flex>\n ) : tabs && tabs.length > 0 ? (\n <Tabs defaultValue={defaultTab || tabs[0].value}>\n <Tabs.List px=\"md\">\n {tabs.map((tab) => (\n <Tabs.Tab\n key={tab.value}\n value={tab.value}\n leftSection={tab.icon ? <tab.icon size={14} /> : undefined}\n >\n {tab.label}\n </Tabs.Tab>\n ))}\n </Tabs.List>\n {tabs.map((tab) => (\n <Tabs.Panel key={tab.value} value={tab.value} p=\"md\">\n {tab.content}\n </Tabs.Panel>\n ))}\n </Tabs>\n ) : (\n <Flex direction=\"column\" p=\"md\">\n {children}\n </Flex>\n )}\n </Drawer>\n );\n};\n\nexport default DetailDrawer;\n","import { Flex, Grid, Text } from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport ClipboardButton from \"../buttons/ClipboardButton.tsx\";\n\nexport interface DetailListItem {\n label: string;\n value: ReactNode;\n hidden?: boolean;\n copyable?: string;\n}\n\nexport interface DetailListProps {\n items: DetailListItem[];\n columns?: number;\n}\n\nconst DetailList = (props: DetailListProps) => {\n const { items, columns = 1 } = props;\n const visibleItems = items.filter((item) => !item.hidden);\n\n return (\n <Grid gutter=\"xs\">\n {visibleItems.map((item) => (\n <Grid.Col key={item.label} span={12 / columns}>\n <Flex\n py={6}\n justify=\"space-between\"\n align=\"center\"\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n >\n <Text size=\"xs\" c=\"dimmed\" style={{ flexShrink: 0 }}>\n {item.label}\n </Text>\n <Flex gap={4} align=\"center\" style={{ minWidth: 0 }}>\n {typeof item.value === \"string\" ||\n typeof item.value === \"number\" ? (\n <Text size=\"sm\" fw={500} truncate>\n {item.value || \"\\u2014\"}\n </Text>\n ) : (\n (item.value ?? (\n <Text size=\"sm\" c=\"dimmed\">\n {\"\\u2014\"}\n </Text>\n ))\n )}\n {item.copyable && (\n <ClipboardButton\n value={item.copyable}\n size=\"xs\"\n variant=\"subtle\"\n c=\"dimmed\"\n />\n )}\n </Flex>\n </Flex>\n </Grid.Col>\n ))}\n </Grid>\n );\n};\n\nexport default DetailList;\n","import { Flex, Paper, Text } from \"@mantine/core\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\n\nexport interface StatCardItem {\n label: string;\n value: ReactNode;\n icon?: ReactNode | ComponentType<{ size?: number }>;\n}\n\nexport interface StatCardsProps {\n items: StatCardItem[];\n}\n\nconst StatCards = ({ items }: StatCardsProps) => (\n <Flex gap=\"sm\" wrap=\"wrap\">\n {items.map((item) => {\n const IconComponent =\n item.icon && typeof item.icon === \"function\" ? item.icon : null;\n const iconNode = IconComponent ? (\n <IconComponent size={ui.sizes.icon.md} />\n ) : (\n (item.icon as ReactNode)\n );\n\n return (\n <Paper\n key={item.label}\n p=\"md\"\n radius=\"md\"\n withBorder\n style={{ flex: \"1 1 0\", minWidth: 120 }}\n >\n <Flex gap=\"sm\" align=\"center\">\n <Flex direction=\"column\">\n <Text size=\"xl\" fw={700} lh={1}>\n {item.value}\n </Text>\n <Text size=\"xs\" c=\"dimmed\">\n {item.label}\n </Text>\n </Flex>\n </Flex>\n </Paper>\n );\n })}\n </Flex>\n);\n\nexport default StatCards;\n","import {\n Flex as MantineFlex,\n type FlexProps as MantineFlexProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\n\nexport interface FlexProps extends MantineFlexProps {\n /**\n * flex: 1 — fill available space.\n */\n fill?: boolean;\n\n /**\n * Shorthand for align=\"center\" + justify=\"center\".\n */\n center?: boolean;\n\n /**\n * Shorthand for justify=\"center\".\n */\n centerX?: boolean;\n\n /**\n * Shorthand for align=\"center\".\n */\n centerY?: boolean;\n\n /**\n * Shorthand for direction=\"column\".\n */\n col?: boolean;\n\n /**\n * Set ground to `var(--alepha-ground)`.\n */\n ground?: boolean;\n\n /**\n * Set ground to `var(--alepha-surface)`.\n */\n surface?: boolean;\n\n /**\n * Set ground to `var(--alepha-elevated)`.\n */\n elevated?: boolean;\n\n /**\n * Add rounded corners to the container. If `true`, a default border radius will be applied. You can also specify a custom border radius value (e.g., \"sm\", \"md\", \"lg\", or any valid CSS border-radius value).\n */\n rounded?: boolean | number | string;\n\n /**\n * Add a border to the container. The color will be determined by the current theme.\n */\n bordered?: boolean;\n\n /**\n * Add a top border only.\n */\n borderedTop?: boolean;\n\n /**\n * Add a bottom border only.\n */\n borderedBottom?: boolean;\n\n /**\n * Add a shadow to the container. The intensity will be determined by the current theme.\n */\n shadowed?: boolean | number | string;\n\n /**\n * Set overflow to \"auto\" to enable scrolling when content overflows the container.\n */\n overflow?: boolean;\n}\n\nconst Flex = forwardRef<HTMLDivElement, FlexProps>((props, ref) => {\n const {\n fill,\n center,\n centerX,\n centerY,\n col,\n ground,\n surface,\n elevated,\n rounded,\n bordered,\n borderedTop,\n borderedBottom,\n shadowed,\n overflow,\n ...rest\n } = props;\n\n if (fill) {\n rest.flex ??= 1;\n }\n\n if (col) {\n rest.direction ??= \"column\";\n }\n\n if (center) {\n rest.align ??= \"center\";\n rest.justify ??= \"center\";\n }\n\n if (centerX) {\n rest.justify ??= \"center\";\n }\n\n if (centerY) {\n rest.align ??= \"center\";\n }\n\n if (ground) {\n rest.bg = \"var(--alepha-ground)\";\n } else if (surface) {\n rest.bg = \"var(--alepha-surface)\";\n } else if (elevated) {\n rest.bg = \"var(--alepha-elevated)\";\n }\n\n if (rounded) {\n rest.bdrs = rounded === true ? \"md\" : rounded;\n }\n\n if (bordered) {\n rest.bd = \"1px solid var(--alepha-border)\";\n }\n\n if (borderedTop) {\n rest.style = {\n borderTop: \"1px solid var(--alepha-border)\",\n ...((rest.style as object) ?? {}),\n };\n }\n\n if (borderedBottom) {\n rest.style = {\n borderBottom: \"1px solid var(--alepha-border)\",\n ...((rest.style as object) ?? {}),\n };\n }\n\n if (shadowed) {\n rest.className =\n `${rest.className ?? \"\"} shadow-${shadowed === true ? \"md\" : shadowed}`.trim();\n }\n\n if (overflow) {\n rest.className = `${rest.className ?? \"\"} overflow-auto`.trim();\n }\n\n return <MantineFlex ref={ref} {...rest} />;\n});\n\nFlex.displayName = \"Flex\";\n\nexport default Flex;\n","import type { ReactNode } from \"react\";\nimport type { AlephaIntent } from \"../interfaces/AlephaIntent.ts\";\n\nexport type HeadingProps = {\n title: string | ReactNode;\n description?: string | ReactNode;\n icon?: ReactNode;\n intent?: AlephaIntent;\n loading?: boolean;\n ellipsis?: boolean;\n fill?: boolean;\n tag?: string | ReactNode;\n};\n\nconst Heading = (props: HeadingProps) => {\n return <h1>Heading</h1>;\n};\n\nexport default Heading;\n","import {\n ActionButton,\n type ActionProps,\n BurgerButton,\n DarkModeButton,\n Flex,\n LanguageButton,\n OmnibarButton,\n type OmnibarButtonProps,\n Text,\n ThemeButton,\n} from \"@alepha/ui\";\nimport {\n Anchor,\n Container,\n type ContainerProps,\n Divider,\n type FlexProps,\n Image,\n} from \"@mantine/core\";\nimport { IconArrowLeft } from \"@tabler/icons-react\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport type { ComponentType, ReactNode } from \"react\";\n\nexport type AppBarItem =\n | AppBarElement\n | AppBarBurger\n | AppBarDark\n | AppBarTheme\n | AppBarSearch\n | AppBarLang\n | AppBarSpacer\n | AppBarDivider\n | AppBarLogo\n | AppBarBack;\n\nexport interface AppBarAbstractItem {\n position: \"left\" | \"center\" | \"right\";\n\n /**\n * Visibility control: return true to show, false to hide.\n */\n can?: () => boolean;\n}\n\nexport interface AppBarElement extends AppBarAbstractItem {\n element: ReactNode;\n}\n\nexport interface AppBarBurger extends AppBarAbstractItem {\n type: \"burger\";\n}\n\nexport interface AppBarDark extends AppBarAbstractItem {\n type: \"dark\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarTheme extends AppBarAbstractItem {\n type: \"theme\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarSearch extends AppBarAbstractItem {\n type: \"search\";\n props?: OmnibarButtonProps;\n}\n\nexport interface AppBarLang extends AppBarAbstractItem {\n type: \"lang\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarSpacer extends AppBarAbstractItem {\n type: \"spacer\";\n}\n\nexport interface AppBarDivider extends AppBarAbstractItem {\n type: \"divider\";\n}\n\nexport interface AppBarLogo extends AppBarAbstractItem {\n type: \"logo\";\n props?: {\n /**\n * Logo image source URL.\n */\n src?: string;\n\n /**\n * Logo text (used if no src provided).\n */\n text?: string;\n\n /**\n * Icon component (used if no src or text provided).\n */\n icon?: ReactNode | ComponentType;\n\n /**\n * Link href when logo is clicked.\n */\n href?: string;\n\n /**\n * Logo image height in pixels.\n * @default 32\n */\n height?: number;\n\n /**\n * Logo image width in pixels.\n */\n width?: number;\n\n /**\n * Font weight for text logo.\n * @default 700\n */\n fontWeight?: number;\n\n /**\n * Font size for text logo.\n * @default \"lg\"\n */\n fontSize?: string;\n };\n}\n\nexport interface AppBarBack extends AppBarAbstractItem {\n type: \"back\";\n props?: {\n /**\n * Custom label for back button.\n * @default \"Back\"\n */\n label?: string;\n\n /**\n * Show only icon without label.\n * @default true\n */\n iconOnly?: boolean;\n\n /**\n * Custom href to navigate to instead of history back.\n */\n href?: string;\n\n /**\n * Custom icon component.\n */\n icon?: ReactNode | ComponentType;\n };\n}\n\nexport interface AppBarProps {\n flexProps?: FlexProps;\n items?: AppBarItem[];\n\n /**\n * Wrap the AppBar content in a Mantine Container.\n * Pass `true` for default Container, or ContainerProps to customize.\n */\n container?: boolean | ContainerProps;\n}\n\nconst AppBar = (props: AppBarProps) => {\n const { items = [] } = props;\n const router = useRouter();\n\n const renderItem = (item: AppBarItem, index: number) => {\n // Check visibility control\n if (item.can && !item.can()) {\n return null;\n }\n\n if (\"type\" in item) {\n if (item.type === \"burger\") {\n return <BurgerButton key={index} />;\n }\n if (item.type === \"dark\") {\n return <DarkModeButton key={index} {...item.props} />;\n }\n if (item.type === \"theme\") {\n return <ThemeButton key={index} {...item.props} />;\n }\n if (item.type === \"search\") {\n return <OmnibarButton key={index} {...item.props} />;\n }\n if (item.type === \"lang\") {\n return <LanguageButton key={index} {...item.props} />;\n }\n if (item.type === \"spacer\") {\n return <Flex key={index} w={16} />;\n }\n if (item.type === \"divider\") {\n return <Divider key={index} orientation=\"vertical\" />;\n }\n if (item.type === \"logo\") {\n return renderLogo(item, index);\n }\n if (item.type === \"back\") {\n return renderBack(item, index);\n }\n }\n if (\"element\" in item) {\n return item.element;\n }\n return null;\n };\n\n const renderLogo = (item: AppBarLogo, index: number) => {\n const {\n src,\n text,\n icon,\n href,\n height = 32,\n width,\n fontWeight = 700,\n fontSize = \"lg\",\n } = item.props ?? {};\n\n const logoContent = src ? (\n <Image src={src} h={height} w={width} fit=\"contain\" />\n ) : icon ? (\n typeof icon === \"function\" ? (\n (() => {\n const IconComponent = icon;\n return <IconComponent />;\n })()\n ) : (\n icon\n )\n ) : text ? (\n <Text fw={fontWeight} size={fontSize}>\n {text}\n </Text>\n ) : null;\n\n if (href) {\n return (\n <Anchor\n component={Link}\n key={index}\n href={href}\n underline=\"never\"\n c=\"inherit\"\n >\n {logoContent}\n </Anchor>\n );\n }\n\n return <Flex key={index}>{logoContent}</Flex>;\n };\n\n const renderBack = (item: AppBarBack, index: number) => {\n const { label = \"Back\", iconOnly = true, href, icon } = item.props ?? {};\n\n const renderIcon = () => {\n if (!icon) {\n return <IconArrowLeft size={18} />;\n }\n if (typeof icon === \"function\") {\n const IconComponent = icon as ComponentType<{ size?: number }>;\n return <IconComponent size={18} />;\n }\n return icon;\n };\n\n const iconElement = renderIcon();\n\n const handleClick = () => {\n if (href) {\n router.push(href);\n } else {\n router.back();\n }\n };\n\n if (iconOnly) {\n return (\n <ActionButton\n key={index}\n icon={iconElement}\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClick}\n tooltip={{ label, position: \"bottom\" }}\n />\n );\n }\n\n return (\n <ActionButton\n key={index}\n leftSection={iconElement}\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClick}\n >\n {label}\n </ActionButton>\n );\n };\n\n const leftItems = items.filter((item) => item.position === \"left\");\n const centerItems = items.filter((item) => item.position === \"center\");\n const rightItems = items.filter((item) => item.position === \"right\");\n\n const content = (\n <Flex\n h=\"100%\"\n align=\"center\"\n px={props.container ? 0 : \"md\"}\n justify=\"space-between\"\n {...props.flexProps}\n >\n <Flex flex={1}>\n {leftItems.map((item, index) => (\n <Flex key={index} ml={index === 0 ? 0 : \"md\"} align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n <Flex>\n {centerItems.map((item, index) => (\n <Flex key={index} mx=\"md\" align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n <Flex flex={1} align={\"center\"} justify={\"end\"}>\n {rightItems.map((item, index) => (\n <Flex key={index} ml={index === 0 ? 0 : \"md\"} align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n </Flex>\n );\n\n if (props.container) {\n const containerProps =\n typeof props.container === \"boolean\" ? {} : props.container;\n return (\n <Container h=\"100%\" {...containerProps}>\n {content}\n </Container>\n );\n }\n\n return content;\n};\n\nexport default AppBar;\n","import { ActionButton, Flex, Text, toTitleCase } from \"@alepha/ui\";\nimport type { FlexProps } from \"@mantine/core\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nexport interface BreadcrumbProps extends FlexProps {\n /**\n * Label for the home/root crumb. Set to `false` to hide the root crumb.\n *\n * @default \"Home\"\n */\n home?: string | false;\n\n /**\n * Custom separator between crumbs.\n *\n * @default IconChevronRight\n */\n separator?: ReactNode;\n\n /**\n * Size of text and separator icons.\n *\n * @default \"xs\"\n */\n size?: string;\n}\n\n/**\n * Automatic breadcrumb component that reads the current route hierarchy\n * from the Alepha router's layer stack.\n *\n * Pages should define a `label` in their `$page()` options for best results.\n * Falls back to the page name converted to Title Case.\n */\nconst Breadcrumb = (props: BreadcrumbProps) => {\n const { home = \"Home\", separator, size = \"sm\", ...groupProps } = props;\n\n const state = useRouterState();\n const router = useRouter();\n\n const crumbs: Array<{ label: string; href: string }> = [];\n\n // Optionally add home crumb\n if (home !== false) {\n crumbs.push({ label: home, href: \"/\" });\n }\n\n // Build crumbs from layers, skipping the root layout (index 0)\n for (let i = 1; i < state.layers.length; i++) {\n const layer = state.layers[i];\n const route = layer.route as any;\n\n // Skip index routes (path \"/\") — they share the parent URL\n if (route?.path === \"/\" || route?.path === \"\") continue;\n\n const label = route?.label ?? toTitleCase(layer.name);\n // Use router.path() to resolve dynamic params (e.g. :userId → 3)\n const href = router.path(layer.name);\n crumbs.push({ label, href });\n }\n\n if (crumbs.length === 0) return null;\n\n const sep = separator ?? <IconChevronRight size={12} color=\"#9ca3af\" />;\n\n return (\n <Flex gap={\"sm\"} {...groupProps}>\n {crumbs.map((crumb, i) => (\n <Flex align={\"center\"} key={crumb.href} gap={\"sm\"}>\n {i > 0 && sep}\n {i < crumbs.length - 1 ? (\n <ActionButton anchor href={crumb.href} size={size} c=\"dimmed\">\n {crumb.label}\n </ActionButton>\n ) : (\n <Text size={size} fw={500}>\n {crumb.label}\n </Text>\n )}\n </Flex>\n ))}\n </Flex>\n );\n};\n\nexport default Breadcrumb;\n","import {\n Container as MantineContainer,\n type ContainerProps as MantineContainerProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\n\nexport interface ContainerProps extends MantineContainerProps {}\n\nconst Container = forwardRef<HTMLDivElement, ContainerProps>((props, ref) => {\n return <MantineContainer ref={ref} {...props} />;\n});\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","import { ui } from \"@alepha/ui\";\nimport { type ComponentType, isValidElement, type ReactNode } from \"react\";\nimport { isComponentType } from \"./isComponentType.ts\";\n\nexport const renderIcon = (\n icon: ReactNode | ComponentType,\n size?: number,\n): ReactNode => {\n if (!icon) return null;\n if (isValidElement(icon)) return icon;\n if (isComponentType(icon)) {\n const IconComponent = icon;\n return <IconComponent size={size ?? ui.sizes.icon.md} />;\n }\n return icon as ReactNode;\n};\n","import {\n Text as MantineText,\n type TextProps as MantineTextProps,\n} from \"@mantine/core\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport type { AlephaIntent } from \"../interfaces/AlephaIntent.ts\";\n\nexport interface TextProps extends MantineTextProps {\n children?: ReactNode;\n\n /**\n * Semantic color intent for the text.\n */\n intent?: AlephaIntent;\n\n /**\n * Shorthand for fw={700}.\n */\n bold?: boolean;\n\n /**\n * Shorthand for fs=\"italic\".\n */\n italic?: boolean;\n\n /**\n * Shorthand for fw={300}.\n */\n light?: boolean;\n\n /**\n * Shorthand for c=\"dimmed\".\n */\n muted?: boolean;\n\n /**\n * Shorthand for size=\"sm\".\n */\n small?: boolean;\n\n /**\n * Shorthand for tt=\"uppercase\".\n */\n uppercase?: boolean;\n\n /**\n * Shorthand for tt=\"capitalize\".\n */\n capitalize?: boolean;\n\n /**\n * Shorthand for ta=\"center\".\n */\n center?: boolean;\n\n /**\n * Shorthand for ff=\"monospace\".\n */\n monospace?: boolean;\n\n /**\n * Text with title styles (larger font size, bolder weight).\n */\n title?: boolean;\n}\n\nconst INTENT_COLORS: Record<AlephaIntent, string> = {\n primary: \"blue\",\n info: \"cyan\",\n success: \"green\",\n warning: \"yellow\",\n danger: \"red\",\n};\n\nconst Text = forwardRef<HTMLParagraphElement, TextProps>((props, ref) => {\n const {\n intent,\n bold,\n italic,\n light,\n muted,\n small,\n uppercase,\n capitalize,\n center,\n monospace,\n title,\n ...rest\n } = props;\n\n if (intent) {\n rest.c ??= INTENT_COLORS[intent];\n }\n\n if (bold) {\n rest.fw ??= 700;\n }\n\n if (light) {\n rest.fw ??= 300;\n }\n\n if (italic) {\n rest.fs ??= \"italic\";\n }\n\n if (muted) {\n rest.c ??= \"dimmed\";\n }\n\n if (small) {\n rest.size ??= \"xs\";\n }\n\n if (uppercase) {\n rest.tt ??= \"uppercase\";\n }\n\n if (capitalize) {\n rest.tt ??= \"capitalize\";\n }\n\n if (center) {\n rest.ta ??= \"center\";\n }\n\n if (monospace) {\n rest.ff ??= \"monospace\";\n }\n\n if (title) {\n rest.size ??= \"xl\";\n }\n\n return <MantineText ref={ref} {...rest} />;\n});\n\nText.displayName = \"Text\";\n\nexport default Text;\n","import { IconSquareRounded } from \"@tabler/icons-react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport type {\n ActionMenuConfig,\n ActionMenuItem,\n} from \"../buttons/ActionButton.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport type { SidebarItemProps } from \"./SidebarItem.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const SidebarCollapsedItem = (props: SidebarItemProps) => {\n const router = useRouter();\n\n const handleItemClick = () => {\n props.onItemClick?.(props.item);\n props.item.onClick?.();\n };\n\n const hasChildren = props.item.children && props.item.children.length > 0;\n\n const menu: ActionMenuConfig | undefined = hasChildren\n ? {\n on: \"hover\",\n position: \"right\",\n menuProps: {\n arrowPosition: \"center\",\n arrowSize: 10,\n withArrow: true,\n },\n items: [\n {\n type: \"label\",\n label: props.item.label,\n },\n ...props.item\n .children!.filter((child) => !child.can || child.can())\n .map(\n (child): ActionMenuItem => ({\n label: child.label as string,\n icon: renderIcon(child.icon, ui.sizes.icon.sm),\n href: child.href,\n active: child.href\n ? router.isActive(child.href, {\n startWith: child.activeStartsWith,\n })\n : undefined,\n }),\n ),\n ],\n }\n : undefined;\n\n return (\n <Flex w={\"100%\"} justify=\"center\" pos={\"relative\"}>\n <ActionButton\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (props.level === 0 ? \"sm\" : \"xs\")\n }\n bd={0}\n variant={\"default\"}\n propsActive={{\n variant: \"outline\",\n }}\n tooltip={\n hasChildren\n ? undefined\n : {\n label: props.item.label,\n position: \"right\",\n }\n }\n onClick={hasChildren ? undefined : handleItemClick}\n icon={\n renderIcon(props.item.icon, ui.sizes.icon.sm) ?? (\n <IconSquareRounded size={ui.sizes.icon.sm} />\n )\n }\n href={hasChildren ? undefined : (props.item.href as any)}\n target={hasChildren ? undefined : props.item.target}\n menu={menu}\n {...props.item.actionProps}\n />\n </Flex>\n );\n};\n","import { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport { useEvents } from \"alepha/react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { useCallback, useState } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport type { SidebarMenuItem, SidebarTheme } from \"./Sidebar.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const SidebarItem = (props: SidebarItemProps) => {\n const maxLevel = 2; // 0, 1, 2 = 3 levels total\n\n const router = useRouter();\n const isActive = useCallback((item: SidebarMenuItem): boolean => {\n if (!item.children) return false;\n for (const child of item.children) {\n if (child.href) {\n if (router.isActive(child.href)) {\n return true;\n }\n }\n if (isActive(child)) {\n return true;\n }\n }\n return false;\n }, []);\n\n const [isOpen, setIsOpen] = useState<boolean>(isActive(props.item));\n\n useEvents(\n {\n \"react:transition:end\": () => {\n // recalculate open state on transition end to ensure correct state after navigation\n if (isActive(props.item)) {\n setIsOpen(true);\n }\n },\n },\n [],\n );\n\n if (props.level > maxLevel) return null;\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (props.item.children && props.item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(props.item);\n props.item.onClick?.();\n }\n };\n\n return (\n <Flex direction={\"column\"} ps={props.level === 0 ? 0 : 32} pos={\"relative\"}>\n <ActionButton\n w={\"100%\"}\n justify=\"space-between\"\n href={props.item.href}\n target={props.item.target}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (props.level === 0 ? \"sm\" : \"xs\")\n }\n bd={0}\n fw={\"normal\"}\n variant={\"default\"}\n propsActive={{\n variant: \"outline\",\n }}\n radius={props.item.theme?.radius ?? props.theme.button?.radius ?? \"md\"}\n onClick={handleItemClick}\n leftSection={\n <Flex w={\"100%\"} align=\"center\" gap={\"sm\"}>\n {renderIcon(props.item.icon, ui.sizes.icon.sm)}\n <Flex direction={\"column\"}>\n <Flex>{props.item.label}</Flex>\n </Flex>\n </Flex>\n }\n rightSection={\n props.item.children ? (\n <Flex>\n {isOpen ? (\n <IconChevronDown size={14} />\n ) : (\n <IconChevronRight size={14} />\n )}\n </Flex>\n ) : (\n props.item.rightSection\n )\n }\n {...props.item.actionProps}\n />\n\n {props.item.children && isOpen && (\n <Flex\n direction={\"column\"}\n data-parent-level={props.level}\n gap={2}\n py={2}\n >\n <Flex\n style={{\n position: \"absolute\",\n width: 1,\n background:\n \"linear-gradient(to bottom, transparent, var(--mantine-color-default-border), transparent)\",\n top: 48,\n left: 20 + 32 * props.level,\n bottom: 16,\n }}\n />\n {props.item.children\n .filter((child) => !child.can || child.can())\n .map((child, index) => (\n <SidebarItem\n key={index}\n item={child}\n level={props.level + 1}\n onItemClick={props.onItemClick}\n theme={props.theme}\n />\n ))}\n </Flex>\n )}\n </Flex>\n );\n};\n","import type { FlexProps, MantineBreakpoint } from \"@mantine/core\";\nimport { useRouter } from \"alepha/react/router\";\nimport { type ComponentType, Fragment, type ReactNode, useMemo } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport type { ActionProps } from \"../buttons/ActionButton.tsx\";\nimport OmnibarButton from \"../buttons/OmnibarButton.tsx\";\nimport SidebarCollapseButton from \"../buttons/ToggleSidebarButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport Text from \"../Text.tsx\";\nimport { SidebarCollapsedItem } from \"./SidebarCollapsedItem.tsx\";\nimport { SidebarItem } from \"./SidebarItem.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarProps {\n items?: SidebarNode[];\n onItemClick?: (item: SidebarMenuItem) => void;\n onSearchClick?: () => void;\n theme?: SidebarTheme;\n flexProps?: Partial<FlexProps>;\n collapsed?: boolean;\n gap?: MantineBreakpoint | number;\n hide?: {\n paths?: string[];\n };\n\n /**\n * Automatically populate the menu from the router's pages.\n */\n autoPopulateMenu?:\n | boolean\n | {\n startsWith: string;\n };\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const Sidebar = (props: SidebarProps) => {\n const router = useRouter();\n\n const divider = (\n key: string | number,\n fill?: boolean,\n collapsed?: boolean,\n ) => {\n return (\n <Flex\n key={key}\n h={1}\n bg={\"var(--mantine-color-default-border)\"}\n my={\"xs\"}\n mx={\n fill ? \"calc(-1 * var(--mantine-spacing-md))\" : collapsed ? 0 : \"sm\"\n }\n />\n );\n };\n\n const renderNode = (\n item: SidebarNode,\n key: number | string,\n collapsed: boolean,\n ) => {\n if (\"type\" in item) {\n // Hide spacers when collapsed\n if (item.type === \"spacer\") {\n if (collapsed) return null;\n return <Flex key={key} h={16} />;\n }\n\n if (item.type === \"divider\") {\n return divider(key, item.fill, collapsed);\n }\n\n if (item.type === \"search\") {\n return (\n <Flex key={key} mb=\"xs\" w={\"100%\"} justify=\"center\" pos={\"relative\"}>\n <OmnibarButton collapsed={collapsed} />\n </Flex>\n );\n }\n\n if (item.type === \"toggle\") {\n return <SidebarCollapseButton key={key} />;\n }\n\n // Replace sections with dividers when collapsed\n if (item.type === \"section\") {\n // Hide section if all children are hidden\n if (item.children && item.children.length > 0) {\n const hasVisibleChild = item.children.some(\n (child) => !(\"can\" in child) || !child.can || child.can(),\n );\n if (!hasVisibleChild) return null;\n }\n\n if (collapsed) {\n return (\n <Fragment key={key}>\n {item.children?.map((child, index) =>\n renderNode(child, `s${key}-${index}`, collapsed),\n )}\n </Fragment>\n );\n }\n\n return (\n <Fragment key={key}>\n <Flex mt={\"md\"} align={\"center\"} gap={\"xs\"}>\n {renderIcon(item.icon, ui.sizes.icon.sm)}\n <Text size={\"xs\"} c={\"dimmed\"} tt={\"uppercase\"} fw={\"bold\"}>\n {item.label}\n </Text>\n </Flex>\n {item.children?.map((child, index) =>\n renderNode(child, `s${key}-${index}`, collapsed),\n )}\n </Fragment>\n );\n }\n }\n\n if (\"element\" in item) {\n return <Fragment key={key}>{item.element}</Fragment>;\n }\n\n // Check visibility control\n if (item.can && !item.can()) {\n return null;\n }\n\n // Hide parent if all children are hidden\n if (item.children && item.children.length > 0) {\n const hasVisibleChild = item.children.some(\n (child) => !child.can || child.can(),\n );\n if (!hasVisibleChild) {\n return null;\n }\n }\n\n if (collapsed) {\n return (\n <SidebarCollapsedItem\n key={key}\n item={item}\n level={0}\n onItemClick={props.onItemClick}\n theme={props.theme ?? {}}\n />\n );\n }\n\n return (\n <SidebarItem\n key={key}\n item={item}\n level={0}\n onItemClick={props.onItemClick}\n theme={props.theme ?? {}}\n />\n );\n };\n\n const getSidebarNodes = (): SidebarNode[] => {\n if (props.items) return props.items;\n if (props.autoPopulateMenu) {\n const items = router.concretePages\n .filter((page) => !page.can || page.can())\n .map((page) => ({\n label: page.label ?? page.name,\n //description: page.description?.slice(0, 32),\n icon: renderIcon(page.icon),\n href: router.path(page.name),\n })) as SidebarMenuItem[];\n if (\n typeof props.autoPopulateMenu === \"object\" &&\n props.autoPopulateMenu.startsWith\n ) {\n const startsWith = props.autoPopulateMenu.startsWith;\n return items.filter((item) => item.href?.startsWith(startsWith));\n }\n return items;\n }\n return [];\n };\n\n const padding = \"md\";\n const gap = props.items ? (props.gap ?? 8) : \"xs\";\n const menu = useMemo(\n () => getSidebarNodes(),\n [props.items, props.autoPopulateMenu],\n );\n\n const renderSidebar = (collapsed: boolean) => (\n <Flex flex={1} py={padding} direction={\"column\"} {...props.flexProps}>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {menu\n .filter((it) => it.position === \"top\")\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"} flex={1}>\n {menu\n .filter((it) => !it.position)\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {menu\n .filter((it) => it.position === \"bottom\")\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n </Flex>\n );\n\n // When collapsed, render both versions and use CSS breakpoints:\n // - Desktop (>=md): show collapsed (icon-only) sidebar\n // - Mobile (<md): show expanded sidebar (drawer with labels)\n if (props.collapsed) {\n return (\n <>\n <Flex flex={1} direction={\"column\"} visibleFrom=\"md\">\n {renderSidebar(true)}\n </Flex>\n <Flex flex={1} direction={\"column\"} hiddenFrom=\"md\">\n {renderSidebar(false)}\n </Flex>\n </>\n );\n }\n\n return renderSidebar(false);\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type SidebarNode =\n | SidebarMenuItem\n | SidebarSpacer\n | SidebarDivider\n | SidebarSearch\n | SidebarElement\n | SidebarSection\n | SidebarToggle;\n\nexport interface SidebarAbstractItem {\n position?: \"top\" | \"bottom\";\n}\n\nexport interface SidebarElement extends SidebarAbstractItem {\n element: ReactNode;\n}\n\nexport interface SidebarSpacer extends SidebarAbstractItem {\n type: \"spacer\";\n}\n\nexport interface SidebarDivider extends SidebarAbstractItem {\n type: \"divider\";\n fill?: true;\n}\n\nexport interface SidebarSearch extends SidebarAbstractItem {\n type: \"search\";\n}\n\nexport interface SidebarToggle extends SidebarAbstractItem {\n type: \"toggle\";\n}\n\nexport interface SidebarSection extends SidebarAbstractItem {\n type: \"section\";\n label: string;\n icon?: ReactNode | ComponentType;\n children?: SidebarNode[];\n}\n\nexport interface SidebarMenuItem extends SidebarAbstractItem {\n label: string | ReactNode;\n description?: string;\n icon?: ReactNode | ComponentType;\n href?: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n activeStartsWith?: boolean; // Use startWith matching for active state\n onClick?: () => void;\n children?: SidebarMenuItem[];\n rightSection?: ReactNode;\n theme?: SidebarButtonTheme;\n actionProps?: ActionProps;\n can?: () => boolean; // Visibility control: true -> visible, false -> hidden\n}\n\nexport interface SidebarButtonTheme {\n radius?: MantineBreakpoint;\n size?: MantineBreakpoint;\n}\n\nexport interface SidebarTheme {\n button?: SidebarButtonTheme;\n search?: SidebarButtonTheme;\n}\n","import { alephaSidebarAtom, Container, Flex } from \"@alepha/ui\";\nimport {\n AppShell,\n type AppShellFooterProps,\n type AppShellHeaderProps,\n type AppShellMainProps,\n type AppShellNavbarProps,\n type AppShellProps,\n type ContainerProps,\n} from \"@mantine/core\";\nimport { useEvents, useStore } from \"alepha/react\";\nimport { NestedView, useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport AppBar, { type AppBarProps } from \"./AppBar.tsx\";\nimport { Sidebar, type SidebarProps } from \"./Sidebar.tsx\";\n\nexport interface DashboardShellProps {\n appShellProps?: Partial<AppShellProps>;\n appShellMainProps?: Partial<AppShellMainProps>;\n appShellHeaderProps?: Partial<AppShellHeaderProps>;\n appShellNavbarProps?: Partial<AppShellNavbarProps>;\n appShellFooterProps?: Partial<AppShellFooterProps>;\n sidebarProps?: Partial<SidebarProps>;\n appBarProps?: Partial<AppBarProps>;\n header?: ReactNode;\n footer?: ReactNode;\n children?: ReactNode;\n\n /**\n * AppShell layout mode.\n * - \"default\": header/footer span full width, navbar below header.\n * - \"alt\": navbar is full height, header/footer offset by navbar width.\n */\n layout?: \"default\" | \"alt\";\n\n /**\n * Content rendered above the Sidebar inside the navbar (e.g. logo).\n */\n navbarHeader?: (props: { collapsed: boolean }) => ReactNode;\n\n /**\n * Content rendered below the Sidebar inside the navbar (e.g. toggle button).\n */\n navbarFooter?: ReactNode;\n\n /**\n * Height of the header bar in pixels.\n * @default 60\n */\n headerHeight?: number;\n\n /**\n * Height of the footer bar in pixels.\n * @default 24\n */\n footerHeight?: number;\n\n noSidebarWhen?: {\n /**\n * Paths where the sidebar should be hidden.\n */\n paths?: string[];\n };\n\n /**\n * Wrap the Dashboard main content in a Mantine Container.\n */\n container?: boolean | ContainerProps;\n\n /**\n * If true, the DashboardShell will fill the height of its container.\n */\n fill?: boolean;\n}\n\nconst DashboardShell = (props: DashboardShellProps) => {\n const router = useRouter();\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n const collapsed =\n props.sidebarProps?.collapsed !== undefined\n ? props.sidebarProps.collapsed\n : sidebar.collapsed;\n\n const { collapsedWidth, expandedWidth } = sidebar;\n\n const shouldShowSidebar = () => {\n if (props.noSidebarWhen?.paths) {\n for (const path of props.noSidebarWhen.paths) {\n if (\n router.isActive(path, {\n startWith: true,\n })\n ) {\n return false;\n }\n }\n }\n return true;\n };\n\n const [showSidebar, setShowSidebar] = useState(shouldShowSidebar());\n\n useEvents(\n {\n \"react:transition:end\": () => {\n setShowSidebar(shouldShowSidebar());\n },\n \"react:transition:begin\": () => {\n setSidebar({ ...sidebar, closed: true });\n },\n },\n [sidebar],\n );\n\n // Default AppBar items with burger button on the left\n const defaultAppBarItems = [\n { position: \"left\" as const, type: \"burger\" as const },\n ];\n\n // Forward container to appBarProps if not already set\n const appBarProps = { ...props.appBarProps };\n appBarProps.container ??= props.container;\n\n const hasSidebar = showSidebar && props.sidebarProps !== undefined;\n const hasAppBar = props.appBarProps || props.header;\n\n let footerElement = props.footer;\n if (props.footerHeight) {\n footerElement ??= <Flex h={props.footerHeight} />;\n }\n\n const hHeight = props.headerHeight ?? 60;\n const fHeight = props.footerHeight ?? 24;\n const headerHeight = hasAppBar ? hHeight : 0;\n const footerHeight = footerElement ? fHeight : 0;\n const navbarWidth = collapsed ? collapsedWidth : expandedWidth;\n const mainContent = props.children ?? <NestedView />;\n\n return (\n <AppShell\n layout={\"alt\"}\n w={\"100%\"}\n h={\"100vh\"}\n flex={1}\n header={hasAppBar ? { height: hHeight } : undefined}\n navbar={\n hasSidebar\n ? {\n width: { base: navbarWidth },\n breakpoint: \"md\",\n collapsed: { mobile: sidebar.closed },\n }\n : undefined\n }\n footer={footerElement ? { height: fHeight } : undefined}\n {...props.appShellProps}\n >\n {hasAppBar && (\n <AppShell.Header {...props.appShellHeaderProps}>\n {props.header ?? (\n <AppBar items={defaultAppBarItems} {...appBarProps} />\n )}\n </AppShell.Header>\n )}\n\n {hasSidebar && (\n <AppShell.Navbar {...props.appShellNavbarProps}>\n {props.navbarHeader ? (\n <Flex\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n h={headerHeight}\n >\n {props.navbarHeader({ collapsed })}\n </Flex>\n ) : null}\n <Sidebar {...(props.sidebarProps ?? {})} collapsed={collapsed} />\n {props.navbarFooter ? (\n <Flex\n style={{\n borderTop: \"1px solid var(--mantine-color-default-border)\",\n }}\n h={footerHeight}\n >\n {props.navbarFooter}\n </Flex>\n ) : null}\n </AppShell.Navbar>\n )}\n\n <AppShell.Main\n display={\"flex\"}\n bg={\"var(--alepha-ground)\"}\n pos={\"relative\"}\n h={props.fill ? \"100%\" : \"inherit\"}\n {...props.appShellMainProps}\n >\n {props.container ? (\n <Container\n {...(typeof props.container === \"boolean\" ? {} : props.container)}\n >\n {mainContent}\n </Container>\n ) : (\n mainContent\n )}\n </AppShell.Main>\n\n {footerElement && (\n <AppShell.Footer {...props.appShellFooterProps}>\n {footerElement}\n </AppShell.Footer>\n )}\n </AppShell>\n );\n};\n\nexport default DashboardShell;\n","import { getDefaultIcon, prettyName, ui } from \"@alepha/ui\";\nimport { type TObject, TypeBoxError } from \"alepha\";\nimport type { BaseInputField } from \"alepha/react/form\";\nimport {\n createElement,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport type { ControlProps } from \"../components/Control.tsx\";\n\nexport const parseInput = (\n props: GenericControlProps,\n form: {\n error?: Error;\n },\n): ControlInput => {\n const disabled = false; // form.loading;\n const id = props.input.props.id;\n const label =\n props.label ??\n (\"title\" in props.input.schema &&\n typeof props.input.schema.title === \"string\"\n ? props.input.schema.title\n : undefined) ??\n prettyName(props.input.path);\n const description =\n props.description ??\n (\"description\" in props.input.schema &&\n typeof props.input.schema.description === \"string\"\n ? props.input.schema.description\n : undefined);\n const error =\n form.error && form.error instanceof TypeBoxError\n ? form.error.value.message\n : undefined;\n\n // Auto-generate icon if not provided\n const icon = !props.icon\n ? getDefaultIcon({\n type:\n props.input.schema && \"type\" in props.input.schema\n ? String(props.input.schema.type)\n : undefined,\n format:\n props.input.schema &&\n \"format\" in props.input.schema &&\n typeof props.input.schema.format === \"string\"\n ? props.input.schema.format\n : undefined,\n name: props.input.props.name,\n isEnum:\n props.input.schema &&\n \"enum\" in props.input.schema &&\n Boolean(props.input.schema.enum),\n isArray:\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\",\n size: props.size,\n })\n : isValidElement(props.icon)\n ? props.icon\n : createElement(props.icon, { size: ui.sizes.icon.sm });\n\n const format =\n props.input.schema &&\n \"format\" in props.input.schema &&\n typeof props.input.schema.format === \"string\"\n ? props.input.schema.format\n : undefined;\n\n const required = props.input.required;\n const schema = props.input.schema as TObject & { $control?: ControlProps };\n\n const testId = (props.input.props as any)?.[\"data-testid\"];\n\n const inputProps: InputProps = {\n label,\n description,\n error,\n required,\n disabled,\n ...(testId ? { \"data-testid\": testId } : {}),\n };\n\n if (\"minLength\" in schema && typeof schema.minLength === \"number\") {\n inputProps.minLength = schema.minLength;\n }\n if (\"maxLength\" in schema && typeof schema.maxLength === \"number\") {\n inputProps.maxLength = schema.maxLength;\n }\n if (\"minimum\" in schema && typeof schema.minimum === \"number\") {\n inputProps.minimum = schema.minimum;\n }\n if (\"maximum\" in schema && typeof schema.maximum === \"number\") {\n inputProps.maximum = schema.maximum;\n }\n\n return {\n id,\n icon,\n format,\n schema: props.input.schema as TObject & { $control?: ControlProps },\n inputProps,\n };\n};\n\nexport interface GenericControlProps {\n input: BaseInputField;\n label?: string;\n description?: string;\n icon?: ReactElement | ((props: { size: number }) => ReactNode);\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\nexport interface ControlInput {\n id?: string;\n icon: ReactElement;\n format?: string;\n schema: TObject & { $control?: ControlProps };\n inputProps: InputProps;\n}\n\nexport interface InputProps {\n label: string;\n description?: string;\n error?: string;\n required: boolean;\n disabled: boolean;\n\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n}\n","import { ui } from \"@alepha/ui\";\nimport {\n ActionIcon,\n Fieldset,\n Flex,\n Grid,\n Text,\n UnstyledButton,\n} from \"@mantine/core\";\nimport { IconGripVertical, IconPlus, IconTrash } from \"@tabler/icons-react\";\nimport type { TObject, TSchema } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport type { BaseInputField } from \"alepha/react/form\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\n/**\n * Represents an array item with a stable key for React reconciliation.\n */\ninterface ArrayItem {\n key: number;\n value: any;\n}\n\nexport interface ControlArrayProps extends GenericControlProps {\n /**\n * Minimum number of items allowed.\n * @default 0\n */\n min?: number;\n\n /**\n * Maximum number of items allowed.\n * @default Infinity\n */\n max?: number;\n\n /**\n * Label for the add button.\n * @default \"Add item\"\n */\n addLabel?: string;\n\n /**\n * Number of columns for object item fields.\n * @default 1\n */\n columns?: number;\n\n /**\n * Variant for the container.\n * - \"fieldset\": Uses Mantine Fieldset with legend\n * - \"plain\": No container, just renders items\n * @default \"fieldset\"\n */\n variant?: \"fieldset\" | \"plain\";\n\n /**\n * Per-field control props override for object items.\n * Keys are field names from the item schema.\n */\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n\n /**\n * Control props for primitive items.\n */\n itemControlProps?: Partial<Omit<ControlProps, \"input\">>;\n\n /**\n * Show drag handle for reordering.\n * @default false\n */\n sortable?: boolean;\n}\n\n/**\n * Custom hook to sync array items with form state.\n * Uses form events as the source of truth, eliminating dual-state issues.\n */\nconst useArrayItems = (\n input: BaseInputField | undefined,\n): {\n items: ArrayItem[];\n setItems: (items: ArrayItem[]) => void;\n nextKey: () => number;\n} => {\n const alepha = useAlepha();\n const keyCounter = useRef(0);\n\n // Initialize from initialValue\n const [items, setItemsState] = useState<ArrayItem[]>(() => {\n const initial = input?.initialValue;\n if (Array.isArray(initial)) {\n return initial.map((value) => ({\n key: keyCounter.current++,\n value,\n }));\n }\n return [];\n });\n\n // Sync form value to local state\n const syncFromFormValue = useCallback((formValue: any[] | undefined) => {\n if (!Array.isArray(formValue)) {\n setItemsState([]);\n return;\n }\n\n // Preserve keys for existing items where possible\n setItemsState((prevItems) => {\n // If lengths match and values are same references, keep existing keys\n if (prevItems.length === formValue.length) {\n const allSame = prevItems.every(\n (item, i) => item.value === formValue[i],\n );\n if (allSame) return prevItems;\n }\n\n // Otherwise, create new items with fresh keys\n keyCounter.current = 0;\n return formValue.map((value) => ({\n key: keyCounter.current++,\n value,\n }));\n });\n }, []);\n\n // Listen for form changes\n useEffect(() => {\n if (!input?.form) return;\n\n const formId = input.form.id;\n const fieldPath = input.path;\n\n const unsub = alepha.events.on(\"form:change\", (event) => {\n if (event.id === formId && event.path === fieldPath) {\n syncFromFormValue(event.value);\n }\n });\n\n return unsub;\n }, [alepha, input, syncFromFormValue]);\n\n // Update form when items change\n const setItems = useCallback(\n (newItems: ArrayItem[]) => {\n setItemsState(newItems);\n // Update form value - this will trigger form:change but we'll detect it's from us\n input?.set(newItems.map((item) => item.value));\n },\n [input],\n );\n\n const nextKey = useCallback(() => keyCounter.current++, []);\n\n return { items, setItems, nextKey };\n};\n\n/**\n * Creates a proper InputField for an array item that integrates with the form system.\n * Uses array index for test IDs to ensure predictable, testable element identifiers.\n */\nconst createArrayItemInput = (\n parentInput: BaseInputField,\n itemSchema: TSchema,\n index: number,\n _itemKey: number,\n value: any,\n onValueChange: (value: any) => void,\n): BaseInputField => {\n return {\n schema: itemSchema,\n path: `${parentInput.path}/${index}`,\n required: false,\n form: parentInput.form,\n initialValue: value,\n props: {\n id: `${parentInput.props.id}-${index}`,\n name: `${parentInput.props.name}[${index}]`,\n },\n set: onValueChange,\n };\n};\n\n/**\n * Creates a proper InputField for a nested object field within an array item.\n * Uses array index for test IDs to ensure predictable, testable element identifiers.\n */\nconst createArrayItemFieldInput = (\n parentInput: BaseInputField,\n itemSchema: TObject,\n fieldName: string,\n index: number,\n _itemKey: number,\n itemValue: any,\n onFieldChange: (field: string, value: any) => void,\n): BaseInputField => {\n const fieldSchema = itemSchema.properties[fieldName];\n return {\n schema: fieldSchema,\n path: `${parentInput.path}/${index}/${fieldName}`,\n required: itemSchema.required?.includes(fieldName) ?? false,\n form: parentInput.form,\n initialValue: itemValue?.[fieldName],\n props: {\n id: `${parentInput.props.id}-${index}-${fieldName}`,\n name: `${parentInput.props.name}[${index}].${fieldName}`,\n },\n set: (value: any) => onFieldChange(fieldName, value),\n };\n};\n\n/**\n * ControlArray component for editing arrays of schema items.\n *\n * Features:\n * - Dynamic add/remove of items\n * - Supports arrays of objects with nested fields\n * - Supports arrays of primitives\n * - Grid layout for object items\n * - Min/max constraints\n * - Syncs with form state (handles external updates and resets)\n *\n * @example\n * ```tsx\n * // For a schema like:\n * // t.object({\n * // contacts: t.array(t.object({\n * // name: t.text(),\n * // email: t.text({ format: \"email\" }),\n * // }))\n * // })\n *\n * <ControlArray\n * input={form.input.contacts}\n * columns={2}\n * addLabel=\"Add contact\"\n * controlProps={{\n * email: { text: { placeholder: \"email@example.com\" } }\n * }}\n * />\n * ```\n */\nconst ControlArray = (props: ControlArrayProps) => {\n const { inputProps } = parseInput(props, {});\n const { items, setItems, nextKey } = useArrayItems(props.input);\n\n if (!props.input?.props) {\n return null;\n }\n\n const schema = props.input.schema;\n if (!schema || !(\"items\" in schema)) {\n return null;\n }\n\n const itemSchema = (schema as { items: TSchema }).items;\n const isObjectItem = itemSchema && \"properties\" in itemSchema;\n const { min = 0, max = Number.POSITIVE_INFINITY, columns = 1 } = props;\n\n const handleAdd = () => {\n if (items.length >= max) return;\n\n // Create default value based on item schema\n let newValue: any;\n if (isObjectItem) {\n newValue = {};\n // Initialize with default values from schema if available\n const objSchema = itemSchema as TObject;\n for (const [key, propSchema] of Object.entries(objSchema.properties)) {\n if (\"default\" in propSchema) {\n newValue[key] = propSchema.default;\n }\n }\n } else {\n newValue = \"\";\n }\n\n setItems([...items, { key: nextKey(), value: newValue }]);\n };\n\n const handleRemove = (index: number) => {\n if (items.length <= min) return;\n setItems(items.filter((_, i) => i !== index));\n };\n\n const handleItemChange = (index: number, value: any) => {\n const newItems = [...items];\n newItems[index] = { ...newItems[index], value };\n setItems(newItems);\n };\n\n const handleFieldChange = (index: number, field: string, value: any) => {\n const newItems = [...items];\n newItems[index] = {\n ...newItems[index],\n value: { ...newItems[index].value, [field]: value },\n };\n setItems(newItems);\n };\n\n const colSpan = 12 / columns;\n const objectItemSchema = isObjectItem ? (itemSchema as TObject) : null;\n const fieldNames = objectItemSchema\n ? Object.keys(objectItemSchema.properties)\n : [];\n\n const renderItems = () => (\n <Flex direction=\"column\" gap=\"sm\">\n {items.map((item, index) => (\n <Flex\n key={item.key}\n gap=\"sm\"\n align=\"flex-start\"\n p=\"xs\"\n bg={ui.colors.surface}\n style={{ borderRadius: \"var(--mantine-radius-sm)\" }}\n >\n {props.sortable && (\n <ActionIcon\n variant=\"subtle\"\n color=\"gray\"\n style={{ cursor: \"grab\" }}\n >\n <IconGripVertical size={16} />\n </ActionIcon>\n )}\n\n {objectItemSchema ? (\n <Grid style={{ flex: 1 }} gutter=\"sm\">\n {fieldNames.map((fieldName) => {\n const fieldControlProps = props.controlProps?.[fieldName] ?? {};\n const fieldInput = createArrayItemFieldInput(\n props.input,\n objectItemSchema,\n fieldName,\n index,\n item.key,\n item.value,\n (field, value) => handleFieldChange(index, field, value),\n );\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={fieldInput} {...fieldControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n ) : (\n <Flex style={{ flex: 1 }}>\n <Control\n input={createArrayItemInput(\n props.input,\n itemSchema,\n index,\n item.key,\n item.value,\n (value) => handleItemChange(index, value),\n )}\n {...props.itemControlProps}\n />\n </Flex>\n )}\n\n <ActionIcon\n variant=\"subtle\"\n color=\"red\"\n onClick={() => handleRemove(index)}\n disabled={items.length <= min}\n >\n <IconTrash size={16} />\n </ActionIcon>\n </Flex>\n ))}\n\n <UnstyledButton\n onClick={handleAdd}\n disabled={items.length >= max}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 6,\n padding: \"8px 12px\",\n borderRadius: \"var(--mantine-radius-sm)\",\n border: \"1px dashed var(--mantine-color-dimmed)\",\n color: \"var(--mantine-color-dimmed)\",\n fontSize: \"var(--mantine-font-size-sm)\",\n cursor: items.length >= max ? \"not-allowed\" : \"pointer\",\n opacity: items.length >= max ? 0.5 : 1,\n transition: \"all 150ms ease\",\n }}\n onMouseEnter={(e) => {\n if (items.length < max) {\n e.currentTarget.style.borderColor =\n \"var(--mantine-color-blue-filled)\";\n e.currentTarget.style.color = \"var(--mantine-color-blue-filled)\";\n e.currentTarget.style.background =\n \"var(--mantine-color-blue-light)\";\n }\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.borderColor = \"var(--mantine-color-dimmed)\";\n e.currentTarget.style.color = \"var(--mantine-color-dimmed)\";\n e.currentTarget.style.background = \"transparent\";\n }}\n >\n <IconPlus size={14} />\n {props.addLabel ?? \"Add\"}\n </UnstyledButton>\n </Flex>\n );\n\n if (props.variant === \"plain\") {\n return (\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.label && (\n <Text size=\"sm\" fw={500}>\n {inputProps.label}\n </Text>\n )}\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderItems()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n );\n }\n\n return (\n <Fieldset legend={inputProps.label}>\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderItems()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n </Fieldset>\n );\n};\n\nexport default ControlArray;\n","import {\n DateInput,\n type DateInputProps,\n DateTimePicker,\n type DateTimePickerProps,\n TimeInput,\n type TimeInputProps,\n} from \"@mantine/dates\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport interface ControlDateProps extends GenericControlProps {\n date?: boolean | DateInputProps;\n datetime?: boolean | DateTimePickerProps;\n time?: boolean | TimeInputProps;\n}\n\n/**\n * ControlDate component for handling date, datetime, and time inputs.\n *\n * Features:\n * - DateInput for date format\n * - DateTimePicker for date-time format\n * - TimeInput for time format\n *\n * Automatically detects date formats from schema and renders appropriate picker.\n */\nconst ControlDate = (props: ControlDateProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon, format } = parseInput(props, form);\n if (!props.input?.props) {\n return null;\n }\n\n // region <DateTimePicker/>\n if (props.datetime || format === \"date-time\") {\n const dateTimePickerProps =\n typeof props.datetime === \"object\" ? props.datetime : {};\n return (\n <DateTimePicker\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ? new Date(value) : null}\n onChange={(val) =>\n setValue(val ? new Date(val).toISOString() : undefined)\n }\n {...dateTimePickerProps}\n />\n );\n }\n //endregion\n\n // region <DateInput/>\n if (props.date || format === \"date\") {\n const dateInputProps = typeof props.date === \"object\" ? props.date : {};\n return (\n <DateInput\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ? new Date(value) : null}\n onChange={(val) =>\n setValue(val ? new Date(val).toISOString().slice(0, 10) : undefined)\n }\n {...dateInputProps}\n />\n );\n }\n //endregion\n\n // region <TimeInput/>\n if (props.time || format === \"time\") {\n const timeInputProps = typeof props.time === \"object\" ? props.time : {};\n return (\n <TimeInput\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(event) => setValue(event.currentTarget.value)}\n {...timeInputProps}\n />\n );\n }\n //endregion\n\n // Fallback - shouldn't happen\n return null;\n};\n\nexport default ControlDate;\n","import {\n Input,\n NumberInput,\n type NumberInputProps,\n Slider,\n type SliderProps,\n} from \"@mantine/core\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport interface ControlNumberProps extends GenericControlProps {\n numberInputProps?: Partial<NumberInputProps>;\n sliderProps?: Partial<SliderProps>;\n}\n\n/**\n *\n */\nconst ControlNumber = (props: ControlNumberProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon } = parseInput(props, form);\n\n if (!props.input?.props) {\n return null;\n }\n\n if (props.sliderProps) {\n const min = props.sliderProps.min ?? inputProps.minimum ?? 0;\n const max = props.sliderProps.max ?? inputProps.maximum ?? 100;\n return (\n <Input.Wrapper {...inputProps}>\n <div\n style={{\n height: 32,\n padding: 8,\n }}\n >\n <Slider\n {...inputProps}\n id={id}\n {...props.sliderProps}\n value={value ?? 0}\n min={min}\n max={max}\n label={() => value}\n onChange={(val) => setValue(val)}\n />\n </div>\n </Input.Wrapper>\n );\n }\n\n return (\n <NumberInput\n {...inputProps}\n id={id}\n leftSection={icon}\n {...props.numberInputProps}\n value={value ?? \"\"}\n onChange={(val) => {\n const newValue = val !== null ? Number(val) : undefined;\n setValue(newValue);\n }}\n />\n );\n};\n\nexport default ControlNumber;\n","import { Fieldset, Flex, Grid, Text } from \"@mantine/core\";\nimport type { TObject } from \"alepha\";\nimport type { BaseInputField, ObjectInputField } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\nexport interface ControlObjectProps extends GenericControlProps {\n /**\n * Number of columns for the grid layout.\n * @default 1\n */\n columns?: number;\n\n /**\n * Variant for the container.\n * - \"fieldset\": Uses Mantine Fieldset with legend\n * - \"plain\": No container, just renders fields\n * @default \"fieldset\"\n */\n variant?: \"fieldset\" | \"plain\";\n\n /**\n * Per-field control props override.\n * Keys are field names from the schema.\n */\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n}\n\n/**\n * ControlObject component for editing nested object schemas.\n *\n * Features:\n * - Renders all properties of an object schema\n * - Supports grid layout with configurable columns\n * - Per-field customization via controlProps\n * - Recursive support for deeply nested objects\n *\n * The form system provides nested InputFields under the `.items` property.\n * For example: form.input.address.items.street\n *\n * @example\n * ```tsx\n * // For a schema like:\n * // t.object({\n * // address: t.object({\n * // street: t.text(),\n * // city: t.text(),\n * // zip: t.text(),\n * // })\n * // })\n *\n * <ControlObject\n * input={form.input.address}\n * columns={2}\n * controlProps={{\n * zip: { text: { maxLength: 10 } }\n * }}\n * />\n * ```\n */\nconst ControlObject = (props: ControlObjectProps) => {\n const { inputProps } = parseInput(props, {});\n\n if (!props.input?.props) {\n return null;\n }\n\n const schema = props.input.schema as TObject;\n if (!schema?.properties) {\n return null;\n }\n\n const fieldNames = Object.keys(schema.properties);\n const columns = props.columns ?? 1;\n const colSpan = 12 / columns;\n\n // The form system provides nested InputFields under .items\n const objectInput = props.input as ObjectInputField<TObject>;\n const nestedItems = objectInput.items as Record<string, BaseInputField>;\n\n const renderFields = () => (\n <Grid>\n {fieldNames.map((fieldName) => {\n const fieldControlProps = props.controlProps?.[fieldName] ?? {};\n\n // Access nested InputField from .items\n const field = nestedItems?.[fieldName];\n if (!field) {\n return null;\n }\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={field} {...fieldControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n\n if (props.variant === \"plain\") {\n return renderFields();\n }\n\n return (\n <Fieldset legend={inputProps.label}>\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderFields()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n </Fieldset>\n );\n};\n\nexport default ControlObject;\n","import { ActionButton, OPERATOR_INFO, type SchemaField, ui } from \"@alepha/ui\";\nimport { Badge, Divider, Flex, Text } from \"@mantine/core\";\n\nexport interface ControlQueryBuilderHelpProps {\n /**\n * Schema fields to display\n */\n fields: SchemaField[];\n\n /**\n * Callback when a text snippet is inserted\n */\n onInsert: (text: string) => void;\n}\n\nconst ControlQueryBuilderHelp = (props: ControlQueryBuilderHelpProps) => {\n const { fields, onInsert } = props;\n\n return (\n <Flex\n gap=\"md\"\n align=\"flex-start\"\n wrap=\"nowrap\"\n bg={ui.colors.surface}\n p={\"sm\"}\n bdrs={\"sm\"}\n >\n {/* Left Column: Operators */}\n <Flex direction=\"column\" gap=\"md\" style={{ flex: 1 }}>\n {/* Available Operators */}\n <Flex direction=\"column\" gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Operators\n </Text>\n <Flex direction=\"column\" gap={4}>\n {Object.entries(OPERATOR_INFO).map(([key, info]) => (\n <Flex key={key} gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(info.symbol)}\n >\n {info.symbol}\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\" style={{ flex: 1 }}>\n {info.label}\n </Text>\n </Flex>\n ))}\n </Flex>\n </Flex>\n\n <Divider />\n\n {/* Logic Operators */}\n <Flex direction=\"column\" gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Logic\n </Text>\n <Flex direction=\"column\" gap={4}>\n <Flex gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(\"&\")}\n >\n &\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\">\n AND\n </Text>\n </Flex>\n <Flex gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(\"|\")}\n >\n |\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\">\n OR\n </Text>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n\n {/* Divider */}\n {fields.length > 0 && <Divider orientation=\"vertical\" />}\n\n {/* Right Column: Fields */}\n {fields.length > 0 && (\n <Flex direction={\"column\"} gap=\"xs\" style={{ flex: 2 }}>\n <Text size=\"sm\" fw={600}>\n Fields\n </Text>\n <Flex\n direction={\"column\"}\n gap={4}\n style={{ maxHeight: 300, overflowY: \"auto\" }}\n >\n {fields.map((field) => (\n <Flex key={field.path} gap=\"xs\" wrap=\"nowrap\" align=\"flex-start\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"end\"}\n miw={120}\n onClick={() => onInsert(field.path)}\n >\n {field.path}\n </ActionButton>\n <Flex\n mt={3}\n direction={\"column\"}\n gap={2}\n style={{ flex: 1, minWidth: 0 }}\n >\n <Text size=\"xs\" c=\"dimmed\" lineClamp={1}>\n {field.description || field.type}\n </Text>\n {field.enum && (\n <Flex gap={0} wrap=\"wrap\">\n {field.enum.map((enumValue) => (\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n key={enumValue}\n onClick={() => onInsert(enumValue)}\n >\n {enumValue}\n </ActionButton>\n ))}\n </Flex>\n )}\n </Flex>\n <Badge size=\"xs\" variant=\"light\" style={{ flexShrink: 0 }}>\n {field.type}\n </Badge>\n </Flex>\n ))}\n </Flex>\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default ControlQueryBuilderHelp;\n","import { extractSchemaFields, ui } from \"@alepha/ui\";\nimport {\n ActionIcon,\n Popover,\n TextInput,\n type TextInputProps,\n} from \"@mantine/core\";\nimport { IconFilter, IconInfoTriangle, IconX } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { parseQueryString } from \"alepha/orm\";\nimport { useEvents } from \"alepha/react\";\nimport { useRef, useState } from \"react\";\nimport ControlQueryBuilderHelp from \"./ControlQueryBuilderHelp.tsx\";\n\nexport interface ControlQueryBuilderProps\n extends Omit<TextInputProps, \"value\" | \"onChange\"> {\n schema?: TObject;\n value?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n}\n\n/**\n * Query builder with text input and help popover.\n * Generates query strings for parseQueryString syntax.\n */\nconst ControlQueryBuilder = (props: ControlQueryBuilderProps) => {\n const {\n schema,\n value = \"\",\n onChange,\n placeholder = \"Enter query or click for assistance...\",\n ...textInputProps\n } = props;\n\n const [helpOpened, setHelpOpened] = useState(false);\n const [textValue, setTextValue] = useState(value);\n const inputRef = useRef<HTMLInputElement>(null);\n const fields = schema ? extractSchemaFields(schema) : [];\n const [error, setError] = useState<string | null>(null);\n\n const isValid = (value: string) => {\n try {\n parseQueryString(value.trim());\n } catch (e) {\n setError((e as Error).message);\n return false;\n }\n setError(null);\n return true;\n };\n\n const handleTextChange = (newValue: string) => {\n setTextValue(newValue);\n if (isValid(newValue)) {\n onChange?.(newValue);\n }\n };\n\n const handleClear = () => {\n setTextValue(\"\");\n onChange?.(\"\");\n isValid(\"\");\n };\n\n const handleInsert = (text: string) => {\n const newValue = textValue ? `${textValue}${text} ` : `${text} `;\n setTextValue(newValue);\n if (isValid(newValue)) {\n onChange?.(newValue);\n }\n // Refocus the input after inserting\n setTimeout(() => {\n inputRef.current?.focus();\n // set cursor to end\n const length = inputRef.current?.value.length || 0;\n inputRef.current?.setSelectionRange(length, length);\n }, 0);\n };\n\n useEvents(\n {\n \"form:change\": (event) => {\n if (event.id === inputRef.current?.form?.id) {\n if (event.path === (textInputProps as any)[\"data-path\"]) {\n setTextValue(event.value ?? \"\");\n }\n }\n },\n },\n [],\n );\n\n return (\n <Popover\n width={800}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={helpOpened}\n onChange={setHelpOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <TextInput\n ref={inputRef}\n placeholder={placeholder}\n value={textValue}\n onChange={(e) => handleTextChange(e.currentTarget.value)}\n onFocus={() => setHelpOpened(true)}\n leftSection={\n error ? <IconInfoTriangle size={16} /> : <IconFilter size={16} />\n }\n rightSection={\n textValue && (\n <ActionIcon\n size=\"sm\"\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClear}\n >\n <IconX size={14} />\n </ActionIcon>\n )\n }\n {...textInputProps}\n />\n </Popover.Target>\n <Popover.Dropdown\n bg={\"transparent\"}\n p={\"xs\"}\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <ControlQueryBuilderHelp fields={fields} onInsert={handleInsert} />\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default ControlQueryBuilder;\n","import {\n Autocomplete,\n type AutocompleteProps,\n Flex,\n Input,\n Loader,\n MultiSelect,\n type MultiSelectProps,\n SegmentedControl,\n type SegmentedControlProps,\n Select,\n type SelectProps,\n TagsInput,\n type TagsInputProps,\n} from \"@mantine/core\";\nimport type { Async } from \"alepha\";\nimport { useAction } from \"alepha/react\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport type SelectValueLabel =\n | string\n | { value: string; label: string; icon?: string };\n\ntype LoaderMode = \"static\" | \"short\" | \"long\";\n\nexport interface ControlSelectProps extends GenericControlProps {\n /**\n * If true, allows creating new values not present in the options list.\n * For single values, Select becomes an Autocomplete.\n * For arrays, MultiSelect becomes a TagsInput.\n */\n creatable?: boolean;\n\n /**\n * Configure select with optional SelectProps.\n */\n selectProps?: boolean | SelectProps;\n\n /**\n * Configure select as multi-select (for array of enums) with optional MultiSelectProps.\n */\n multiSelectProps?: boolean | MultiSelectProps;\n\n /**\n * If true, renders a SegmentedControl instead of Select/MultiSelect.\n */\n segmentedProps?: boolean | Partial<SegmentedControlProps>;\n\n /**\n * Props passed to the Autocomplete component when creatable is true and the field is single-value.\n */\n autocompleteProps?: Partial<AutocompleteProps>;\n\n /**\n * Props passed to the TagsInput component when creatable is true and the field is array-value.\n */\n tagsInputProps?: Partial<TagsInputProps>;\n\n /**\n * Async loader for select options.\n *\n * @param search - Search text (empty string on initial load)\n * @param resolve - Optional array of values to resolve labels for (used for default values in long mode)\n */\n loader?: (search: string, resolve?: string[]) => Async<SelectValueLabel[]>;\n\n /**\n * Threshold to distinguish short (client-filtered) from long (server-filtered) lists.\n * If initial load returns <= threshold items, mode is \"short\" (cached, client-filtered).\n * If > threshold, mode is \"long\" (debounced server search).\n * @default 100\n */\n loaderThreshold?: number;\n\n /**\n * Debounce delay in ms for server search in long mode.\n * @default 300\n */\n loaderDebounce?: number;\n}\n\n/**\n * ControlSelect component for handling Select, MultiSelect, Autocomplete, and TagsInput.\n *\n * Features:\n * - Basic Select with enum support\n * - MultiSelect for array of enums\n * - Autocomplete for creatable single values\n * - TagsInput for creatable array values\n * - Async lazy loading with auto short/long mode detection\n * - Short mode: client-side filtering with cached data\n * - Long mode: debounced server search\n *\n * Automatically detects enum values and array types from schema.\n */\nconst ControlSelect = (props: ControlSelectProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon } = parseInput(props, form);\n\n // Detect if schema is an array type\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n // Detect if schema is numeric (for value coercion)\n const isNumeric =\n props.input.schema &&\n \"type\" in props.input.schema &&\n (props.input.schema.type === \"integer\" ||\n props.input.schema.type === \"number\");\n\n // Detect if schema is boolean (for value coercion)\n const isBoolean =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"boolean\";\n\n // Extract enum values from schema (for non-array select)\n const enumValues =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n Array.isArray(props.input.schema.enum)\n ? props.input.schema.enum\n : [];\n\n // Async loader hook\n const {\n data: asyncData,\n loading,\n mode,\n search,\n } = useAsyncLoader(\n props.loader,\n props.loaderThreshold ?? 100,\n props.loaderDebounce ?? 300,\n props.input.initialValue,\n );\n\n // Static data from enum (no loader)\n const [staticData, setStaticData] = useState<SelectValueLabel[]>([]);\n\n const enumKey = JSON.stringify(enumValues);\n useEffect(() => {\n if (!props.input?.props || props.loader) return;\n if (isBoolean && enumValues.length === 0) {\n setStaticData([\n { value: \"true\", label: \"True\" },\n { value: \"false\", label: \"False\" },\n ]);\n } else {\n setStaticData(enumValues);\n }\n }, [props.input, props.loader, enumKey, isBoolean]);\n\n const data = props.loader ? asyncData : staticData;\n\n if (!props.input?.props) {\n return null;\n }\n\n /**\n * Coerce value for numeric schemas — Select values are always strings.\n */\n const coerceValue = (val: string | null) => {\n if (val == null) return val;\n if (isNumeric) return Number(val);\n if (isBoolean) return val === \"true\";\n return val;\n };\n\n // region <SegmentedControl/> — early return\n if (props.segmentedProps) {\n const segmentedControlProps: Partial<SegmentedControlProps> =\n typeof props.segmentedProps === \"object\" ? props.segmentedProps : {};\n const segmentedData = segmentedControlProps.data ?? data.slice(0, 10);\n\n return (\n <Input.Wrapper {...inputProps}>\n <Flex my={\"calc(var(--mantine-spacing-xs) / 2)\"}>\n <SegmentedControl\n disabled={inputProps.disabled}\n value={value != null ? String(value) : \"\"}\n {...segmentedControlProps}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n data={segmentedData}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n // endregion\n\n // Shared props used by all select-like components\n const sharedProps = {\n size: props.size,\n id,\n leftSection: loading ? <Loader color={\"gray\"} size={10} /> : icon,\n data,\n };\n\n // Select and MultiSelect: searchable + hide default chevron\n const selectableProps = {\n ...sharedProps,\n searchable: true,\n rightSection: <span />,\n };\n\n // Long mode additions: bypass client filter + wire server search\n const longModeProps =\n mode === \"long\"\n ? {\n filter: ({ options }: { options: any[] }) => options,\n onSearchChange: search.run,\n }\n : {};\n\n // region <TagsInput/> — creatable + array\n if (props.creatable && (isArray || props.tagsInputProps)) {\n const tagsInputExtraProps = props.tagsInputProps ?? {};\n\n return (\n <TagsInput\n {...inputProps}\n {...sharedProps}\n {...longModeProps}\n value={Array.isArray(value) ? value : []}\n onChange={(val) => {\n setValue(val);\n }}\n {...tagsInputExtraProps}\n />\n );\n }\n // endregion\n\n // region <Autocomplete/> — creatable + single\n if (props.creatable) {\n const autocompleteExtraProps = props.autocompleteProps ?? {};\n\n return (\n <Autocomplete\n {...inputProps}\n {...sharedProps}\n {...longModeProps}\n value={value != null ? String(value) : \"\"}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...autocompleteExtraProps}\n />\n );\n }\n // endregion\n\n // region <MultiSelect/> — array (non-creatable)\n if (isArray || props.multiSelectProps) {\n const multiSelectExtraProps =\n typeof props.multiSelectProps === \"object\" ? props.multiSelectProps : {};\n\n return (\n <MultiSelect\n {...inputProps}\n {...selectableProps}\n {...longModeProps}\n value={Array.isArray(value) ? value : []}\n onChange={(val) => {\n setValue(val);\n }}\n {...multiSelectExtraProps}\n />\n );\n }\n // endregion\n\n // region <Select/> — single value (static, short, or long mode)\n const selectExtraProps =\n typeof props.selectProps === \"object\" ? props.selectProps : {};\n\n // Static mode\n if (mode === \"static\") {\n return (\n <Select\n {...inputProps}\n {...selectableProps}\n value={value != null ? String(value) : null}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...selectExtraProps}\n />\n );\n }\n\n // Short or long mode\n return (\n <Select\n {...inputProps}\n {...selectableProps}\n {...longModeProps}\n value={value != null ? String(value) : null}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...selectExtraProps}\n />\n );\n // endregion\n};\n\nexport default ControlSelect;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Hook for async select data loading with auto short/long mode detection.\n */\nconst useAsyncLoader = (\n loader: ControlSelectProps[\"loader\"],\n threshold: number,\n debounceMs: number,\n defaultValue: any,\n) => {\n const [data, setData] = useState<SelectValueLabel[]>([]);\n const [loading, setLoading] = useState(false);\n const [mode, setMode] = useState<LoaderMode>(\"static\");\n const cache = useRef(new Map<string, SelectValueLabel[]>());\n\n useAction(\n {\n name: \"select:loader:init\",\n runOnInit: true,\n handler: async () => {\n if (!loader) {\n setMode(\"static\");\n return;\n }\n\n setLoading(true);\n try {\n const result = await loader(\"\");\n const isShort = result.length <= threshold;\n setMode(isShort ? \"short\" : \"long\");\n cache.current.set(\"\", result);\n setData(result);\n\n // In long mode, resolve default value label before clearing loading\n if (!isShort && defaultValue != null && String(defaultValue) !== \"\") {\n const resolved = await loader(\"\", [String(defaultValue)]);\n if (resolved.length > 0) {\n setData((prev) => {\n const existing = new Set(\n prev.map((d) => (typeof d === \"string\" ? d : d.value)),\n );\n const newItems = resolved.filter((r) => {\n const val = typeof r === \"string\" ? r : r.value;\n return !existing.has(val);\n });\n return [...prev, ...newItems];\n });\n }\n }\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, threshold],\n );\n\n // Debounced search (long mode only)\n const search = useAction<[string]>(\n {\n debounce: debounceMs,\n handler: async (text) => {\n if (!loader || mode !== \"long\") return;\n\n // Check cache first (immediate, no network)\n if (cache.current.has(text)) {\n setData(cache.current.get(text)!);\n return;\n }\n\n setLoading(true);\n try {\n const result = await loader(text);\n cache.current.set(text, result);\n setData(result);\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, mode, debounceMs],\n );\n\n return { data, loading, mode, search };\n};\n","import {\n ColorInput,\n type ColorInputProps,\n FileInput,\n type FileInputProps,\n Flex,\n Input,\n PasswordInput,\n type PasswordInputProps,\n Switch,\n type SwitchProps,\n Textarea,\n type TextareaProps,\n TextInput,\n type TextInputProps,\n} from \"@mantine/core\";\nimport type {\n DateInputProps,\n DateTimePickerProps,\n TimeInputProps,\n} from \"@mantine/dates\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport type { ComponentType } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport ControlArray, { type ControlArrayProps } from \"./ControlArray.tsx\";\nimport ControlDate from \"./ControlDate.tsx\";\nimport ControlNumber, { type ControlNumberProps } from \"./ControlNumber.tsx\";\nimport ControlObject, { type ControlObjectProps } from \"./ControlObject.tsx\";\nimport ControlQueryBuilder from \"./ControlQueryBuilder.tsx\";\nimport ControlSelect, { type ControlSelectProps } from \"./ControlSelect.tsx\";\n\nexport interface ControlProps extends GenericControlProps {\n text?: TextInputProps;\n area?: boolean | TextareaProps;\n select?: boolean | Partial<ControlSelectProps>;\n password?: boolean | PasswordInputProps;\n switch?: boolean | SwitchProps;\n number?: boolean | Partial<ControlNumberProps>;\n file?: boolean | FileInputProps;\n color?: boolean | ColorInputProps;\n date?: boolean | DateInputProps;\n datetime?: boolean | DateTimePickerProps;\n time?: boolean | TimeInputProps;\n query?: any; // Enable query builder mode with schema-aware autocomplete\n object?: boolean | Partial<Omit<ControlObjectProps, \"input\">>; // Nested object editing\n array?: boolean | Partial<Omit<ControlArrayProps, \"input\">>; // Array of items editing\n custom?: ComponentType<CustomControlProps>;\n\n slider?: boolean;\n segmented?: boolean;\n}\n\n/**\n * Generic form control that renders the appropriate input based on the schema and props.\n *\n * Supports:\n * - TextInput (with format detection: email, url, tel)\n * - Textarea\n * - NumberInput (for number/integer types)\n * - FileInput\n * - ColorInput (for color format)\n * - Select (for enum types)\n * - Autocomplete\n * - PasswordInput\n * - Switch (for boolean types)\n * - SegmentedControl (for enum types)\n * - DateInput (for date format)\n * - DateTimePicker (for date-time format)\n * - TimeInput (for time format)\n * - QueryBuilder (for building type-safe queries with autocomplete)\n * - ControlObject (for nested object schemas)\n * - ControlArray (for arrays of objects)\n * - Custom component\n *\n * Automatically handles labels, descriptions, error messages, required state, and default icons.\n */\nconst Control = (_props: ControlProps) => {\n const form = useFormState(_props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(_props.input);\n\n // Early return if input is not properly initialized\n if (!_props.input?.props) {\n return null;\n }\n\n const { inputProps, id, icon, format, schema } = parseInput(_props, form);\n\n const props = {\n ..._props,\n ...schema.$control,\n };\n\n //region <QueryBuilder/>\n if (props.query) {\n return (\n <ControlQueryBuilder\n {...inputProps}\n schema={props.query}\n value={value}\n onChange={(val) => {\n setValue(val);\n }}\n />\n );\n }\n //endregion\n\n //region <Custom/>\n if (props.custom) {\n const Custom = props.custom;\n return (\n <Input.Wrapper {...inputProps}>\n <Flex flex={1} mt={\"calc(var(--mantine-spacing-xs) / 2)\"}>\n <Custom\n value={value}\n onChange={(val) => {\n setValue(val);\n }}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n //endregion\n\n //region <ControlObject/>\n // Handle nested objects with properties\n const isObject =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"object\" &&\n \"properties\" in props.input.schema;\n\n if (props.object || isObject) {\n const controlObjectProps =\n typeof props.object === \"object\" ? props.object : {};\n return (\n <ControlObject\n input={props.input}\n label={props.label}\n description={props.description}\n {...controlObjectProps}\n />\n );\n }\n //endregion\n\n //region <ControlArray/>\n // Handle arrays of objects (arrays of primitives are handled by ControlSelect)\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n const isArrayOfObjects =\n isArray &&\n \"items\" in props.input.schema &&\n props.input.schema.items &&\n typeof props.input.schema.items === \"object\" &&\n \"properties\" in props.input.schema.items;\n\n if (props.array || isArrayOfObjects) {\n const controlArrayProps =\n typeof props.array === \"object\" ? props.array : {};\n return (\n <ControlArray\n input={props.input}\n label={props.label}\n description={props.description}\n {...controlArrayProps}\n />\n );\n }\n //endregion\n\n //region <NumberInput/>\n if (\n props.number ||\n (!props.select &&\n props.input.schema &&\n \"type\" in props.input.schema &&\n (props.input.schema.type === \"number\" ||\n props.input.schema.type === \"integer\"))\n ) {\n const controlNumberProps =\n typeof props.number === \"object\" ? props.number : {};\n if (props.slider) {\n controlNumberProps.sliderProps ??= {};\n }\n return (\n <ControlNumber\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n {...controlNumberProps}\n />\n );\n }\n //endregion\n\n //region <FileInput/>\n if (props.file) {\n const fileInputProps = typeof props.file === \"object\" ? props.file : {};\n return (\n <FileInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n onChange={(file) => setValue(file)}\n {...fileInputProps}\n />\n );\n }\n //endregion\n\n //region <ColorInput/>\n if (props.color || format === \"color\") {\n const colorInputProps = typeof props.color === \"object\" ? props.color : {};\n return (\n <ColorInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(val) => setValue(val)}\n {...colorInputProps}\n />\n );\n }\n //endregion\n\n //region <ControlSelect/>\n // Handle: single enum, array of enum, array of strings, or explicit select/multi/tags props\n // Note: arrays of objects are handled by ControlArray above, this handles primitive arrays\n const isEnum =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n props.input.schema.enum;\n\n if (isEnum || (isArray && !isArrayOfObjects) || props.select) {\n const opts = typeof props.select === \"object\" ? props.select : {};\n if (props.segmented) {\n opts.segmentedProps ??= {};\n }\n return (\n <ControlSelect\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n {...opts}\n />\n );\n }\n //endregion\n\n //region <Switch/>\n if (\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"boolean\"\n ) {\n if (props.switch) {\n const switchProps = typeof props.switch === \"object\" ? props.switch : {};\n return (\n <Switch\n {...inputProps}\n size={props.size}\n id={id}\n color={\"blue\"}\n checked={Boolean(value)}\n onChange={(event) => {\n setValue(event.currentTarget.checked);\n }}\n {...switchProps}\n />\n );\n }\n\n const opts: ControlSelectProps = {\n input: props.input,\n selectProps: {\n data: [\n { value: \"true\", label: \"Yes\" },\n { value: \"false\", label: \"No\" },\n ],\n },\n };\n\n return (\n <ControlSelect\n size={props.size}\n label={props.label}\n description={props.description}\n icon={icon}\n {...opts}\n />\n );\n }\n //endregion\n\n //region <PasswordInput/>\n if (props.password || props.input.props.name?.includes(\"password\")) {\n const passwordInputProps =\n typeof props.password === \"object\" ? props.password : {};\n return (\n <PasswordInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...passwordInputProps}\n />\n );\n }\n //endregion\n\n //region <Textarea/>\n if (props.area) {\n const textAreaProps = typeof props.area === \"object\" ? props.area : {};\n return (\n <Textarea\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...textAreaProps}\n />\n );\n }\n //endregion\n\n //region <ControlDate/>\n // Handle: date, date-time, and time formats\n if (\n props.date ||\n props.datetime ||\n props.time ||\n format === \"date\" ||\n format === \"date-time\" ||\n format === \"time\"\n ) {\n return (\n <ControlDate\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n date={props.date}\n datetime={props.datetime}\n time={props.time}\n />\n );\n }\n //endregion\n\n //region <TextInput/> with format detection\n const textInputProps = typeof props.text === \"object\" ? props.text : {};\n\n // Detect HTML5 input type from format\n const getInputType = (): string | undefined => {\n switch (format) {\n case \"email\":\n return \"email\";\n case \"url\":\n case \"uri\":\n return \"url\";\n case \"tel\":\n case \"phone\":\n return \"tel\";\n default:\n return props.input.props.type ?? \"text\";\n }\n };\n\n return (\n <TextInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n type={getInputType()}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...textInputProps}\n />\n );\n //endregion\n};\n\nexport default Control;\n\nexport type CustomControlProps = {\n value: any;\n onChange: (value: any) => void;\n};\n","import { ActionButton, type ActionSubmitButtonProps } from \"@alepha/ui\";\nimport { Card, Flex, type FlexProps, Grid } from \"@mantine/core\";\nimport type { TObject } from \"alepha\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport type { ReactNode } from \"react\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\nexport interface TypeFormProps<T extends TObject> {\n form: FormModel<T>;\n columns?:\n | number\n | {\n base?: number;\n xs?: number;\n sm?: number;\n md?: number;\n lg?: number;\n xl?: number;\n };\n schema?: TObject;\n children?: (input: FormModel<T>[\"input\"]) => ReactNode;\n\n /**\n * Control props applied to all fields.\n */\n controlProps?: Partial<Omit<ControlProps, \"input\">>;\n\n /**\n * Per-field control props override.\n * Keys are field names from the schema.\n */\n fieldControlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n skipFormElement?: boolean;\n skipSubmitButton?: boolean;\n submitButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n resetButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n\n fill?: boolean;\n flexProps?: FlexProps;\n\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\n/**\n * TypeForm component that automatically renders all form inputs based on schema.\n * Uses the Control component to render individual fields and Mantine Grid for responsive layout.\n *\n * Supports all field types including:\n * - Primitive types (string, number, boolean, etc.)\n * - Enum types (rendered as Select)\n * - Arrays of primitives (rendered as MultiSelect/TagsInput)\n * - Arrays of objects (rendered as ControlArray)\n * - Nested objects (rendered as ControlObject)\n *\n * @example\n * ```tsx\n * import { t } from \"alepha\";\n * import { useForm } from \"alepha/react/form\";\n * import { TypeForm } from \"@alepha/ui\";\n *\n * const form = useForm({\n * schema: t.object({\n * username: t.text(),\n * email: t.text(),\n * age: t.integer(),\n * subscribe: t.boolean(),\n * address: t.object({\n * street: t.text(),\n * city: t.text(),\n * }),\n * tags: t.array(t.text()),\n * contacts: t.array(t.object({\n * name: t.text(),\n * email: t.text(),\n * })),\n * }),\n * handler: (values) => {\n * console.log(values);\n * },\n * });\n *\n * return <TypeForm form={form} columns={2} />;\n * ```\n */\nconst TypeForm = <T extends TObject>(props: TypeFormProps<T>) => {\n const {\n form,\n columns = 3,\n children,\n controlProps,\n fieldControlProps,\n skipFormElement = false,\n skipSubmitButton = false,\n submitButtonProps,\n fill = true,\n size,\n } = props;\n\n const { dirty } = useFormState(form, [\"dirty\"]);\n\n const schema = props.schema || form.options.schema;\n if (!schema?.properties) {\n return null;\n }\n\n const fieldNames = Object.keys(schema.properties);\n\n // Filter to only include valid InputFields\n // All types are now supported: primitives, enums, arrays, objects\n const supportedFields = fieldNames;\n\n // Handle column configuration with defaults: xs=1, sm=2, lg=3\n const colSpan =\n typeof columns === \"number\"\n ? {\n xs: 12,\n sm: 6,\n lg: 12 / columns,\n }\n : {\n base: columns.base ? 12 / columns.base : undefined,\n xs: columns.xs ? 12 / columns.xs : 12,\n sm: columns.sm ? 12 / columns.sm : 6,\n md: columns.md ? 12 / columns.md : undefined,\n lg: columns.lg ? 12 / columns.lg : 4,\n xl: columns.xl ? 12 / columns.xl : undefined,\n };\n\n const renderFields = () => {\n if (children) {\n return <>{children(form.input)}</>;\n }\n\n return (\n <Grid>\n {supportedFields.map((fieldName) => {\n const field = form.input[fieldName as keyof typeof form.input];\n const fieldSchema: any = schema.properties[fieldName];\n\n // Type guard to ensure field has the expected structure\n if (!field || !fieldSchema) {\n return null;\n }\n\n // Determine if this is a complex type (object or array of objects)\n // that should span full width\n const isObject =\n fieldSchema &&\n \"type\" in fieldSchema &&\n fieldSchema.type === \"object\";\n\n const isArrayOfObjects =\n fieldSchema &&\n \"type\" in fieldSchema &&\n fieldSchema.type === \"array\" &&\n \"items\" in fieldSchema &&\n fieldSchema.items &&\n \"properties\" in fieldSchema.items;\n\n // Complex types span full width, primitives use grid columns\n const span = isObject || isArrayOfObjects ? 12 : colSpan;\n\n // Merge control props: base controlProps + field-specific overrides\n const mergedControlProps = {\n ...controlProps,\n ...fieldControlProps?.[fieldName],\n };\n\n if (size) {\n mergedControlProps.size = size;\n }\n\n return (\n <Grid.Col key={fieldName} span={span}>\n <Control input={field} {...mergedControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n };\n\n const content = (\n <Flex\n direction={\"column\"}\n gap={\"sm\"}\n flex={fill ? 1 : undefined}\n {...props.flexProps}\n >\n <Flex direction={\"column\"} gap={\"sm\"} flex={1}>\n {renderFields()}\n </Flex>\n {!skipSubmitButton && (\n <Card w={\"100%\"} withBorder>\n <Flex gap={\"sm\"} flex={1}>\n <Flex></Flex>\n <Flex flex={1}></Flex>\n <Flex gap={\"sm\"}>\n <ActionButton variant={\"subtle\"} type={\"reset\"} disabled={!dirty}>\n Reset\n </ActionButton>\n <ActionButton\n intent={\"primary\"}\n form={form}\n disabled={!dirty}\n {...submitButtonProps}\n >\n {submitButtonProps?.children ?? \"Submit\"}\n </ActionButton>\n </Flex>\n </Flex>\n </Card>\n )}\n </Flex>\n );\n\n if (skipFormElement) {\n return content;\n }\n\n return (\n <Flex\n component={\"form\"}\n flex={fill ? 1 : undefined}\n {...form.props}\n {...props.flexProps}\n >\n {content}\n </Flex>\n );\n};\n\nexport default TypeForm;\n","import type { BaseDialogOptions } from \"@alepha/ui\";\nimport type { TObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport TypeForm, { type TypeFormProps } from \"../components/TypeForm.tsx\";\n\nexport interface DialogFormOptions<T extends TObject>\n extends BaseDialogOptions {\n typeFormProps?: Partial<Omit<TypeFormProps<T>, \"form\">>;\n}\n\n/**\n * Creates dialog options for a form dialog.\n *\n * @param form - The form model to render.\n * @param options - Additional dialog and TypeForm options.\n */\nexport const dialogForm = <T extends TObject>(\n form: FormModel<T>,\n options?: DialogFormOptions<T>,\n): BaseDialogOptions => ({\n size: \"lg\",\n title: options?.title || \"Form\",\n ...options,\n content: (\n <TypeForm\n form={form}\n skipSubmitButton={false}\n {...options?.typeFormProps}\n />\n ),\n});\n","import { ActionIcon } from \"@mantine/core\";\nimport { IconCheck, IconCopy } from \"@tabler/icons-react\";\nimport { useCallback, useState } from \"react\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerCopyButtonProps {\n value: string;\n iconSize: number;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewerCopyButton = (props: JsonViewerCopyButtonProps) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n navigator.clipboard.writeText(props.value);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n },\n [props.value],\n );\n\n return (\n <ActionIcon\n size={props.iconSize + 4}\n variant=\"transparent\"\n c={copied ? \"green\" : \"dimmed\"}\n onClick={handleCopy}\n className=\"alepha-json-viewer-copy\"\n >\n {copied ? (\n <IconCheck size={props.iconSize} />\n ) : (\n <IconCopy size={props.iconSize} />\n )}\n </ActionIcon>\n );\n};\n","import type { MantineSize } from \"@mantine/core\";\nimport type { CSSProperties } from \"react\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface JsonTreeNode {\n value: string;\n label: string;\n children?: JsonTreeNode[];\n nodeValue: any;\n nodeKey: string | undefined;\n path: string[];\n isArrayItem: boolean;\n isRoot?: boolean;\n}\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\nexport const SIZE_CONFIG: Record<\n MantineSize,\n { icon: number; levelOffset: number }\n> = {\n xs: { icon: 14, levelOffset: 16 },\n sm: { icon: 16, levelOffset: 20 },\n md: { icon: 18, levelOffset: 24 },\n lg: { icon: 20, levelOffset: 28 },\n xl: { icon: 22, levelOffset: 32 },\n};\n\nexport const STYLES = {\n root: {\n fontFamily: \"var(--mantine-font-family-monospace)\",\n } satisfies CSSProperties,\n chevron: {\n flexShrink: 0,\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n key: {\n color: \"var(--mantine-color-cyan-text)\",\n fontWeight: 500,\n } satisfies CSSProperties,\n colon: {\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n string: {\n color: \"var(--mantine-color-teal-text)\",\n } satisfies CSSProperties,\n number: {\n color: \"var(--mantine-color-blue-text)\",\n } satisfies CSSProperties,\n boolean: {\n color: \"var(--mantine-color-violet-text)\",\n } satisfies CSSProperties,\n null: {\n color: \"var(--mantine-color-dimmed)\",\n fontStyle: \"italic\",\n } satisfies CSSProperties,\n preview: {\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n};\n\n// =============================================================================\n// HELPERS\n// =============================================================================\n\nexport const getValueType = (val: any): string => {\n if (val === null) return \"null\";\n if (val === undefined) return \"undefined\";\n if (Array.isArray(val)) return \"array\";\n return typeof val;\n};\n","import { Flex, type MantineSize, Text } from \"@mantine/core\";\nimport { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { JsonViewerCopyButton } from \"./JsonViewerCopyButton.tsx\";\nimport { getValueType, type JsonTreeNode, STYLES } from \"./JsonViewerShared.ts\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerRowNodeProps {\n node: JsonTreeNode;\n expanded: boolean;\n hasChildren: boolean;\n elementProps: any;\n size: MantineSize;\n config: { icon: number; levelOffset: number };\n showQuotes: boolean;\n showCopyButton: boolean;\n renderValue: (val: any, key: string | undefined, path: string[]) => ReactNode;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewerRowNode = (props: JsonViewerRowNodeProps) => {\n const { nodeValue, nodeKey, path, isArrayItem } = props.node;\n const type = getValueType(nodeValue);\n const isExpandable = type === \"object\" || type === \"array\";\n\n const getPreview = () => {\n if (!isExpandable) return null;\n const entries = type === \"array\" ? nodeValue : Object.keys(nodeValue);\n const count = entries.length;\n const label = type === \"array\" ? \"item\" : \"key\";\n\n if (!props.expanded) {\n return (\n <Text\n fs={\"italic\"}\n component=\"span\"\n size={props.size}\n style={STYLES.preview}\n >\n {count === 0\n ? type === \"array\"\n ? \"[]\"\n : \"{}\"\n : type === \"array\"\n ? `[ ${count} ${count === 1 ? label : `${label}s`} ]`\n : `{ ${count} ${count === 1 ? label : `${label}s`} }`}\n </Text>\n );\n }\n\n return null;\n };\n\n const getCopyValue = () =>\n isExpandable ? JSON.stringify(nodeValue, null, 2) : String(nodeValue ?? \"\");\n\n return (\n <Flex\n gap={6}\n wrap=\"nowrap\"\n {...props.elementProps}\n className={`alepha-json-viewer-row ${props.elementProps.className || \"\"}`}\n >\n {props.hasChildren ? (\n props.expanded ? (\n <IconChevronDown size={props.config.icon} style={STYLES.chevron} />\n ) : (\n <IconChevronRight size={props.config.icon} style={STYLES.chevron} />\n )\n ) : (\n <span style={{ width: props.config.icon, flexShrink: 0 }} />\n )}\n\n {nodeKey !== undefined && !isArrayItem && (\n <Text component=\"span\" size={props.size}>\n <span style={STYLES.key}>\n {props.showQuotes ? `\"${nodeKey}\"` : nodeKey}\n </span>\n <span style={STYLES.colon}>:</span>\n </Text>\n )}\n\n {nodeKey !== undefined && isArrayItem && (\n <Text component=\"span\" size={props.size}>\n <span style={STYLES.key}>{nodeKey}</span>\n <span style={STYLES.colon}>:</span>\n </Text>\n )}\n\n {props.hasChildren ? (\n getPreview()\n ) : isExpandable ? (\n type === \"array\" ? (\n <Text component=\"span\" size={props.size} style={STYLES.preview}>\n []\n </Text>\n ) : (\n <Text component=\"span\" size={props.size} style={STYLES.preview}>\n {\"{}\"}\n </Text>\n )\n ) : (\n props.renderValue(nodeValue, nodeKey, path)\n )}\n\n {props.showCopyButton && (\n <JsonViewerCopyButton\n value={getCopyValue()}\n iconSize={props.config.icon}\n />\n )}\n </Flex>\n );\n};\n","import {\n getTreeExpandedState,\n type MantineSize,\n Text,\n Tree,\n useTree,\n} from \"@mantine/core\";\nimport { type ReactNode, useCallback, useMemo } from \"react\";\nimport { JsonViewerRowNode } from \"./JsonViewerRowNode.tsx\";\nimport {\n getValueType,\n type JsonTreeNode,\n SIZE_CONFIG,\n STYLES,\n} from \"./JsonViewerShared.ts\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerProps {\n data: any;\n /**\n * Depth level to expand by default (0 = collapsed, Infinity = all expanded)\n */\n defaultExpandedDepth?: number;\n /**\n * Maximum nesting depth to render\n */\n maxDepth?: number;\n /**\n * Size variant\n */\n size?: MantineSize;\n /**\n * Whether to show quotes around keys and strings\n */\n showQuotes?: boolean;\n /**\n * Show copy button on row hover\n */\n showCopyButton?: boolean;\n /**\n * Custom value formatter. Return formatted string or undefined to use default.\n */\n formatValue?: (\n key: string | undefined,\n value: any,\n path: string[],\n ) => string | number | undefined;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewer = (props: JsonViewerProps) => {\n const {\n data,\n defaultExpandedDepth = 2,\n maxDepth = 10,\n size = \"sm\",\n showQuotes = false,\n showCopyButton = true,\n formatValue,\n } = props;\n\n const config = SIZE_CONFIG[size] || SIZE_CONFIG.sm;\n\n // Build tree data from JSON with root wrapper\n const treeData = useMemo(() => {\n const type = getValueType(data);\n\n // For objects and arrays, create a root node wrapper\n if (type === \"object\" || type === \"array\") {\n const entries =\n type === \"array\"\n ? (data as any[]).map((v, i) => [String(i), v] as const)\n : Object.entries(data);\n const children = entries\n .map(([k, v]) => buildTreeNodes(v, [], k, type === \"array\", maxDepth))\n .filter((n): n is JsonTreeNode => n !== null);\n\n const rootNode: JsonTreeNode = {\n value: \"root\",\n label: \"\",\n nodeValue: data,\n nodeKey: undefined,\n path: [],\n isArrayItem: false,\n isRoot: true,\n children: children.length > 0 ? children : undefined,\n };\n return [rootNode];\n }\n\n // For primitives, just show the value directly\n const node = buildTreeNodes(data, [], undefined, false, maxDepth);\n return node ? [node] : [];\n }, [data, maxDepth]);\n\n // Compute initial expanded state (root is always expanded by default unless depth is 0)\n const initialExpandedState = useMemo(() => {\n if (defaultExpandedDepth === 0) return {};\n if (defaultExpandedDepth === Infinity) {\n return getTreeExpandedState(treeData, \"*\");\n }\n // Add 1 to depth to account for root node\n const ids = getExpandedIds(treeData, defaultExpandedDepth + 1);\n return getTreeExpandedState(treeData, ids);\n }, [treeData, defaultExpandedDepth]);\n\n const tree = useTree({ initialExpandedState });\n\n // Render value based on type\n const renderValue = useCallback(\n (val: any, key: string | undefined, path: string[]): ReactNode => {\n const custom = formatValue?.(key, val, path);\n if (custom !== undefined) {\n return (\n <Text\n component=\"span\"\n size={size}\n style={STYLES.string}\n className=\"alepha-json-viewer-value\"\n title={String(val)}\n >\n {custom}\n </Text>\n );\n }\n\n const type = getValueType(val);\n switch (type) {\n case \"string\": {\n return (\n <Text\n style={STYLES.string}\n component=\"span\"\n size={size}\n className=\"alepha-json-viewer-value\"\n title={val}\n >\n \"{val}\"\n </Text>\n );\n }\n case \"number\":\n return (\n <Text component=\"span\" size={size} style={STYLES.number}>\n {val}\n </Text>\n );\n case \"boolean\":\n return (\n <Text component=\"span\" size={size} style={STYLES.boolean}>\n {String(val)}\n </Text>\n );\n case \"null\":\n case \"undefined\":\n return (\n <Text component=\"span\" size={size} style={STYLES.null}>\n {type}\n </Text>\n );\n default:\n return (\n <Text component=\"span\" size={size}>\n {String(val)}\n </Text>\n );\n }\n },\n [formatValue, showQuotes, size],\n );\n\n // Render tree node\n const renderNode = useCallback(\n ({\n node,\n expanded,\n hasChildren,\n elementProps,\n }: {\n node: JsonTreeNode;\n expanded: boolean;\n hasChildren: boolean;\n elementProps: any;\n }): ReactNode => {\n return (\n <JsonViewerRowNode\n node={node}\n expanded={expanded}\n hasChildren={hasChildren}\n elementProps={elementProps}\n size={size}\n config={config}\n showQuotes={showQuotes}\n showCopyButton={showCopyButton}\n renderValue={renderValue}\n />\n );\n },\n [config, renderValue, showCopyButton, showQuotes, size],\n );\n\n if (treeData.length === 0) {\n return (\n <Text size={size} style={STYLES.null}>\n {data === null ? \"null\" : data === undefined ? \"undefined\" : \"{}\"}\n </Text>\n );\n }\n\n return (\n <Tree\n data={treeData}\n tree={tree}\n levelOffset={config.levelOffset}\n expandOnClick\n renderNode={renderNode as any}\n styles={{ root: STYLES.root }}\n />\n );\n};\n\n// =============================================================================\n// HELPERS\n// =============================================================================\n\n/**\n * Convert JSON to tree data structure.\n */\nconst buildTreeNodes = (\n data: any,\n path: string[] = [],\n key?: string,\n isArrayItem = false,\n maxDepth = 10,\n): JsonTreeNode | null => {\n const currentPath = key !== undefined ? [...path, key] : path;\n const nodeId = currentPath.length > 0 ? currentPath.join(\".\") : \"root\";\n\n if (currentPath.length > maxDepth) {\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n };\n }\n\n const type = getValueType(data);\n\n if (type === \"object\" || type === \"array\") {\n const entries =\n type === \"array\"\n ? (data as any[]).map((v, i) => [String(i), v] as const)\n : Object.entries(data);\n\n const children = entries\n .map(([k, v]) =>\n buildTreeNodes(v, currentPath, k, type === \"array\", maxDepth),\n )\n .filter((n): n is JsonTreeNode => n !== null);\n\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n children: children.length > 0 ? children : undefined,\n };\n }\n\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n };\n};\n\n/**\n * Get all expandable node IDs up to a certain depth.\n */\nconst getExpandedIds = (\n nodes: JsonTreeNode[],\n targetDepth: number,\n currentDepth = 0,\n): string[] => {\n if (currentDepth >= targetDepth) return [];\n const ids: string[] = [];\n for (const node of nodes) {\n if (node.children) {\n ids.push(node.value);\n ids.push(...getExpandedIds(node.children, targetDepth, currentDepth + 1));\n }\n }\n return ids;\n};\n\nexport default JsonViewer;\n","import type { BaseDialogOptions } from \"@alepha/ui\";\nimport { ui } from \"@alepha/ui\";\nimport { Flex } from \"@mantine/core\";\nimport { JsonViewer } from \"../components/JsonViewer.tsx\";\n\n/**\n * Creates dialog options for a JSON viewer dialog.\n *\n * @param data - The JSON data to display.\n * @param options - Additional dialog options.\n */\nexport const dialogJson = (\n data?: any,\n options?: BaseDialogOptions,\n): BaseDialogOptions => ({\n size: \"lg\",\n title: options?.title || \"Json Viewer\",\n ...options,\n content: (\n <Flex bdrs={\"md\"} w={\"100%\"} flex={1} p={\"sm\"} bg={ui.colors.surface}>\n <JsonViewer size={\"xs\"} data={data} />\n </Flex>\n ),\n});\n","import { $context } from \"alepha\";\nimport {\n type AlephaThemeListAtom,\n alephaThemeListAtom,\n} from \"../atoms/alephaThemeListAtom.ts\";\nimport { UiRouter } from \"../UiRouter.ts\";\n\n/**\n * Convenience function to configure and inject the UiRouter.\n */\nexport const $ui = (options: { themes?: AlephaThemeListAtom } = {}) => {\n const { alepha } = $context();\n if (options.themes) {\n alepha.store.set(alephaThemeListAtom, options.themes);\n }\n return alepha.inject(UiRouter); // Inject as singleton ?\n};\n","import type { ActionProps } from \"@alepha/ui\";\nimport type { DrawerProps, TableProps, TableTrProps } from \"@mantine/core\";\nimport type {\n Alepha,\n Async,\n Page,\n PageMetadata,\n Static,\n TObject,\n} from \"alepha\";\nimport type { DurationLike } from \"alepha/datetime\";\nimport type { FormModel } from \"alepha/react/form\";\nimport type { ReactNode } from \"react\";\nimport type { TypeFormProps } from \"../../form/components/TypeForm.tsx\";\n\n// -----------------------------------------------------------------------------\n// Constants\n// -----------------------------------------------------------------------------\n\nexport const DEFAULT_MAX_VISIBLE_COLUMNS = 8;\n\n// -----------------------------------------------------------------------------\n// Row Action Types\n// -----------------------------------------------------------------------------\n\nexport type DataTableRowAction = ActionProps & {\n /**\n * Label for the action shown in the row menu.\n */\n label?: string;\n visible?: boolean;\n /**\n * When true, skip the automatic table refresh after a successful onClick.\n * By default, the table re-fetches data after every row action completes.\n */\n skipRefresh?: boolean;\n};\n\n// -----------------------------------------------------------------------------\n// Visibility Types\n// -----------------------------------------------------------------------------\n\nexport interface ColumnVisibility {\n [key: string]: boolean;\n}\n\nexport interface FilterVisibility {\n [key: string]: boolean;\n}\n\n// -----------------------------------------------------------------------------\n// Column Types\n// -----------------------------------------------------------------------------\n\nexport interface DataTableColumnContext<Filters extends TObject> {\n index: number;\n form: FormModel<Filters>;\n alepha: Alepha;\n}\n\nexport interface DataTableColumn<T extends object, Filters extends TObject> {\n label: string;\n value?: (item: T, ctx: DataTableColumnContext<Filters>) => ReactNode;\n fit?: boolean;\n /**\n * Enable sorting for this column. When true, clicking the header will sort by this column.\n */\n sortable?: boolean;\n /**\n * The field name to use for sorting. If not provided, the column key is used.\n * Follows Alepha sort convention: 'field' for ASC, '-field' for DESC.\n */\n sortKey?: string;\n /**\n * Hide this column by default. Users can show it via the column picker.\n */\n defaultHidden?: boolean;\n /**\n * Wrap the cell content with an ActionButton. Defaults to `variant=\"unstyled\"`.\n * Receives the row item to generate per-row action props (e.g., dynamic href).\n */\n action?: (item: T) => ActionProps;\n}\n\n// -----------------------------------------------------------------------------\n// Page Types\n// -----------------------------------------------------------------------------\n\nexport type MaybePage<T> = Omit<Page<T>, \"page\"> & {\n page?: Partial<PageMetadata>;\n};\n\nexport interface DataTableSubmitContext<T extends object> {\n items: T[];\n}\n\n// -----------------------------------------------------------------------------\n// Checkbox Types\n// -----------------------------------------------------------------------------\n\nexport interface CheckboxActionContext<T extends object> {\n selectedItems: T[];\n clearSelection: () => void;\n}\n\nexport interface CheckboxAction<T extends object> {\n label: ReactNode;\n icon?: ReactNode;\n intent?: \"primary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"none\";\n onClick: (ctx: CheckboxActionContext<T>) => void | Promise<void>;\n}\n\n// -----------------------------------------------------------------------------\n// Props Types\n// -----------------------------------------------------------------------------\n\nexport interface DataTableProps<T extends object, Filters extends TObject> {\n /**\n * The items to display in the table. Can be a static page of items or a function that returns a promise resolving to a page of items.\n */\n items:\n | MaybePage<T>\n | ((\n filters: Static<Filters> & {\n page: number;\n size: number;\n sort?: string;\n },\n ctx: DataTableSubmitContext<T>,\n ) => Async<MaybePage<T>>);\n\n /**\n * The columns to display in the table. Each column is defined by a key and a DataTableColumn object.\n */\n columns: {\n [key: string]: DataTableColumn<T, Filters>;\n };\n\n defaultSize?: number;\n\n typeFormProps?: Partial<Omit<TypeFormProps<Filters>, \"form\">>;\n\n onFilterChange?: (\n key: string,\n value: unknown,\n form: FormModel<Filters>,\n ) => void;\n\n /**\n * Skip auto-submit when filter values change.\n * When true, filters update form state but do not trigger a refetch.\n * The user must manually refresh (e.g. via the toolbar refresh button).\n */\n skipSubmitOnChange?: boolean;\n\n /**\n * Debounce delay in milliseconds for filter auto-submit.\n * Defaults to 300ms. Set to 0 to disable debounce.\n * Ignored when skipSubmitOnChange is true.\n */\n debounce?: number;\n\n /**\n * Optional filters to apply to the data.\n */\n filters?: TObject;\n\n panel?:\n | ((item: T) => ReactNode)\n | {\n render: (item: T) => ReactNode;\n can?: (item: T) => boolean;\n };\n\n drawer?:\n | ((item: T) => ReactNode)\n | {\n render: (item: T) => ReactNode;\n can?: (item: T) => boolean;\n props?: Omit<DrawerProps, \"opened\" | \"onClose\" | \"children\">;\n };\n\n submitOnInit?: boolean;\n submitEvery?: DurationLike;\n\n /**\n * Enable export button in toolbar (CSV download + clipboard copy).\n */\n withExport?: boolean;\n\n /**\n * Enable row selection with checkboxes. When true, a checkbox column is added as the first column.\n */\n withCheckbox?: boolean;\n\n /**\n * Function to get a unique key for each item.\n * Used to track selected items, panel expansion, and drawer identity.\n * Falls back to item.id then JSON.stringify if not provided.\n */\n getItemKey?: (item: T) => string;\n\n /**\n * Actions to display when items are selected. Each action receives the selected items.\n */\n checkboxActions?: Array<CheckboxAction<T>>;\n\n actions?: Array<ActionProps & { label?: ReactNode }>;\n\n /**\n * Row-level actions rendered as a 3-dot menu on each row.\n * Use `visible` on each action to conditionally show/hide.\n */\n rowActions?: (\n item: T,\n ctx: DataTableColumnContext<Filters>,\n ) => DataTableRowAction[];\n\n /**\n * Enable infinity scroll mode. When true, pagination controls are hidden and new items are loaded automatically when scrolling to the bottom.\n */\n infinityScroll?: boolean;\n\n /**\n * Filter keys to show by default. Default: none (empty array).\n */\n defaultFilters?: string[];\n\n // -------------------------------------------------------------------------------------------------------------------\n // Mantine Props\n // -------------------------------------------------------------------------------------------------------------------\n\n /**\n * Label shown when the table has no results. Defaults to \"No results\".\n */\n emptyLabel?: string;\n\n /**\n * Props to pass to the Mantine Table component.\n */\n tableProps?: TableProps;\n\n /**\n * Function to generate props for each table row based on the item.\n */\n tableTrProps?: (item: T) => TableTrProps;\n}\n","import { Flex } from \"@alepha/ui\";\nimport { type TObject, t } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useMemo } from \"react\";\nimport {\n default as TypeForm,\n type TypeFormProps,\n} from \"../../form/components/TypeForm.tsx\";\nimport type { FilterVisibility } from \"../interfaces/types.ts\";\n\nexport interface DataTableFiltersProps {\n schema: TObject;\n form: FormModel<TObject>;\n typeFormProps?: Partial<Omit<TypeFormProps<TObject>, \"form\">>;\n filterVisibility: FilterVisibility;\n}\n\nconst DataTableFilters = (props: DataTableFiltersProps) => {\n const { schema, form, typeFormProps, filterVisibility } = props;\n\n const visibleSchema = useMemo(() => {\n const visibleKeys = Object.keys(schema.properties).filter(\n (key) => filterVisibility[key] !== false,\n );\n\n if (visibleKeys.length === 0) {\n return null;\n }\n\n const visibleProps = visibleKeys.reduce(\n (acc, key) => {\n acc[key] = schema.properties[key];\n return acc;\n },\n {} as Record<string, unknown>,\n );\n\n return t.object(visibleProps as TObject[\"properties\"]);\n }, [schema, filterVisibility]);\n\n if (!visibleSchema) {\n return null;\n }\n\n return (\n <Flex surface flex={1} mt={-4} p=\"xs\" m=\"xs\" bdrs=\"md\">\n <TypeForm\n {...typeFormProps}\n skipSubmitButton\n fill\n form={form}\n schema={visibleSchema}\n columns={{\n base: 1,\n sm: 2,\n md: 3,\n lg: 4,\n xl: 5,\n }}\n />\n </Flex>\n );\n};\n\nexport default DataTableFilters;\n","import { Flex, Text } from \"@alepha/ui\";\nimport { Pagination, Select } from \"@mantine/core\";\n\nexport interface DataTablePaginationProps {\n page: number;\n size: string;\n totalPages?: number;\n totalElements?: number;\n isFirst?: boolean;\n isLast?: boolean;\n offset: number;\n numberOfElements: number;\n onPageChange: (page: number) => void;\n onSizeChange: (size: number) => void;\n}\n\nconst DataTablePagination = ({\n page,\n size,\n totalPages,\n totalElements,\n isFirst,\n isLast,\n offset,\n numberOfElements,\n onPageChange,\n onSizeChange,\n}: DataTablePaginationProps) => {\n const from = numberOfElements > 0 ? offset + 1 : 0;\n const to = offset + numberOfElements;\n const hasTotal = totalPages != null;\n\n return (\n <Flex\n align=\"center\"\n justify=\"space-between\"\n gap=\"md\"\n px=\"xs\"\n py={4}\n style={{\n borderTop: \"1px solid var(--alepha-border)\",\n }}\n >\n <Flex align=\"center\">\n <Text size=\"xs\" c=\"dimmed\">\n {totalElements != null\n ? `Showing ${from} - ${to} of ${totalElements}`\n : `Showing ${from} - ${to}`}\n </Text>\n </Flex>\n <Flex align=\"center\" gap=\"md\">\n <Flex>\n <Select\n color={\"gray\"}\n c={\"gray\"}\n size={\"xs\"}\n w={96}\n variant=\"default\"\n value={size}\n onChange={(value) => {\n if (value) {\n onSizeChange(Number(value));\n }\n }}\n data={[\n { value: \"10\", label: \"10\" },\n { value: \"25\", label: \"25\" },\n { value: \"50\", label: \"50\" },\n { value: \"100\", label: \"100\" },\n ]}\n />\n </Flex>\n <Flex>\n <Pagination\n size={\"sm\"}\n withEdges={hasTotal}\n withPages={hasTotal}\n total={hasTotal ? totalPages : isLast !== false ? page : page + 1}\n value={page}\n onChange={onPageChange}\n />\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTablePagination;\n","import { ActionButton, ui } from \"@alepha/ui\";\nimport { Checkbox, Flex, Popover, ScrollArea, Text } from \"@mantine/core\";\nimport { IconColumns } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { useState } from \"react\";\nimport {\n type ColumnVisibility,\n type DataTableColumn,\n DEFAULT_MAX_VISIBLE_COLUMNS,\n} from \"../interfaces/types.ts\";\n\nexport interface ColumnPickerProps<T extends object, Filters extends TObject> {\n columns: { [key: string]: DataTableColumn<T, Filters> };\n visibility: ColumnVisibility;\n onVisibilityChange: (visibility: ColumnVisibility) => void;\n}\n\nconst ColumnPicker = <T extends object, Filters extends TObject>({\n columns,\n visibility,\n onVisibilityChange,\n}: ColumnPickerProps<T, Filters>) => {\n const [opened, setOpened] = useState(false);\n const columnEntries = Object.entries(columns);\n\n const handleShowAll = () => {\n const newVisibility = columnEntries.reduce(\n (acc, [key]) => ({ ...acc, [key]: true }),\n {} as ColumnVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleDefault = () => {\n let count = 0;\n const newVisibility = columnEntries.reduce((acc, [key, col]) => {\n if (col.defaultHidden) {\n acc[key] = false;\n } else if (count < DEFAULT_MAX_VISIBLE_COLUMNS) {\n acc[key] = true;\n count++;\n } else {\n acc[key] = false;\n }\n return acc;\n }, {} as ColumnVisibility);\n onVisibilityChange(newVisibility);\n };\n\n const handleToggle = (key: string, checked: boolean) => {\n onVisibilityChange({\n ...visibility,\n [key]: checked,\n });\n };\n\n const visibleCount = columnEntries.filter(\n ([key]) => visibility[key] !== false,\n ).length;\n\n return (\n <Popover\n width={280}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={opened}\n onChange={setOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <div>\n <ActionButton\n variant={\"minimal\"}\n icon={IconColumns}\n onClick={() => setOpened((o) => !o)}\n />\n </div>\n </Popover.Target>\n <Popover.Dropdown\n bg=\"transparent\"\n p=\"xs\"\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <Flex\n direction=\"column\"\n gap=\"xs\"\n bg={ui.colors.surface}\n p=\"sm\"\n bdrs=\"sm\"\n >\n <Flex justify=\"space-between\">\n <Text size=\"sm\" fw={500}>\n Columns ({visibleCount}/{columnEntries.length})\n </Text>\n <Flex gap={4}>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleShowAll}\n >\n All\n </ActionButton>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleDefault}\n >\n Default\n </ActionButton>\n </Flex>\n </Flex>\n\n <ScrollArea.Autosize mah={300}>\n <Flex direction=\"column\" gap={4}>\n {columnEntries.map(([key, col]) => (\n <Checkbox\n key={key}\n label={col.label || key}\n checked={visibility[key] !== false}\n onChange={(e) => handleToggle(key, e.currentTarget.checked)}\n size=\"sm\"\n />\n ))}\n </Flex>\n </ScrollArea.Autosize>\n </Flex>\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default ColumnPicker;\n","import { ActionButton, ui } from \"@alepha/ui\";\nimport { Checkbox, Flex, Popover, ScrollArea, Text } from \"@mantine/core\";\nimport { IconFilter } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { useState } from \"react\";\nimport type { FilterVisibility } from \"../interfaces/types.ts\";\n\nexport interface FilterPickerProps {\n schema: TObject;\n visibility: FilterVisibility;\n onVisibilityChange: (visibility: FilterVisibility) => void;\n}\n\nconst getFieldLabel = (schema: TObject, key: string): string => {\n const prop = schema.properties[key];\n if (prop && typeof prop === \"object\" && \"title\" in prop && prop.title) {\n return prop.title as string;\n }\n // Convert camelCase to Title Case\n return key\n .replace(/([A-Z])/g, \" $1\")\n .replace(/^./, (str) => str.toUpperCase())\n .trim();\n};\n\nconst FilterPicker = ({\n schema,\n visibility,\n onVisibilityChange,\n}: FilterPickerProps) => {\n const [opened, setOpened] = useState(false);\n const filterKeys = Object.keys(schema.properties);\n\n const handleShowAll = () => {\n const newVisibility = filterKeys.reduce(\n (acc, key) => ({ ...acc, [key]: true }),\n {} as FilterVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleHideAll = () => {\n const newVisibility = filterKeys.reduce(\n (acc, key) => ({ ...acc, [key]: false }),\n {} as FilterVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleToggle = (key: string, checked: boolean) => {\n onVisibilityChange({\n ...visibility,\n [key]: checked,\n });\n };\n\n const visibleCount = filterKeys.filter((key) => visibility[key]).length;\n\n return (\n <Popover\n width={280}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={opened}\n onChange={setOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <div>\n <ActionButton\n variant={\"minimal\"}\n icon={IconFilter}\n onClick={() => setOpened((o) => !o)}\n />\n </div>\n </Popover.Target>\n <Popover.Dropdown\n bg=\"transparent\"\n p=\"xs\"\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <Flex\n direction=\"column\"\n gap=\"xs\"\n bg={ui.colors.surface}\n p=\"sm\"\n bdrs=\"sm\"\n >\n <Flex justify=\"space-between\">\n <Text size=\"sm\" fw={500}>\n Filters ({visibleCount}/{filterKeys.length})\n </Text>\n <Flex gap={4}>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleShowAll}\n >\n All\n </ActionButton>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleHideAll}\n >\n None\n </ActionButton>\n </Flex>\n </Flex>\n\n <ScrollArea.Autosize mah={300}>\n <Flex direction=\"column\" gap={4}>\n {filterKeys.map((key) => (\n <Checkbox\n key={key}\n label={getFieldLabel(schema, key)}\n checked={visibility[key] === true}\n onChange={(e) => handleToggle(key, e.currentTarget.checked)}\n size=\"sm\"\n />\n ))}\n </Flex>\n </ScrollArea.Autosize>\n </Flex>\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default FilterPicker;\n","import {\n ActionButton,\n type ActionProps,\n Flex,\n isComponentType,\n} from \"@alepha/ui\";\nimport { Badge, Divider } from \"@mantine/core\";\nimport {\n IconClipboard,\n IconDownload,\n IconRefresh,\n IconX,\n} from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { isValidElement, type ReactNode, useCallback } from \"react\";\nimport type {\n CheckboxAction,\n CheckboxActionContext,\n ColumnVisibility,\n DataTableColumn,\n FilterVisibility,\n} from \"../interfaces/types.ts\";\nimport ColumnPicker from \"./ColumnPicker.tsx\";\nimport FilterPicker from \"./FilterPicker.tsx\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst escapeCsvField = (value: string): string => {\n if (value.includes(\",\") || value.includes('\"') || value.includes(\"\\n\")) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n};\n\nconst extractText = (node: ReactNode): string => {\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(extractText).join(\"\");\n if (typeof node === \"object\" && \"props\" in node) {\n return extractText((node as any).props.children);\n }\n return \"\";\n};\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface DataTableToolbarProps<\n T extends object,\n Filters extends TObject,\n> {\n columns: { [key: string]: DataTableColumn<T, Filters> };\n filters?: TObject;\n columnVisibility: ColumnVisibility;\n filterVisibility: FilterVisibility;\n onColumnVisibilityChange: (visibility: ColumnVisibility) => void;\n onFilterVisibilityChange: (visibility: FilterVisibility) => void;\n actions?: Array<ActionProps & { label?: ReactNode }>;\n onRefresh?: () => void;\n items: T[];\n withExport?: boolean;\n // Checkbox-related props\n selectedItems?: T[];\n checkboxActions?: Array<CheckboxAction<T>>;\n onClearSelection?: () => void;\n}\n\nconst DataTableToolbar = <T extends object, Filters extends TObject>({\n columns,\n filters,\n columnVisibility,\n filterVisibility,\n onColumnVisibilityChange,\n onFilterVisibilityChange,\n actions,\n onRefresh,\n items,\n withExport,\n selectedItems = [],\n checkboxActions,\n onClearSelection,\n}: DataTableToolbarProps<T, Filters>) => {\n const hasSelection = selectedItems.length > 0;\n\n const exportableColumns = useCallback(() => {\n return Object.entries(columns).filter(\n ([key]) => columnVisibility[key] !== false,\n );\n }, [columns, columnVisibility]);\n\n const buildRows = useCallback((): string[][] => {\n const cols = exportableColumns();\n return items.map((item) =>\n cols.map(([_key, col]) => {\n if (!col.value) return \"\";\n const node = col.value(item, {} as any);\n return extractText(node);\n }),\n );\n }, [items, exportableColumns]);\n\n const buildCsv = useCallback((): string => {\n const cols = exportableColumns();\n const header = cols.map(([_key, col]) => escapeCsvField(col.label));\n const rows = buildRows().map((row) => row.map(escapeCsvField));\n return [header.join(\",\"), ...rows.map((r) => r.join(\",\"))].join(\"\\n\");\n }, [exportableColumns, buildRows]);\n\n const exportCsv = useCallback(() => {\n const csv = buildCsv();\n const blob = new Blob([csv], { type: \"text/csv;charset=utf-8;\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = \"export.csv\";\n a.click();\n URL.revokeObjectURL(url);\n }, [buildCsv]);\n\n const exportClipboard = useCallback(async () => {\n const cols = exportableColumns();\n const header = cols.map(([_key, col]) => col.label);\n const rows = buildRows();\n const text = [header.join(\"\\t\"), ...rows.map((r) => r.join(\"\\t\"))].join(\n \"\\n\",\n );\n await navigator.clipboard.writeText(text);\n }, [exportableColumns, buildRows]);\n\n const handleCheckboxAction = async (action: CheckboxAction<T>) => {\n const ctx: CheckboxActionContext<T> = {\n selectedItems,\n clearSelection: onClearSelection || (() => {}),\n };\n await action.onClick(ctx);\n };\n\n return (\n <Flex p=\"xs\">\n <Flex gap={4} align=\"center\">\n {filters && (\n <FilterPicker\n schema={filters}\n visibility={filterVisibility}\n onVisibilityChange={onFilterVisibilityChange}\n />\n )}\n <ColumnPicker\n columns={columns}\n visibility={columnVisibility}\n onVisibilityChange={onColumnVisibilityChange}\n />\n {withExport && (\n <ActionButton\n variant={\"minimal\"}\n icon={IconDownload}\n menu={{\n items: [\n {\n label: \"Export as CSV\",\n icon: <IconDownload size={14} />,\n onClick: exportCsv,\n },\n {\n label: \"Copy to clipboard\",\n icon: <IconClipboard size={14} />,\n onClick: exportClipboard,\n },\n ],\n }}\n />\n )}\n\n {hasSelection && (\n <>\n <Divider orientation=\"vertical\" mx=\"xs\" />\n <Badge variant=\"light\" size=\"lg\">\n {selectedItems.length} selected\n </Badge>\n <ActionButton\n variant={\"minimal\"}\n size=\"compact-sm\"\n icon={IconX}\n onClick={onClearSelection}\n >\n Clear\n </ActionButton>\n {checkboxActions?.map((action, index) => (\n <ActionButton\n key={index}\n variant=\"light\"\n size=\"compact-sm\"\n intent={action.intent}\n icon={\n action.icon && isComponentType(action.icon)\n ? action.icon\n : undefined\n }\n onClick={() => handleCheckboxAction(action)}\n >\n {action.label}\n </ActionButton>\n ))}\n </>\n )}\n </Flex>\n <Flex flex={1} />\n <Flex gap=\"xs\">\n {actions?.map((props, index) =>\n !isValidElement(props) ? (\n <ActionButton key={index} {...(props as ActionProps)}>\n {(props as ActionProps & { label?: ReactNode }).label}\n </ActionButton>\n ) : (\n props\n ),\n )}\n <ActionButton\n variant={\"minimal\"}\n icon={IconRefresh}\n onClick={onRefresh}\n />\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTableToolbar;\n","import { useCallback, useMemo, useState } from \"react\";\n\nexport interface UseTableSelectionReturn<T> {\n selectedItems: T[];\n allSelected: boolean;\n someSelected: boolean;\n toggleItem: (item: T) => void;\n toggleAll: () => void;\n clear: () => void;\n isSelected: (item: T) => boolean;\n}\n\nexport const useTableSelection = <T>(\n items: T[],\n getItemKey: (item: T) => string,\n enabled: boolean,\n): UseTableSelectionReturn<T> => {\n const [selectedKeys, setSelectedKeys] = useState<Set<string>>(new Set());\n\n const selectedItems = useMemo(() => {\n if (!enabled) return [];\n return items.filter((item) => selectedKeys.has(getItemKey(item)));\n }, [items, selectedKeys, getItemKey, enabled]);\n\n const allSelected = useMemo(() => {\n if (items.length === 0) return false;\n return items.every((item) => selectedKeys.has(getItemKey(item)));\n }, [items, selectedKeys, getItemKey]);\n\n const someSelected = useMemo(() => {\n if (items.length === 0) return false;\n const count = items.filter((item) =>\n selectedKeys.has(getItemKey(item)),\n ).length;\n return count > 0 && count < items.length;\n }, [items, selectedKeys, getItemKey]);\n\n const toggleItem = useCallback(\n (item: T) => {\n const key = getItemKey(item);\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n },\n [getItemKey],\n );\n\n const toggleAll = useCallback(() => {\n if (allSelected) {\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n for (const item of items) next.delete(getItemKey(item));\n return next;\n });\n } else {\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n for (const item of items) next.add(getItemKey(item));\n return next;\n });\n }\n }, [allSelected, items, getItemKey]);\n\n const clear = useCallback(() => setSelectedKeys(new Set()), []);\n\n const isSelected = useCallback(\n (item: T) => selectedKeys.has(getItemKey(item)),\n [selectedKeys, getItemKey],\n );\n\n return {\n selectedItems,\n allSelected,\n someSelected,\n toggleItem,\n toggleAll,\n clear,\n isSelected,\n };\n};\n","import { ActionButton, Flex, isComponentType, Text, ui } from \"@alepha/ui\";\nimport { Checkbox, Drawer, Loader, Table, UnstyledButton } from \"@mantine/core\";\nimport {\n IconArrowDown,\n IconArrowsSort,\n IconArrowUp,\n IconChevronDown,\n IconChevronRight,\n IconDotsVertical,\n} from \"@tabler/icons-react\";\nimport { Alepha, type Static, type TObject, t } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useInject } from \"alepha/react\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n ColumnVisibility,\n DataTableColumnContext,\n DataTableProps,\n FilterVisibility,\n MaybePage,\n} from \"../interfaces/types.ts\";\nimport { DEFAULT_MAX_VISIBLE_COLUMNS } from \"../interfaces/types.ts\";\nimport DataTableFilters, {\n type DataTableFiltersProps,\n} from \"./DataTableFilters.tsx\";\nimport DataTablePagination from \"./DataTablePagination.tsx\";\nimport DataTableToolbar from \"./DataTableToolbar.tsx\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\ntype SortDirection = \"asc\" | \"desc\" | null;\n\n/**\n * Parse the sort string to get direction for a specific field.\n * Alepha convention: 'field' = ASC, '-field' = DESC\n */\nconst getSortDirection = (\n sortString: string | undefined,\n field: string,\n): SortDirection => {\n if (!sortString) return null;\n const parts = sortString.split(\",\").map((s) => s.trim());\n for (const part of parts) {\n if (part === field) return \"asc\";\n if (part === `-${field}`) return \"desc\";\n }\n return null;\n};\n\n/**\n * Toggle sort for a field in the sort string.\n * Cycles: null -> asc -> desc -> null\n */\nconst toggleSort = (\n sortString: string | undefined,\n field: string,\n): string | undefined => {\n const current = getSortDirection(sortString, field);\n\n // Remove existing sort for this field\n const parts = (sortString || \"\")\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s && s !== field && s !== `-${field}`);\n\n if (current === null) {\n // No sort -> ASC\n parts.unshift(field);\n } else if (current === \"asc\") {\n // ASC -> DESC\n parts.unshift(`-${field}`);\n }\n // DESC -> remove (already filtered out above)\n\n return parts.length > 0 ? parts.join(\",\") : undefined;\n};\n\nconst toAriaSort = (\n dir: SortDirection,\n): \"ascending\" | \"descending\" | \"none\" => {\n if (dir === \"asc\") return \"ascending\";\n if (dir === \"desc\") return \"descending\";\n return \"none\";\n};\n\nconst FIT_STYLE = { width: 1, whiteSpace: \"nowrap\" } as const;\n\nconst DataTable = <T extends object, Filters extends TObject>(\n props: DataTableProps<T, Filters>,\n) => {\n const [items, setItems] = useState<MaybePage<T>>(\n typeof props.items === \"function\" ? { content: [] } : props.items,\n );\n const itemsRef = useRef(items);\n const [loaded, setLoaded] = useState(\n typeof props.items !== \"function\" || !props.submitOnInit,\n );\n\n const defaultSize = props.defaultSize || (props.infinityScroll ? 100 : 10);\n const [page, setPage] = useState(1);\n const [size, setSize] = useState(String(defaultSize));\n const [currentPage, setCurrentPage] = useState(0);\n const alepha = useInject(Alepha);\n itemsRef.current = items;\n const sentinelRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Column visibility state\n const [columnVisibility, setColumnVisibility] = useState<ColumnVisibility>(\n () => {\n const entries = Object.entries(props.columns);\n let visibleCount = 0;\n return entries.reduce((acc, [key, col]) => {\n if (col.defaultHidden) {\n acc[key] = false;\n } else if (visibleCount < DEFAULT_MAX_VISIBLE_COLUMNS) {\n acc[key] = true;\n visibleCount++;\n } else {\n acc[key] = false;\n }\n return acc;\n }, {} as ColumnVisibility);\n },\n );\n\n // Filter visibility state — default: none visible\n const [filterVisibility, setFilterVisibility] = useState<FilterVisibility>(\n () => {\n if (!props.filters?.properties) return {};\n const defaults = new Set(props.defaultFilters ?? []);\n return Object.keys(props.filters.properties).reduce(\n (acc, key) => ({ ...acc, [key]: defaults.has(key) }),\n {} as FilterVisibility,\n );\n },\n );\n\n // Compute visible columns\n const visibleColumns = useMemo(() => {\n return Object.entries(props.columns).filter(\n ([key]) => columnVisibility[key] !== false,\n );\n }, [props.columns, columnVisibility]);\n\n // Current sort string\n const [sortString, setSortString] = useState<string | undefined>(undefined);\n\n // Handle column header click for sorting\n const handleSortClick = (columnKey: string, sortKey?: string) => {\n const field = sortKey || columnKey;\n const newSort = toggleSort(sortString, field);\n setSortString(newSort);\n form.input.sort.set(newSort);\n form.input.page.set(0); // Reset to first page when sorting changes\n };\n\n // Item key resolver — prefers explicit prop, falls back to .id, then JSON\n const getItemKey = useCallback(\n (item: T): string => {\n if (props.getItemKey) return props.getItemKey(item);\n if (\"id\" in item) return String((item as Record<string, unknown>).id);\n return JSON.stringify(item);\n },\n [props.getItemKey],\n );\n\n // Checkbox selection (extracted hook)\n const selection = useTableSelection(\n items.content as T[],\n getItemKey,\n props.withCheckbox ?? false,\n );\n\n // Panel — normalize shorthand vs object form\n const panelConfig = useMemo(() => {\n if (!props.panel) return null;\n if (typeof props.panel === \"function\") {\n return { render: props.panel, can: undefined };\n }\n return props.panel;\n }, [props.panel]);\n\n // Drawer — normalize shorthand vs object form\n const [drawerItem, setDrawerItem] = useState<T | null>(null);\n const drawerConfig = useMemo(() => {\n if (!props.drawer) return null;\n if (typeof props.drawer === \"function\") {\n return { render: props.drawer, can: undefined, props: undefined };\n }\n return props.drawer;\n }, [props.drawer]);\n\n // Panel expand state\n const [expandedKeys, setExpandedKeys] = useState<Set<string>>(new Set());\n\n const toggleExpand = useCallback((key: string) => {\n setExpandedKeys((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n\n const form = useForm(\n {\n schema: t.object({\n ...(props.filters ? props.filters.properties : {}),\n page: t.number({ default: 0 }),\n size: t.number({ default: defaultSize }),\n sort: t.optional(t.string()),\n }),\n handler: async (values) => {\n if (typeof props.items === \"function\") {\n const response = await props.items(\n values as Static<Filters> & {\n page: number;\n size: number;\n sort?: string;\n },\n {\n items: itemsRef.current.content,\n },\n );\n\n if (props.infinityScroll && values.page > 0) {\n // Append new items to existing ones for infinity scroll\n setItems((prev) => ({\n ...response,\n content: [...prev.content, ...response.content],\n }));\n } else {\n setItems(response);\n }\n\n setCurrentPage(values.page);\n if (!loaded) setLoaded(true);\n }\n },\n onReset: async () => {\n setPage(1);\n setSize(String(defaultSize));\n await form.submit();\n },\n onChange: async (key, value) => {\n if (key === \"page\") {\n setPage(value + 1);\n await form.submit();\n return;\n }\n\n if (key === \"size\") {\n setSize(String(value));\n form.input.page.set(0);\n return;\n }\n\n props.onFilterChange?.(\n key,\n value,\n form as unknown as FormModel<Filters>,\n );\n\n if (props.skipSubmitOnChange) return;\n\n form.input.page.set(0);\n\n const delay = props.debounce ?? 300;\n if (delay > 0) {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n form.submit();\n }, delay);\n } else {\n await form.submit();\n }\n },\n },\n [],\n );\n\n const dt = useInject(DateTimeProvider);\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n };\n }, []);\n\n useEffect(() => {\n if (props.submitOnInit) {\n form.submit();\n }\n if (props.submitEvery) {\n const it = dt.createInterval(() => {\n form.submit();\n }, props.submitEvery);\n return () => dt.clearInterval(it);\n }\n }, []);\n\n useEffect(() => {\n if (typeof props.items !== \"function\") {\n setItems(props.items);\n }\n }, [props.items]);\n\n // Infinity scroll via IntersectionObserver\n useEffect(() => {\n if (!props.infinityScroll || typeof props.items !== \"function\") return;\n\n const sentinel = sentinelRef.current;\n if (!sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (!entries[0].isIntersecting || form.submitting) return;\n\n const totalPages = items.page?.totalPages ?? 1;\n if (currentPage + 1 < totalPages) {\n form.input.page.set(currentPage + 1);\n }\n },\n { rootMargin: \"300px\" },\n );\n\n observer.observe(sentinel);\n return () => observer.disconnect();\n }, [\n props.infinityScroll,\n form.submitting,\n items.page?.totalPages,\n currentPage,\n form,\n ]);\n\n // Total column count (for colSpan)\n const totalColumns =\n visibleColumns.length +\n (panelConfig ? 1 : 0) +\n (props.withCheckbox ? 1 : 0) +\n (props.rowActions ? 1 : 0);\n\n // Checkbox header column\n const checkboxHeader = props.withCheckbox ? (\n <Table.Th style={{ width: 40 }}>\n <Checkbox\n checked={selection.allSelected}\n indeterminate={selection.someSelected}\n onChange={selection.toggleAll}\n aria-label=\"Select all\"\n />\n </Table.Th>\n ) : null;\n\n const head = visibleColumns.map(([key, col]) => {\n const sortField = col.sortKey || key;\n const sortDir = col.sortable\n ? getSortDirection(sortString, sortField)\n : null;\n\n return (\n <Table.Th\n key={key}\n onClick={\n col.sortable ? () => handleSortClick(key, col.sortKey) : undefined\n }\n aria-sort={col.sortable ? toAriaSort(sortDir) : undefined}\n style={{\n ...(col.fit ? FIT_STYLE : {}),\n ...(col.sortable ? { cursor: \"pointer\", userSelect: \"none\" } : {}),\n }}\n >\n <Flex align=\"center\" gap={4}>\n <Text bold muted size=\"xs\">\n {col.label}\n </Text>\n {col.sortable && (\n <Flex c=\"dimmed\">\n {sortDir === \"asc\" && <IconArrowUp size={ui.sizes.icon.xs} />}\n {sortDir === \"desc\" && <IconArrowDown size={ui.sizes.icon.xs} />}\n {sortDir === null && <IconArrowsSort size={ui.sizes.icon.xs} />}\n </Flex>\n )}\n </Flex>\n </Table.Th>\n );\n });\n\n const rows = items.content.flatMap((item, index) => {\n const trProps = props.tableTrProps ? props.tableTrProps(item as T) : {};\n const itemKey = getItemKey(item as T);\n const isSelected = selection.isSelected(item as T);\n const showPanel =\n panelConfig && (panelConfig.can ? panelConfig.can(item as T) : true);\n const isExpanded = expandedKeys.has(itemKey);\n const canOpenDrawer =\n drawerConfig && (drawerConfig.can ? drawerConfig.can(item as T) : true);\n\n const elements = [\n <Table.Tr\n key={itemKey}\n {...trProps}\n style={{\n ...(canOpenDrawer ? { cursor: \"pointer\" } : {}),\n ...(trProps.style ?? {}),\n }}\n onClick={(e) => {\n if (canOpenDrawer) setDrawerItem(item as T);\n trProps.onClick?.(e);\n }}\n >\n {panelConfig && (\n <Table.Td style={{ width: 36, textAlign: \"center\" }} py={2} px={0}>\n {showPanel && (\n <UnstyledButton\n onClick={(e) => {\n e.stopPropagation();\n toggleExpand(itemKey);\n }}\n style={{ display: \"inline-flex\" }}\n >\n <Flex c=\"dimmed\" align=\"center\" justify=\"center\">\n {isExpanded ? (\n <IconChevronDown size={ui.sizes.icon.sm} />\n ) : (\n <IconChevronRight size={ui.sizes.icon.sm} />\n )}\n </Flex>\n </UnstyledButton>\n )}\n </Table.Td>\n )}\n {props.withCheckbox && (\n <Table.Td style={{ width: 40 }} onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={isSelected}\n onChange={() => selection.toggleItem(item as T)}\n aria-label=\"Select row\"\n />\n </Table.Td>\n )}\n {visibleColumns.map(([key, col]) => {\n const ctx = {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n } as DataTableColumnContext<Filters>;\n\n const content = col.value?.(item as T, ctx);\n\n return (\n <Table.Td key={key} style={col.fit ? FIT_STYLE : undefined}>\n {col.action ? (\n <ActionButton\n td={\"inherit\"}\n unstyled\n {...col.action(item as T)}\n >\n {content}\n </ActionButton>\n ) : (\n content\n )}\n </Table.Td>\n );\n })}\n {props.rowActions &&\n (() => {\n const ctx = {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n } as DataTableColumnContext<Filters>;\n const actions = props.rowActions!(item as T, ctx).filter(\n (a) => a.visible !== false,\n );\n if (actions.length === 0) return <Table.Td style={FIT_STYLE} />;\n return (\n <Table.Td\n py={2}\n px={4}\n style={FIT_STYLE}\n onClick={(e) => e.stopPropagation()}\n >\n <ActionButton\n variant={\"minimal\"}\n size=\"xs\"\n icon={IconDotsVertical}\n menu={{\n items: actions.map((action) => {\n const Icon = action.icon;\n return {\n label:\n action.label ??\n (typeof action.tooltip === \"string\"\n ? action.tooltip\n : undefined),\n icon:\n Icon && isComponentType(Icon) ? (\n <Icon size={14} />\n ) : (\n (Icon as ReactNode)\n ),\n onClick: (action as any).onClick\n ? async () => {\n await (action as any).onClick();\n if (!action.skipRefresh) {\n await form.submit();\n }\n }\n : undefined,\n color: action.color,\n };\n }),\n }}\n />\n </Table.Td>\n );\n })()}\n </Table.Tr>,\n ];\n\n if (panelConfig && showPanel && isExpanded) {\n elements.push(\n <Table.Tr key={`${itemKey}-panel`}>\n <Table.Td colSpan={totalColumns} p={0}>\n {panelConfig.render(item as T)}\n </Table.Td>\n </Table.Tr>,\n );\n }\n\n return elements;\n });\n\n const filterSchema = useMemo(() => {\n if (!props.filters) return null;\n return t.omit(form.options.schema, [\"page\", \"size\", \"sort\"]);\n }, [props.filters, form.options.schema]);\n\n return (\n <Flex\n gap={\"xs\"}\n flex={1}\n p={0}\n direction=\"column\"\n style={{ overflow: \"hidden\" }}\n >\n <Flex rounded bordered elevated shadowed={\"xs\"} col>\n <DataTableToolbar\n columns={props.columns}\n filters={props.filters}\n columnVisibility={columnVisibility}\n filterVisibility={filterVisibility}\n onColumnVisibilityChange={setColumnVisibility}\n onFilterVisibilityChange={setFilterVisibility}\n actions={props.actions}\n onRefresh={() => form.submit()}\n items={items.content as T[]}\n withExport={props.withExport}\n selectedItems={selection.selectedItems}\n checkboxActions={props.checkboxActions}\n onClearSelection={selection.clear}\n />\n\n {filterSchema && props.filters && (\n <DataTableFilters\n schema={filterSchema}\n form={form as unknown as FormModel<TObject>}\n typeFormProps={\n props.typeFormProps as DataTableFiltersProps[\"typeFormProps\"]\n }\n filterVisibility={filterVisibility}\n />\n )}\n </Flex>\n\n <Flex\n col\n rounded\n bordered\n elevated\n shadowed={\"xs\"}\n flex={1}\n style={{ minHeight: 0 }}\n >\n <Flex className=\"overflow-auto\" flex={1} style={{ minHeight: 0 }} col>\n <Table\n aria-label=\"Data table\"\n withRowBorders\n highlightOnHover\n {...props.tableProps}\n >\n <Table.Thead\n bdrs={\"md\"}\n style={{\n position: \"sticky\",\n top: 0,\n zIndex: 1,\n backgroundColor: \"var(--alepha-elevated)\",\n }}\n >\n <Table.Tr>\n {panelConfig && <Table.Th style={{ width: 36 }} />}\n {checkboxHeader}\n {head}\n {props.rowActions && <Table.Th style={FIT_STYLE} />}\n </Table.Tr>\n </Table.Thead>\n <Table.Tbody>\n {!loaded || form.submitting ? (\n <Table.Tr>\n <Table.Td colSpan={totalColumns || 1} py=\"sm\">\n <Flex justify=\"center\" p={\"md\"}>\n <Loader size=\"sm\" type=\"dots\" />\n </Flex>\n </Table.Td>\n </Table.Tr>\n ) : rows.length === 0 ? (\n <Table.Tr>\n <Table.Td colSpan={totalColumns || 1} py=\"xl\">\n <Flex justify=\"center\">\n <Text c=\"dimmed\" size=\"sm\">\n {props.emptyLabel ?? \"No results\"}\n </Text>\n </Flex>\n </Table.Td>\n </Table.Tr>\n ) : (\n rows\n )}\n </Table.Tbody>\n </Table>\n </Flex>\n\n {props.infinityScroll && <div ref={sentinelRef} />}\n\n {!props.infinityScroll && (\n <DataTablePagination\n page={page}\n size={size}\n totalPages={items.page?.totalPages}\n totalElements={items.page?.totalElements}\n isFirst={items.page?.isFirst}\n isLast={items.page?.isLast}\n offset={items.page?.offset ?? 0}\n numberOfElements={items.content.length}\n onPageChange={(value) => {\n form.input.page.set(value - 1);\n }}\n onSizeChange={(value) => {\n form.input.size.set(value);\n }}\n />\n )}\n\n {drawerConfig && (\n <Drawer\n opened={drawerItem !== null}\n onClose={() => setDrawerItem(null)}\n position=\"right\"\n size=\"xl\"\n {...drawerConfig.props}\n >\n {drawerItem && drawerConfig.render(drawerItem)}\n </Drawer>\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTable;\n","import type { TObject, TProperties, TSchema } from \"alepha\";\n\nexport interface SchemaField {\n name: string;\n path: string;\n type: string;\n enum?: readonly any[];\n format?: string;\n description?: string;\n nested?: SchemaField[];\n}\n\n/**\n * Extract field information from a TypeBox schema for query building.\n * Supports nested objects and provides field metadata for autocomplete.\n */\nexport function extractSchemaFields(\n schema: TObject | TProperties,\n prefix = \"\",\n): SchemaField[] {\n const fields: SchemaField[] = [];\n\n // Safety check\n if (!schema || typeof schema !== \"object\") {\n return fields;\n }\n\n // Handle TObject wrapper\n const properties =\n \"properties\" in schema ? schema.properties : (schema as TProperties);\n\n // Safety check for properties\n if (!properties || typeof properties !== \"object\") {\n return fields;\n }\n\n for (const [key, value] of Object.entries(properties)) {\n // Skip if value is not an object (type guard)\n if (typeof value !== \"object\" || value === null) {\n continue;\n }\n\n const fieldSchema = value as TSchema & {\n format?: string;\n enum?: readonly any[];\n description?: string;\n };\n\n const path = prefix ? `${prefix}.${key}` : key;\n\n // Determine the display type - use format for datetime-related fields\n const format = \"format\" in fieldSchema ? fieldSchema.format : undefined;\n const baseType =\n \"type\" in fieldSchema ? (fieldSchema.type as string) : \"object\";\n\n let displayType = baseType;\n if (format === \"date-time\") {\n displayType = \"datetime\";\n } else if (format === \"date\") {\n displayType = \"date\";\n } else if (format === \"time\") {\n displayType = \"time\";\n } else if (format === \"duration\") {\n displayType = \"duration\";\n }\n\n const field: SchemaField = {\n name: key,\n path,\n type: displayType,\n format,\n description:\n \"description\" in fieldSchema ? fieldSchema.description : undefined,\n };\n\n // Handle enum\n if (\"enum\" in fieldSchema && fieldSchema.enum) {\n field.enum = fieldSchema.enum;\n field.type = \"enum\";\n }\n\n // Handle nested objects\n if (\n \"type\" in fieldSchema &&\n fieldSchema.type === \"object\" &&\n \"properties\" in fieldSchema &&\n typeof fieldSchema.properties === \"object\"\n ) {\n field.nested = extractSchemaFields(\n fieldSchema.properties as TProperties,\n path,\n );\n }\n\n fields.push(field);\n\n // Also add nested fields to the flat list for autocomplete\n if (field.nested) {\n fields.push(...field.nested);\n }\n }\n\n return fields;\n}\n\n/**\n * Get suggested operators based on field type\n */\nexport function getOperatorsForField(field: SchemaField): string[] {\n const allOperators = [\"=\", \"!=\"];\n\n if (field.enum) {\n // Enum fields: equality and IN array\n return [...allOperators, \"in\"];\n }\n\n switch (field.type) {\n case \"string\":\n case \"text\":\n // String fields: equality and null checks (wildcards supported in = operator)\n return [...allOperators, \"null\"];\n\n case \"number\":\n case \"integer\":\n // Numeric fields: all comparison operators\n return [...allOperators, \">\", \">=\", \"<\", \"<=\"];\n\n case \"boolean\":\n // Boolean fields: only equality\n return allOperators;\n\n case \"datetime\":\n case \"date\":\n // Date fields: all comparison operators\n return [...allOperators, \">\", \">=\", \"<\", \"<=\"];\n\n default:\n return [...allOperators, \"null\"];\n }\n}\n\n/**\n * Get operator symbol and description\n */\nexport const OPERATOR_INFO: Record<\n string,\n { symbol: string; label: string; example: string }\n> = {\n eq: { symbol: \"=\", label: \"equals\", example: \"name=John\" },\n ne: { symbol: \"!=\", label: \"not equals\", example: \"status!=archived\" },\n gt: { symbol: \">\", label: \"greater than\", example: \"age>18\" },\n gte: { symbol: \">=\", label: \"greater or equal\", example: \"age>=18\" },\n lt: { symbol: \"<\", label: \"less than\", example: \"age<65\" },\n lte: { symbol: \"<=\", label: \"less or equal\", example: \"age<=65\" },\n null: { symbol: \"=null\", label: \"is null\", example: \"deletedAt=null\" },\n notNull: {\n symbol: \"!=null\",\n label: \"is not null\",\n example: \"email!=null\",\n },\n in: {\n symbol: \"[...]\",\n label: \"in array\",\n example: \"status=[active,pending]\",\n },\n};\n","import {\n IconAt,\n IconCalendar,\n IconClock,\n IconColorPicker,\n IconFile,\n IconHash,\n IconKey,\n IconLetterCase,\n IconLink,\n IconList,\n IconMail,\n IconPalette,\n IconPhone,\n IconSelector,\n IconToggleLeft,\n} from \"@tabler/icons-react\";\nimport type { ReactElement } from \"react\";\nimport { ui } from \"../constants/ui.ts\";\n\nexport type IconSize = keyof typeof ui.sizes.icon;\n\n/**\n * Get the default icon for an input based on its type, format, or name.\n */\nexport const getDefaultIcon = (params: {\n type?: string;\n format?: string;\n name?: string;\n isEnum?: boolean;\n isArray?: boolean;\n size?: IconSize;\n}): ReactElement => {\n const { type, format, name, isEnum, isArray, size = \"xs\" } = params;\n const iconSize = ui.sizes.icon[size] - 4; // TODO: better mapping\n\n // Format-based icons (highest priority)\n if (format) {\n switch (format) {\n case \"email\":\n return <IconMail size={iconSize} />;\n case \"url\":\n case \"uri\":\n return <IconLink size={iconSize} />;\n case \"tel\":\n case \"phone\":\n return <IconPhone size={iconSize} />;\n case \"date\":\n return <IconCalendar size={iconSize} />;\n case \"date-time\":\n return <IconCalendar size={iconSize} />;\n case \"time\":\n return <IconClock size={iconSize} />;\n case \"color\":\n return <IconColorPicker size={iconSize} />;\n case \"uuid\":\n return <IconKey size={iconSize} />;\n }\n }\n\n // Name-based icons (medium priority)\n if (name) {\n const nameLower = name.toLowerCase();\n if (nameLower.includes(\"password\") || nameLower.includes(\"secret\")) {\n return <IconKey size={iconSize} />;\n }\n if (nameLower.includes(\"email\") || nameLower.includes(\"mail\")) {\n return <IconMail size={iconSize} />;\n }\n if (nameLower.includes(\"url\") || nameLower.includes(\"link\")) {\n return <IconLink size={iconSize} />;\n }\n if (nameLower.includes(\"phone\") || nameLower.includes(\"tel\")) {\n return <IconPhone size={iconSize} />;\n }\n if (nameLower.includes(\"color\")) {\n return <IconPalette size={iconSize} />;\n }\n if (nameLower.includes(\"file\") || nameLower.includes(\"upload\")) {\n return <IconFile size={iconSize} />;\n }\n if (nameLower.includes(\"date\")) {\n return <IconCalendar size={iconSize} />;\n }\n if (nameLower.includes(\"time\")) {\n return <IconClock size={iconSize} />;\n }\n }\n\n // Type-based icons (lowest priority)\n if (isEnum || isArray) {\n return <IconSelector size={iconSize} />;\n }\n\n if (type) {\n switch (type) {\n case \"boolean\":\n return <IconToggleLeft size={iconSize} />;\n case \"number\":\n case \"integer\":\n return <IconHash size={iconSize} />;\n case \"array\":\n return <IconList size={iconSize} />;\n case \"string\":\n return <IconLetterCase size={iconSize} />;\n }\n }\n\n // Default icon\n return <IconAt size={iconSize} />;\n};\n","/**\n * Capitalizes the first letter of a string.\n *\n * @example\n * capitalize(\"hello\") // \"Hello\"\n */\nexport const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\n/**\n * Converts camelCase or snake_case to Title Case with spaces.\n *\n * @example\n * toTitleCase(\"userName\") // \"User Name\"\n * toTitleCase(\"first_name\") // \"First Name\"\n * toTitleCase(\"email\") // \"Email\"\n */\nexport const toTitleCase = (str: string): string => {\n return str\n .replace(/([a-z])([A-Z])/g, \"$1 $2\") // camelCase -> camel Case\n .replace(/_/g, \" \") // snake_case -> snake case\n .replace(/\\b\\w/g, (c) => c.toUpperCase()); // capitalize words\n};\n\n/**\n * Converts a path or identifier string into a pretty display name.\n * For paths like \"/contacts/0/name\", extracts just the field name \"Name\".\n * Handles camelCase and snake_case conversion to Title Case.\n *\n * @example\n * prettyName(\"/userName\") // \"User Name\"\n * prettyName(\"/contacts/0/email\") // \"Email\"\n * prettyName(\"/address/streetName\") // \"Street Name\"\n * prettyName(\"first_name\") // \"First Name\"\n */\nexport const prettyName = (name: string): string => {\n // Split by slash and filter out empty strings and numeric indices\n const segments = name.split(\"/\").filter((s) => s && !/^\\d+$/.test(s));\n\n // Use the last non-numeric segment as the field name\n const fieldName = segments[segments.length - 1] || name.replaceAll(\"/\", \"\");\n\n return toTitleCase(fieldName);\n};\n","import { $module, type Static } from \"alepha\";\nimport { AlephaReactForm } from \"alepha/react/form\";\nimport { AlephaReactHead } from \"alepha/react/head\";\nimport { AlephaReactI18n } from \"alepha/react/i18n\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { alephaSidebarAtom } from \"./atoms/alephaSidebarAtom.ts\";\nimport { alephaThemeAtom } from \"./atoms/alephaThemeAtom.ts\";\nimport { alephaThemeOverridesAtom } from \"./atoms/alephaThemeOverridesAtom.ts\";\nimport { ThemeProvider } from \"./providers/ThemeProvider.ts\";\nimport { DialogService } from \"./services/DialogService.tsx\";\nimport { ToastService } from \"./services/ToastService.tsx\";\nimport { UiRouter } from \"./UiRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./atoms/alephaSidebarAtom.ts\";\nexport * from \"./atoms/alephaThemeAtom.ts\";\nexport * from \"./atoms/alephaThemeListAtom.ts\";\nexport * from \"./atoms/alephaThemeOverridesAtom.ts\";\nexport * from \"./atoms/themes/default.ts\";\nexport * from \"./atoms/themes/midnight.ts\";\nexport type { AlephaMantineProviderProps } from \"./components/AlephaMantineProvider.tsx\";\nexport { default as AlephaMantineProvider } from \"./components/AlephaMantineProvider.tsx\";\nexport type {\n ActionClickButtonProps,\n ActionCommonProps,\n ActionMenuConfig,\n ActionMenuItem,\n ActionNavigationButtonProps,\n ActionProps,\n ActionSubmitButtonProps,\n} from \"./components/buttons/ActionButton.tsx\";\nexport { default as ActionButton } from \"./components/buttons/ActionButton.tsx\";\nexport { default as BurgerButton } from \"./components/buttons/BurgerButton.tsx\";\nexport type { ClipboardButtonProps } from \"./components/buttons/ClipboardButton.tsx\";\nexport { default as ClipboardButton } from \"./components/buttons/ClipboardButton.tsx\";\nexport { default as DarkModeButton } from \"./components/buttons/DarkModeButton.tsx\";\nexport { default as LanguageButton } from \"./components/buttons/LanguageButton.tsx\";\nexport type { OmnibarButtonProps } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as OmnibarButton } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as ThemeButton } from \"./components/buttons/ThemeButton.tsx\";\nexport { default as SidebarCollapseButton } from \"./components/buttons/ToggleSidebarButton.tsx\";\nexport type {\n DetailDrawerProps,\n DetailDrawerStatus,\n DetailDrawerTab,\n} from \"./components/data/DetailDrawer.tsx\";\nexport { default as DetailDrawer } from \"./components/data/DetailDrawer.tsx\";\nexport type {\n DetailListItem,\n DetailListProps,\n} from \"./components/data/DetailList.tsx\";\nexport { default as DetailList } from \"./components/data/DetailList.tsx\";\nexport type {\n StatCardItem,\n StatCardsProps,\n} from \"./components/data/StatCards.tsx\";\nexport { default as StatCards } from \"./components/data/StatCards.tsx\";\nexport { default as AlertDialog } from \"./components/dialogs/AlertDialog.tsx\";\nexport { default as ConfirmDialog } from \"./components/dialogs/ConfirmDialog.tsx\";\nexport { default as PromptDialog } from \"./components/dialogs/PromptDialog.tsx\";\nexport type { FlexProps } from \"./components/Flex.tsx\";\nexport { default as Flex } from \"./components/Flex.tsx\";\nexport { default as Heading } from \"./components/Heading.tsx\";\nexport type {\n AppBarBack,\n AppBarBurger,\n AppBarDark,\n AppBarDivider,\n AppBarElement,\n AppBarItem,\n AppBarLang,\n AppBarLogo,\n AppBarProps,\n AppBarSearch,\n AppBarSpacer,\n} from \"./components/layout/AppBar.tsx\";\nexport { default as AppBar } from \"./components/layout/AppBar.tsx\";\nexport type { BreadcrumbProps } from \"./components/layout/Breadcrumb.tsx\";\nexport { default as Breadcrumbs } from \"./components/layout/Breadcrumb.tsx\";\nexport type { ContainerProps } from \"./components/layout/Container.tsx\";\nexport { default as Container } from \"./components/layout/Container.tsx\";\nexport {\n type DashboardShellProps,\n type DashboardShellProps as AdminShellProps,\n default as DashboardShell,\n default as AdminShell,\n} from \"./components/layout/DashboardShell.tsx\";\nexport type { OmnibarProps } from \"./components/layout/Omnibar.tsx\";\nexport { default as Omnibar } from \"./components/layout/Omnibar.tsx\";\nexport type {\n SidebarAbstractItem,\n SidebarButtonTheme,\n SidebarDivider,\n SidebarElement,\n SidebarMenuItem,\n SidebarNode,\n SidebarProps,\n SidebarSearch,\n SidebarSection,\n SidebarSpacer,\n SidebarTheme,\n} from \"./components/layout/Sidebar.tsx\";\nexport { Sidebar } from \"./components/layout/Sidebar.tsx\";\nexport { SidebarCollapsedItem } from \"./components/layout/SidebarCollapsedItem.tsx\";\nexport type { SidebarItemProps } from \"./components/layout/SidebarItem.tsx\";\nexport { SidebarItem } from \"./components/layout/SidebarItem.tsx\";\nexport type { TextProps } from \"./components/Text.tsx\";\nexport { default as Text } from \"./components/Text.tsx\";\nexport * from \"./constants/ui.ts\";\n// Form\nexport * from \"./form/index.ts\";\nexport * from \"./helpers/isComponentType.ts\";\nexport * from \"./helpers/renderIcon.tsx\";\nexport { useDialog } from \"./hooks/useDialog.ts\";\nexport { type ThemeExpert, useTheme } from \"./hooks/useTheme.ts\";\nexport { useToast } from \"./hooks/useToast.ts\";\nexport * from \"./interfaces/AlephaIntent.ts\";\n// JSON\nexport * from \"./json/index.ts\";\nexport * from \"./primitives/$ui.ts\";\nexport * from \"./providers/ThemeProvider.ts\";\nexport type {\n AlertDialogOptions,\n AlertDialogProps,\n BaseDialogOptions,\n ConfirmDialogOptions,\n ConfirmDialogProps,\n PromptDialogOptions,\n PromptDialogProps,\n} from \"./services/DialogService.tsx\";\nexport { DialogService } from \"./services/DialogService.tsx\";\nexport { ToastService } from \"./services/ToastService.tsx\";\n// Table\nexport * from \"./table/index.ts\";\nexport * from \"./UiRouter.ts\";\nexport * from \"./utils/extractSchemaFields.ts\";\nexport * from \"./utils/icons.tsx\";\nexport * from \"./utils/string.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"alepha\" {\n interface State {\n [alephaSidebarAtom.key]?: Static<typeof alephaSidebarAtom.schema>;\n [alephaThemeAtom.key]?: Static<typeof alephaThemeAtom.schema>;\n [alephaThemeOverridesAtom.key]?: Static<\n typeof alephaThemeOverridesAtom.schema\n >;\n }\n}\n\ndeclare module \"alepha/react/router\" {\n interface PagePrimitiveOptions {\n /**\n * Human-readable title for the page.\n * - for Sidebar navigation\n * - for Omnibar navigation\n * (soon)\n * - for Breadcrumbs\n * - for document title (with AlephaReactHead)\n */\n label?: string;\n\n /**\n * Optional description of the page.\n */\n description?: string;\n\n /**\n * Optional icon for the page.\n */\n icon?: ReactNode | ComponentType;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Core UI components based on Mantine UI v8.\n *\n * **Features:**\n * - Mantine integration with theme support\n * - ActionButton, BurgerButton, ClipboardButton, DarkModeButton, LanguageButton, ThemeButton\n * - AlertDialog, ConfirmDialog, PromptDialog\n * - Form controls: Control, ControlArray, ControlDate, ControlNumber, ControlObject, ControlSelect, ControlQueryBuilder\n * - TypeForm for automatic form generation from TypeBox schemas\n * - DashboardShell layout component\n * - AppBar with configurable elements\n * - Sidebar navigation with sections and menu items\n * - Omnibar for command palette / search\n * - DataTable with filtering, sorting, pagination\n * - Toast notifications\n * - Theme system with dark mode\n *\n * @module alepha.ui\n */\nexport const AlephaUI = $module({\n name: \"alepha.ui\",\n services: [DialogService, ToastService, ThemeProvider, UiRouter],\n register: (alepha) => {\n alepha.with(AlephaReactI18n);\n alepha.with(AlephaReactHead);\n alepha.with(AlephaReactForm);\n alepha.with(ThemeProvider);\n alepha.with(DialogService);\n alepha.with(ToastService);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,oBAAoB,MAAM;CACrC,MAAM;CACN,QAAQ,EAAE,OAAO;EAIf,QAAQ,EAAE,SAAS;EAInB,WAAW,EAAE,SAAS;EAKtB,eAAe,EAAE,QAAQ;EAKzB,gBAAgB,EAAE,QAAQ;EAC3B,CAAC;CACF,SAAS;EACP,QAAQ;EACR,WAAW;EACX,eAAe;EACf,gBAAgB;EACjB;CACF,CAAC;;;;AC5BF,MA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EAEN,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GACH;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CAED,YAAY;EACV,QAAQ,OAAO,OAAO;GACpB,cAAc,EACZ,IAAI,KACL;GACD,QAAQ,EACN,MAAM;IACJ,QAAQ;IACR,eAAe;IACf,eAAe;IACf,UAAU;IACX,EACF;GACF,CAAC;EAEF,YAAY,WAAW,OAAO,EAC5B,QAAQ,EACN,MAAM,EACJ,QAAQ,0BACT,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO,EAClB,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,MAAM,KAAK,OAAO,EAChB,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,WAAW,UAAU,OAAO,EAC1B,QAAQ,EACN,OAAO,EACL,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO;GAClB,cAAc;IACZ,IAAI;IACJ,SAAS;IACV;GACD,QAAQ,EACN,MAAM;IACJ,eAAe;IACf,eAAe;IACf,UAAU;IACV,QAAQ;IACT,EACF;GACF,CAAC;EACH;CACF;;;;;;;;;;;ACnLD,MAAa,gBAA6B;CACxC,MAAM;CACN,aAAa;CACb,oBAAoB;CACpB,cAAc;CACd,cAAc;EAAE,OAAO;EAAG,MAAM;EAAG;CACnC,cAAc;CACd,YACE;CACF,qBACE;CACF,UAAU;EACR,YACE;EACF,YAAY;EAC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text","Flex","Flex","Flex","Text","Flex","Text","Flex","Text","Flex","Text","Flex","Text","MantineFlex","Container","MantineContainer","MantineText","SidebarCollapseButton","Fragment","Flex","Text","Flex","Text","Flex","Text","Flex","Flex","Flex","Text","Flex","Text","Flex","Flex","Text","Flex","Text"],"sources":["../../src/core/atoms/alephaSidebarAtom.ts","../../src/core/atoms/alephaThemeAtom.ts","../../src/core/atoms/alephaThemeOverridesAtom.ts","../../src/core/atoms/themes/default.ts","../../src/core/atoms/themes/editorial.ts","../../src/core/atoms/themes/midnight.ts","../../src/core/atoms/themes/monochrome.ts","../../src/core/atoms/themes/rosePine.ts","../../src/core/atoms/themes/softBrutalism.ts","../../src/core/atoms/themes/terminal.ts","../../src/core/atoms/alephaThemeListAtom.ts","../../src/core/providers/ThemeProvider.ts","../../src/core/components/dialogs/AlertDialog.tsx","../../src/core/components/dialogs/ConfirmDialog.tsx","../../src/core/components/dialogs/PromptDialog.tsx","../../src/core/services/DialogService.tsx","../../src/core/services/ToastService.tsx","../../src/core/UiRouter.ts","../../src/core/hooks/useTheme.ts","../../src/core/hooks/useToast.ts","../../src/core/components/layout/Omnibar.tsx","../../src/core/components/AlephaMantineProvider.tsx","../../src/core/constants/ui.ts","../../src/core/helpers/isComponentType.ts","../../src/core/components/buttons/ActionButton.tsx","../../src/core/components/buttons/BurgerButton.tsx","../../src/core/components/buttons/ClipboardButton.tsx","../../src/core/components/buttons/DarkModeButton.tsx","../../src/core/components/buttons/LanguageButton.tsx","../../src/core/components/buttons/OmnibarButton.tsx","../../src/core/hooks/useDialog.ts","../../src/core/components/buttons/ThemeExpertModal.tsx","../../src/core/components/buttons/ThemeButton.tsx","../../src/core/components/buttons/ToggleSidebarButton.tsx","../../src/core/components/data/DetailDrawer.tsx","../../src/core/components/data/DetailList.tsx","../../src/core/components/data/StatCards.tsx","../../src/core/components/Flex.tsx","../../src/core/components/layout/AppBar.tsx","../../src/core/components/layout/Breadcrumb.tsx","../../src/core/components/layout/Container.tsx","../../src/core/helpers/renderIcon.tsx","../../src/core/components/Text.tsx","../../src/core/components/layout/SidebarCollapsedItem.tsx","../../src/core/components/layout/SidebarItem.tsx","../../src/core/components/layout/Sidebar.tsx","../../src/core/components/layout/DashboardShell.tsx","../../src/core/components/SectionHeader.tsx","../../src/core/components/Section.tsx","../../src/core/form/utils/parseInput.ts","../../src/core/form/components/ControlArray.tsx","../../src/core/form/components/ControlDate.tsx","../../src/core/form/components/ControlNumber.tsx","../../src/core/form/components/ControlObject.tsx","../../src/core/form/components/ControlQueryBuilderHelp.tsx","../../src/core/form/components/ControlQueryBuilder.tsx","../../src/core/form/components/ControlSelect.tsx","../../src/core/form/components/Control.tsx","../../src/core/form/components/TypeForm.tsx","../../src/core/form/factories/dialogForm.tsx","../../src/core/json/components/JsonViewerCopyButton.tsx","../../src/core/json/components/JsonViewerShared.ts","../../src/core/json/components/JsonViewerRowNode.tsx","../../src/core/json/components/JsonViewer.tsx","../../src/core/json/factories/dialogJson.tsx","../../src/core/primitives/$ui.ts","../../src/core/table/components/DataTableFilters.tsx","../../src/core/table/components/DataTablePagination.tsx","../../src/core/table/components/ColumnPicker.tsx","../../src/core/table/components/FilterPicker.tsx","../../src/core/table/components/DataTableToolbar.tsx","../../src/core/table/components/useTableSelection.ts","../../src/core/table/components/DataTable.tsx","../../src/core/utils/extractSchemaFields.ts","../../src/core/utils/icons.tsx","../../src/core/utils/string.ts","../../src/core/index.ts"],"sourcesContent":["import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaSidebarAtom = $atom({\n name: \"alepha.ui.sidebar\",\n schema: t.object({\n /**\n * Whether the sidebar drawer is closed (mobile).\n */\n closed: t.boolean(),\n /**\n * Whether the sidebar is collapsed (desktop icon-only mode).\n */\n collapsed: t.boolean(),\n /**\n * Width of the sidebar when expanded.\n * @default 300\n */\n expandedWidth: t.number(),\n /**\n * Width of the sidebar when collapsed.\n * @default 78\n */\n collapsedWidth: t.number(),\n }),\n default: {\n closed: true,\n collapsed: false,\n expandedWidth: 300,\n collapsedWidth: 72,\n },\n});\n\nexport type AlephaSidebarState = Static<typeof alephaSidebarAtom.schema>;\n","import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaThemeAtom = $atom({\n name: \"alepha.ui.theme\",\n schema: t.object({\n index: t.integer(),\n }),\n default: {\n index: 0,\n },\n});\n\nexport type CurrentAlephaTheme = Static<typeof alephaThemeAtom.schema>;\n","import { $atom, type Static, t } from \"alepha\";\n\nexport const alephaThemeOverridesAtom = $atom({\n name: \"alepha.ui.themeOverrides\",\n schema: t.object({\n primaryColor: t.optional(t.text()),\n radius: t.optional(t.text()),\n fontFamily: t.optional(t.text()),\n fontSize: t.optional(t.text()),\n scale: t.optional(t.text()),\n }),\n default: {},\n});\n\nexport type AlephaThemeOverrides = Static<\n typeof alephaThemeOverridesAtom.schema\n>;\n","import type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\nexport const defaultTheme: AlephaTheme = {\n name: \"Default\",\n description: \"Default Alepha Theme\",\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Editorial theme.\n *\n * Serif typography, high contrast black and white, thin borders, generous whitespace.\n * Newspaper/magazine aesthetic — elegant restraint.\n */\nexport const editorialTheme: AlephaTheme = {\n name: \"Editorial\",\n description: \"Serif typography with newspaper elegance\",\n defaultColorScheme: \"light\",\n head: {\n link: [\n { rel: \"preconnect\", href: \"https://fonts.googleapis.com\" },\n {\n rel: \"preconnect\",\n href: \"https://fonts.gstatic.com\",\n crossorigin: \"\",\n },\n {\n rel: \"stylesheet\",\n href: \"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap\",\n },\n ],\n },\n primaryColor: \"ink\",\n primaryShade: { light: 7, dark: 3 },\n autoContrast: true,\n fontFamily: '\"Source Serif 4\", \"Georgia\", \"Times New Roman\", serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily: '\"Playfair Display\", \"Georgia\", \"Times New Roman\", serif',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2.5rem\", lineHeight: \"1.15\" },\n h2: { fontSize: \"1.75rem\", lineHeight: \"1.2\" },\n h3: { fontSize: \"1.375rem\", lineHeight: \"1.3\" },\n h4: { fontSize: \"1.125rem\", lineHeight: \"1.4\" },\n h5: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"sm\",\n radius: {\n xs: \"2px\",\n sm: \"3px\",\n md: \"4px\",\n lg: \"6px\",\n xl: \"8px\",\n },\n shadows: {\n xs: \"0 1px 2px rgba(0, 0, 0, 0.06)\",\n sm: \"0 1px 3px rgba(0, 0, 0, 0.08)\",\n md: \"0 2px 6px rgba(0, 0, 0, 0.08)\",\n lg: \"0 4px 12px rgba(0, 0, 0, 0.1)\",\n xl: \"0 8px 24px rgba(0, 0, 0, 0.1)\",\n },\n colors: {\n // Primary — ink black with warm tint\n ink: [\n \"#f5f3f0\",\n \"#e8e4de\",\n \"#d4cec5\",\n \"#b5ad9f\",\n \"#8c8272\",\n \"#6b6050\",\n \"#4a4035\",\n \"#332b22\",\n \"#1f1812\",\n \"#0d0a07\",\n ],\n // Accent — muted burgundy\n burgundy: [\n \"#faf0f0\",\n \"#f0d4d4\",\n \"#e0adad\",\n \"#cc8585\",\n \"#b35e5e\",\n \"#944545\",\n \"#763636\",\n \"#5a2828\",\n \"#3d1b1b\",\n \"#220f0f\",\n ],\n // Warm grays — paper-tinted\n gray: [\n \"#faf9f7\",\n \"#f0eee9\",\n \"#e0dcd5\",\n \"#c8c2b8\",\n \"#a8a194\",\n \"#8a8273\",\n \"#6b6456\",\n \"#504a3f\",\n \"#36322b\",\n \"#1e1b17\",\n ],\n // Dark palette — warm charcoal\n dark: [\n \"#d5d2cd\",\n \"#aba59c\",\n \"#817a6e\",\n \"#5e584e\",\n \"#46413a\",\n \"#36322c\",\n \"#2a2721\",\n \"#201d19\",\n \"#171411\",\n \"#0d0b09\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n letterSpacing: \"0.02em\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n variant: \"outline\",\n },\n styles: {\n root: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',\n letterSpacing: \"0.04em\",\n textTransform: \"uppercase\" as const,\n fontSize: \"0.65rem\",\n },\n },\n }),\n },\n};\n","import type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\nexport const midnightTheme: AlephaTheme = {\n name: \"Midnight\",\n description: \"Clean, developer-focused design\",\n primaryColor: \"pink\",\n primaryShade: { light: 7, dark: 8 },\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\"',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"600\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n radius: {\n xs: \"3px\",\n sm: \"6px\",\n md: \"6px\",\n lg: \"8px\",\n xl: \"12px\",\n },\n defaultRadius: \"sm\",\n colors: {\n dark: [\n \"#d0d7de\",\n \"#8b949e\",\n \"#6e7681\",\n \"#484f58\",\n \"#30363d\",\n \"#21262d\",\n \"#161b22\",\n \"#151b23\",\n \"#0d1117\",\n \"#010409\",\n ],\n gray: [\n \"#f6f8fa\",\n \"#eaeef2\",\n \"#d0d7de\",\n \"#afb8c1\",\n \"#8c959f\",\n \"#6e7781\",\n \"#57606a\",\n \"#424a53\",\n \"#32383f\",\n \"#24292f\",\n ],\n blue: [\n \"#ddf4ff\",\n \"#b6e3ff\",\n \"#80ccff\",\n \"#54aeff\",\n \"#218bff\",\n \"#0969da\",\n \"#0550ae\",\n \"#033d8b\",\n \"#0a3069\",\n \"#002155\",\n ],\n green: [\n \"#dafbe1\",\n \"#aceebb\",\n \"#6fdd8b\",\n \"#4ac26b\",\n \"#2da44e\",\n \"#1a7f37\",\n \"#116329\",\n \"#044f1e\",\n \"#003d16\",\n \"#002d11\",\n ],\n red: [\n \"#ffebe9\",\n \"#ffcecb\",\n \"#ffaba8\",\n \"#ff8182\",\n \"#fa4549\",\n \"#cf222e\",\n \"#a40e26\",\n \"#82071e\",\n \"#660018\",\n \"#4c0014\",\n ],\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Monochrome theme.\n *\n * Pure black and white. No color. Bold typography does all the heavy lifting.\n * A design-school statement piece — minimalist color, maximalist type.\n */\nexport const monochromeTheme: AlephaTheme = {\n name: \"Monochrome\",\n description: \"Pure black and white — zero color, maximum typography\",\n primaryColor: \"mono\",\n primaryShade: { light: 8, dark: 1 },\n autoContrast: true,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"800\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2.25rem\", lineHeight: \"1.15\" },\n h2: { fontSize: \"1.625rem\", lineHeight: \"1.25\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.35\" },\n h4: { fontSize: \"1.0625rem\", lineHeight: \"1.45\" },\n h5: { fontSize: \"0.9375rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.8125rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"0\",\n radius: {\n xs: \"0\",\n sm: \"0\",\n md: \"0\",\n lg: \"0\",\n xl: \"2px\",\n },\n shadows: {\n xs: \"0 1px 2px rgba(0, 0, 0, 0.08)\",\n sm: \"0 1px 4px rgba(0, 0, 0, 0.1)\",\n md: \"0 2px 8px rgba(0, 0, 0, 0.12)\",\n lg: \"0 4px 16px rgba(0, 0, 0, 0.14)\",\n xl: \"0 8px 32px rgba(0, 0, 0, 0.16)\",\n },\n colors: {\n // Primary — pure grayscale\n mono: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n // Gray — identical to mono for consistency\n gray: [\n \"#f5f5f5\",\n \"#e5e5e5\",\n \"#cccccc\",\n \"#b0b0b0\",\n \"#909090\",\n \"#707070\",\n \"#555555\",\n \"#3a3a3a\",\n \"#252525\",\n \"#121212\",\n ],\n // \"Colors\" are all grayscale — no hue anywhere\n blue: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n green: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n red: [\n \"#f5f5f5\",\n \"#e0e0e0\",\n \"#c0c0c0\",\n \"#a0a0a0\",\n \"#808080\",\n \"#606060\",\n \"#404040\",\n \"#282828\",\n \"#141414\",\n \"#000000\",\n ],\n // Dark palette — true blacks\n dark: [\n \"#d0d0d0\",\n \"#a0a0a0\",\n \"#707070\",\n \"#505050\",\n \"#383838\",\n \"#282828\",\n \"#1c1c1c\",\n \"#141414\",\n \"#0a0a0a\",\n \"#000000\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 700,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n letterSpacing: \"0.03em\",\n textTransform: \"uppercase\" as const,\n fontSize: \"0.8125rem\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"2px solid currentColor\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 700,\n variant: \"outline\",\n },\n styles: {\n root: {\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.06em\",\n fontSize: \"0.65rem\",\n border: \"2px solid currentColor\",\n },\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Rosé Pine theme.\n *\n * Muted pinks, golds, and subtle greens on warm dark backgrounds.\n * Cozy, low-contrast, easy on the eyes.\n * Based on the Rosé Pine color philosophy.\n */\nexport const rosePineTheme: AlephaTheme = {\n name: \"Rosé Pine\",\n description: \"Muted pinks and golds on warm dark backgrounds\",\n defaultColorScheme: \"dark\",\n primaryColor: \"rose\",\n primaryShade: { light: 5, dark: 4 },\n autoContrast: true,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"600\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"md\",\n radius: {\n xs: \"4px\",\n sm: \"6px\",\n md: \"8px\",\n lg: \"12px\",\n xl: \"16px\",\n },\n shadows: {\n xs: \"0 1px 3px rgba(0, 0, 0, 0.2)\",\n sm: \"0 2px 6px rgba(0, 0, 0, 0.2)\",\n md: \"0 4px 12px rgba(0, 0, 0, 0.25)\",\n lg: \"0 8px 24px rgba(0, 0, 0, 0.3)\",\n xl: \"0 12px 36px rgba(0, 0, 0, 0.35)\",\n },\n colors: {\n // Primary — rose\n rose: [\n \"#faf0f4\",\n \"#f2d8e3\",\n \"#eabdd0\",\n \"#e0a0bb\",\n \"#d4849f\",\n \"#c4748f\",\n \"#b06282\",\n \"#9a5275\",\n \"#7a3f5e\",\n \"#5c2e47\",\n ],\n // Accent — gold\n gold: [\n \"#fdf8ec\",\n \"#f8ecc8\",\n \"#f2dda0\",\n \"#eacb72\",\n \"#e0b94d\",\n \"#c9a33e\",\n \"#a98830\",\n \"#866b24\",\n \"#634f1a\",\n \"#403310\",\n ],\n // Pine — muted green\n pine: [\n \"#ecf5f0\",\n \"#d0e6da\",\n \"#add4be\",\n \"#86c0a0\",\n \"#62ac84\",\n \"#4e9670\",\n \"#3e7a5a\",\n \"#2f5e44\",\n \"#20412f\",\n \"#12251b\",\n ],\n // Foam — muted teal\n foam: [\n \"#edf6f7\",\n \"#d2e9eb\",\n \"#b0d9dd\",\n \"#8bc6cc\",\n \"#6ab3bb\",\n \"#569da5\",\n \"#438088\",\n \"#33636a\",\n \"#23454a\",\n \"#14292c\",\n ],\n // Love — muted red\n red: [\n \"#f9eef0\",\n \"#efd3d8\",\n \"#e3b2bb\",\n \"#d68e9b\",\n \"#c86c7c\",\n \"#b25566\",\n \"#944454\",\n \"#733442\",\n \"#52252f\",\n \"#33161d\",\n ],\n // Warm grays — subtle mauve tint\n gray: [\n \"#f4f0f2\",\n \"#e4dde1\",\n \"#cec5cb\",\n \"#b5aab2\",\n \"#9a8e96\",\n \"#7e737a\",\n \"#635a60\",\n \"#4a4248\",\n \"#332d31\",\n \"#1e1a1c\",\n ],\n // Dark palette — Rosé Pine base/surface/overlay\n dark: [\n \"#e0d8e0\",\n \"#b0a6b2\",\n \"#817786\",\n \"#615768\",\n \"#4a3f54\",\n \"#3a3044\",\n \"#2a2436\",\n \"#211e2e\",\n \"#1a1724\",\n \"#110f1a\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 500,\n },\n styles: {\n root: {\n transition: \"background-color 0.15s ease, opacity 0.15s ease\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n transition: \"background-color 0.15s ease, opacity 0.15s ease\",\n },\n },\n }),\n\n Paper: Paper.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 500,\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Soft Brutalism theme.\n *\n * Pastel pop palette with solid offset shadows, rounded corners, and bold borders.\n * A friendlier take on neubrutalism — playful but production-ready.\n */\nexport const softBrutalismTheme: AlephaTheme = {\n name: \"Soft Brutalism\",\n description: \"Pastel pop with bold borders and offset shadows\",\n head: {\n link: [\n { rel: \"preconnect\", href: \"https://fonts.googleapis.com\" },\n {\n rel: \"preconnect\",\n href: \"https://fonts.gstatic.com\",\n crossorigin: \"\",\n },\n {\n rel: \"stylesheet\",\n href: \"https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap\",\n },\n ],\n },\n primaryColor: \"lavender\",\n primaryShade: { light: 5, dark: 7 },\n autoContrast: true,\n cursorType: \"pointer\",\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"2rem\", lineHeight: \"1.25\" },\n h2: { fontSize: \"1.5rem\", lineHeight: \"1.3\" },\n h3: { fontSize: \"1.25rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"md\",\n radius: {\n xs: \"6px\",\n sm: \"8px\",\n md: \"12px\",\n lg: \"16px\",\n xl: \"24px\",\n },\n shadows: {\n xs: \"2px 2px 0 0 rgba(100, 80, 140, 0.15)\",\n sm: \"3px 3px 0 0 rgba(100, 80, 140, 0.2)\",\n md: \"4px 4px 0 0 rgba(100, 80, 140, 0.2)\",\n lg: \"6px 6px 0 0 rgba(100, 80, 140, 0.25)\",\n xl: \"8px 8px 0 0 rgba(100, 80, 140, 0.3)\",\n },\n colors: {\n // Primary — lavender\n lavender: [\n \"#f3f0fa\",\n \"#e4dcf4\",\n \"#d1c4e9\",\n \"#b4a7d6\",\n \"#9a8bc4\",\n \"#7f6cb0\",\n \"#6a549e\",\n \"#543f87\",\n \"#3d2d6b\",\n \"#2a1d52\",\n ],\n // Accent — peach\n peach: [\n \"#fef3ec\",\n \"#fce4d0\",\n \"#f9d0ae\",\n \"#f4b886\",\n \"#f4a261\",\n \"#e68a42\",\n \"#c67234\",\n \"#a35a28\",\n \"#6b3a1a\",\n \"#4a2710\",\n ],\n // Success — mint\n mint: [\n \"#ecfaf0\",\n \"#d4f2dc\",\n \"#b3e8c2\",\n \"#8edba4\",\n \"#81c995\",\n \"#5ab874\",\n \"#42a05c\",\n \"#2e8548\",\n \"#1a5c2e\",\n \"#0f3f1e\",\n ],\n // Danger — coral\n coral: [\n \"#fef0ef\",\n \"#fcd9d7\",\n \"#f8b8b4\",\n \"#f29490\",\n \"#e97171\",\n \"#d65454\",\n \"#b83e3e\",\n \"#962d2d\",\n \"#6b1f1f\",\n \"#4a1414\",\n ],\n // Warm grays — cream-shifted\n gray: [\n \"#faf8f6\",\n \"#f0ece8\",\n \"#ddd7d0\",\n \"#c4bbb2\",\n \"#a89e95\",\n \"#8c8279\",\n \"#6e655d\",\n \"#524b44\",\n \"#3a342f\",\n \"#24211e\",\n ],\n // Warm dark palette — lavender-tinted blacks\n dark: [\n \"#d4d0dc\",\n \"#a9a2b5\",\n \"#7e7690\",\n \"#5c546e\",\n \"#443c56\",\n \"#342d45\",\n \"#2a2339\",\n \"#1e1a2e\",\n \"#161224\",\n \"#0f0c1a\",\n ],\n },\n\n // ---------------------------------------------------------------------------\n // Component overrides\n // ---------------------------------------------------------------------------\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n boxShadow: \"3px 3px 0 0 rgba(100, 80, 140, 0.2)\",\n transition: \"box-shadow 0.15s ease, transform 0.15s ease\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"2px solid currentColor\",\n boxShadow: \"2px 2px 0 0 rgba(100, 80, 140, 0.15)\",\n },\n },\n }),\n\n Paper: Paper.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n defaultProps: {\n shadow: \"sm\",\n },\n styles: {\n root: {\n border: \"2px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"2px solid var(--mantine-color-default-border)\",\n transition: \"box-shadow 0.15s ease, border-color 0.15s ease\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"2px solid currentColor\",\n },\n },\n }),\n },\n};\n","import {\n ActionIcon,\n Badge,\n Button,\n Card,\n Paper,\n TextInput,\n} from \"@mantine/core\";\nimport type { AlephaTheme } from \"../../interfaces/AlephaTheme.ts\";\n\n/**\n * Terminal theme.\n *\n * Monospace everything, green-on-black, zero radius.\n * CRT/hacker aesthetic for developer tools and dashboards.\n */\nexport const terminalTheme: AlephaTheme = {\n name: \"Terminal\",\n description: \"Green phosphor on black — monospace hacker aesthetic\",\n defaultColorScheme: \"dark\",\n primaryColor: \"terminal\",\n primaryShade: { light: 5, dark: 4 },\n autoContrast: true,\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n headings: {\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontWeight: \"700\",\n textWrap: \"wrap\",\n sizes: {\n h1: { fontSize: \"1.75rem\", lineHeight: \"1.3\" },\n h2: { fontSize: \"1.375rem\", lineHeight: \"1.35\" },\n h3: { fontSize: \"1.125rem\", lineHeight: \"1.4\" },\n h4: { fontSize: \"1rem\", lineHeight: \"1.5\" },\n h5: { fontSize: \"0.875rem\", lineHeight: \"1.5\" },\n h6: { fontSize: \"0.75rem\", lineHeight: \"1.5\" },\n },\n },\n defaultRadius: \"0\",\n radius: {\n xs: \"0\",\n sm: \"0\",\n md: \"0\",\n lg: \"2px\",\n xl: \"4px\",\n },\n shadows: {\n xs: \"none\",\n sm: \"none\",\n md: \"0 0 8px rgba(0, 255, 65, 0.08)\",\n lg: \"0 0 16px rgba(0, 255, 65, 0.1)\",\n xl: \"0 0 24px rgba(0, 255, 65, 0.12)\",\n },\n colors: {\n // Primary — phosphor green\n terminal: [\n \"#e6fff0\",\n \"#b3ffd1\",\n \"#80ffb3\",\n \"#4dff94\",\n \"#00ff41\",\n \"#00d636\",\n \"#00ad2b\",\n \"#008521\",\n \"#005c17\",\n \"#00330d\",\n ],\n // Amber accent\n amber: [\n \"#fff8e6\",\n \"#ffecb3\",\n \"#ffe080\",\n \"#ffd54d\",\n \"#ffca28\",\n \"#d4a520\",\n \"#aa8418\",\n \"#806310\",\n \"#554208\",\n \"#2b2104\",\n ],\n // Danger — red\n red: [\n \"#ffe6e6\",\n \"#ffb3b3\",\n \"#ff8080\",\n \"#ff4d4d\",\n \"#ff1a1a\",\n \"#d41515\",\n \"#aa1010\",\n \"#800c0c\",\n \"#550808\",\n \"#2b0404\",\n ],\n // Cool grays\n gray: [\n \"#e8eaed\",\n \"#c8cdd3\",\n \"#a4aab3\",\n \"#808892\",\n \"#5f6872\",\n \"#474f58\",\n \"#363c44\",\n \"#282d33\",\n \"#1c2026\",\n \"#12151a\",\n ],\n // True black darks\n dark: [\n \"#c9cdd2\",\n \"#8b9198\",\n \"#5c636b\",\n \"#3d444c\",\n \"#2b3138\",\n \"#1e242b\",\n \"#151a20\",\n \"#0e1216\",\n \"#080c0f\",\n \"#020303\",\n ],\n },\n\n components: {\n Button: Button.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"1px solid currentColor\",\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.05em\",\n fontSize: \"0.8125rem\",\n },\n },\n }),\n\n ActionIcon: ActionIcon.extend({\n styles: {\n root: {\n border: \"1px solid currentColor\",\n },\n },\n }),\n\n Paper: Paper.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n Card: Card.extend({\n styles: {\n root: {\n border: \"1px solid var(--mantine-color-default-border)\",\n },\n },\n }),\n\n TextInput: TextInput.extend({\n styles: {\n input: {\n border: \"1px solid var(--mantine-color-default-border)\",\n fontFamily: \"inherit\",\n },\n },\n }),\n\n Badge: Badge.extend({\n defaultProps: {\n fw: 600,\n },\n styles: {\n root: {\n border: \"1px solid currentColor\",\n textTransform: \"uppercase\" as const,\n letterSpacing: \"0.05em\",\n },\n },\n }),\n },\n};\n","import { $atom, type Static, t } from \"alepha\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\nimport { defaultTheme } from \"./themes/default.ts\";\nimport { editorialTheme } from \"./themes/editorial.ts\";\nimport { midnightTheme } from \"./themes/midnight.ts\";\nimport { monochromeTheme } from \"./themes/monochrome.ts\";\nimport { rosePineTheme } from \"./themes/rosePine.ts\";\nimport { softBrutalismTheme } from \"./themes/softBrutalism.ts\";\nimport { terminalTheme } from \"./themes/terminal.ts\";\n\nexport const alephaThemeListAtom = $atom({\n name: \"alepha.ui.themeList\",\n schema: t.array(t.json<AlephaTheme>()), // TODO: translate to proper schema\n default: [\n defaultTheme,\n midnightTheme,\n softBrutalismTheme,\n terminalTheme,\n editorialTheme,\n rosePineTheme,\n monochromeTheme,\n ],\n});\n\nexport type AlephaThemeListAtom = Static<typeof alephaThemeListAtom.schema>;\n","import { $inject, Alepha, AlephaError } from \"alepha\";\nimport { $head, BrowserHeadProvider } from \"alepha/react/head\";\nimport { $cookie } from \"alepha/server/cookies\";\nimport { alephaThemeAtom } from \"../atoms/alephaThemeAtom.ts\";\nimport { alephaThemeListAtom } from \"../atoms/alephaThemeListAtom.ts\";\nimport {\n type AlephaThemeOverrides,\n alephaThemeOverridesAtom,\n} from \"../atoms/alephaThemeOverridesAtom.ts\";\nimport { defaultTheme } from \"../atoms/themes/default.ts\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\n\nexport class ThemeProvider {\n protected readonly alepha = $inject(Alepha);\n protected readonly cookie = $cookie({\n name: \"theme\",\n schema: alephaThemeAtom.schema,\n ttl: [1, \"year\"],\n });\n\n protected readonly overridesCookie = $cookie({\n name: \"themeOverrides\",\n schema: alephaThemeOverridesAtom.schema,\n ttl: [1, \"year\"],\n });\n\n protected readonly head = $head(() => {\n const theme = this.getTheme();\n if (!theme || !theme.name) {\n return {};\n }\n return {\n htmlAttributes: {\n \"data-theme\": this.slugify(theme.name),\n },\n ...theme.head,\n };\n });\n\n public setTheme(index: number) {\n const newTheme = this.alepha.store.get(alephaThemeListAtom)[\n index\n ] as AlephaTheme;\n\n if (!newTheme) {\n throw new AlephaError(`Theme with index ${index} not found`);\n }\n\n this.cookie.set({ index });\n this.alepha.store.set(alephaThemeAtom, { index });\n\n if (!this.alepha.isBrowser()) {\n return;\n }\n\n this.alepha.inject(BrowserHeadProvider).refreshGlobalHead();\n }\n\n protected slugify(name: string): string {\n return name.toLowerCase().replace(/\\s+/g, \"-\");\n }\n\n protected static readonly FONT_SIZE_MULTIPLIERS: Record<string, number> = {\n xs: 0.85,\n sm: 0.925,\n md: 1,\n lg: 1.1,\n xl: 1.25,\n };\n\n protected static readonly SCALE_VALUES: Record<string, number> = {\n xs: 0.85,\n sm: 0.925,\n md: 1,\n lg: 1.1,\n xl: 1.25,\n };\n\n protected static readonly DEFAULT_FONT_SIZES: Record<string, string> = {\n xs: \"0.75rem\",\n sm: \"0.875rem\",\n md: \"1rem\",\n lg: \"1.125rem\",\n xl: \"1.25rem\",\n };\n\n public getTheme() {\n const index = this.getThemeIndex();\n const list = this.alepha.store.get(\n alephaThemeListAtom,\n ) as Array<AlephaTheme>;\n const base = list[index] || list[0] || defaultTheme;\n const overrides = this.getThemeOverrides();\n\n if (\n !overrides.primaryColor &&\n !overrides.radius &&\n !overrides.fontFamily &&\n !overrides.fontSize &&\n !overrides.scale\n ) {\n return base;\n }\n\n const merged = {\n ...base,\n ...(overrides.primaryColor && { primaryColor: overrides.primaryColor }),\n ...(overrides.radius && { defaultRadius: overrides.radius }),\n ...(overrides.fontFamily && { fontFamily: overrides.fontFamily }),\n ...(overrides.scale &&\n overrides.scale !== \"md\" && {\n scale: ThemeProvider.SCALE_VALUES[overrides.scale] ?? 1,\n }),\n };\n\n if (overrides.fontSize && overrides.fontSize !== \"md\") {\n const multiplier =\n ThemeProvider.FONT_SIZE_MULTIPLIERS[overrides.fontSize] ?? 1;\n const baseSizes =\n (base.fontSizes as Record<string, string> | undefined) ??\n ThemeProvider.DEFAULT_FONT_SIZES;\n merged.fontSizes = Object.fromEntries(\n Object.entries(baseSizes).map(([key, val]) => [\n key,\n `${(Number.parseFloat(String(val)) * multiplier).toFixed(4)}rem`,\n ]),\n ) as typeof merged.fontSizes;\n }\n\n return merged;\n }\n\n public setThemeOverrides(overrides: AlephaThemeOverrides) {\n this.overridesCookie.set(overrides);\n this.alepha.store.set(alephaThemeOverridesAtom, overrides);\n\n if (!this.alepha.isBrowser()) {\n return;\n }\n\n this.alepha.inject(BrowserHeadProvider).refreshGlobalHead();\n }\n\n public getThemeOverrides(): AlephaThemeOverrides {\n try {\n return (\n this.overridesCookie.get() ??\n this.alepha.store.get(alephaThemeOverridesAtom) ??\n {}\n );\n } catch {\n return this.alepha.store.get(alephaThemeOverridesAtom) ?? {};\n }\n }\n\n public resetThemeOverrides() {\n this.setThemeOverrides({});\n }\n\n protected getThemeIndex() {\n // TODO: make a safe cookie getter, today it crash when Cookie Server is called inside vite pre-render\n try {\n return (\n this.cookie.get()?.index ??\n this.alepha.store.get(alephaThemeAtom)?.index ??\n 0\n );\n } catch {\n return this.alepha.store.get(alephaThemeAtom)?.index ?? 0;\n }\n }\n}\n","import { Button, Flex, Text } from \"@mantine/core\";\nimport type { AlertDialogProps } from \"../../services/DialogService.tsx\";\n\nconst AlertDialog = ({ options, onClose }: AlertDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Flex justify=\"flex-end\">\n <Button onClick={onClose}>{options?.okLabel || \"OK\"}</Button>\n </Flex>\n </>\n);\n\nexport default AlertDialog;\n","import { Button, Flex, Text } from \"@mantine/core\";\nimport type { ConfirmDialogProps } from \"../../services/DialogService.tsx\";\n\nconst ConfirmDialog = ({ options, onConfirm }: ConfirmDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Flex justify=\"flex-end\">\n <Button variant=\"subtle\" onClick={() => onConfirm(false)}>\n {options?.cancelLabel || \"Cancel\"}\n </Button>\n <Button\n color={options?.confirmColor || \"blue\"}\n onClick={() => onConfirm(true)}\n >\n {options?.confirmLabel || \"Confirm\"}\n </Button>\n </Flex>\n </>\n);\n\nexport default ConfirmDialog;\n","import { Button, Flex, Text, TextInput } from \"@mantine/core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { PromptDialogProps } from \"../../services/DialogService.tsx\";\n\nconst PromptDialog = ({ options, onSubmit }: PromptDialogProps) => {\n const [value, setValue] = useState(options?.defaultValue || \"\");\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n // autofocus the input when the dialog opens\n inputRef.current?.focus();\n }, []);\n\n const handleSubmit = () => {\n if (!options?.required || value.trim()) {\n onSubmit(value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\") {\n handleSubmit();\n }\n };\n\n return (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <TextInput\n ref={inputRef}\n label={options?.label}\n placeholder={options?.placeholder}\n value={value}\n onChange={(event) => setValue(event.currentTarget.value)}\n onKeyDown={handleKeyDown}\n required={options?.required}\n mb=\"md\"\n />\n <Flex justify=\"flex-end\" gap={\"xs\"}>\n <Button variant=\"subtle\" onClick={() => onSubmit(null)}>\n {options?.cancelLabel || \"Cancel\"}\n </Button>\n <Button\n onClick={handleSubmit}\n disabled={options?.required && !value.trim()}\n >\n {options?.submitLabel || \"OK\"}\n </Button>\n </Flex>\n </>\n );\n};\n\nexport default PromptDialog;\n","import type { ModalProps } from \"@mantine/core\";\nimport { modals } from \"@mantine/modals\";\nimport type { ReactNode } from \"react\";\nimport AlertDialog from \"../components/dialogs/AlertDialog.tsx\";\nimport ConfirmDialog from \"../components/dialogs/ConfirmDialog.tsx\";\nimport PromptDialog from \"../components/dialogs/PromptDialog.tsx\";\n\n// Base interfaces\nexport interface BaseDialogOptions extends Partial<ModalProps> {\n title?: ReactNode;\n message?: ReactNode;\n content?: any; // weird typing for mantine modals content\n}\n\nexport interface AlertDialogOptions extends BaseDialogOptions {\n okLabel?: string;\n}\n\nexport interface ConfirmDialogOptions extends BaseDialogOptions {\n confirmLabel?: string;\n cancelLabel?: string;\n confirmColor?: string;\n}\n\nexport interface PromptDialogOptions extends BaseDialogOptions {\n placeholder?: string;\n defaultValue?: string;\n label?: string;\n required?: boolean;\n submitLabel?: string;\n cancelLabel?: string;\n}\n\n// Component prop interfaces\nexport interface AlertDialogProps {\n options?: AlertDialogOptions;\n onClose: () => void;\n}\n\nexport interface ConfirmDialogProps {\n options?: ConfirmDialogOptions;\n onConfirm: (confirmed: boolean) => void;\n}\n\nexport interface PromptDialogProps {\n options?: PromptDialogOptions;\n onSubmit: (value: string | null) => void;\n}\n\nexport interface DialogServiceOptions {\n default?: Partial<BaseDialogOptions>;\n}\n\nexport class DialogService {\n public readonly options: DialogServiceOptions = {\n default: {\n centered: true,\n withCloseButton: true,\n size: \"md\",\n overlayProps: {\n backgroundOpacity: 0.55,\n blur: 3,\n },\n transitionProps: {\n transition: \"pop\",\n duration: 200,\n },\n },\n };\n\n /**\n * Show an alert dialog with a message\n */\n public alert(options?: AlertDialogOptions): Promise<void> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = () => {\n if (resolved) return;\n resolved = true;\n resolve();\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Alert\",\n onClose: done,\n content: (\n <AlertDialog\n options={options}\n onClose={() => {\n this.close(modalId);\n done();\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Show a confirmation dialog that returns a promise\n */\n public confirm(options?: ConfirmDialogOptions): Promise<boolean> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = (confirmed: boolean) => {\n if (resolved) return;\n resolved = true;\n resolve(confirmed);\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Confirm\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n onClose: () => done(false),\n content: (\n <ConfirmDialog\n options={options}\n onConfirm={(confirmed) => {\n done(confirmed);\n this.close(modalId);\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Show a prompt dialog to get user input\n */\n public prompt(options?: PromptDialogOptions): Promise<string | null> {\n return new Promise((resolve) => {\n let resolved = false;\n const done = (value: string | null) => {\n if (resolved) return;\n resolved = true;\n resolve(value);\n };\n const modalId = this.open({\n ...options,\n title: options?.title || \"Input\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n onClose: () => done(null),\n content: (\n <PromptDialog\n options={options}\n onSubmit={(value) => {\n done(value);\n this.close(modalId);\n }}\n />\n ),\n });\n });\n }\n\n /**\n * Open a custom dialog with provided content\n */\n public open(options?: BaseDialogOptions): string {\n return modals.open({\n ...this.options.default,\n ...options,\n children: options?.content || options?.message,\n });\n }\n\n /**\n * Close the currently open dialog or a specific dialog by ID\n */\n public close(modalId?: string): void {\n if (modalId) {\n modals.close(modalId);\n } else {\n modals.closeAll();\n }\n }\n}\n","import type { NotificationData } from \"@mantine/notifications\";\nimport { notifications } from \"@mantine/notifications\";\nimport {\n IconAlertTriangle,\n IconCheck,\n IconInfoCircle,\n IconX,\n} from \"@tabler/icons-react\";\n\nexport interface ToastServiceOptions {\n default?: Partial<NotificationData>;\n}\n\nexport class ToastService {\n protected readonly raw = notifications;\n\n public readonly options: ToastServiceOptions = {\n default: {\n radius: \"md\",\n withBorder: true,\n withCloseButton: true,\n autoClose: 5000,\n position: \"top-center\",\n },\n };\n\n public show(options: NotificationData) {\n notifications.show({\n ...this.options.default,\n ...options,\n });\n }\n\n public info(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"blue\",\n icon: <IconInfoCircle size={20} />,\n title: \"Info\",\n message: \"Information notification\",\n ...options,\n });\n }\n\n public success(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"green\",\n icon: <IconCheck size={16} />,\n title: \"Success\",\n message: \"Operation completed successfully\",\n ...options,\n });\n }\n\n public warning(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"yellow\",\n icon: <IconAlertTriangle size={20} />,\n title: \"Warning\",\n message: \"Please review this warning\",\n ...options,\n });\n }\n\n public danger(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"red\",\n icon: <IconX size={20} />,\n title: \"Error\",\n message: \"An error occurred\",\n ...options,\n });\n }\n}\n","import { AlephaMantineProvider } from \"@alepha/ui\";\nimport { $page } from \"alepha/react/router\";\n\n/**\n * UI Router defining the root page with AlephaMantineProvider.\n *\n * - Use UiRouter when you need Alepha's Mantine-based UI components and theming.\n * - Prefer to use $ui() for convenience. (Custom Factory of UiRouter)\n */\nexport class UiRouter {\n public readonly root = $page({\n path: \"/\",\n component: AlephaMantineProvider,\n });\n}\n","import { useInject, useStore } from \"alepha/react\";\nimport {\n alephaThemeAtom,\n type CurrentAlephaTheme,\n} from \"../atoms/alephaThemeAtom.ts\";\nimport {\n type AlephaThemeOverrides,\n alephaThemeOverridesAtom,\n} from \"../atoms/alephaThemeOverridesAtom.ts\";\nimport type { AlephaTheme } from \"../interfaces/AlephaTheme.ts\";\nimport { ThemeProvider } from \"../providers/ThemeProvider.ts\";\n\nexport interface ThemeExpert {\n overrides: AlephaThemeOverrides;\n setOverrides: (overrides: AlephaThemeOverrides) => void;\n resetOverrides: () => void;\n}\n\n/**\n * Hook to get and set the current theme.\n *\n * Returns a tuple with the current theme, a function to set the theme,\n * and expert mode controls for fine-grained customization.\n *\n * ```tsx\n * const [theme, setTheme, expert] = useTheme();\n * ```\n */\nexport const useTheme = (): [\n AlephaTheme,\n (theme: CurrentAlephaTheme) => void,\n ThemeExpert,\n] => {\n useStore(alephaThemeAtom);\n useStore(alephaThemeOverridesAtom);\n\n const themeProvider = useInject(ThemeProvider);\n const theme = themeProvider.getTheme();\n const setTheme = (theme: CurrentAlephaTheme) => {\n themeProvider.setTheme(theme.index);\n };\n\n const expert: ThemeExpert = {\n overrides: themeProvider.getThemeOverrides(),\n setOverrides: (overrides: AlephaThemeOverrides) => {\n themeProvider.setThemeOverrides(overrides);\n },\n resetOverrides: () => {\n themeProvider.resetThemeOverrides();\n },\n };\n\n return [theme, setTheme, expert] as const;\n};\n","import { useInject } from \"alepha/react\";\nimport { ToastService } from \"../services/ToastService.tsx\";\n\n/**\n * Use this hook to access the Toast Service for showing notifications.\n *\n * @example\n * ```tsx\n * const toast = useToast();\n * toast.success({ message: \"Operation completed successfully!\" });\n * toast.error({ title: \"Error\", message: \"Something went wrong\" });\n * ```\n */\nexport const useToast = (): ToastService => {\n return useInject(ToastService);\n};\n","import { renderIcon, ui } from \"@alepha/ui\";\nimport { Spotlight, type SpotlightActionData } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { currentUserAtom } from \"alepha/security\";\nimport { type ReactNode, useMemo } from \"react\";\n\nexport interface OmnibarProps {\n shortcut?: string | string[];\n searchPlaceholder?: string;\n nothingFound?: ReactNode;\n}\n\nconst Omnibar = (props: OmnibarProps) => {\n const shortcut = props.shortcut ?? \"mod+K\";\n const searchPlaceholder = props.searchPlaceholder ?? \"Search...\";\n const nothingFound = props.nothingFound ?? \"Nothing found...\";\n const router = useRouter();\n\n // watch user to re-render on permission changes\n const [user] = useStore(currentUserAtom);\n\n const actions: SpotlightActionData[] = useMemo(\n () =>\n router.concretePages\n .filter((page) => {\n if (page.can && !page.can()) return false;\n\n return true;\n })\n .map((page) => ({\n id: page.name,\n label: page.label ?? page.name,\n description: page.description,\n onClick: () => {\n if (page.staticName) {\n return router.push(page.staticName, { params: page.params });\n }\n return router.push(page.name);\n },\n leftSection: renderIcon(page.icon),\n })),\n [user],\n );\n\n return (\n <Spotlight\n actions={actions}\n shortcut={shortcut}\n limit={10}\n searchProps={{\n leftSection: <IconSearch size={ui.sizes.icon.md} />,\n placeholder: searchPlaceholder,\n }}\n nothingFound={nothingFound}\n />\n );\n};\n\nexport default Omnibar;\n","import {\n ColorSchemeScript,\n type ColorSchemeScriptProps,\n MantineProvider,\n type MantineProviderProps,\n} from \"@mantine/core\";\nimport { ModalsProvider, type ModalsProviderProps } from \"@mantine/modals\";\nimport { Notifications, type NotificationsProps } from \"@mantine/notifications\";\nimport type { NavigationProgressProps } from \"@mantine/nprogress\";\nimport { NavigationProgress, nprogress } from \"@mantine/nprogress\";\nimport { TypeBoxError } from \"alepha\";\nimport { useEvents } from \"alepha/react\";\nimport { FormValidationError } from \"alepha/react/form\";\nimport { NestedView } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useTheme } from \"../hooks/useTheme.ts\";\nimport { useToast } from \"../hooks/useToast.ts\";\nimport Omnibar, { type OmnibarProps } from \"./layout/Omnibar.tsx\";\n\nexport interface AlephaMantineProviderProps {\n children?: ReactNode;\n mantine?: MantineProviderProps;\n colorSchemeScript?: ColorSchemeScriptProps;\n navigationProgress?: NavigationProgressProps;\n notifications?: NotificationsProps;\n modals?: ModalsProviderProps;\n omnibar?: OmnibarProps | false;\n}\n\nconst AlephaMantineProvider = (props: AlephaMantineProviderProps) => {\n const toast = useToast();\n const [theme] = useTheme();\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n nprogress.start();\n },\n \"react:transition:end\": () => {\n nprogress.complete();\n },\n \"react:action:error\": ({ error, type }) => {\n if (\n type === \"transition\" ||\n error instanceof FormValidationError ||\n error instanceof TypeBoxError\n ) {\n // Validation errors are handled by the form component\n return;\n }\n\n toast.danger({\n title: error.name || \"Error\",\n message:\n error.message ?? \"An error occurred while processing your action.\",\n });\n },\n },\n [],\n );\n\n const defaultColorScheme =\n props.mantine?.defaultColorScheme ?? theme.defaultColorScheme;\n\n return (\n <>\n <ColorSchemeScript\n defaultColorScheme={defaultColorScheme}\n {...props.colorSchemeScript}\n />\n <MantineProvider\n {...props.mantine}\n defaultColorScheme={defaultColorScheme}\n theme={{\n // Spread all theme properties from the selected theme\n ...theme,\n // User overrides take precedence\n ...props.mantine?.theme,\n }}\n >\n <Notifications {...props.notifications} />\n <NavigationProgress {...props.navigationProgress} />\n <ModalsProvider {...props.modals}>\n {props.omnibar !== false && <Omnibar {...props.omnibar} />}\n {props.children ?? <NestedView />}\n </ModalsProvider>\n </MantineProvider>\n </>\n );\n};\n\nexport default AlephaMantineProvider;\n","export const ui = {\n colors: {\n transparent: \"transparent\",\n background: \"var(--alepha-ground)\",\n surface: \"var(--alepha-surface)\",\n elevated: \"var(--alepha-elevated)\",\n border: \"var(--alepha-border)\",\n },\n sizes: {\n icon: {\n xs: 16,\n sm: 20,\n md: 24,\n lg: 28,\n xl: 32,\n },\n },\n};\n","import { type ComponentType, isValidElement } from \"react\";\n\nexport function isComponentType(param: any): param is ComponentType<any> {\n if (isValidElement(param)) return false;\n return (\n typeof param === \"function\" ||\n (typeof param === \"object\" && param !== null && \"$$typeof\" in param)\n );\n}\n","import {\n Anchor,\n type AnchorProps,\n Button,\n type ButtonProps,\n Flex,\n Menu,\n type MenuItemProps,\n type MenuProps,\n type MenuTargetProps,\n type ThemeIconProps,\n Tooltip,\n type TooltipProps,\n useMantineTheme,\n} from \"@mantine/core\";\nimport { IconCheck, IconChevronRight } from \"@tabler/icons-react\";\nimport { type UseActionReturn, useAction } from \"alepha/react\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport {\n type RouterPushOptions,\n type UseActiveOptions,\n useActive,\n useRouter,\n} from \"alepha/react/router\";\nimport {\n type ButtonHTMLAttributes,\n Children,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { isComponentType } from \"../../helpers/isComponentType.ts\";\n\nexport interface ActionMenuItem {\n /**\n * Menu item type\n */\n type?: \"item\" | \"divider\" | \"label\";\n\n /**\n * Label text for the menu item\n */\n label?: string | ReactNode;\n\n /**\n * Icon element to display before the label\n */\n icon?: ReactNode;\n\n /**\n * Click handler for menu items\n */\n onClick?: () => void;\n\n /**\n * Href for navigation menu items\n */\n href?: string;\n\n /**\n * Color for the menu item (e.g., \"red\" for danger actions)\n */\n color?: string;\n\n /**\n * Nested submenu items\n */\n children?: ActionMenuItem[];\n\n /**\n * Whether the menu item is active\n */\n active?: boolean;\n}\n\nexport interface ActionMenuConfig {\n /**\n * Array of menu items to display\n */\n items: ActionMenuItem[];\n\n /**\n * Menu position relative to the button\n */\n position?:\n | \"bottom\"\n | \"bottom-start\"\n | \"bottom-end\"\n | \"top\"\n | \"top-start\"\n | \"top-end\"\n | \"left\"\n | \"right\";\n\n /**\n * Menu width\n */\n width?: number | string;\n\n /**\n * Menu shadow\n */\n shadow?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n on?: \"hover\" | \"click\";\n\n targetProps?: MenuTargetProps;\n\n menuProps?: MenuProps;\n}\n\nexport interface ActionCommonProps extends ButtonProps {\n children?: ReactNode;\n\n /**\n * If set, the button will show only the icon on smaller screens and reveal the text from the specified breakpoint and up.\n */\n textVisibleFrom?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n /**\n * Tooltip to display on hover. Can be a string for simple tooltips\n * or a TooltipProps object for advanced configuration.\n */\n tooltip?: string | number | TooltipProps;\n\n /**\n * Menu configuration. When provided, the action will display a dropdown menu.\n */\n menu?: ActionMenuConfig;\n\n /**\n * If set, a confirmation dialog will be shown before performing the action.\n * If `true`, a default title and message will be used.\n * If a string, it will be used as the message with a default title.\n * If an object, it can contain `title` and `message` properties to customize the dialog.\n */\n confirm?: boolean | string | { title?: string; message: string };\n\n /**\n * Icon to display on the left side of the button.\n * If no children are provided, the button will be styled as an icon-only button.\n */\n icon?: ReactNode | ComponentType;\n\n /**\n * Size of the icon. Can be a number (pixels) or a string (e.g., \"1em\", \"20px\").\n */\n iconSize?: number | string;\n\n /**\n * Additional props to pass to the ThemeIcon wrapping the icon.\n */\n themeIconProps?: ThemeIconProps;\n\n /**\n * Visual intent of the action button.\n */\n intent?: \"primary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"none\";\n\n /**\n * Active state styling for navigation actions. When set, the button will apply active styles based on the current route.\n */\n variant?: ButtonProps[\"variant\"] | \"minimal\";\n}\n\nexport type ActionProps = ActionCommonProps &\n (\n | ActionNavigationButtonProps\n | ActionClickButtonProps\n | ActionSubmitButtonProps\n | ActionHookButtonProps\n | {}\n );\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nconst ActionButton = (_props: ActionProps) => {\n const theme = useMantineTheme();\n const props = { ..._props };\n\n if (props.variant === \"minimal\") {\n //props.variant = \"default\";\n //props.bd = 0;\n }\n\n const { tooltip, menu, icon, iconSize, ...restProps } = props;\n\n if (props.intent) {\n if (props.intent === \"primary\") {\n restProps.color ??= theme.primaryColor;\n } else if (props.intent === \"success\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"green\";\n } else if (props.intent === \"danger\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"red\";\n } else if (props.intent === \"warning\") {\n restProps.color ??= \"yellow\";\n } else if (props.intent === \"info\") {\n restProps.c ??= \"white\";\n restProps.color ??= \"blue\";\n }\n }\n\n if (props.icon) {\n const sizes = ui.sizes.icon as Record<string, number>;\n const iconSize = props.iconSize ?? sizes[props.size || \"sm\"];\n const icon = isComponentType(props.icon) ? (\n <props.icon size={iconSize} />\n ) : (\n <span>{props.icon as ReactNode}</span>\n );\n\n if (!props.children) {\n restProps.children = Children.only(icon);\n restProps.p ??= 8;\n } else {\n restProps.leftSection = icon;\n }\n }\n\n if (props.leftSection && !props.children) {\n restProps.px ??= \"xs\";\n }\n\n if (props.textVisibleFrom) {\n const { children, textVisibleFrom, leftSection, ...rest } = restProps;\n return (\n <>\n <Flex w={\"100%\"} visibleFrom={textVisibleFrom}>\n <ActionButton\n flex={1}\n {...rest}\n leftSection={leftSection}\n tooltip={tooltip}\n menu={menu}\n >\n {children}\n </ActionButton>\n </Flex>\n <Flex w={\"100%\"} hiddenFrom={textVisibleFrom}>\n <ActionButton\n px={\"xs\"}\n {...rest}\n aria-label={typeof children === \"string\" ? children : undefined}\n tooltip={tooltip}\n menu={menu}\n >\n {leftSection}\n </ActionButton>\n </Flex>\n </>\n );\n }\n\n const renderAction = () => {\n if (\"href\" in restProps && restProps.href) {\n if (restProps.href.startsWith(\"http\") || restProps.target) {\n return (\n <ActionHrefButton {...restProps} href={restProps.href}>\n {restProps.children}\n </ActionHrefButton>\n );\n }\n\n return (\n <ActionNavigationButton {...restProps} href={restProps.href}>\n {restProps.children}\n </ActionNavigationButton>\n );\n }\n\n delete (restProps as any).classNameActive;\n delete (restProps as any).variantActive;\n delete (restProps as any).propsActive;\n\n if (\"action\" in restProps && restProps.action) {\n return (\n <ActionHookButton {...restProps} action={restProps.action}>\n {restProps.children}\n </ActionHookButton>\n );\n }\n\n if (\"onClick\" in restProps && restProps.onClick) {\n return (\n <ActionClickButton {...restProps} onClick={restProps.onClick}>\n {restProps.children}\n </ActionClickButton>\n );\n }\n\n if (\"form\" in restProps && restProps.form) {\n if (restProps.type === \"reset\") {\n return (\n <ActionResetButton {...restProps} form={restProps.form}>\n {restProps.children}\n </ActionResetButton>\n );\n }\n return (\n <ActionSubmitButton {...restProps} form={restProps.form}>\n {restProps.children}\n </ActionSubmitButton>\n );\n }\n\n return <Button {...(restProps as any)}>{restProps.children}</Button>;\n };\n\n let actionElement = renderAction();\n\n // wrap with Menu if provided\n if (menu) {\n actionElement = (\n <Menu\n position={menu.position || \"bottom-start\"}\n width={menu.width || 200}\n shadow={menu.shadow || \"md\"}\n trigger={menu.on === \"hover\" ? \"hover\" : \"click\"}\n {...menu.menuProps}\n >\n <Menu.Target {...menu.targetProps}>{actionElement}</Menu.Target>\n <Menu.Dropdown>\n {menu.items.map((item, index) => (\n <ActionMenuItem item={item} index={index} key={index} />\n ))}\n </Menu.Dropdown>\n </Menu>\n );\n }\n\n // Wrap with Tooltip if provided\n if (tooltip) {\n // openDelay: 1000 -> like HTML title attribute\n const defaultTooltipProps: Partial<TooltipProps> = {\n openDelay: 1000,\n };\n const tooltipProps: TooltipProps =\n typeof tooltip === \"string\" || typeof tooltip === \"number\"\n ? {\n ...defaultTooltipProps,\n label: tooltip,\n children: actionElement,\n }\n : { ...defaultTooltipProps, ...tooltip, children: actionElement };\n\n return <Tooltip {...tooltipProps} />;\n }\n\n return actionElement;\n};\n\nexport default ActionButton;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Submit\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionSubmitButtonProps extends ButtonProps {\n form: FormModel<any>;\n type?: \"submit\" | \"reset\";\n}\n\n/**\n * Action button that submits a form with loading and disabled state handling.\n */\nconst ActionSubmitButton = (props: ActionSubmitButtonProps) => {\n const { form, ...buttonProps } = props;\n const state = useFormState(form);\n return (\n <Button\n {...buttonProps}\n loading={state.loading}\n disabled={state.loading}\n type={\"submit\"}\n >\n {props.children}\n </Button>\n );\n};\n\nconst ActionResetButton = (props: ActionSubmitButtonProps) => {\n const { form, ...buttonProps } = props;\n const state = useFormState(form);\n return (\n <Button {...buttonProps} disabled={state.loading} type={\"reset\"}>\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action with useAction Hook\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionHookButtonProps extends ButtonProps {\n action: UseActionReturn<any[], any>;\n}\n\n/**\n * Action button that integrates with useAction hook return value.\n * Automatically handles loading state and executes the action on click.\n *\n * @example\n * ```tsx\n * const saveAction = useAction({\n * handler: async (data) => {\n * await api.save(data);\n * }\n * }, []);\n *\n * <ActionButton action={saveAction}>\n * Save\n * </ActionButton>\n * ```\n */\nconst ActionHookButton = (props: ActionHookButtonProps) => {\n const { action, ...buttonProps } = props;\n\n return (\n <Button\n {...buttonProps}\n disabled={action.loading || props.disabled}\n loading={action.loading}\n onClick={() => action.run()}\n >\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Click\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionClickButtonProps extends ButtonProps {\n onClick: (e: any) => any;\n preventDefault?: boolean;\n}\n\n/**\n * Basic action button that handles click events with loading and error handling.\n *\n * @example\n * ```tsx\n * <ActionButton onClick={() => api.doSomething()}>\n * Do Something\n * </ActionButton>\n * ```\n */\nconst ActionClickButton = ({\n preventDefault,\n ...props\n}: ActionClickButtonProps) => {\n const action = useAction(\n {\n handler: async (e: any) => {\n if (preventDefault) {\n e.preventDefault();\n }\n await props.onClick(e);\n },\n },\n [props.onClick, preventDefault],\n );\n\n return (\n <Button\n {...props}\n disabled={action.loading || props.disabled}\n loading={action.loading}\n onClick={action.run}\n >\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Action Navigation\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface ActionNavigationButtonProps extends ButtonProps {\n href: string;\n active?: Partial<UseActiveOptions> | false;\n routerGoOptions?: RouterPushOptions;\n classNameActive?: string;\n variantActive?: ButtonProps[\"variant\"];\n propsActive?: ButtonProps;\n target?: string;\n anchorProps?: AnchorProps;\n anchor?: boolean;\n}\n\n/**\n * Action for navigation with active state support.\n */\nconst ActionNavigationButton = (props: ActionNavigationButtonProps) => {\n const {\n active: options,\n classNameActive,\n variantActive,\n propsActive,\n routerGoOptions,\n onClick: propsOnClick,\n anchorProps: buttonAnchorProps,\n anchor,\n ...buttonProps\n } = props as ActionNavigationButtonProps & { onClick?: (e: any) => void };\n const router = useRouter();\n const { isPending, isActive } = useActive(\n options ? { href: props.href, ...options } : { href: props.href },\n );\n const anchorProps = router.anchor(props.href, routerGoOptions);\n\n if (propsActive && isActive) {\n Object.assign(buttonProps, propsActive);\n }\n\n // Combine passed onClick with router's onClick\n const combinedOnClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n propsOnClick?.(e as any);\n anchorProps.onClick?.(e);\n };\n\n const className = buttonProps.className || \"\";\n if (isActive && options !== false && classNameActive) {\n buttonProps.className = `${className} ${classNameActive}`.trim();\n }\n\n if (buttonAnchorProps || anchor) {\n return (\n <Anchor\n component={\"a\"}\n {...anchorProps}\n {...(buttonProps as AnchorProps)}\n {...buttonAnchorProps}\n onClick={combinedOnClick}\n >\n {props.children}\n </Anchor>\n );\n }\n\n return (\n <Button\n component={\"a\"}\n loading={isPending}\n {...buttonProps}\n {...anchorProps}\n onClick={combinedOnClick}\n variant={\n isActive && options !== false\n ? (variantActive ?? \"filled\")\n : (buttonProps.variant ?? \"subtle\")\n }\n >\n {props.children}\n </Button>\n );\n};\n\nconst ActionHrefButton = (props: ActionNavigationButtonProps) => {\n const {\n active: options,\n classNameActive,\n variantActive,\n propsActive,\n routerGoOptions,\n target,\n ...buttonProps\n } = props;\n\n return (\n <Button component={\"a\"} target={target} {...buttonProps}>\n {props.children}\n </Button>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n// Helper function to render menu items recursively\nconst ActionMenuItem = (props: {\n item: ActionMenuItem;\n index: number;\n}): ReactNode => {\n const { item, index } = props;\n\n const router = useRouter();\n const action = useAction(\n {\n handler: async (e: any) => {\n await item.onClick?.();\n },\n },\n [item.onClick],\n );\n\n // Render divider\n if (item.type === \"divider\") {\n return <Menu.Divider key={index} />;\n }\n\n // Render label\n if (item.type === \"label\") {\n return <Menu.Label key={index}>{item.label}</Menu.Label>;\n }\n\n // Render submenu if it has children\n if (item.children && item.children.length > 0) {\n return (\n <Menu key={index} trigger=\"hover\" position=\"right-start\" offset={2}>\n <Menu.Target>\n <Menu.Item\n leftSection={item.icon}\n rightSection={<IconChevronRight size={14} />}\n >\n {item.label}\n </Menu.Item>\n </Menu.Target>\n <Menu.Dropdown>\n {item.children.map((child, childIndex) => (\n <ActionMenuItem item={child} index={childIndex} key={childIndex} />\n ))}\n </Menu.Dropdown>\n </Menu>\n );\n }\n\n const menuItemProps: MenuItemProps & ButtonHTMLAttributes<unknown> = {};\n if (props.item.onClick) {\n menuItemProps.onClick = action.run;\n } else if (props.item.href) {\n Object.assign(menuItemProps, router.anchor(props.item.href));\n }\n\n // render regular menu item\n return (\n <Menu.Item\n key={index}\n leftSection={\n item.icon ??\n (item.active ? (\n <IconCheck size={ui.sizes.icon.sm} />\n ) : (\n <Flex w={ui.sizes.icon.sm} />\n ))\n }\n onClick={item.onClick}\n color={item.color}\n {...menuItemProps}\n >\n {item.label}\n </Menu.Item>\n );\n};\n","import { Burger, type BurgerProps } from \"@mantine/core\";\nimport { useStore } from \"alepha/react\";\nimport { alephaSidebarAtom } from \"../../atoms/alephaSidebarAtom.ts\";\n\nexport interface BurgerButtonProps extends BurgerProps {}\n\nconst BurgerButton = (props: BurgerButtonProps) => {\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n\n return (\n <Burger\n opened={!sidebar.closed}\n onClick={() => setSidebar({ ...sidebar, closed: !sidebar.closed })}\n hiddenFrom=\"md\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport default BurgerButton;\n","import { CopyButton, Tooltip } from \"@mantine/core\";\nimport { IconCheck, IconCopy } from \"@tabler/icons-react\";\nimport ActionButton, { type ActionCommonProps } from \"./ActionButton.tsx\";\n\nexport interface ClipboardButtonProps\n extends Omit<ActionCommonProps, \"onClick\" | \"icon\"> {\n /**\n * The value to copy to the clipboard\n */\n value: string;\n\n /**\n * Timeout in ms to show the \"Copied\" state (default: 2000)\n */\n timeout?: number;\n\n /**\n * Label to show in tooltip when not copied (default: \"Copy\")\n */\n copyLabel?: string;\n\n /**\n * Label to show in tooltip when copied (default: \"Copied\")\n */\n copiedLabel?: string;\n}\n\nconst ClipboardButton = (props: ClipboardButtonProps) => {\n const {\n value,\n timeout = 2000,\n copyLabel = \"Copy\",\n copiedLabel = \"Copied\",\n children,\n ...buttonProps\n } = props;\n\n return (\n <CopyButton value={value} timeout={timeout}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? copiedLabel : copyLabel} openDelay={500}>\n <ActionButton\n color={copied ? \"teal\" : undefined}\n onClick={copy}\n icon={copied ? IconCheck : IconCopy}\n {...buttonProps}\n >\n {children}\n </ActionButton>\n </Tooltip>\n )}\n </CopyButton>\n );\n};\n\nexport default ClipboardButton;\n","import { useMantineColorScheme } from \"@mantine/core\";\nimport { IconMoon, IconSun } from \"@tabler/icons-react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\n/**\n * SSR-safe dark mode toggle button.\n *\n * Uses CSS-based icon switching to avoid hydration mismatches.\n * Both icons are rendered, CSS hides the wrong one based on\n * `data-mantine-color-scheme` attribute.\n */\nconst DarkModeButton = (props: Partial<ActionProps>) => {\n const { setColorScheme } = useMantineColorScheme();\n\n const toggleColorScheme = () => {\n const current =\n document.documentElement.getAttribute(\"data-mantine-color-scheme\") ??\n \"light\";\n setColorScheme(current === \"dark\" ? \"light\" : \"dark\");\n };\n\n const size = props.size ?? \"sm\";\n const iconSize =\n (ui.sizes.icon as Record<string, number>)[size] ?? ui.sizes.icon.sm;\n\n return (\n <ActionButton\n onClick={toggleColorScheme}\n variant={props.variant ?? \"default\"}\n size={size}\n aria-label=\"Toggle color scheme\"\n icon={\n <>\n <IconSun size={iconSize} className=\"alepha-light-hidden\" />\n <IconMoon size={iconSize} className=\"alepha-dark-hidden\" />\n </>\n }\n {...props}\n />\n );\n};\n\nexport default DarkModeButton;\n","import { IconLanguage } from \"@tabler/icons-react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nconst LanguageButton = (props: Partial<ActionProps>) => {\n const i18n = useI18n();\n return (\n <ActionButton\n variant={\"default\"}\n icon={IconLanguage}\n menu={{\n items: i18n.languages.map((lang) => ({\n label: i18n.tr(lang),\n onClick: () => i18n.setLang(lang),\n active: i18n.lang === lang,\n })),\n }}\n {...props}\n />\n );\n};\n\nexport default LanguageButton;\n","import { Flex, Kbd, Text } from \"@mantine/core\";\nimport { useOs } from \"@mantine/hooks\";\nimport { spotlight } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { ClientOnly } from \"alepha/react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface OmnibarButtonProps {\n actionProps?: ActionProps;\n collapsed?: boolean;\n}\n\nconst OmnibarButton = (props: OmnibarButtonProps) => {\n const os = useOs();\n const isMac = os === \"macos\" || os === \"ios\";\n const shortcut = isMac ? \"⌘\" : \"Ctrl\";\n\n if (props.collapsed) {\n return (\n <ActionButton\n variant={\"subtle\"}\n onClick={spotlight.open}\n icon={IconSearch}\n tooltip={{ label: \"Search\", position: \"right\" }}\n {...props.actionProps}\n />\n );\n }\n\n return (\n <ActionButton\n variant={\"default\"}\n onClick={spotlight.open}\n justify={\"space-between\"}\n rightSection={\n <Kbd visibleFrom={\"sm\"} size={\"sm\"}>\n <ClientOnly>{shortcut}</ClientOnly>+K\n </Kbd>\n }\n radius={\"md\"}\n {...props.actionProps}\n >\n <Flex align={\"center\"} gap={\"xs\"}>\n <IconSearch size={16} color={\"gray\"} />\n <Flex visibleFrom={\"sm\"} miw={192}>\n <Text size={\"xs\"} c={\"dimmed\"}>\n Search...\n </Text>\n </Flex>\n </Flex>\n </ActionButton>\n );\n};\n\nexport default OmnibarButton;\n","import { useInject } from \"alepha/react\";\nimport { DialogService } from \"../services/DialogService.tsx\";\n\n/**\n * Use this hook to access the Dialog Service for showing various dialog types.\n *\n * @example\n * ```tsx\n * const dialog = useDialog();\n * await dialog.alert({ title: \"Alert\", message: \"This is an alert message\" });\n * const confirmed = await dialog.confirm({ title: \"Confirm\", message: \"Are you sure?\" });\n * const input = await dialog.prompt({ title: \"Input\", message: \"Enter your name:\" });\n * ```\n */\nexport const useDialog = (): DialogService => {\n return useInject(DialogService);\n};\n","import {\n ColorSwatch,\n Flex,\n Select,\n SimpleGrid,\n Text,\n useMantineTheme,\n} from \"@mantine/core\";\nimport { IconCheck } from \"@tabler/icons-react\";\nimport type { AlephaThemeOverrides } from \"../../atoms/alephaThemeOverridesAtom.ts\";\nimport { useDialog } from \"../../hooks/useDialog.ts\";\nimport { useTheme } from \"../../hooks/useTheme.ts\";\nimport ActionButton from \"./ActionButton.tsx\";\n\nconst MANTINE_COLORS = [\n \"red\",\n \"pink\",\n \"grape\",\n \"violet\",\n \"indigo\",\n \"blue\",\n \"cyan\",\n \"teal\",\n \"green\",\n \"lime\",\n \"yellow\",\n \"orange\",\n];\n\nconst RADIUS_OPTIONS = [\n { label: \"xs\", value: \"xs\" },\n { label: \"sm\", value: \"sm\" },\n { label: \"md\", value: \"md\" },\n { label: \"lg\", value: \"lg\" },\n { label: \"xl\", value: \"xl\" },\n];\n\nconst SIZE_OPTIONS = [\n { label: \"xs\", value: \"xs\" },\n { label: \"sm\", value: \"sm\" },\n { label: \"md\", value: \"md\" },\n { label: \"lg\", value: \"lg\" },\n { label: \"xl\", value: \"xl\" },\n];\n\nconst FONT_OPTIONS = [\n { label: \"System\", value: \"\" },\n { label: \"Inter\", value: \"Inter, sans-serif\" },\n { label: \"Mono\", value: \"ui-monospace, SFMono-Regular, Menlo, monospace\" },\n { label: \"Serif\", value: \"Georgia, 'Times New Roman', serif\" },\n];\n\nconst ThemeExpertModal = () => {\n const [, , expert] = useTheme();\n const dialog = useDialog();\n const mantineTheme = useMantineTheme();\n const { overrides, setOverrides } = expert;\n\n const currentColor = overrides.primaryColor || mantineTheme.primaryColor;\n const currentRadius = overrides.radius || mantineTheme.defaultRadius || \"md\";\n const currentFont = overrides.fontFamily || \"\";\n const currentFontSize = overrides.fontSize || \"md\";\n const currentScale = overrides.scale || \"md\";\n\n const updateOverrides = (patch: Partial<AlephaThemeOverrides>) => {\n setOverrides({ ...overrides, ...patch });\n };\n\n return (\n <Flex direction=\"column\" gap=\"lg\">\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Primary Color\n </Text>\n <SimpleGrid cols={6} spacing=\"xs\">\n {MANTINE_COLORS.map((color) => (\n <Flex key={color} justify=\"center\">\n <ColorSwatch\n color={mantineTheme.colors[color]?.[6] ?? color}\n onClick={() => updateOverrides({ primaryColor: color })}\n style={{ cursor: \"pointer\" }}\n size={32}\n >\n {currentColor === color && (\n <IconCheck size={14} color=\"white\" />\n )}\n </ColorSwatch>\n </Flex>\n ))}\n </SimpleGrid>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Border Radius\n </Text>\n <Flex gap=\"xs\">\n {RADIUS_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={\n String(currentRadius) === opt.value ? \"filled\" : \"default\"\n }\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ radius: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Font Family\n </Text>\n <Select\n data={FONT_OPTIONS}\n value={currentFont}\n onChange={(value) => updateOverrides({ fontFamily: value ?? \"\" })}\n allowDeselect={false}\n />\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Font Size\n </Text>\n <Flex gap=\"xs\">\n {SIZE_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={currentFontSize === opt.value ? \"filled\" : \"default\"}\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ fontSize: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex direction=\"column\" gap=\"xs\">\n <Text fw={500} size=\"sm\">\n Scale\n </Text>\n <Flex gap=\"xs\">\n {SIZE_OPTIONS.map((opt) => (\n <ActionButton\n key={opt.value}\n variant={currentScale === opt.value ? \"filled\" : \"default\"}\n size=\"xs\"\n flex={1}\n onClick={() => updateOverrides({ scale: opt.value })}\n >\n {opt.label}\n </ActionButton>\n ))}\n </Flex>\n </Flex>\n\n <Flex justify=\"space-between\">\n <ActionButton\n variant=\"subtle\"\n color=\"red\"\n onClick={() => expert.resetOverrides()}\n >\n Reset\n </ActionButton>\n <ActionButton\n variant={\"default\"}\n px={\"xl\"}\n onClick={() => dialog.close()}\n >\n OK\n </ActionButton>\n </Flex>\n </Flex>\n );\n};\n\nexport default ThemeExpertModal;\n","import { IconPalette } from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { alephaThemeListAtom } from \"../../atoms/alephaThemeListAtom.ts\";\nimport { useDialog } from \"../../hooks/useDialog.ts\";\nimport { useTheme } from \"../../hooks/useTheme.ts\";\nimport type { ActionMenuItem } from \"./ActionButton.tsx\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\nimport ThemeExpertModal from \"./ThemeExpertModal.tsx\";\n\ntype ThemeButtonProps = Partial<ActionProps> & {\n /**\n * Enable expert mode with color, radius, and font customization.\n */\n expert?: boolean;\n};\n\nconst ThemeButton = (props: ThemeButtonProps) => {\n const { expert, ...actionProps } = props;\n const [theme, setTheme] = useTheme();\n const themeList = useStore(alephaThemeListAtom)[0];\n const dialog = useDialog();\n\n const items: ActionMenuItem[] = themeList.map((it, index) => ({\n label: it.name,\n onClick: () =>\n setTheme({\n index,\n }),\n active: theme.name === it.name,\n }));\n\n if (expert) {\n items.push(\n { type: \"divider\" },\n {\n label: \"Customize...\",\n onClick: () => {\n dialog.open({\n title: \"Customize Theme\",\n content: <ThemeExpertModal />,\n });\n },\n },\n );\n }\n\n return (\n <ActionButton\n variant=\"default\"\n icon={IconPalette}\n menu={{\n items,\n }}\n {...actionProps}\n />\n );\n};\n\nexport default ThemeButton;\n","import {\n IconLayoutSidebarLeftCollapse,\n IconLayoutSidebarRightCollapse,\n} from \"@tabler/icons-react\";\nimport { useStore } from \"alepha/react\";\nimport { alephaSidebarAtom } from \"../../atoms/alephaSidebarAtom.ts\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\ntype Props = ActionProps;\n\nconst ToggleSidebarButton = (props: Props) => {\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n\n return (\n <ActionButton\n icon={\n sidebar.collapsed\n ? IconLayoutSidebarRightCollapse\n : IconLayoutSidebarLeftCollapse\n }\n visibleFrom={\"md\"}\n variant={\"default\"}\n onClick={() => {\n setSidebar({\n ...sidebar,\n collapsed: !sidebar.collapsed,\n });\n }}\n tooltip={{\n position: \"right\",\n label: sidebar.collapsed ? \"Show sidebar\" : \"Hide sidebar\",\n }}\n {...props}\n />\n );\n};\n\nexport default ToggleSidebarButton;\n","import {\n Drawer,\n type DrawerProps,\n Flex,\n Loader,\n Tabs,\n Text,\n} from \"@mantine/core\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport type { ActionMenuItem } from \"../buttons/ActionButton.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\n\nexport interface DetailDrawerTab {\n value: string;\n label: string;\n icon?: ComponentType<{ size?: number }>;\n content: ReactNode;\n}\n\nexport interface DetailDrawerStatus {\n label: string;\n active: boolean;\n}\n\nexport interface DetailDrawerProps {\n opened: boolean;\n onClose: () => void;\n title: ReactNode;\n subtitle?: ReactNode;\n status?: DetailDrawerStatus;\n actions?: ActionMenuItem[];\n tabs?: DetailDrawerTab[];\n children?: ReactNode;\n loading?: boolean;\n size?: DrawerProps[\"size\"];\n defaultTab?: string;\n}\n\nconst DetailDrawer = (props: DetailDrawerProps) => {\n const {\n opened,\n onClose,\n title,\n subtitle,\n status,\n actions,\n tabs,\n children,\n loading,\n size = \"xl\",\n defaultTab,\n } = props;\n\n return (\n <Drawer\n opened={opened}\n onClose={onClose}\n position=\"right\"\n size={size}\n withCloseButton={false}\n padding={0}\n >\n {/* Header */}\n <Flex\n p=\"md\"\n justify=\"space-between\"\n align=\"flex-start\"\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n >\n <Flex direction=\"column\" gap={2} style={{ minWidth: 0, flex: 1 }}>\n <Flex gap=\"xs\" align=\"center\">\n {status && (\n <Flex\n w={8}\n h={8}\n style={{\n borderRadius: \"50%\",\n backgroundColor: status.active\n ? \"var(--mantine-color-green-6)\"\n : \"var(--mantine-color-red-6)\",\n flexShrink: 0,\n }}\n />\n )}\n <Text size=\"lg\" fw={600} truncate>\n {title}\n </Text>\n </Flex>\n {subtitle && (\n <Text size=\"sm\" c=\"dimmed\" truncate>\n {subtitle}\n </Text>\n )}\n </Flex>\n <Flex gap=\"xs\" align=\"center\" style={{ flexShrink: 0 }}>\n {actions && actions.length > 0 && (\n <ActionButton\n variant=\"default\"\n size=\"xs\"\n menu={{\n items: actions,\n position: \"bottom-end\",\n width: 200,\n }}\n >\n Actions\n </ActionButton>\n )}\n <ActionButton variant=\"subtle\" size=\"xs\" c=\"dimmed\" onClick={onClose}>\n Close\n </ActionButton>\n </Flex>\n </Flex>\n\n {/* Content */}\n {loading ? (\n <Flex flex={1} justify=\"center\" align=\"center\" py=\"xl\">\n <Loader />\n </Flex>\n ) : tabs && tabs.length > 0 ? (\n <Tabs defaultValue={defaultTab || tabs[0].value}>\n <Tabs.List px=\"md\">\n {tabs.map((tab) => (\n <Tabs.Tab\n key={tab.value}\n value={tab.value}\n leftSection={tab.icon ? <tab.icon size={14} /> : undefined}\n >\n {tab.label}\n </Tabs.Tab>\n ))}\n </Tabs.List>\n {tabs.map((tab) => (\n <Tabs.Panel key={tab.value} value={tab.value} p=\"md\">\n {tab.content}\n </Tabs.Panel>\n ))}\n </Tabs>\n ) : (\n <Flex direction=\"column\" p=\"md\">\n {children}\n </Flex>\n )}\n </Drawer>\n );\n};\n\nexport default DetailDrawer;\n","import { Flex, Grid, Text } from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport ClipboardButton from \"../buttons/ClipboardButton.tsx\";\n\nexport interface DetailListItem {\n label: string;\n value: ReactNode;\n hidden?: boolean;\n copyable?: string;\n}\n\nexport interface DetailListProps {\n items: DetailListItem[];\n columns?: number;\n}\n\nconst DetailList = (props: DetailListProps) => {\n const { items, columns = 1 } = props;\n const visibleItems = items.filter((item) => !item.hidden);\n\n return (\n <Grid gutter=\"xs\">\n {visibleItems.map((item) => (\n <Grid.Col key={item.label} span={12 / columns}>\n <Flex\n py={6}\n justify=\"space-between\"\n align=\"center\"\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n >\n <Text size=\"xs\" c=\"dimmed\" style={{ flexShrink: 0 }}>\n {item.label}\n </Text>\n <Flex gap={4} align=\"center\" style={{ minWidth: 0 }}>\n {typeof item.value === \"string\" ||\n typeof item.value === \"number\" ? (\n <Text size=\"sm\" fw={500} truncate>\n {item.value || \"\\u2014\"}\n </Text>\n ) : (\n (item.value ?? (\n <Text size=\"sm\" c=\"dimmed\">\n {\"\\u2014\"}\n </Text>\n ))\n )}\n {item.copyable && (\n <ClipboardButton\n value={item.copyable}\n size=\"xs\"\n variant=\"subtle\"\n c=\"dimmed\"\n />\n )}\n </Flex>\n </Flex>\n </Grid.Col>\n ))}\n </Grid>\n );\n};\n\nexport default DetailList;\n","import { Flex, Paper, Text } from \"@mantine/core\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\n\nexport interface StatCardItem {\n label: string;\n value: ReactNode;\n icon?: ReactNode | ComponentType<{ size?: number }>;\n}\n\nexport interface StatCardsProps {\n items: StatCardItem[];\n}\n\nconst StatCards = ({ items }: StatCardsProps) => (\n <Flex gap=\"sm\" wrap=\"wrap\">\n {items.map((item) => {\n const IconComponent =\n item.icon && typeof item.icon === \"function\" ? item.icon : null;\n const iconNode = IconComponent ? (\n <IconComponent size={ui.sizes.icon.md} />\n ) : (\n (item.icon as ReactNode)\n );\n\n return (\n <Paper\n key={item.label}\n p=\"md\"\n radius=\"md\"\n withBorder\n style={{ flex: \"1 1 0\", minWidth: 120 }}\n >\n <Flex gap=\"sm\" align=\"center\">\n <Flex direction=\"column\">\n <Text size=\"xl\" fw={700} lh={1}>\n {item.value}\n </Text>\n <Text size=\"xs\" c=\"dimmed\">\n {item.label}\n </Text>\n </Flex>\n </Flex>\n </Paper>\n );\n })}\n </Flex>\n);\n\nexport default StatCards;\n","import {\n Flex as MantineFlex,\n type FlexProps as MantineFlexProps,\n} from \"@mantine/core\";\nimport { FormModel } from \"alepha/react/form\";\nimport type { FormHTMLAttributes } from \"react\";\nimport { forwardRef } from \"react\";\n\nexport interface FlexProps extends MantineFlexProps {\n /**\n * Render as a `<form>` element.\n * If `true`, renders as a plain form.\n * If an object, spreads the form attributes (onSubmit, id, noValidate, etc.).\n */\n form?: boolean | FormHTMLAttributes<HTMLFormElement> | FormModel<any>;\n /**\n * flex: 1 — fill available space.\n */\n fill?: boolean;\n\n /**\n * Shorthand for align=\"center\" + justify=\"center\".\n */\n center?: boolean;\n\n /**\n * Shorthand for justify=\"center\".\n */\n centerX?: boolean;\n\n /**\n * Shorthand for align=\"center\".\n */\n centerY?: boolean;\n\n /**\n * Shorthand for direction=\"column\".\n */\n col?: boolean;\n\n /**\n * Set ground to `var(--alepha-ground)`.\n */\n ground?: boolean;\n\n /**\n * Set ground to `var(--alepha-surface)`.\n */\n surface?: boolean;\n\n /**\n * Set ground to `var(--alepha-elevated)`.\n */\n elevated?: boolean;\n\n /**\n * Add rounded corners to the container. If `true`, a default border radius will be applied. You can also specify a custom border radius value (e.g., \"sm\", \"md\", \"lg\", or any valid CSS border-radius value).\n */\n rounded?: boolean | number | string;\n\n /**\n * Add a border to the container. The color will be determined by the current theme.\n */\n bordered?: boolean;\n\n /**\n * Add a top border only.\n */\n borderedTop?: boolean;\n\n /**\n * Add a bottom border only.\n */\n borderedBottom?: boolean;\n\n /**\n * Add a shadow to the container. The intensity will be determined by the current theme.\n */\n shadowed?: boolean | number | string;\n\n /**\n * Set overflow to \"auto\" to enable scrolling when content overflows the container.\n */\n overflow?: boolean;\n}\n\nconst Flex = forwardRef<HTMLDivElement, FlexProps>((props, ref) => {\n const {\n fill,\n center,\n centerX,\n centerY,\n col,\n ground,\n surface,\n elevated,\n rounded,\n bordered,\n borderedTop,\n borderedBottom,\n shadowed,\n overflow,\n form,\n ...rest\n } = props;\n\n if (fill) {\n rest.flex ??= 1;\n }\n\n if (col) {\n rest.direction ??= \"column\";\n }\n\n if (center) {\n rest.align ??= \"center\";\n rest.justify ??= \"center\";\n }\n\n if (centerX) {\n rest.justify ??= \"center\";\n }\n\n if (centerY) {\n rest.align ??= \"center\";\n }\n\n if (ground) {\n rest.bg = \"var(--alepha-ground)\";\n } else if (surface) {\n rest.bg = \"var(--alepha-surface)\";\n } else if (elevated) {\n rest.bg = \"var(--alepha-elevated)\";\n }\n\n if (rounded) {\n rest.bdrs = rounded === true ? \"md\" : rounded;\n }\n\n if (bordered) {\n rest.bd = \"1px solid var(--alepha-border)\";\n }\n\n if (borderedTop) {\n rest.style = {\n borderTop: \"1px solid var(--alepha-border)\",\n ...((rest.style as object) ?? {}),\n };\n }\n\n if (borderedBottom) {\n rest.style = {\n borderBottom: \"1px solid var(--alepha-border)\",\n ...((rest.style as object) ?? {}),\n };\n }\n\n if (shadowed) {\n rest.className =\n `${rest.className ?? \"\"} shadow-${shadowed === true ? \"md\" : shadowed}`.trim();\n }\n\n if (overflow) {\n rest.className = `${rest.className ?? \"\"} overflow-auto`.trim();\n }\n\n if (form) {\n let formProps: any = typeof form === \"object\" ? form : {};\n if (formProps instanceof FormModel) {\n formProps = formProps.props;\n }\n return (\n <MantineFlex\n ref={ref}\n component={\"form\"}\n {...(formProps as any)}\n {...rest}\n />\n );\n }\n\n return <MantineFlex ref={ref} {...rest} />;\n});\n\nFlex.displayName = \"Flex\";\n\nexport default Flex;\n","import {\n ActionButton,\n type ActionProps,\n BurgerButton,\n DarkModeButton,\n Flex,\n LanguageButton,\n OmnibarButton,\n type OmnibarButtonProps,\n Text,\n ThemeButton,\n} from \"@alepha/ui\";\nimport {\n Anchor,\n Container,\n type ContainerProps,\n Divider,\n type FlexProps,\n Image,\n} from \"@mantine/core\";\nimport { IconArrowLeft } from \"@tabler/icons-react\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport type { ComponentType, ReactNode } from \"react\";\n\nexport type AppBarItem =\n | AppBarElement\n | AppBarBurger\n | AppBarDark\n | AppBarTheme\n | AppBarSearch\n | AppBarLang\n | AppBarSpacer\n | AppBarDivider\n | AppBarLogo\n | AppBarBack;\n\nexport interface AppBarAbstractItem {\n position: \"left\" | \"center\" | \"right\";\n\n /**\n * Visibility control: return true to show, false to hide.\n */\n can?: () => boolean;\n}\n\nexport interface AppBarElement extends AppBarAbstractItem {\n element: ReactNode;\n}\n\nexport interface AppBarBurger extends AppBarAbstractItem {\n type: \"burger\";\n}\n\nexport interface AppBarDark extends AppBarAbstractItem {\n type: \"dark\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarTheme extends AppBarAbstractItem {\n type: \"theme\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarSearch extends AppBarAbstractItem {\n type: \"search\";\n props?: OmnibarButtonProps;\n}\n\nexport interface AppBarLang extends AppBarAbstractItem {\n type: \"lang\";\n props?: Partial<ActionProps>;\n}\n\nexport interface AppBarSpacer extends AppBarAbstractItem {\n type: \"spacer\";\n}\n\nexport interface AppBarDivider extends AppBarAbstractItem {\n type: \"divider\";\n}\n\nexport interface AppBarLogo extends AppBarAbstractItem {\n type: \"logo\";\n props?: {\n /**\n * Logo image source URL.\n */\n src?: string;\n\n /**\n * Logo text (used if no src provided).\n */\n text?: string;\n\n /**\n * Icon component (used if no src or text provided).\n */\n icon?: ReactNode | ComponentType;\n\n /**\n * Link href when logo is clicked.\n */\n href?: string;\n\n /**\n * Logo image height in pixels.\n * @default 32\n */\n height?: number;\n\n /**\n * Logo image width in pixels.\n */\n width?: number;\n\n /**\n * Font weight for text logo.\n * @default 700\n */\n fontWeight?: number;\n\n /**\n * Font size for text logo.\n * @default \"lg\"\n */\n fontSize?: string;\n };\n}\n\nexport interface AppBarBack extends AppBarAbstractItem {\n type: \"back\";\n props?: {\n /**\n * Custom label for back button.\n * @default \"Back\"\n */\n label?: string;\n\n /**\n * Show only icon without label.\n * @default true\n */\n iconOnly?: boolean;\n\n /**\n * Custom href to navigate to instead of history back.\n */\n href?: string;\n\n /**\n * Custom icon component.\n */\n icon?: ReactNode | ComponentType;\n };\n}\n\nexport interface AppBarProps {\n flexProps?: FlexProps;\n items?: AppBarItem[];\n\n /**\n * Wrap the AppBar content in a Mantine Container.\n * Pass `true` for default Container, or ContainerProps to customize.\n */\n container?: boolean | ContainerProps;\n}\n\nconst AppBar = (props: AppBarProps) => {\n const { items = [] } = props;\n const router = useRouter();\n\n const renderItem = (item: AppBarItem, index: number) => {\n // Check visibility control\n if (item.can && !item.can()) {\n return null;\n }\n\n if (\"type\" in item) {\n if (item.type === \"burger\") {\n return <BurgerButton key={index} />;\n }\n if (item.type === \"dark\") {\n return <DarkModeButton key={index} {...item.props} />;\n }\n if (item.type === \"theme\") {\n return <ThemeButton key={index} {...item.props} />;\n }\n if (item.type === \"search\") {\n return <OmnibarButton key={index} {...item.props} />;\n }\n if (item.type === \"lang\") {\n return <LanguageButton key={index} {...item.props} />;\n }\n if (item.type === \"spacer\") {\n return <Flex key={index} w={16} />;\n }\n if (item.type === \"divider\") {\n return <Divider key={index} orientation=\"vertical\" />;\n }\n if (item.type === \"logo\") {\n return renderLogo(item, index);\n }\n if (item.type === \"back\") {\n return renderBack(item, index);\n }\n }\n if (\"element\" in item) {\n return item.element;\n }\n return null;\n };\n\n const renderLogo = (item: AppBarLogo, index: number) => {\n const {\n src,\n text,\n icon,\n href,\n height = 32,\n width,\n fontWeight = 700,\n fontSize = \"lg\",\n } = item.props ?? {};\n\n const logoContent = src ? (\n <Image src={src} h={height} w={width} fit=\"contain\" />\n ) : icon ? (\n typeof icon === \"function\" ? (\n (() => {\n const IconComponent = icon;\n return <IconComponent />;\n })()\n ) : (\n icon\n )\n ) : text ? (\n <Text fw={fontWeight} size={fontSize}>\n {text}\n </Text>\n ) : null;\n\n if (href) {\n return (\n <Anchor\n component={Link}\n key={index}\n href={href}\n underline=\"never\"\n c=\"inherit\"\n >\n {logoContent}\n </Anchor>\n );\n }\n\n return <Flex key={index}>{logoContent}</Flex>;\n };\n\n const renderBack = (item: AppBarBack, index: number) => {\n const { label = \"Back\", iconOnly = true, href, icon } = item.props ?? {};\n\n const renderIcon = () => {\n if (!icon) {\n return <IconArrowLeft size={18} />;\n }\n if (typeof icon === \"function\") {\n const IconComponent = icon as ComponentType<{ size?: number }>;\n return <IconComponent size={18} />;\n }\n return icon;\n };\n\n const iconElement = renderIcon();\n\n const handleClick = () => {\n if (href) {\n router.push(href);\n } else {\n router.back();\n }\n };\n\n if (iconOnly) {\n return (\n <ActionButton\n key={index}\n icon={iconElement}\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClick}\n tooltip={{ label, position: \"bottom\" }}\n />\n );\n }\n\n return (\n <ActionButton\n key={index}\n leftSection={iconElement}\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClick}\n >\n {label}\n </ActionButton>\n );\n };\n\n const leftItems = items.filter((item) => item.position === \"left\");\n const centerItems = items.filter((item) => item.position === \"center\");\n const rightItems = items.filter((item) => item.position === \"right\");\n\n const content = (\n <Flex\n h=\"100%\"\n align=\"center\"\n px={props.container ? 0 : \"md\"}\n justify=\"space-between\"\n {...props.flexProps}\n >\n <Flex flex={1}>\n {leftItems.map((item, index) => (\n <Flex key={index} ml={index === 0 ? 0 : \"md\"} align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n <Flex>\n {centerItems.map((item, index) => (\n <Flex key={index} mx=\"md\" align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n <Flex flex={1} align={\"center\"} justify={\"end\"}>\n {rightItems.map((item, index) => (\n <Flex key={index} ml={index === 0 ? 0 : \"md\"} align=\"center\">\n {renderItem(item, index)}\n </Flex>\n ))}\n </Flex>\n </Flex>\n );\n\n if (props.container) {\n const containerProps =\n typeof props.container === \"boolean\" ? {} : props.container;\n return (\n <Container h=\"100%\" {...containerProps}>\n {content}\n </Container>\n );\n }\n\n return content;\n};\n\nexport default AppBar;\n","import { ActionButton, Flex, Text, toTitleCase } from \"@alepha/ui\";\nimport type { FlexProps } from \"@mantine/core\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nexport interface BreadcrumbProps extends FlexProps {\n /**\n * Label for the home/root crumb. Set to `false` to hide the root crumb.\n *\n * @default \"Home\"\n */\n home?: string | false;\n\n /**\n * Custom separator between crumbs.\n *\n * @default IconChevronRight\n */\n separator?: ReactNode;\n\n /**\n * Size of text and separator icons.\n *\n * @default \"xs\"\n */\n size?: string;\n}\n\n/**\n * Automatic breadcrumb component that reads the current route hierarchy\n * from the Alepha router's layer stack.\n *\n * Pages should define a `label` in their `$page()` options for best results.\n * Falls back to the page name converted to Title Case.\n */\nconst Breadcrumbs = (props: BreadcrumbProps) => {\n const { home = \"Home\", separator, size = \"sm\", ...groupProps } = props;\n\n const state = useRouterState();\n const router = useRouter();\n\n const crumbs: Array<{ label: string; href: string }> = [];\n\n // Optionally add home crumb\n if (home !== false) {\n crumbs.push({ label: home, href: \"/\" });\n }\n\n // Build crumbs from layers, skipping the root layout (index 0)\n for (let i = 1; i < state.layers.length; i++) {\n const layer = state.layers[i];\n const route = layer.route as any;\n\n // Skip index routes (path \"/\") — they share the parent URL\n if (route?.path === \"/\" || route?.path === \"\") continue;\n\n const label = route?.label ?? toTitleCase(layer.name);\n // Use router.path() to resolve dynamic params (e.g. :userId → 3)\n const href = router.path(layer.name);\n crumbs.push({ label, href });\n }\n\n if (crumbs.length === 0) return null;\n\n const sep = separator ?? <IconChevronRight size={12} color=\"#9ca3af\" />;\n\n return (\n <Flex gap={\"sm\"} {...groupProps}>\n {crumbs.map((crumb, i) => (\n <Flex align={\"center\"} key={crumb.href} gap={\"sm\"}>\n {i > 0 && sep}\n {i < crumbs.length - 1 ? (\n <ActionButton anchor href={crumb.href} size={size} c=\"dimmed\">\n {crumb.label}\n </ActionButton>\n ) : (\n <Text size={size} fw={500}>\n {crumb.label}\n </Text>\n )}\n </Flex>\n ))}\n </Flex>\n );\n};\n\nexport default Breadcrumbs;\n","import {\n Container as MantineContainer,\n type ContainerProps as MantineContainerProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\n\nexport interface ContainerProps extends MantineContainerProps {}\n\nconst Container = forwardRef<HTMLDivElement, ContainerProps>((props, ref) => {\n return <MantineContainer ref={ref} {...props} />;\n});\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","import { ui } from \"@alepha/ui\";\nimport { type ComponentType, isValidElement, type ReactNode } from \"react\";\nimport { isComponentType } from \"./isComponentType.ts\";\n\nexport const renderIcon = (\n icon: ReactNode | ComponentType,\n size?: number,\n): ReactNode => {\n if (!icon) return null;\n if (isValidElement(icon)) return icon;\n if (isComponentType(icon)) {\n const IconComponent = icon;\n return <IconComponent size={size ?? ui.sizes.icon.md} />;\n }\n return icon as ReactNode;\n};\n","import {\n Text as MantineText,\n type TextProps as MantineTextProps,\n} from \"@mantine/core\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport type { AlephaIntent } from \"../interfaces/AlephaIntent.ts\";\n\nexport interface TextProps extends MantineTextProps {\n children?: ReactNode;\n\n /**\n * Semantic color intent for the text.\n */\n intent?: AlephaIntent;\n\n /**\n * Shorthand for fw={700}.\n */\n bold?: boolean;\n\n /**\n * Shorthand for fs=\"italic\".\n */\n italic?: boolean;\n\n /**\n * Shorthand for fw={300}.\n */\n light?: boolean;\n\n /**\n * Shorthand for c=\"dimmed\".\n */\n muted?: boolean;\n\n /**\n * Shorthand for size=\"sm\".\n */\n small?: boolean;\n\n /**\n * Shorthand for tt=\"uppercase\".\n */\n uppercase?: boolean;\n\n /**\n * Shorthand for tt=\"capitalize\".\n */\n capitalize?: boolean;\n\n /**\n * Shorthand for ta=\"center\".\n */\n center?: boolean;\n\n /**\n * Shorthand for ff=\"monospace\".\n */\n monospace?: boolean;\n\n /**\n * Text with title styles (larger font size, bolder weight).\n */\n title?: boolean;\n}\n\nconst INTENT_COLORS: Record<AlephaIntent, string> = {\n primary: \"blue\",\n info: \"cyan\",\n success: \"green\",\n warning: \"yellow\",\n danger: \"red\",\n};\n\nconst Text = forwardRef<HTMLParagraphElement, TextProps>((props, ref) => {\n const {\n intent,\n bold,\n italic,\n light,\n muted,\n small,\n uppercase,\n capitalize,\n center,\n monospace,\n title,\n ...rest\n } = props;\n\n if (intent) {\n rest.c ??= INTENT_COLORS[intent];\n }\n\n if (bold) {\n rest.fw ??= 700;\n }\n\n if (light) {\n rest.fw ??= 300;\n }\n\n if (italic) {\n rest.fs ??= \"italic\";\n }\n\n if (muted) {\n rest.c ??= \"dimmed\";\n }\n\n if (small) {\n rest.size ??= \"xs\";\n }\n\n if (uppercase) {\n rest.tt ??= \"uppercase\";\n }\n\n if (capitalize) {\n rest.tt ??= \"capitalize\";\n }\n\n if (center) {\n rest.ta ??= \"center\";\n }\n\n if (monospace) {\n rest.ff ??= \"monospace\";\n }\n\n if (title) {\n rest.size ??= \"xl\";\n }\n\n return <MantineText ref={ref} {...rest} />;\n});\n\nText.displayName = \"Text\";\n\nexport default Text;\n","import { IconSquareRounded } from \"@tabler/icons-react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport type {\n ActionMenuConfig,\n ActionMenuItem,\n} from \"../buttons/ActionButton.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport type { SidebarItemProps } from \"./SidebarItem.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const SidebarCollapsedItem = (props: SidebarItemProps) => {\n const router = useRouter();\n\n const handleItemClick = () => {\n props.onItemClick?.(props.item);\n props.item.onClick?.();\n };\n\n const hasChildren = props.item.children && props.item.children.length > 0;\n\n const menu: ActionMenuConfig | undefined = hasChildren\n ? {\n on: \"hover\",\n position: \"right\",\n menuProps: {\n arrowPosition: \"center\",\n arrowSize: 10,\n withArrow: true,\n },\n items: [\n {\n type: \"label\",\n label: props.item.label,\n },\n ...props.item\n .children!.filter((child) => !child.can || child.can())\n .map(\n (child): ActionMenuItem => ({\n label: child.label as string,\n icon: renderIcon(child.icon, ui.sizes.icon.sm),\n href: child.href,\n active: child.href\n ? router.isActive(child.href, {\n startWith: child.activeStartsWith,\n })\n : undefined,\n }),\n ),\n ],\n }\n : undefined;\n\n return (\n <Flex w={\"100%\"} justify=\"center\" pos={\"relative\"}>\n <ActionButton\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (props.level === 0 ? \"sm\" : \"xs\")\n }\n bd={0}\n variant={\"default\"}\n propsActive={{\n variant: \"outline\",\n }}\n tooltip={\n hasChildren\n ? undefined\n : {\n label: props.item.label,\n position: \"right\",\n }\n }\n onClick={hasChildren ? undefined : handleItemClick}\n icon={\n renderIcon(props.item.icon, ui.sizes.icon.sm) ?? (\n <IconSquareRounded size={ui.sizes.icon.sm} />\n )\n }\n href={hasChildren ? undefined : (props.item.href as any)}\n target={hasChildren ? undefined : props.item.target}\n menu={menu}\n {...props.item.actionProps}\n />\n </Flex>\n );\n};\n","import { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport { useEvents } from \"alepha/react\";\nimport { useRouter } from \"alepha/react/router\";\nimport { useCallback, useState } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport type { SidebarMenuItem, SidebarTheme } from \"./Sidebar.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const SidebarItem = (props: SidebarItemProps) => {\n const maxLevel = 2; // 0, 1, 2 = 3 levels total\n\n const router = useRouter();\n const isActive = useCallback((item: SidebarMenuItem): boolean => {\n if (!item.children) return false;\n for (const child of item.children) {\n if (child.href) {\n if (router.isActive(child.href)) {\n return true;\n }\n }\n if (isActive(child)) {\n return true;\n }\n }\n return false;\n }, []);\n\n const [isOpen, setIsOpen] = useState<boolean>(isActive(props.item));\n\n useEvents(\n {\n \"react:transition:end\": () => {\n // recalculate open state on transition end to ensure correct state after navigation\n if (isActive(props.item)) {\n setIsOpen(true);\n }\n },\n },\n [],\n );\n\n if (props.level > maxLevel) return null;\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (props.item.children && props.item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(props.item);\n props.item.onClick?.();\n }\n };\n\n return (\n <Flex direction={\"column\"} ps={props.level === 0 ? 0 : 32} pos={\"relative\"}>\n <ActionButton\n w={\"100%\"}\n justify=\"space-between\"\n href={props.item.href}\n target={props.item.target}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (props.level === 0 ? \"sm\" : \"xs\")\n }\n bd={0}\n fw={\"normal\"}\n variant={\"default\"}\n propsActive={{\n variant: \"outline\",\n }}\n radius={props.item.theme?.radius ?? props.theme.button?.radius ?? \"md\"}\n onClick={handleItemClick}\n leftSection={\n <Flex w={\"100%\"} align=\"center\" gap={\"sm\"}>\n {renderIcon(props.item.icon, ui.sizes.icon.sm)}\n <Flex direction={\"column\"}>\n <Flex>{props.item.label}</Flex>\n </Flex>\n </Flex>\n }\n rightSection={\n props.item.children ? (\n <Flex>\n {isOpen ? (\n <IconChevronDown size={14} />\n ) : (\n <IconChevronRight size={14} />\n )}\n </Flex>\n ) : (\n props.item.rightSection\n )\n }\n {...props.item.actionProps}\n />\n\n {props.item.children && isOpen && (\n <Flex\n direction={\"column\"}\n data-parent-level={props.level}\n gap={2}\n py={2}\n >\n <Flex\n style={{\n position: \"absolute\",\n width: 1,\n background:\n \"linear-gradient(to bottom, transparent, var(--mantine-color-default-border), transparent)\",\n top: 48,\n left: 20 + 32 * props.level,\n bottom: 16,\n }}\n />\n {props.item.children\n .filter((child) => !child.can || child.can())\n .map((child, index) => (\n <SidebarItem\n key={index}\n item={child}\n level={props.level + 1}\n onItemClick={props.onItemClick}\n theme={props.theme}\n />\n ))}\n </Flex>\n )}\n </Flex>\n );\n};\n","import type { FlexProps, MantineBreakpoint } from \"@mantine/core\";\nimport { useRouter } from \"alepha/react/router\";\nimport { type ComponentType, Fragment, type ReactNode, useMemo } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport { renderIcon } from \"../../helpers/renderIcon.tsx\";\nimport type { ActionProps } from \"../buttons/ActionButton.tsx\";\nimport OmnibarButton from \"../buttons/OmnibarButton.tsx\";\nimport SidebarCollapseButton from \"../buttons/ToggleSidebarButton.tsx\";\nimport Flex from \"../Flex.tsx\";\nimport Text from \"../Text.tsx\";\nimport { SidebarCollapsedItem } from \"./SidebarCollapsedItem.tsx\";\nimport { SidebarItem } from \"./SidebarItem.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarProps {\n items?: SidebarNode[];\n onItemClick?: (item: SidebarMenuItem) => void;\n onSearchClick?: () => void;\n theme?: SidebarTheme;\n flexProps?: Partial<FlexProps>;\n collapsed?: boolean;\n gap?: MantineBreakpoint | number;\n hide?: {\n paths?: string[];\n };\n\n /**\n * Automatically populate the menu from the router's pages.\n */\n autoPopulateMenu?:\n | boolean\n | {\n startsWith: string;\n };\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const Sidebar = (props: SidebarProps) => {\n const router = useRouter();\n\n const divider = (\n key: string | number,\n fill?: boolean,\n collapsed?: boolean,\n ) => {\n return (\n <Flex\n key={key}\n h={1}\n bg={\"var(--mantine-color-default-border)\"}\n my={\"xs\"}\n mx={\n fill ? \"calc(-1 * var(--mantine-spacing-md))\" : collapsed ? 0 : \"sm\"\n }\n />\n );\n };\n\n const renderNode = (\n item: SidebarNode,\n key: number | string,\n collapsed: boolean,\n ) => {\n if (\"type\" in item) {\n // Hide spacers when collapsed\n if (item.type === \"spacer\") {\n if (collapsed) return null;\n return <Flex key={key} h={16} />;\n }\n\n if (item.type === \"divider\") {\n return divider(key, item.fill, collapsed);\n }\n\n if (item.type === \"search\") {\n return (\n <Flex key={key} mb=\"xs\" w={\"100%\"} justify=\"center\" pos={\"relative\"}>\n <OmnibarButton collapsed={collapsed} />\n </Flex>\n );\n }\n\n if (item.type === \"toggle\") {\n return <SidebarCollapseButton key={key} />;\n }\n\n // Replace sections with dividers when collapsed\n if (item.type === \"section\") {\n // Hide section if all children are hidden\n if (item.children && item.children.length > 0) {\n const hasVisibleChild = item.children.some(\n (child) => !(\"can\" in child) || !child.can || child.can(),\n );\n if (!hasVisibleChild) return null;\n }\n\n if (collapsed) {\n return (\n <Fragment key={key}>\n {item.children?.map((child, index) =>\n renderNode(child, `s${key}-${index}`, collapsed),\n )}\n </Fragment>\n );\n }\n\n return (\n <Fragment key={key}>\n <Flex mt={\"md\"} align={\"center\"} gap={\"xs\"}>\n {renderIcon(item.icon, ui.sizes.icon.sm)}\n <Text size={\"xs\"} c={\"dimmed\"} tt={\"uppercase\"} fw={\"bold\"}>\n {item.label}\n </Text>\n </Flex>\n {item.children?.map((child, index) =>\n renderNode(child, `s${key}-${index}`, collapsed),\n )}\n </Fragment>\n );\n }\n }\n\n if (\"element\" in item) {\n return <Fragment key={key}>{item.element}</Fragment>;\n }\n\n // Check visibility control\n if (item.can && !item.can()) {\n return null;\n }\n\n // Hide parent if all children are hidden\n if (item.children && item.children.length > 0) {\n const hasVisibleChild = item.children.some(\n (child) => !child.can || child.can(),\n );\n if (!hasVisibleChild) {\n return null;\n }\n }\n\n if (collapsed) {\n return (\n <SidebarCollapsedItem\n key={key}\n item={item}\n level={0}\n onItemClick={props.onItemClick}\n theme={props.theme ?? {}}\n />\n );\n }\n\n return (\n <SidebarItem\n key={key}\n item={item}\n level={0}\n onItemClick={props.onItemClick}\n theme={props.theme ?? {}}\n />\n );\n };\n\n const getSidebarNodes = (): SidebarNode[] => {\n if (props.items) return props.items;\n if (props.autoPopulateMenu) {\n const items = router.concretePages\n .filter((page) => !page.can || page.can())\n .map((page) => ({\n label: page.label ?? page.name,\n //description: page.description?.slice(0, 32),\n icon: renderIcon(page.icon),\n href: router.path(page.name),\n })) as SidebarMenuItem[];\n if (\n typeof props.autoPopulateMenu === \"object\" &&\n props.autoPopulateMenu.startsWith\n ) {\n const startsWith = props.autoPopulateMenu.startsWith;\n return items.filter((item) => item.href?.startsWith(startsWith));\n }\n return items;\n }\n return [];\n };\n\n const padding = \"md\";\n const gap = props.items ? (props.gap ?? 8) : \"xs\";\n const menu = useMemo(\n () => getSidebarNodes(),\n [props.items, props.autoPopulateMenu],\n );\n\n const renderSidebar = (collapsed: boolean) => (\n <Flex flex={1} py={padding} direction={\"column\"} {...props.flexProps}>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {menu\n .filter((it) => it.position === \"top\")\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"} flex={1}>\n {menu\n .filter((it) => !it.position)\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {menu\n .filter((it) => it.position === \"bottom\")\n .map((item, index) => renderNode(item, index, collapsed))}\n </Flex>\n </Flex>\n );\n\n // When collapsed, render both versions and use CSS breakpoints:\n // - Desktop (>=md): show collapsed (icon-only) sidebar\n // - Mobile (<md): show expanded sidebar (drawer with labels)\n if (props.collapsed) {\n return (\n <>\n <Flex flex={1} direction={\"column\"} visibleFrom=\"md\">\n {renderSidebar(true)}\n </Flex>\n <Flex flex={1} direction={\"column\"} hiddenFrom=\"md\">\n {renderSidebar(false)}\n </Flex>\n </>\n );\n }\n\n return renderSidebar(false);\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type SidebarNode =\n | SidebarMenuItem\n | SidebarSpacer\n | SidebarDivider\n | SidebarSearch\n | SidebarElement\n | SidebarSection\n | SidebarToggle;\n\nexport interface SidebarAbstractItem {\n position?: \"top\" | \"bottom\";\n}\n\nexport interface SidebarElement extends SidebarAbstractItem {\n element: ReactNode;\n}\n\nexport interface SidebarSpacer extends SidebarAbstractItem {\n type: \"spacer\";\n}\n\nexport interface SidebarDivider extends SidebarAbstractItem {\n type: \"divider\";\n fill?: true;\n}\n\nexport interface SidebarSearch extends SidebarAbstractItem {\n type: \"search\";\n}\n\nexport interface SidebarToggle extends SidebarAbstractItem {\n type: \"toggle\";\n}\n\nexport interface SidebarSection extends SidebarAbstractItem {\n type: \"section\";\n label: string;\n icon?: ReactNode | ComponentType;\n children?: SidebarNode[];\n}\n\nexport interface SidebarMenuItem extends SidebarAbstractItem {\n label: string | ReactNode;\n description?: string;\n icon?: ReactNode | ComponentType;\n href?: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n activeStartsWith?: boolean; // Use startWith matching for active state\n onClick?: () => void;\n children?: SidebarMenuItem[];\n rightSection?: ReactNode;\n theme?: SidebarButtonTheme;\n actionProps?: ActionProps;\n can?: () => boolean; // Visibility control: true -> visible, false -> hidden\n}\n\nexport interface SidebarButtonTheme {\n radius?: MantineBreakpoint;\n size?: MantineBreakpoint;\n}\n\nexport interface SidebarTheme {\n button?: SidebarButtonTheme;\n search?: SidebarButtonTheme;\n}\n","import { alephaSidebarAtom, Container, Flex } from \"@alepha/ui\";\nimport {\n AppShell,\n type AppShellFooterProps,\n type AppShellHeaderProps,\n type AppShellMainProps,\n type AppShellNavbarProps,\n type AppShellProps,\n type ContainerProps,\n} from \"@mantine/core\";\nimport { useEvents, useStore } from \"alepha/react\";\nimport { NestedView, useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport AppBar, { type AppBarProps } from \"./AppBar.tsx\";\nimport { Sidebar, type SidebarProps } from \"./Sidebar.tsx\";\n\nexport interface DashboardShellProps {\n appShellProps?: Partial<AppShellProps>;\n appShellMainProps?: Partial<AppShellMainProps>;\n appShellHeaderProps?: Partial<AppShellHeaderProps>;\n appShellNavbarProps?: Partial<AppShellNavbarProps>;\n appShellFooterProps?: Partial<AppShellFooterProps>;\n sidebarProps?: Partial<SidebarProps>;\n appBarProps?: Partial<AppBarProps>;\n header?: ReactNode;\n footer?: ReactNode;\n children?: ReactNode;\n\n /**\n * AppShell layout mode.\n * - \"default\": header/footer span full width, navbar below header.\n * - \"alt\": navbar is full height, header/footer offset by navbar width.\n */\n layout?: \"default\" | \"alt\";\n\n /**\n * Content rendered above the Sidebar inside the navbar (e.g. logo).\n */\n navbarHeader?: (props: { collapsed: boolean }) => ReactNode;\n\n /**\n * Content rendered below the Sidebar inside the navbar (e.g. toggle button).\n */\n navbarFooter?: ReactNode;\n\n /**\n * Height of the header bar in pixels.\n * @default 60\n */\n headerHeight?: number;\n\n /**\n * Height of the footer bar in pixels.\n * @default 24\n */\n footerHeight?: number;\n\n noSidebarWhen?: {\n /**\n * Paths where the sidebar should be hidden.\n */\n paths?: string[];\n };\n\n /**\n * Wrap the Dashboard main content in a Mantine Container.\n */\n container?: boolean | ContainerProps;\n\n /**\n * If true, the DashboardShell will fill the height with its container.\n */\n fill?: boolean;\n}\n\nconst DashboardShell = (props: DashboardShellProps) => {\n const router = useRouter();\n const [sidebar, setSidebar] = useStore(alephaSidebarAtom);\n const collapsed =\n props.sidebarProps?.collapsed !== undefined\n ? props.sidebarProps.collapsed\n : sidebar.collapsed;\n\n const { collapsedWidth, expandedWidth } = sidebar;\n\n const shouldShowSidebar = () => {\n if (props.noSidebarWhen?.paths) {\n for (const path of props.noSidebarWhen.paths) {\n if (\n router.isActive(path, {\n startWith: true,\n })\n ) {\n return false;\n }\n }\n }\n return true;\n };\n\n const [showSidebar, setShowSidebar] = useState(shouldShowSidebar());\n\n useEvents(\n {\n \"react:transition:end\": () => {\n setShowSidebar(shouldShowSidebar());\n },\n \"react:transition:begin\": () => {\n setSidebar({ ...sidebar, closed: true });\n },\n },\n [sidebar],\n );\n\n // Default AppBar items with burger button on the left\n const defaultAppBarItems = [\n { position: \"left\" as const, type: \"burger\" as const },\n ];\n\n // Forward container to appBarProps if not already set\n const appBarProps = { ...props.appBarProps };\n appBarProps.container ??= props.container;\n\n const hasSidebar = showSidebar && props.sidebarProps !== undefined;\n const hasAppBar = props.appBarProps || props.header;\n\n let footerElement = props.footer;\n if (props.footerHeight) {\n footerElement ??= <Flex h={props.footerHeight} />;\n }\n\n const hHeight = props.headerHeight ?? 60;\n const fHeight = props.footerHeight ?? 24;\n const headerHeight = hasAppBar ? hHeight : 0;\n const footerHeight = footerElement ? fHeight : 0;\n const navbarWidth = collapsed ? collapsedWidth : expandedWidth;\n const mainContent = props.children ?? <NestedView />;\n\n return (\n <AppShell\n layout={\"alt\"}\n w={\"100%\"}\n h={\"100vh\"}\n flex={1}\n header={hasAppBar ? { height: hHeight } : undefined}\n navbar={\n hasSidebar\n ? {\n width: { base: navbarWidth },\n breakpoint: \"md\",\n collapsed: { mobile: sidebar.closed },\n }\n : undefined\n }\n footer={footerElement ? { height: fHeight } : undefined}\n {...props.appShellProps}\n >\n {hasAppBar && (\n <AppShell.Header {...props.appShellHeaderProps}>\n {props.header ?? (\n <AppBar items={defaultAppBarItems} {...appBarProps} />\n )}\n </AppShell.Header>\n )}\n\n {hasSidebar && (\n <AppShell.Navbar {...props.appShellNavbarProps}>\n {props.navbarHeader ? (\n <Flex\n style={{\n borderBottom: \"1px solid var(--mantine-color-default-border)\",\n }}\n h={headerHeight}\n >\n {props.navbarHeader({ collapsed })}\n </Flex>\n ) : null}\n <Sidebar {...(props.sidebarProps ?? {})} collapsed={collapsed} />\n {props.navbarFooter ? (\n <Flex\n style={{\n borderTop: \"1px solid var(--mantine-color-default-border)\",\n }}\n h={footerHeight}\n >\n {props.navbarFooter}\n </Flex>\n ) : null}\n </AppShell.Navbar>\n )}\n\n <AppShell.Main\n display={\"flex\"}\n bg={\"var(--alepha-ground)\"}\n pos={\"relative\"}\n h={props.fill ? \"100%\" : \"inherit\"}\n {...props.appShellMainProps}\n >\n {props.container ? (\n <Container\n {...(typeof props.container === \"boolean\" ? {} : props.container)}\n >\n {mainContent}\n </Container>\n ) : (\n mainContent\n )}\n </AppShell.Main>\n\n {footerElement && (\n <AppShell.Footer {...props.appShellFooterProps}>\n {footerElement}\n </AppShell.Footer>\n )}\n </AppShell>\n );\n};\n\nexport default DashboardShell;\n","import { Title } from \"@mantine/core\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { ui } from \"../constants/ui.ts\";\nimport { renderIcon } from \"../helpers/renderIcon.tsx\";\nimport type { ActionProps } from \"./buttons/ActionButton.tsx\";\nimport ActionButton from \"./buttons/ActionButton.tsx\";\nimport Flex from \"./Flex.tsx\";\nimport Text from \"./Text.tsx\";\n\nexport interface SectionHeaderProps {\n /**\n * Icon displayed before the title.\n * Accepts a React element or a component type (e.g. `IconUser` from tabler).\n */\n icon?: ReactNode | ComponentType<{ size?: number }>;\n\n /**\n * Main title text.\n */\n title: string | ReactNode;\n\n /**\n * Optional tag displayed after the title (e.g. a Badge or status text).\n */\n tag?: ReactNode;\n\n /**\n * Subtitle displayed below the title.\n */\n subtitle?: string | ReactNode;\n\n /**\n * Action buttons displayed on the right side.\n */\n actions?: ActionProps[];\n\n /**\n * Controls the title size and icon size.\n *\n * - `\"sm\"` → Title order 5, icon 16px\n * - `\"md\"` → Title order 4, icon 20px (default)\n * - `\"lg\"` → Title order 3, icon 24px\n */\n size?: \"sm\" | \"md\" | \"lg\";\n\n /**\n * Extra content appended to the right side (after actions).\n */\n extra?: ReactNode;\n}\n\nconst TITLE_ORDER: Record<string, 1 | 2 | 3 | 4 | 5 | 6> = {\n sm: 5,\n md: 4,\n lg: 3,\n};\n\nconst ICON_SIZE: Record<string, number> = {\n sm: ui.sizes.icon.xs,\n md: ui.sizes.icon.sm,\n lg: ui.sizes.icon.md,\n};\n\nconst SectionHeader = (props: SectionHeaderProps) => {\n const { icon, title, tag, subtitle, actions, size = \"md\", extra } = props;\n\n const iconSize = ICON_SIZE[size];\n const titleOrder = TITLE_ORDER[size];\n\n return (\n <Flex col gap={2}>\n <Flex centerY gap=\"xs\">\n {icon && (\n <Flex centerY style={{ flexShrink: 0 }}>\n {renderIcon(icon, iconSize)}\n </Flex>\n )}\n <Title order={titleOrder} lh={1.2}>\n {title}\n </Title>\n {tag}\n <Flex fill />\n {actions && actions.length > 0 && (\n <Flex gap=\"xs\" centerY style={{ flexShrink: 0 }}>\n {actions.map((actionProps, index) => (\n <ActionButton\n key={index}\n size=\"xs\"\n variant=\"default\"\n {...actionProps}\n />\n ))}\n </Flex>\n )}\n {extra}\n </Flex>\n {subtitle && (\n <Text muted small>\n {subtitle}\n </Text>\n )}\n </Flex>\n );\n};\n\nexport default SectionHeader;\n","import { Collapse } from \"@mantine/core\";\nimport { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport { type ReactNode, useState } from \"react\";\nimport { ui } from \"../constants/ui.ts\";\nimport type { ActionProps } from \"./buttons/ActionButton.tsx\";\nimport Flex from \"./Flex.tsx\";\nimport SectionHeader, { type SectionHeaderProps } from \"./SectionHeader.tsx\";\n\nexport interface SectionProps\n extends Omit<SectionHeaderProps, \"extra\" | \"size\" | \"title\"> {\n /**\n * Section header title. When omitted, no header is rendered.\n */\n title?: string | ReactNode;\n /**\n * Section content.\n */\n children?: ReactNode;\n\n /**\n * When `true`, the section body can be collapsed/expanded.\n */\n collapsible?: boolean;\n\n /**\n * Initial collapsed state. Only applies when `collapsible` is `true`.\n */\n defaultCollapsed?: boolean;\n\n /**\n * Padding for the section body.\n */\n p?: string | number;\n}\n\nconst Section = (props: SectionProps) => {\n const {\n children,\n collapsible,\n defaultCollapsed = false,\n title,\n icon,\n tag,\n subtitle,\n actions,\n p = \"md\",\n ...rest\n } = props;\n\n const [collapsed, setCollapsed] = useState(\n collapsible ? defaultCollapsed : false,\n );\n\n const hasHeader = !!title;\n\n const headerActions: ActionProps[] = [...(actions ?? [])];\n\n const chevronExtra = collapsible ? (\n <Flex\n centerY\n style={{ cursor: \"pointer\", flexShrink: 0 }}\n onClick={() => setCollapsed((v) => !v)}\n >\n {collapsed ? (\n <IconChevronRight size={ui.sizes.icon.sm} />\n ) : (\n <IconChevronDown size={ui.sizes.icon.sm} />\n )}\n </Flex>\n ) : undefined;\n\n return (\n <Flex col surface rounded bordered {...rest}>\n {hasHeader && (\n <Flex\n p=\"sm\"\n px=\"md\"\n style={{\n cursor: collapsible ? \"pointer\" : undefined,\n }}\n onClick={collapsible ? () => setCollapsed((v) => !v) : undefined}\n >\n <SectionHeader\n icon={icon}\n title={title}\n tag={tag}\n subtitle={subtitle}\n actions={headerActions}\n size=\"sm\"\n extra={chevronExtra}\n />\n </Flex>\n )}\n {collapsible ? (\n <Collapse in={!collapsed}>\n <Flex col p={p} {...(hasHeader ? { borderedTop: true } : {})}>\n {children}\n </Flex>\n </Collapse>\n ) : (\n <Flex col p={p} {...(hasHeader ? { borderedTop: true } : {})}>\n {children}\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default Section;\n","import { getDefaultIcon, prettyName, ui } from \"@alepha/ui\";\nimport { type TObject, TypeBoxError } from \"alepha\";\nimport type { BaseInputField } from \"alepha/react/form\";\nimport {\n createElement,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport type { ControlProps } from \"../components/Control.tsx\";\n\nexport const parseInput = (\n props: GenericControlProps,\n form: {\n error?: Error;\n },\n): ControlInput => {\n const disabled = false; // form.loading;\n const id = props.input.props.id;\n const label =\n props.label ??\n (\"title\" in props.input.schema &&\n typeof props.input.schema.title === \"string\"\n ? props.input.schema.title\n : undefined) ??\n prettyName(props.input.path);\n const description =\n props.description ??\n (\"description\" in props.input.schema &&\n typeof props.input.schema.description === \"string\"\n ? props.input.schema.description\n : undefined);\n const error =\n form.error && form.error instanceof TypeBoxError\n ? form.error.value.message\n : undefined;\n\n // Auto-generate icon if not provided\n const icon = !props.icon\n ? getDefaultIcon({\n type:\n props.input.schema && \"type\" in props.input.schema\n ? String(props.input.schema.type)\n : undefined,\n format:\n props.input.schema &&\n \"format\" in props.input.schema &&\n typeof props.input.schema.format === \"string\"\n ? props.input.schema.format\n : undefined,\n name: props.input.props.name,\n isEnum:\n props.input.schema &&\n \"enum\" in props.input.schema &&\n Boolean(props.input.schema.enum),\n isArray:\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\",\n size: props.size,\n })\n : isValidElement(props.icon)\n ? props.icon\n : createElement(props.icon, { size: ui.sizes.icon.sm });\n\n const format =\n props.input.schema &&\n \"format\" in props.input.schema &&\n typeof props.input.schema.format === \"string\"\n ? props.input.schema.format\n : undefined;\n\n const required = props.input.required;\n const schema = props.input.schema as TObject & { $control?: ControlProps };\n\n const testId = (props.input.props as any)?.[\"data-testid\"];\n\n const inputProps: InputProps = {\n label,\n description,\n error,\n required,\n disabled,\n ...(testId ? { \"data-testid\": testId } : {}),\n };\n\n if (\"minLength\" in schema && typeof schema.minLength === \"number\") {\n inputProps.minLength = schema.minLength;\n }\n if (\"maxLength\" in schema && typeof schema.maxLength === \"number\") {\n inputProps.maxLength = schema.maxLength;\n }\n if (\"minimum\" in schema && typeof schema.minimum === \"number\") {\n inputProps.minimum = schema.minimum;\n }\n if (\"maximum\" in schema && typeof schema.maximum === \"number\") {\n inputProps.maximum = schema.maximum;\n }\n\n return {\n id,\n icon,\n format,\n schema: props.input.schema as TObject & { $control?: ControlProps },\n inputProps,\n };\n};\n\nexport interface GenericControlProps {\n input: BaseInputField;\n label?: string;\n description?: string;\n icon?: ReactElement | ((props: { size: number }) => ReactNode);\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\nexport interface ControlInput {\n id?: string;\n icon: ReactElement;\n format?: string;\n schema: TObject & { $control?: ControlProps };\n inputProps: InputProps;\n}\n\nexport interface InputProps {\n label: string;\n description?: string;\n error?: string;\n required: boolean;\n disabled: boolean;\n\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n}\n","import { ui } from \"@alepha/ui\";\nimport {\n ActionIcon,\n Fieldset,\n Flex,\n Grid,\n Text,\n UnstyledButton,\n} from \"@mantine/core\";\nimport { IconGripVertical, IconPlus, IconTrash } from \"@tabler/icons-react\";\nimport type { TObject, TSchema } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport type { BaseInputField } from \"alepha/react/form\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\n/**\n * Represents an array item with a stable key for React reconciliation.\n */\ninterface ArrayItem {\n key: number;\n value: any;\n}\n\nexport interface ControlArrayProps extends GenericControlProps {\n /**\n * Minimum number of items allowed.\n * @default 0\n */\n min?: number;\n\n /**\n * Maximum number of items allowed.\n * @default Infinity\n */\n max?: number;\n\n /**\n * Label for the add button.\n * @default \"Add item\"\n */\n addLabel?: string;\n\n /**\n * Number of columns for object item fields.\n * @default 1\n */\n columns?: number;\n\n /**\n * Variant for the container.\n * - \"fieldset\": Uses Mantine Fieldset with legend\n * - \"plain\": No container, just renders items\n * @default \"fieldset\"\n */\n variant?: \"fieldset\" | \"plain\";\n\n /**\n * Per-field control props override for object items.\n * Keys are field names from the item schema.\n */\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n\n /**\n * Control props for primitive items.\n */\n itemControlProps?: Partial<Omit<ControlProps, \"input\">>;\n\n /**\n * Show drag handle for reordering.\n * @default false\n */\n sortable?: boolean;\n}\n\n/**\n * Custom hook to sync array items with form state.\n * Uses form events as the source of truth, eliminating dual-state issues.\n */\nconst useArrayItems = (\n input: BaseInputField | undefined,\n): {\n items: ArrayItem[];\n setItems: (items: ArrayItem[]) => void;\n nextKey: () => number;\n} => {\n const alepha = useAlepha();\n const keyCounter = useRef(0);\n\n // Initialize from initialValue\n const [items, setItemsState] = useState<ArrayItem[]>(() => {\n const initial = input?.initialValue;\n if (Array.isArray(initial)) {\n return initial.map((value) => ({\n key: keyCounter.current++,\n value,\n }));\n }\n return [];\n });\n\n // Sync form value to local state\n const syncFromFormValue = useCallback((formValue: any[] | undefined) => {\n if (!Array.isArray(formValue)) {\n setItemsState([]);\n return;\n }\n\n // Preserve keys for existing items where possible\n setItemsState((prevItems) => {\n // If lengths match and values are same references, keep existing keys\n if (prevItems.length === formValue.length) {\n const allSame = prevItems.every(\n (item, i) => item.value === formValue[i],\n );\n if (allSame) return prevItems;\n }\n\n // Otherwise, create new items with fresh keys\n keyCounter.current = 0;\n return formValue.map((value) => ({\n key: keyCounter.current++,\n value,\n }));\n });\n }, []);\n\n // Listen for form changes\n useEffect(() => {\n if (!input?.form) return;\n\n const formId = input.form.id;\n const fieldPath = input.path;\n\n const unsub = alepha.events.on(\"form:change\", (event) => {\n if (event.id === formId && event.path === fieldPath) {\n syncFromFormValue(event.value);\n }\n });\n\n return unsub;\n }, [alepha, input, syncFromFormValue]);\n\n // Update form when items change\n const setItems = useCallback(\n (newItems: ArrayItem[]) => {\n setItemsState(newItems);\n // Update form value - this will trigger form:change but we'll detect it's from us\n input?.set(newItems.map((item) => item.value));\n },\n [input],\n );\n\n const nextKey = useCallback(() => keyCounter.current++, []);\n\n return { items, setItems, nextKey };\n};\n\n/**\n * Creates a proper InputField for an array item that integrates with the form system.\n * Uses array index for test IDs to ensure predictable, testable element identifiers.\n */\nconst createArrayItemInput = (\n parentInput: BaseInputField,\n itemSchema: TSchema,\n index: number,\n _itemKey: number,\n value: any,\n onValueChange: (value: any) => void,\n): BaseInputField => {\n return {\n schema: itemSchema,\n path: `${parentInput.path}/${index}`,\n required: false,\n form: parentInput.form,\n initialValue: value,\n props: {\n id: `${parentInput.props.id}-${index}`,\n name: `${parentInput.props.name}[${index}]`,\n },\n set: onValueChange,\n };\n};\n\n/**\n * Creates a proper InputField for a nested object field within an array item.\n * Uses array index for test IDs to ensure predictable, testable element identifiers.\n */\nconst createArrayItemFieldInput = (\n parentInput: BaseInputField,\n itemSchema: TObject,\n fieldName: string,\n index: number,\n _itemKey: number,\n itemValue: any,\n onFieldChange: (field: string, value: any) => void,\n): BaseInputField => {\n const fieldSchema = itemSchema.properties[fieldName];\n return {\n schema: fieldSchema,\n path: `${parentInput.path}/${index}/${fieldName}`,\n required: itemSchema.required?.includes(fieldName) ?? false,\n form: parentInput.form,\n initialValue: itemValue?.[fieldName],\n props: {\n id: `${parentInput.props.id}-${index}-${fieldName}`,\n name: `${parentInput.props.name}[${index}].${fieldName}`,\n },\n set: (value: any) => onFieldChange(fieldName, value),\n };\n};\n\n/**\n * ControlArray component for editing arrays of schema items.\n *\n * Features:\n * - Dynamic add/remove of items\n * - Supports arrays of objects with nested fields\n * - Supports arrays of primitives\n * - Grid layout for object items\n * - Min/max constraints\n * - Syncs with form state (handles external updates and resets)\n *\n * @example\n * ```tsx\n * // For a schema like:\n * // t.object({\n * // contacts: t.array(t.object({\n * // name: t.text(),\n * // email: t.text({ format: \"email\" }),\n * // }))\n * // })\n *\n * <ControlArray\n * input={form.input.contacts}\n * columns={2}\n * addLabel=\"Add contact\"\n * controlProps={{\n * email: { text: { placeholder: \"email@example.com\" } }\n * }}\n * />\n * ```\n */\nconst ControlArray = (props: ControlArrayProps) => {\n const { inputProps } = parseInput(props, {});\n const { items, setItems, nextKey } = useArrayItems(props.input);\n\n if (!props.input?.props) {\n return null;\n }\n\n const schema = props.input.schema;\n if (!schema || !(\"items\" in schema)) {\n return null;\n }\n\n const itemSchema = (schema as { items: TSchema }).items;\n const isObjectItem = itemSchema && \"properties\" in itemSchema;\n const { min = 0, max = Number.POSITIVE_INFINITY, columns = 1 } = props;\n\n const handleAdd = () => {\n if (items.length >= max) return;\n\n // Create default value based on item schema\n let newValue: any;\n if (isObjectItem) {\n newValue = {};\n // Initialize with default values from schema if available\n const objSchema = itemSchema as TObject;\n for (const [key, propSchema] of Object.entries(objSchema.properties)) {\n if (\"default\" in propSchema) {\n newValue[key] = propSchema.default;\n }\n }\n } else {\n newValue = \"\";\n }\n\n setItems([...items, { key: nextKey(), value: newValue }]);\n };\n\n const handleRemove = (index: number) => {\n if (items.length <= min) return;\n setItems(items.filter((_, i) => i !== index));\n };\n\n const handleItemChange = (index: number, value: any) => {\n const newItems = [...items];\n newItems[index] = { ...newItems[index], value };\n setItems(newItems);\n };\n\n const handleFieldChange = (index: number, field: string, value: any) => {\n const newItems = [...items];\n newItems[index] = {\n ...newItems[index],\n value: { ...newItems[index].value, [field]: value },\n };\n setItems(newItems);\n };\n\n const colSpan = 12 / columns;\n const objectItemSchema = isObjectItem ? (itemSchema as TObject) : null;\n const fieldNames = objectItemSchema\n ? Object.keys(objectItemSchema.properties)\n : [];\n\n const renderItems = () => (\n <Flex direction=\"column\" gap=\"sm\">\n {items.map((item, index) => (\n <Flex\n key={item.key}\n gap=\"sm\"\n align=\"flex-start\"\n p=\"xs\"\n bg={ui.colors.surface}\n style={{ borderRadius: \"var(--mantine-radius-sm)\" }}\n >\n {props.sortable && (\n <ActionIcon\n variant=\"subtle\"\n color=\"gray\"\n style={{ cursor: \"grab\" }}\n >\n <IconGripVertical size={16} />\n </ActionIcon>\n )}\n\n {objectItemSchema ? (\n <Grid style={{ flex: 1 }} gutter=\"sm\">\n {fieldNames.map((fieldName) => {\n const fieldControlProps = props.controlProps?.[fieldName] ?? {};\n const fieldInput = createArrayItemFieldInput(\n props.input,\n objectItemSchema,\n fieldName,\n index,\n item.key,\n item.value,\n (field, value) => handleFieldChange(index, field, value),\n );\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={fieldInput} {...fieldControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n ) : (\n <Flex style={{ flex: 1 }}>\n <Control\n input={createArrayItemInput(\n props.input,\n itemSchema,\n index,\n item.key,\n item.value,\n (value) => handleItemChange(index, value),\n )}\n {...props.itemControlProps}\n />\n </Flex>\n )}\n\n <ActionIcon\n variant=\"subtle\"\n color=\"red\"\n onClick={() => handleRemove(index)}\n disabled={items.length <= min}\n >\n <IconTrash size={16} />\n </ActionIcon>\n </Flex>\n ))}\n\n <UnstyledButton\n onClick={handleAdd}\n disabled={items.length >= max}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 6,\n padding: \"8px 12px\",\n borderRadius: \"var(--mantine-radius-sm)\",\n border: \"1px dashed var(--mantine-color-dimmed)\",\n color: \"var(--mantine-color-dimmed)\",\n fontSize: \"var(--mantine-font-size-sm)\",\n cursor: items.length >= max ? \"not-allowed\" : \"pointer\",\n opacity: items.length >= max ? 0.5 : 1,\n transition: \"all 150ms ease\",\n }}\n onMouseEnter={(e) => {\n if (items.length < max) {\n e.currentTarget.style.borderColor =\n \"var(--mantine-color-blue-filled)\";\n e.currentTarget.style.color = \"var(--mantine-color-blue-filled)\";\n e.currentTarget.style.background =\n \"var(--mantine-color-blue-light)\";\n }\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.borderColor = \"var(--mantine-color-dimmed)\";\n e.currentTarget.style.color = \"var(--mantine-color-dimmed)\";\n e.currentTarget.style.background = \"transparent\";\n }}\n >\n <IconPlus size={14} />\n {props.addLabel ?? \"Add\"}\n </UnstyledButton>\n </Flex>\n );\n\n if (props.variant === \"plain\") {\n return (\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.label && (\n <Text size=\"sm\" fw={500}>\n {inputProps.label}\n </Text>\n )}\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderItems()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n );\n }\n\n return (\n <Fieldset legend={inputProps.label}>\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderItems()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n </Fieldset>\n );\n};\n\nexport default ControlArray;\n","import {\n DateInput,\n type DateInputProps,\n DateTimePicker,\n type DateTimePickerProps,\n TimeInput,\n type TimeInputProps,\n} from \"@mantine/dates\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport interface ControlDateProps extends GenericControlProps {\n date?: boolean | DateInputProps;\n datetime?: boolean | DateTimePickerProps;\n time?: boolean | TimeInputProps;\n}\n\n/**\n * ControlDate component for handling date, datetime, and time inputs.\n *\n * Features:\n * - DateInput for date format\n * - DateTimePicker for date-time format\n * - TimeInput for time format\n *\n * Automatically detects date formats from schema and renders appropriate picker.\n */\nconst ControlDate = (props: ControlDateProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon, format } = parseInput(props, form);\n if (!props.input?.props) {\n return null;\n }\n\n // region <DateTimePicker/>\n if (props.datetime || format === \"date-time\") {\n const dateTimePickerProps =\n typeof props.datetime === \"object\" ? props.datetime : {};\n return (\n <DateTimePicker\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ? new Date(value) : null}\n onChange={(val) =>\n setValue(val ? new Date(val).toISOString() : undefined)\n }\n {...dateTimePickerProps}\n />\n );\n }\n //endregion\n\n // region <DateInput/>\n if (props.date || format === \"date\") {\n const dateInputProps = typeof props.date === \"object\" ? props.date : {};\n return (\n <DateInput\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ? new Date(value) : null}\n onChange={(val) =>\n setValue(val ? new Date(val).toISOString().slice(0, 10) : undefined)\n }\n {...dateInputProps}\n />\n );\n }\n //endregion\n\n // region <TimeInput/>\n if (props.time || format === \"time\") {\n const timeInputProps = typeof props.time === \"object\" ? props.time : {};\n return (\n <TimeInput\n {...inputProps}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(event) => setValue(event.currentTarget.value)}\n {...timeInputProps}\n />\n );\n }\n //endregion\n\n // Fallback - shouldn't happen\n return null;\n};\n\nexport default ControlDate;\n","import {\n Input,\n NumberInput,\n type NumberInputProps,\n Slider,\n type SliderProps,\n} from \"@mantine/core\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport interface ControlNumberProps extends GenericControlProps {\n numberInputProps?: Partial<NumberInputProps>;\n sliderProps?: Partial<SliderProps>;\n}\n\n/**\n *\n */\nconst ControlNumber = (props: ControlNumberProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon } = parseInput(props, form);\n\n if (!props.input?.props) {\n return null;\n }\n\n if (props.sliderProps) {\n const min = props.sliderProps.min ?? inputProps.minimum ?? 0;\n const max = props.sliderProps.max ?? inputProps.maximum ?? 100;\n return (\n <Input.Wrapper {...inputProps}>\n <div\n style={{\n height: 32,\n padding: 8,\n }}\n >\n <Slider\n {...inputProps}\n id={id}\n {...props.sliderProps}\n value={value ?? 0}\n min={min}\n max={max}\n label={() => value}\n onChange={(val) => setValue(val)}\n />\n </div>\n </Input.Wrapper>\n );\n }\n\n return (\n <NumberInput\n {...inputProps}\n id={id}\n leftSection={icon}\n {...props.numberInputProps}\n value={value ?? \"\"}\n onChange={(val) => {\n const newValue = val !== null ? Number(val) : undefined;\n setValue(newValue);\n }}\n />\n );\n};\n\nexport default ControlNumber;\n","import { Fieldset, Flex, Grid, Text } from \"@mantine/core\";\nimport type { TObject } from \"alepha\";\nimport type { BaseInputField, ObjectInputField } from \"alepha/react/form\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\nexport interface ControlObjectProps extends GenericControlProps {\n /**\n * Number of columns for the grid layout.\n * @default 1\n */\n columns?: number;\n\n /**\n * Variant for the container.\n * - \"fieldset\": Uses Mantine Fieldset with legend\n * - \"plain\": No container, just renders fields\n * @default \"fieldset\"\n */\n variant?: \"fieldset\" | \"plain\";\n\n /**\n * Per-field control props override.\n * Keys are field names from the schema.\n */\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n}\n\n/**\n * ControlObject component for editing nested object schemas.\n *\n * Features:\n * - Renders all properties of an object schema\n * - Supports grid layout with configurable columns\n * - Per-field customization via controlProps\n * - Recursive support for deeply nested objects\n *\n * The form system provides nested InputFields under the `.items` property.\n * For example: form.input.address.items.street\n *\n * @example\n * ```tsx\n * // For a schema like:\n * // t.object({\n * // address: t.object({\n * // street: t.text(),\n * // city: t.text(),\n * // zip: t.text(),\n * // })\n * // })\n *\n * <ControlObject\n * input={form.input.address}\n * columns={2}\n * controlProps={{\n * zip: { text: { maxLength: 10 } }\n * }}\n * />\n * ```\n */\nconst ControlObject = (props: ControlObjectProps) => {\n const { inputProps } = parseInput(props, {});\n\n if (!props.input?.props) {\n return null;\n }\n\n const schema = props.input.schema as TObject;\n if (!schema?.properties) {\n return null;\n }\n\n const fieldNames = Object.keys(schema.properties);\n const columns = props.columns ?? 1;\n const colSpan = 12 / columns;\n\n // The form system provides nested InputFields under .items\n const objectInput = props.input as ObjectInputField<TObject>;\n const nestedItems = objectInput.items as Record<string, BaseInputField>;\n\n const renderFields = () => (\n <Grid>\n {fieldNames.map((fieldName) => {\n const fieldControlProps = props.controlProps?.[fieldName] ?? {};\n\n // Access nested InputField from .items\n const field = nestedItems?.[fieldName];\n if (!field) {\n return null;\n }\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={field} {...fieldControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n\n if (props.variant === \"plain\") {\n return renderFields();\n }\n\n return (\n <Fieldset legend={inputProps.label}>\n <Flex direction=\"column\" gap=\"xs\">\n {inputProps.description && (\n <Text size=\"sm\" c=\"dimmed\">\n {inputProps.description}\n </Text>\n )}\n {renderFields()}\n {inputProps.error && (\n <Text size=\"sm\" c=\"red\">\n {inputProps.error}\n </Text>\n )}\n </Flex>\n </Fieldset>\n );\n};\n\nexport default ControlObject;\n","import { ActionButton, OPERATOR_INFO, type SchemaField, ui } from \"@alepha/ui\";\nimport { Badge, Divider, Flex, Text } from \"@mantine/core\";\n\nexport interface ControlQueryBuilderHelpProps {\n /**\n * Schema fields to display\n */\n fields: SchemaField[];\n\n /**\n * Callback when a text snippet is inserted\n */\n onInsert: (text: string) => void;\n}\n\nconst ControlQueryBuilderHelp = (props: ControlQueryBuilderHelpProps) => {\n const { fields, onInsert } = props;\n\n return (\n <Flex\n gap=\"md\"\n align=\"flex-start\"\n wrap=\"nowrap\"\n bg={ui.colors.surface}\n p={\"sm\"}\n bdrs={\"sm\"}\n >\n {/* Left Column: Operators */}\n <Flex direction=\"column\" gap=\"md\" style={{ flex: 1 }}>\n {/* Available Operators */}\n <Flex direction=\"column\" gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Operators\n </Text>\n <Flex direction=\"column\" gap={4}>\n {Object.entries(OPERATOR_INFO).map(([key, info]) => (\n <Flex key={key} gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(info.symbol)}\n >\n {info.symbol}\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\" style={{ flex: 1 }}>\n {info.label}\n </Text>\n </Flex>\n ))}\n </Flex>\n </Flex>\n\n <Divider />\n\n {/* Logic Operators */}\n <Flex direction=\"column\" gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Logic\n </Text>\n <Flex direction=\"column\" gap={4}>\n <Flex gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(\"&\")}\n >\n &\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\">\n AND\n </Text>\n </Flex>\n <Flex gap=\"xs\" wrap=\"nowrap\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"center\"}\n miw={48}\n onClick={() => onInsert(\"|\")}\n >\n |\n </ActionButton>\n <Text size=\"xs\" c=\"dimmed\">\n OR\n </Text>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n\n {/* Divider */}\n {fields.length > 0 && <Divider orientation=\"vertical\" />}\n\n {/* Right Column: Fields */}\n {fields.length > 0 && (\n <Flex direction={\"column\"} gap=\"xs\" style={{ flex: 2 }}>\n <Text size=\"sm\" fw={600}>\n Fields\n </Text>\n <Flex\n direction={\"column\"}\n gap={4}\n style={{ maxHeight: 300, overflowY: \"auto\" }}\n >\n {fields.map((field) => (\n <Flex key={field.path} gap=\"xs\" wrap=\"nowrap\" align=\"flex-start\">\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n variant={\"default\"}\n justify={\"end\"}\n miw={120}\n onClick={() => onInsert(field.path)}\n >\n {field.path}\n </ActionButton>\n <Flex\n mt={3}\n direction={\"column\"}\n gap={2}\n style={{ flex: 1, minWidth: 0 }}\n >\n <Text size=\"xs\" c=\"dimmed\" lineClamp={1}>\n {field.description || field.type}\n </Text>\n {field.enum && (\n <Flex gap={0} wrap=\"wrap\">\n {field.enum.map((enumValue) => (\n <ActionButton\n px={\"xs\"}\n size={\"xs\"}\n h={24}\n key={enumValue}\n onClick={() => onInsert(enumValue)}\n >\n {enumValue}\n </ActionButton>\n ))}\n </Flex>\n )}\n </Flex>\n <Badge size=\"xs\" variant=\"light\" style={{ flexShrink: 0 }}>\n {field.type}\n </Badge>\n </Flex>\n ))}\n </Flex>\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default ControlQueryBuilderHelp;\n","import { extractSchemaFields, ui } from \"@alepha/ui\";\nimport {\n ActionIcon,\n Popover,\n TextInput,\n type TextInputProps,\n} from \"@mantine/core\";\nimport { IconFilter, IconInfoTriangle, IconX } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { parseQueryString } from \"alepha/orm\";\nimport { useEvents } from \"alepha/react\";\nimport { useRef, useState } from \"react\";\nimport ControlQueryBuilderHelp from \"./ControlQueryBuilderHelp.tsx\";\n\nexport interface ControlQueryBuilderProps\n extends Omit<TextInputProps, \"value\" | \"onChange\"> {\n schema?: TObject;\n value?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n}\n\n/**\n * Query builder with text input and help popover.\n * Generates query strings for parseQueryString syntax.\n */\nconst ControlQueryBuilder = (props: ControlQueryBuilderProps) => {\n const {\n schema,\n value = \"\",\n onChange,\n placeholder = \"Enter query or click for assistance...\",\n ...textInputProps\n } = props;\n\n const [helpOpened, setHelpOpened] = useState(false);\n const [textValue, setTextValue] = useState(value);\n const inputRef = useRef<HTMLInputElement>(null);\n const fields = schema ? extractSchemaFields(schema) : [];\n const [error, setError] = useState<string | null>(null);\n\n const isValid = (value: string) => {\n try {\n parseQueryString(value.trim());\n } catch (e) {\n setError((e as Error).message);\n return false;\n }\n setError(null);\n return true;\n };\n\n const handleTextChange = (newValue: string) => {\n setTextValue(newValue);\n if (isValid(newValue)) {\n onChange?.(newValue);\n }\n };\n\n const handleClear = () => {\n setTextValue(\"\");\n onChange?.(\"\");\n isValid(\"\");\n };\n\n const handleInsert = (text: string) => {\n const newValue = textValue ? `${textValue}${text} ` : `${text} `;\n setTextValue(newValue);\n if (isValid(newValue)) {\n onChange?.(newValue);\n }\n // Refocus the input after inserting\n setTimeout(() => {\n inputRef.current?.focus();\n // set cursor to end\n const length = inputRef.current?.value.length || 0;\n inputRef.current?.setSelectionRange(length, length);\n }, 0);\n };\n\n useEvents(\n {\n \"form:change\": (event) => {\n if (event.id === inputRef.current?.form?.id) {\n if (event.path === (textInputProps as any)[\"data-path\"]) {\n setTextValue(event.value ?? \"\");\n }\n }\n },\n },\n [],\n );\n\n return (\n <Popover\n width={800}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={helpOpened}\n onChange={setHelpOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <TextInput\n ref={inputRef}\n placeholder={placeholder}\n value={textValue}\n onChange={(e) => handleTextChange(e.currentTarget.value)}\n onFocus={() => setHelpOpened(true)}\n leftSection={\n error ? <IconInfoTriangle size={16} /> : <IconFilter size={16} />\n }\n rightSection={\n textValue && (\n <ActionIcon\n size=\"sm\"\n variant=\"subtle\"\n color=\"gray\"\n onClick={handleClear}\n >\n <IconX size={14} />\n </ActionIcon>\n )\n }\n {...textInputProps}\n />\n </Popover.Target>\n <Popover.Dropdown\n bg={\"transparent\"}\n p={\"xs\"}\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <ControlQueryBuilderHelp fields={fields} onInsert={handleInsert} />\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default ControlQueryBuilder;\n","import {\n Autocomplete,\n type AutocompleteProps,\n Flex,\n Input,\n Loader,\n MultiSelect,\n type MultiSelectProps,\n SegmentedControl,\n type SegmentedControlProps,\n Select,\n type SelectProps,\n TagsInput,\n type TagsInputProps,\n} from \"@mantine/core\";\nimport type { Async } from \"alepha\";\nimport { useAction } from \"alepha/react\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\n\nexport type SelectValueLabel =\n | string\n | { value: string; label: string; icon?: string };\n\ntype LoaderMode = \"static\" | \"short\" | \"long\";\n\nexport interface ControlSelectProps extends GenericControlProps {\n /**\n * If true, allows creating new values not present in the options list.\n * For single values, Select becomes an Autocomplete.\n * For arrays, MultiSelect becomes a TagsInput.\n */\n creatable?: boolean;\n\n /**\n * Configure select with optional SelectProps.\n */\n selectProps?: boolean | SelectProps;\n\n /**\n * Configure select as multi-select (for array of enums) with optional MultiSelectProps.\n */\n multiSelectProps?: boolean | MultiSelectProps;\n\n /**\n * If true, renders a SegmentedControl instead of Select/MultiSelect.\n */\n segmentedProps?: boolean | Partial<SegmentedControlProps>;\n\n /**\n * Props passed to the Autocomplete component when creatable is true and the field is single-value.\n */\n autocompleteProps?: Partial<AutocompleteProps>;\n\n /**\n * Props passed to the TagsInput component when creatable is true and the field is array-value.\n */\n tagsInputProps?: Partial<TagsInputProps>;\n\n /**\n * Async loader for select options.\n *\n * @param search - Search text (empty string on initial load)\n * @param resolve - Optional array of values to resolve labels for (used for default values in long mode)\n */\n loader?: (search: string, resolve?: string[]) => Async<SelectValueLabel[]>;\n\n /**\n * Threshold to distinguish short (client-filtered) from long (server-filtered) lists.\n * If initial load returns <= threshold items, mode is \"short\" (cached, client-filtered).\n * If > threshold, mode is \"long\" (debounced server search).\n * @default 100\n */\n loaderThreshold?: number;\n\n /**\n * Debounce delay in ms for server search in long mode.\n * @default 300\n */\n loaderDebounce?: number;\n}\n\n/**\n * ControlSelect component for handling Select, MultiSelect, Autocomplete, and TagsInput.\n *\n * Features:\n * - Basic Select with enum support\n * - MultiSelect for array of enums\n * - Autocomplete for creatable single values\n * - TagsInput for creatable array values\n * - Async lazy loading with auto short/long mode detection\n * - Short mode: client-side filtering with cached data\n * - Long mode: debounced server search\n *\n * Automatically detects enum values and array types from schema.\n */\nconst ControlSelect = (props: ControlSelectProps) => {\n const form = useFormState(props.input);\n const [value, setValue] = useFieldValue(props.input);\n const { inputProps, id, icon } = parseInput(props, form);\n\n // Detect if schema is an array type\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n // Detect if schema is numeric (for value coercion)\n const isNumeric =\n props.input.schema &&\n \"type\" in props.input.schema &&\n (props.input.schema.type === \"integer\" ||\n props.input.schema.type === \"number\");\n\n // Detect if schema is boolean (for value coercion)\n const isBoolean =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"boolean\";\n\n // Extract enum values from schema (for non-array select)\n const enumValues =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n Array.isArray(props.input.schema.enum)\n ? props.input.schema.enum\n : [];\n\n // Async loader hook\n const {\n data: asyncData,\n loading,\n mode,\n search,\n } = useAsyncLoader(\n props.loader,\n props.loaderThreshold ?? 100,\n props.loaderDebounce ?? 300,\n props.input.initialValue,\n );\n\n // Static data from enum (no loader)\n const [staticData, setStaticData] = useState<SelectValueLabel[]>([]);\n\n const enumKey = JSON.stringify(enumValues);\n useEffect(() => {\n if (!props.input?.props || props.loader) return;\n if (isBoolean && enumValues.length === 0) {\n setStaticData([\n { value: \"true\", label: \"True\" },\n { value: \"false\", label: \"False\" },\n ]);\n } else {\n setStaticData(enumValues);\n }\n }, [props.input, props.loader, enumKey, isBoolean]);\n\n const data = props.loader ? asyncData : staticData;\n\n if (!props.input?.props) {\n return null;\n }\n\n /**\n * Coerce value for numeric schemas — Select values are always strings.\n */\n const coerceValue = (val: string | null) => {\n if (val == null) return val;\n if (isNumeric) return Number(val);\n if (isBoolean) return val === \"true\";\n return val;\n };\n\n // region <SegmentedControl/> — early return\n if (props.segmentedProps) {\n const segmentedControlProps: Partial<SegmentedControlProps> =\n typeof props.segmentedProps === \"object\" ? props.segmentedProps : {};\n const segmentedData = segmentedControlProps.data ?? data.slice(0, 10);\n\n return (\n <Input.Wrapper {...inputProps}>\n <Flex my={\"calc(var(--mantine-spacing-xs) / 2)\"}>\n <SegmentedControl\n disabled={inputProps.disabled}\n value={value != null ? String(value) : \"\"}\n {...segmentedControlProps}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n data={segmentedData}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n // endregion\n\n // Shared props used by all select-like components\n const sharedProps = {\n size: props.size,\n id,\n leftSection: loading ? <Loader color={\"gray\"} size={10} /> : icon,\n data,\n };\n\n // Select and MultiSelect: searchable + hide default chevron\n const selectableProps = {\n ...sharedProps,\n searchable: true,\n rightSection: <span />,\n };\n\n // Long mode additions: bypass client filter + wire server search\n const longModeProps =\n mode === \"long\"\n ? {\n filter: ({ options }: { options: any[] }) => options,\n onSearchChange: search.run,\n }\n : {};\n\n // region <TagsInput/> — creatable + array\n if (props.creatable && (isArray || props.tagsInputProps)) {\n const tagsInputExtraProps = props.tagsInputProps ?? {};\n\n return (\n <TagsInput\n {...inputProps}\n {...sharedProps}\n {...longModeProps}\n value={Array.isArray(value) ? value : []}\n onChange={(val) => {\n setValue(val);\n }}\n {...tagsInputExtraProps}\n />\n );\n }\n // endregion\n\n // region <Autocomplete/> — creatable + single\n if (props.creatable) {\n const autocompleteExtraProps = props.autocompleteProps ?? {};\n\n return (\n <Autocomplete\n {...inputProps}\n {...sharedProps}\n {...longModeProps}\n value={value != null ? String(value) : \"\"}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...autocompleteExtraProps}\n />\n );\n }\n // endregion\n\n // region <MultiSelect/> — array (non-creatable)\n if (isArray || props.multiSelectProps) {\n const multiSelectExtraProps =\n typeof props.multiSelectProps === \"object\" ? props.multiSelectProps : {};\n\n return (\n <MultiSelect\n {...inputProps}\n {...selectableProps}\n {...longModeProps}\n value={Array.isArray(value) ? value : []}\n onChange={(val) => {\n setValue(val);\n }}\n {...multiSelectExtraProps}\n />\n );\n }\n // endregion\n\n // region <Select/> — single value (static, short, or long mode)\n const selectExtraProps =\n typeof props.selectProps === \"object\" ? props.selectProps : {};\n\n // Static mode\n if (mode === \"static\") {\n return (\n <Select\n {...inputProps}\n {...selectableProps}\n value={value != null ? String(value) : null}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...selectExtraProps}\n />\n );\n }\n\n // Short or long mode\n return (\n <Select\n {...inputProps}\n {...selectableProps}\n {...longModeProps}\n value={value != null ? String(value) : null}\n onChange={(val) => {\n setValue(coerceValue(val));\n }}\n {...selectExtraProps}\n />\n );\n // endregion\n};\n\nexport default ControlSelect;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Hook for async select data loading with auto short/long mode detection.\n */\nconst useAsyncLoader = (\n loader: ControlSelectProps[\"loader\"],\n threshold: number,\n debounceMs: number,\n defaultValue: any,\n) => {\n const [data, setData] = useState<SelectValueLabel[]>([]);\n const [loading, setLoading] = useState(false);\n const [mode, setMode] = useState<LoaderMode>(\"static\");\n const cache = useRef(new Map<string, SelectValueLabel[]>());\n\n useAction(\n {\n name: \"select:loader:init\",\n runOnInit: true,\n handler: async () => {\n if (!loader) {\n setMode(\"static\");\n return;\n }\n\n setLoading(true);\n try {\n const result = await loader(\"\");\n const isShort = result.length <= threshold;\n setMode(isShort ? \"short\" : \"long\");\n cache.current.set(\"\", result);\n setData(result);\n\n // In long mode, resolve default value label before clearing loading\n if (!isShort && defaultValue != null && String(defaultValue) !== \"\") {\n const resolved = await loader(\"\", [String(defaultValue)]);\n if (resolved.length > 0) {\n setData((prev) => {\n const existing = new Set(\n prev.map((d) => (typeof d === \"string\" ? d : d.value)),\n );\n const newItems = resolved.filter((r) => {\n const val = typeof r === \"string\" ? r : r.value;\n return !existing.has(val);\n });\n return [...prev, ...newItems];\n });\n }\n }\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, threshold],\n );\n\n // Debounced search (long mode only)\n const search = useAction<[string]>(\n {\n debounce: debounceMs,\n handler: async (text) => {\n if (!loader || mode !== \"long\") return;\n\n // Check cache first (immediate, no network)\n if (cache.current.has(text)) {\n setData(cache.current.get(text)!);\n return;\n }\n\n setLoading(true);\n try {\n const result = await loader(text);\n cache.current.set(text, result);\n setData(result);\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, mode, debounceMs],\n );\n\n return { data, loading, mode, search };\n};\n","import {\n ColorInput,\n type ColorInputProps,\n FileInput,\n type FileInputProps,\n Flex,\n Input,\n PasswordInput,\n type PasswordInputProps,\n Switch,\n type SwitchProps,\n Textarea,\n type TextareaProps,\n TextInput,\n type TextInputProps,\n} from \"@mantine/core\";\nimport type {\n DateInputProps,\n DateTimePickerProps,\n TimeInputProps,\n} from \"@mantine/dates\";\nimport { useFieldValue, useFormState } from \"alepha/react/form\";\nimport type { ComponentType } from \"react\";\nimport { type GenericControlProps, parseInput } from \"../utils/parseInput.ts\";\nimport ControlArray, { type ControlArrayProps } from \"./ControlArray.tsx\";\nimport ControlDate from \"./ControlDate.tsx\";\nimport ControlNumber, { type ControlNumberProps } from \"./ControlNumber.tsx\";\nimport ControlObject, { type ControlObjectProps } from \"./ControlObject.tsx\";\nimport ControlQueryBuilder from \"./ControlQueryBuilder.tsx\";\nimport ControlSelect, { type ControlSelectProps } from \"./ControlSelect.tsx\";\n\nexport interface ControlProps extends GenericControlProps {\n text?: TextInputProps;\n area?: boolean | TextareaProps;\n select?: boolean | Partial<ControlSelectProps>;\n password?: boolean | PasswordInputProps;\n switch?: boolean | SwitchProps;\n number?: boolean | Partial<ControlNumberProps>;\n file?: boolean | FileInputProps;\n color?: boolean | ColorInputProps;\n date?: boolean | DateInputProps;\n datetime?: boolean | DateTimePickerProps;\n time?: boolean | TimeInputProps;\n query?: any; // Enable query builder mode with schema-aware autocomplete\n object?: boolean | Partial<Omit<ControlObjectProps, \"input\">>; // Nested object editing\n array?: boolean | Partial<Omit<ControlArrayProps, \"input\">>; // Array of items editing\n custom?: ComponentType<CustomControlProps>;\n\n slider?: boolean;\n segmented?: boolean;\n}\n\n/**\n * Generic form control that renders the appropriate input based on the schema and props.\n *\n * Supports:\n * - TextInput (with format detection: email, url, tel)\n * - Textarea\n * - NumberInput (for number/integer types)\n * - FileInput\n * - ColorInput (for color format)\n * - Select (for enum types)\n * - Autocomplete\n * - PasswordInput\n * - Switch (for boolean types)\n * - SegmentedControl (for enum types)\n * - DateInput (for date format)\n * - DateTimePicker (for date-time format)\n * - TimeInput (for time format)\n * - QueryBuilder (for building type-safe queries with autocomplete)\n * - ControlObject (for nested object schemas)\n * - ControlArray (for arrays of objects)\n * - Custom component\n *\n * Automatically handles labels, descriptions, error messages, required state, and default icons.\n */\nconst Control = (_props: ControlProps) => {\n const form = useFormState(_props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(_props.input);\n\n // Early return if input is not properly initialized\n if (!_props.input?.props) {\n return null;\n }\n\n const { inputProps, id, icon, format, schema } = parseInput(_props, form);\n\n const props = {\n ..._props,\n ...schema.$control,\n };\n\n //region <QueryBuilder/>\n if (props.query) {\n return (\n <ControlQueryBuilder\n {...inputProps}\n schema={props.query}\n value={value}\n onChange={(val) => {\n setValue(val);\n }}\n />\n );\n }\n //endregion\n\n //region <Custom/>\n if (props.custom) {\n const Custom = props.custom;\n return (\n <Input.Wrapper {...inputProps}>\n <Flex flex={1} mt={\"calc(var(--mantine-spacing-xs) / 2)\"}>\n <Custom\n value={value}\n onChange={(val) => {\n setValue(val);\n }}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n //endregion\n\n //region <ControlObject/>\n // Handle nested objects with properties\n const isObject =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"object\" &&\n \"properties\" in props.input.schema;\n\n if (props.object || isObject) {\n const controlObjectProps =\n typeof props.object === \"object\" ? props.object : {};\n return (\n <ControlObject\n input={props.input}\n label={props.label}\n description={props.description}\n {...controlObjectProps}\n />\n );\n }\n //endregion\n\n //region <ControlArray/>\n // Handle arrays of objects (arrays of primitives are handled by ControlSelect)\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n const isArrayOfObjects =\n isArray &&\n \"items\" in props.input.schema &&\n props.input.schema.items &&\n typeof props.input.schema.items === \"object\" &&\n \"properties\" in props.input.schema.items;\n\n if (props.array || isArrayOfObjects) {\n const controlArrayProps =\n typeof props.array === \"object\" ? props.array : {};\n return (\n <ControlArray\n input={props.input}\n label={props.label}\n description={props.description}\n {...controlArrayProps}\n />\n );\n }\n //endregion\n\n //region <NumberInput/>\n if (\n props.number ||\n (!props.select &&\n props.input.schema &&\n \"type\" in props.input.schema &&\n (props.input.schema.type === \"number\" ||\n props.input.schema.type === \"integer\"))\n ) {\n const controlNumberProps =\n typeof props.number === \"object\" ? props.number : {};\n if (props.slider) {\n controlNumberProps.sliderProps ??= {};\n }\n return (\n <ControlNumber\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n {...controlNumberProps}\n />\n );\n }\n //endregion\n\n //region <FileInput/>\n if (props.file) {\n const fileInputProps = typeof props.file === \"object\" ? props.file : {};\n return (\n <FileInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n onChange={(file) => setValue(file)}\n {...fileInputProps}\n />\n );\n }\n //endregion\n\n //region <ColorInput/>\n if (props.color || format === \"color\") {\n const colorInputProps = typeof props.color === \"object\" ? props.color : {};\n return (\n <ColorInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(val) => setValue(val)}\n {...colorInputProps}\n />\n );\n }\n //endregion\n\n //region <ControlSelect/>\n // Handle: single enum, array of enum, array of strings, or explicit select/multi/tags props\n // Note: arrays of objects are handled by ControlArray above, this handles primitive arrays\n const isEnum =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n props.input.schema.enum;\n\n if (isEnum || (isArray && !isArrayOfObjects) || props.select) {\n const opts = typeof props.select === \"object\" ? props.select : {};\n if (props.segmented) {\n opts.segmentedProps ??= {};\n }\n return (\n <ControlSelect\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n {...opts}\n />\n );\n }\n //endregion\n\n //region <Switch/>\n if (\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"boolean\"\n ) {\n if (props.switch) {\n const switchProps = typeof props.switch === \"object\" ? props.switch : {};\n return (\n <Switch\n {...inputProps}\n size={props.size}\n id={id}\n color={\"blue\"}\n checked={Boolean(value)}\n onChange={(event) => {\n setValue(event.currentTarget.checked);\n }}\n {...switchProps}\n />\n );\n }\n\n const opts: ControlSelectProps = {\n input: props.input,\n selectProps: {\n data: [\n { value: \"true\", label: \"Yes\" },\n { value: \"false\", label: \"No\" },\n ],\n },\n };\n\n return (\n <ControlSelect\n size={props.size}\n label={props.label}\n description={props.description}\n icon={icon}\n {...opts}\n />\n );\n }\n //endregion\n\n //region <PasswordInput/>\n if (props.password || props.input.props.name?.includes(\"password\")) {\n const passwordInputProps =\n typeof props.password === \"object\" ? props.password : {};\n return (\n <PasswordInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...passwordInputProps}\n />\n );\n }\n //endregion\n\n //region <Textarea/>\n if (props.area) {\n const textAreaProps = typeof props.area === \"object\" ? props.area : {};\n return (\n <Textarea\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...textAreaProps}\n />\n );\n }\n //endregion\n\n //region <ControlDate/>\n // Handle: date, date-time, and time formats\n if (\n props.date ||\n props.datetime ||\n props.time ||\n format === \"date\" ||\n format === \"date-time\" ||\n format === \"time\"\n ) {\n return (\n <ControlDate\n size={props.size}\n input={props.input}\n label={props.label}\n description={props.description}\n icon={icon}\n date={props.date}\n datetime={props.datetime}\n time={props.time}\n />\n );\n }\n //endregion\n\n //region <TextInput/> with format detection\n const textInputProps = typeof props.text === \"object\" ? props.text : {};\n\n // Detect HTML5 input type from format\n const getInputType = (): string | undefined => {\n switch (format) {\n case \"email\":\n return \"email\";\n case \"url\":\n case \"uri\":\n return \"url\";\n case \"tel\":\n case \"phone\":\n return \"tel\";\n default:\n return props.input.props.type ?? \"text\";\n }\n };\n\n return (\n <TextInput\n {...inputProps}\n size={props.size}\n id={id}\n leftSection={icon}\n type={getInputType()}\n value={value ?? \"\"}\n onChange={(ev) => setValue(ev.target.value)}\n {...textInputProps}\n />\n );\n //endregion\n};\n\nexport default Control;\n\nexport type CustomControlProps = {\n value: any;\n onChange: (value: any) => void;\n};\n","import { ActionButton, type ActionSubmitButtonProps } from \"@alepha/ui\";\nimport { Card, Flex, type FlexProps, Grid } from \"@mantine/core\";\nimport type { TObject } from \"alepha\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport type { ReactNode } from \"react\";\nimport Control, { type ControlProps } from \"./Control.tsx\";\n\nexport interface TypeFormProps<T extends TObject> {\n form: FormModel<T>;\n columns?:\n | number\n | {\n base?: number;\n xs?: number;\n sm?: number;\n md?: number;\n lg?: number;\n xl?: number;\n };\n schema?: TObject;\n children?: (input: FormModel<T>[\"input\"]) => ReactNode;\n\n /**\n * Control props applied to all fields.\n */\n controlProps?: Partial<Omit<ControlProps, \"input\">>;\n\n /**\n * Per-field control props override.\n * Keys are field names from the schema.\n */\n fieldControlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n skipFormElement?: boolean;\n skipSubmitButton?: boolean;\n submitButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n resetButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n\n fill?: boolean;\n flexProps?: FlexProps;\n\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\n/**\n * TypeForm component that automatically renders all form inputs based on schema.\n * Uses the Control component to render individual fields and Mantine Grid for responsive layout.\n *\n * Supports all field types including:\n * - Primitive types (string, number, boolean, etc.)\n * - Enum types (rendered as Select)\n * - Arrays of primitives (rendered as MultiSelect/TagsInput)\n * - Arrays of objects (rendered as ControlArray)\n * - Nested objects (rendered as ControlObject)\n *\n * @example\n * ```tsx\n * import { t } from \"alepha\";\n * import { useForm } from \"alepha/react/form\";\n * import { TypeForm } from \"@alepha/ui\";\n *\n * const form = useForm({\n * schema: t.object({\n * username: t.text(),\n * email: t.text(),\n * age: t.integer(),\n * subscribe: t.boolean(),\n * address: t.object({\n * street: t.text(),\n * city: t.text(),\n * }),\n * tags: t.array(t.text()),\n * contacts: t.array(t.object({\n * name: t.text(),\n * email: t.text(),\n * })),\n * }),\n * handler: (values) => {\n * console.log(values);\n * },\n * });\n *\n * return <TypeForm form={form} columns={2} />;\n * ```\n */\nconst TypeForm = <T extends TObject>(props: TypeFormProps<T>) => {\n const {\n form,\n columns = 3,\n children,\n controlProps,\n fieldControlProps,\n skipFormElement = false,\n skipSubmitButton = false,\n submitButtonProps,\n fill = true,\n size,\n } = props;\n\n const { dirty } = useFormState(form, [\"dirty\"]);\n\n const schema = props.schema || form.options.schema;\n if (!schema?.properties) {\n return null;\n }\n\n const fieldNames = Object.keys(schema.properties);\n\n // Filter to only include valid InputFields\n // All types are now supported: primitives, enums, arrays, objects\n const supportedFields = fieldNames;\n\n // Handle column configuration with defaults: xs=1, sm=2, lg=3\n const colSpan =\n typeof columns === \"number\"\n ? {\n xs: 12,\n sm: 6,\n lg: 12 / columns,\n }\n : {\n base: columns.base ? 12 / columns.base : undefined,\n xs: columns.xs ? 12 / columns.xs : 12,\n sm: columns.sm ? 12 / columns.sm : 6,\n md: columns.md ? 12 / columns.md : undefined,\n lg: columns.lg ? 12 / columns.lg : 4,\n xl: columns.xl ? 12 / columns.xl : undefined,\n };\n\n const renderFields = () => {\n if (children) {\n return <>{children(form.input)}</>;\n }\n\n return (\n <Grid>\n {supportedFields.map((fieldName) => {\n const field = form.input[fieldName as keyof typeof form.input];\n const fieldSchema: any = schema.properties[fieldName];\n\n // Type guard to ensure field has the expected structure\n if (!field || !fieldSchema) {\n return null;\n }\n\n // Determine if this is a complex type (object or array of objects)\n // that should span full width\n const isObject =\n fieldSchema &&\n \"type\" in fieldSchema &&\n fieldSchema.type === \"object\";\n\n const isArrayOfObjects =\n fieldSchema &&\n \"type\" in fieldSchema &&\n fieldSchema.type === \"array\" &&\n \"items\" in fieldSchema &&\n fieldSchema.items &&\n \"properties\" in fieldSchema.items;\n\n // Complex types span full width, primitives use grid columns\n const span = isObject || isArrayOfObjects ? 12 : colSpan;\n\n // Merge control props: base controlProps + field-specific overrides\n const mergedControlProps = {\n ...controlProps,\n ...fieldControlProps?.[fieldName],\n };\n\n if (size) {\n mergedControlProps.size = size;\n }\n\n return (\n <Grid.Col key={fieldName} span={span}>\n <Control input={field} {...mergedControlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n };\n\n const content = (\n <Flex\n direction={\"column\"}\n gap={\"sm\"}\n flex={fill ? 1 : undefined}\n {...props.flexProps}\n >\n <Flex direction={\"column\"} gap={\"sm\"} flex={1}>\n {renderFields()}\n </Flex>\n {!skipSubmitButton && (\n <Card w={\"100%\"} withBorder>\n <Flex gap={\"sm\"} flex={1}>\n <Flex></Flex>\n <Flex flex={1}></Flex>\n <Flex gap={\"sm\"}>\n <ActionButton variant={\"subtle\"} type={\"reset\"} disabled={!dirty}>\n Reset\n </ActionButton>\n <ActionButton\n intent={\"primary\"}\n form={form}\n disabled={!dirty}\n {...submitButtonProps}\n >\n {submitButtonProps?.children ?? \"Submit\"}\n </ActionButton>\n </Flex>\n </Flex>\n </Card>\n )}\n </Flex>\n );\n\n if (skipFormElement) {\n return content;\n }\n\n return (\n <Flex\n component={\"form\"}\n flex={fill ? 1 : undefined}\n {...form.props}\n {...props.flexProps}\n >\n {content}\n </Flex>\n );\n};\n\nexport default TypeForm;\n","import type { BaseDialogOptions } from \"@alepha/ui\";\nimport type { TObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport TypeForm, { type TypeFormProps } from \"../components/TypeForm.tsx\";\n\nexport interface DialogFormOptions<T extends TObject>\n extends BaseDialogOptions {\n typeFormProps?: Partial<Omit<TypeFormProps<T>, \"form\">>;\n}\n\n/**\n * Creates dialog options for a form dialog.\n *\n * @param form - The form model to render.\n * @param options - Additional dialog and TypeForm options.\n */\nexport const dialogForm = <T extends TObject>(\n form: FormModel<T>,\n options?: DialogFormOptions<T>,\n): BaseDialogOptions => ({\n size: \"lg\",\n title: options?.title || \"Form\",\n ...options,\n content: (\n <TypeForm\n form={form}\n skipSubmitButton={false}\n {...options?.typeFormProps}\n />\n ),\n});\n","import { ActionIcon } from \"@mantine/core\";\nimport { IconCheck, IconCopy } from \"@tabler/icons-react\";\nimport { useCallback, useState } from \"react\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerCopyButtonProps {\n value: string;\n iconSize: number;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewerCopyButton = (props: JsonViewerCopyButtonProps) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n navigator.clipboard.writeText(props.value);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n },\n [props.value],\n );\n\n return (\n <ActionIcon\n size={props.iconSize + 4}\n variant=\"transparent\"\n c={copied ? \"green\" : \"dimmed\"}\n onClick={handleCopy}\n className=\"alepha-json-viewer-copy\"\n >\n {copied ? (\n <IconCheck size={props.iconSize} />\n ) : (\n <IconCopy size={props.iconSize} />\n )}\n </ActionIcon>\n );\n};\n","import type { MantineSize } from \"@mantine/core\";\nimport type { CSSProperties } from \"react\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface JsonTreeNode {\n value: string;\n label: string;\n children?: JsonTreeNode[];\n nodeValue: any;\n nodeKey: string | undefined;\n path: string[];\n isArrayItem: boolean;\n isRoot?: boolean;\n}\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\nexport const SIZE_CONFIG: Record<\n MantineSize,\n { icon: number; levelOffset: number }\n> = {\n xs: { icon: 14, levelOffset: 16 },\n sm: { icon: 16, levelOffset: 20 },\n md: { icon: 18, levelOffset: 24 },\n lg: { icon: 20, levelOffset: 28 },\n xl: { icon: 22, levelOffset: 32 },\n};\n\nexport const STYLES = {\n root: {\n fontFamily: \"var(--mantine-font-family-monospace)\",\n } satisfies CSSProperties,\n chevron: {\n flexShrink: 0,\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n key: {\n color: \"var(--mantine-color-cyan-text)\",\n fontWeight: 500,\n } satisfies CSSProperties,\n colon: {\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n string: {\n color: \"var(--mantine-color-teal-text)\",\n } satisfies CSSProperties,\n number: {\n color: \"var(--mantine-color-blue-text)\",\n } satisfies CSSProperties,\n boolean: {\n color: \"var(--mantine-color-violet-text)\",\n } satisfies CSSProperties,\n null: {\n color: \"var(--mantine-color-dimmed)\",\n fontStyle: \"italic\",\n } satisfies CSSProperties,\n preview: {\n color: \"var(--mantine-color-dimmed)\",\n } satisfies CSSProperties,\n};\n\n// =============================================================================\n// HELPERS\n// =============================================================================\n\nexport const getValueType = (val: any): string => {\n if (val === null) return \"null\";\n if (val === undefined) return \"undefined\";\n if (Array.isArray(val)) return \"array\";\n return typeof val;\n};\n","import { Flex, type MantineSize, Text } from \"@mantine/core\";\nimport { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { JsonViewerCopyButton } from \"./JsonViewerCopyButton.tsx\";\nimport { getValueType, type JsonTreeNode, STYLES } from \"./JsonViewerShared.ts\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerRowNodeProps {\n node: JsonTreeNode;\n expanded: boolean;\n hasChildren: boolean;\n elementProps: any;\n size: MantineSize;\n config: { icon: number; levelOffset: number };\n showQuotes: boolean;\n showCopyButton: boolean;\n renderValue: (val: any, key: string | undefined, path: string[]) => ReactNode;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewerRowNode = (props: JsonViewerRowNodeProps) => {\n const { nodeValue, nodeKey, path, isArrayItem } = props.node;\n const type = getValueType(nodeValue);\n const isExpandable = type === \"object\" || type === \"array\";\n\n const getPreview = () => {\n if (!isExpandable) return null;\n const entries = type === \"array\" ? nodeValue : Object.keys(nodeValue);\n const count = entries.length;\n const label = type === \"array\" ? \"item\" : \"key\";\n\n if (!props.expanded) {\n return (\n <Text\n fs={\"italic\"}\n component=\"span\"\n size={props.size}\n style={STYLES.preview}\n >\n {count === 0\n ? type === \"array\"\n ? \"[]\"\n : \"{}\"\n : type === \"array\"\n ? `[ ${count} ${count === 1 ? label : `${label}s`} ]`\n : `{ ${count} ${count === 1 ? label : `${label}s`} }`}\n </Text>\n );\n }\n\n return null;\n };\n\n const getCopyValue = () =>\n isExpandable ? JSON.stringify(nodeValue, null, 2) : String(nodeValue ?? \"\");\n\n return (\n <Flex\n gap={6}\n wrap=\"nowrap\"\n {...props.elementProps}\n className={`alepha-json-viewer-row ${props.elementProps.className || \"\"}`}\n >\n {props.hasChildren ? (\n props.expanded ? (\n <IconChevronDown size={props.config.icon} style={STYLES.chevron} />\n ) : (\n <IconChevronRight size={props.config.icon} style={STYLES.chevron} />\n )\n ) : (\n <span style={{ width: props.config.icon, flexShrink: 0 }} />\n )}\n\n {nodeKey !== undefined && !isArrayItem && (\n <Text component=\"span\" size={props.size}>\n <span style={STYLES.key}>\n {props.showQuotes ? `\"${nodeKey}\"` : nodeKey}\n </span>\n <span style={STYLES.colon}>:</span>\n </Text>\n )}\n\n {nodeKey !== undefined && isArrayItem && (\n <Text component=\"span\" size={props.size}>\n <span style={STYLES.key}>{nodeKey}</span>\n <span style={STYLES.colon}>:</span>\n </Text>\n )}\n\n {props.hasChildren ? (\n getPreview()\n ) : isExpandable ? (\n type === \"array\" ? (\n <Text component=\"span\" size={props.size} style={STYLES.preview}>\n []\n </Text>\n ) : (\n <Text component=\"span\" size={props.size} style={STYLES.preview}>\n {\"{}\"}\n </Text>\n )\n ) : (\n props.renderValue(nodeValue, nodeKey, path)\n )}\n\n {props.showCopyButton && (\n <JsonViewerCopyButton\n value={getCopyValue()}\n iconSize={props.config.icon}\n />\n )}\n </Flex>\n );\n};\n","import {\n getTreeExpandedState,\n type MantineSize,\n Text,\n Tree,\n useTree,\n} from \"@mantine/core\";\nimport { type ReactNode, useCallback, useMemo } from \"react\";\nimport { JsonViewerRowNode } from \"./JsonViewerRowNode.tsx\";\nimport {\n getValueType,\n type JsonTreeNode,\n SIZE_CONFIG,\n STYLES,\n} from \"./JsonViewerShared.ts\";\n\n// =============================================================================\n// PROPS\n// =============================================================================\n\nexport interface JsonViewerProps {\n data: any;\n /**\n * Depth level to expand by default (0 = collapsed, Infinity = all expanded)\n */\n defaultExpandedDepth?: number;\n /**\n * Maximum nesting depth to render\n */\n maxDepth?: number;\n /**\n * Size variant\n */\n size?: MantineSize;\n /**\n * Whether to show quotes around keys and strings\n */\n showQuotes?: boolean;\n /**\n * Show copy button on row hover\n */\n showCopyButton?: boolean;\n /**\n * Custom value formatter. Return formatted string or undefined to use default.\n */\n formatValue?: (\n key: string | undefined,\n value: any,\n path: string[],\n ) => string | number | undefined;\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nexport const JsonViewer = (props: JsonViewerProps) => {\n const {\n data,\n defaultExpandedDepth = 2,\n maxDepth = 10,\n size = \"sm\",\n showQuotes = false,\n showCopyButton = true,\n formatValue,\n } = props;\n\n const config = SIZE_CONFIG[size] || SIZE_CONFIG.sm;\n\n // Build tree data from JSON with root wrapper\n const treeData = useMemo(() => {\n const type = getValueType(data);\n\n // For objects and arrays, create a root node wrapper\n if (type === \"object\" || type === \"array\") {\n const entries =\n type === \"array\"\n ? (data as any[]).map((v, i) => [String(i), v] as const)\n : Object.entries(data);\n const children = entries\n .map(([k, v]) => buildTreeNodes(v, [], k, type === \"array\", maxDepth))\n .filter((n): n is JsonTreeNode => n !== null);\n\n const rootNode: JsonTreeNode = {\n value: \"root\",\n label: \"\",\n nodeValue: data,\n nodeKey: undefined,\n path: [],\n isArrayItem: false,\n isRoot: true,\n children: children.length > 0 ? children : undefined,\n };\n return [rootNode];\n }\n\n // For primitives, just show the value directly\n const node = buildTreeNodes(data, [], undefined, false, maxDepth);\n return node ? [node] : [];\n }, [data, maxDepth]);\n\n // Compute initial expanded state (root is always expanded by default unless depth is 0)\n const initialExpandedState = useMemo(() => {\n if (defaultExpandedDepth === 0) return {};\n if (defaultExpandedDepth === Infinity) {\n return getTreeExpandedState(treeData, \"*\");\n }\n // Add 1 to depth to account for root node\n const ids = getExpandedIds(treeData, defaultExpandedDepth + 1);\n return getTreeExpandedState(treeData, ids);\n }, [treeData, defaultExpandedDepth]);\n\n const tree = useTree({ initialExpandedState });\n\n // Render value based on type\n const renderValue = useCallback(\n (val: any, key: string | undefined, path: string[]): ReactNode => {\n const custom = formatValue?.(key, val, path);\n if (custom !== undefined) {\n return (\n <Text\n component=\"span\"\n size={size}\n style={STYLES.string}\n className=\"alepha-json-viewer-value\"\n title={String(val)}\n >\n {custom}\n </Text>\n );\n }\n\n const type = getValueType(val);\n switch (type) {\n case \"string\": {\n return (\n <Text\n style={STYLES.string}\n component=\"span\"\n size={size}\n className=\"alepha-json-viewer-value\"\n title={val}\n >\n \"{val}\"\n </Text>\n );\n }\n case \"number\":\n return (\n <Text component=\"span\" size={size} style={STYLES.number}>\n {val}\n </Text>\n );\n case \"boolean\":\n return (\n <Text component=\"span\" size={size} style={STYLES.boolean}>\n {String(val)}\n </Text>\n );\n case \"null\":\n case \"undefined\":\n return (\n <Text component=\"span\" size={size} style={STYLES.null}>\n {type}\n </Text>\n );\n default:\n return (\n <Text component=\"span\" size={size}>\n {String(val)}\n </Text>\n );\n }\n },\n [formatValue, showQuotes, size],\n );\n\n // Render tree node\n const renderNode = useCallback(\n ({\n node,\n expanded,\n hasChildren,\n elementProps,\n }: {\n node: JsonTreeNode;\n expanded: boolean;\n hasChildren: boolean;\n elementProps: any;\n }): ReactNode => {\n return (\n <JsonViewerRowNode\n node={node}\n expanded={expanded}\n hasChildren={hasChildren}\n elementProps={elementProps}\n size={size}\n config={config}\n showQuotes={showQuotes}\n showCopyButton={showCopyButton}\n renderValue={renderValue}\n />\n );\n },\n [config, renderValue, showCopyButton, showQuotes, size],\n );\n\n if (treeData.length === 0) {\n return (\n <Text size={size} style={STYLES.null}>\n {data === null ? \"null\" : data === undefined ? \"undefined\" : \"{}\"}\n </Text>\n );\n }\n\n return (\n <Tree\n data={treeData}\n tree={tree}\n levelOffset={config.levelOffset}\n expandOnClick\n renderNode={renderNode as any}\n styles={{ root: STYLES.root }}\n />\n );\n};\n\n// =============================================================================\n// HELPERS\n// =============================================================================\n\n/**\n * Convert JSON to tree data structure.\n */\nconst buildTreeNodes = (\n data: any,\n path: string[] = [],\n key?: string,\n isArrayItem = false,\n maxDepth = 10,\n): JsonTreeNode | null => {\n const currentPath = key !== undefined ? [...path, key] : path;\n const nodeId = currentPath.length > 0 ? currentPath.join(\".\") : \"root\";\n\n if (currentPath.length > maxDepth) {\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n };\n }\n\n const type = getValueType(data);\n\n if (type === \"object\" || type === \"array\") {\n const entries =\n type === \"array\"\n ? (data as any[]).map((v, i) => [String(i), v] as const)\n : Object.entries(data);\n\n const children = entries\n .map(([k, v]) =>\n buildTreeNodes(v, currentPath, k, type === \"array\", maxDepth),\n )\n .filter((n): n is JsonTreeNode => n !== null);\n\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n children: children.length > 0 ? children : undefined,\n };\n }\n\n return {\n value: nodeId,\n label: key ?? \"\",\n nodeValue: data,\n nodeKey: key,\n path: currentPath,\n isArrayItem,\n };\n};\n\n/**\n * Get all expandable node IDs up to a certain depth.\n */\nconst getExpandedIds = (\n nodes: JsonTreeNode[],\n targetDepth: number,\n currentDepth = 0,\n): string[] => {\n if (currentDepth >= targetDepth) return [];\n const ids: string[] = [];\n for (const node of nodes) {\n if (node.children) {\n ids.push(node.value);\n ids.push(...getExpandedIds(node.children, targetDepth, currentDepth + 1));\n }\n }\n return ids;\n};\n\nexport default JsonViewer;\n","import type { BaseDialogOptions } from \"@alepha/ui\";\nimport { ui } from \"@alepha/ui\";\nimport { Flex } from \"@mantine/core\";\nimport { JsonViewer } from \"../components/JsonViewer.tsx\";\n\n/**\n * Creates dialog options for a JSON viewer dialog.\n *\n * @param data - The JSON data to display.\n * @param options - Additional dialog options.\n */\nexport const dialogJson = (\n data?: any,\n options?: BaseDialogOptions,\n): BaseDialogOptions => ({\n size: \"lg\",\n title: options?.title || \"Json Viewer\",\n ...options,\n content: (\n <Flex bdrs={\"md\"} w={\"100%\"} flex={1} p={\"sm\"} bg={ui.colors.surface}>\n <JsonViewer size={\"xs\"} data={data} />\n </Flex>\n ),\n});\n","import { $context } from \"alepha\";\nimport {\n type AlephaThemeListAtom,\n alephaThemeListAtom,\n} from \"../atoms/alephaThemeListAtom.ts\";\nimport { UiRouter } from \"../UiRouter.ts\";\n\n/**\n * Convenience function to configure and inject the UiRouter.\n */\nexport const $ui = (options: { themes?: AlephaThemeListAtom } = {}) => {\n const { alepha } = $context();\n if (options.themes) {\n alepha.store.set(alephaThemeListAtom, options.themes);\n }\n return alepha.inject(UiRouter); // Inject as singleton ?\n};\n","import { Flex } from \"@alepha/ui\";\nimport { type TObject, t } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useMemo } from \"react\";\nimport {\n default as TypeForm,\n type TypeFormProps,\n} from \"../../form/components/TypeForm.tsx\";\nimport type { FilterVisibility } from \"../interfaces/types.ts\";\n\nexport interface DataTableFiltersProps {\n schema: TObject;\n form: FormModel<TObject>;\n typeFormProps?: Partial<Omit<TypeFormProps<TObject>, \"form\">>;\n filterVisibility: FilterVisibility;\n}\n\nconst DataTableFilters = (props: DataTableFiltersProps) => {\n const { schema, form, typeFormProps, filterVisibility } = props;\n\n const visibleSchema = useMemo(() => {\n const visibleKeys = Object.keys(schema.properties).filter(\n (key) => filterVisibility[key] !== false,\n );\n\n if (visibleKeys.length === 0) {\n return null;\n }\n\n const visibleProps = visibleKeys.reduce(\n (acc, key) => {\n acc[key] = schema.properties[key];\n return acc;\n },\n {} as Record<string, unknown>,\n );\n\n return t.object(visibleProps as TObject[\"properties\"]);\n }, [schema, filterVisibility]);\n\n if (!visibleSchema) {\n return null;\n }\n\n return (\n <Flex surface flex={1} mt={-4} p=\"xs\" m=\"xs\" bdrs=\"md\">\n <TypeForm\n {...typeFormProps}\n skipSubmitButton\n fill\n form={form}\n schema={visibleSchema}\n columns={{\n base: 1,\n sm: 2,\n md: 3,\n lg: 4,\n xl: 5,\n }}\n />\n </Flex>\n );\n};\n\nexport default DataTableFilters;\n","import { Flex, Text } from \"@alepha/ui\";\nimport { Pagination, Select } from \"@mantine/core\";\n\nexport interface DataTablePaginationProps {\n page: number;\n size: string;\n totalPages?: number;\n totalElements?: number;\n isFirst?: boolean;\n isLast?: boolean;\n offset: number;\n numberOfElements: number;\n onPageChange: (page: number) => void;\n onSizeChange: (size: number) => void;\n}\n\nconst DataTablePagination = ({\n page,\n size,\n totalPages,\n totalElements,\n isFirst,\n isLast,\n offset,\n numberOfElements,\n onPageChange,\n onSizeChange,\n}: DataTablePaginationProps) => {\n const from = numberOfElements > 0 ? offset + 1 : 0;\n const to = offset + numberOfElements;\n const hasTotal = totalPages != null;\n\n return (\n <Flex\n align=\"center\"\n justify=\"space-between\"\n gap=\"md\"\n px=\"xs\"\n py={4}\n style={{\n borderTop: \"1px solid var(--alepha-border)\",\n }}\n >\n <Flex align=\"center\">\n <Text size=\"xs\" c=\"dimmed\">\n {totalElements != null\n ? `Showing ${from} - ${to} of ${totalElements}`\n : `Showing ${from} - ${to}`}\n </Text>\n </Flex>\n <Flex align=\"center\" gap=\"md\">\n <Flex>\n <Select\n color={\"gray\"}\n c={\"gray\"}\n size={\"xs\"}\n w={96}\n variant=\"default\"\n value={size}\n onChange={(value) => {\n if (value) {\n onSizeChange(Number(value));\n }\n }}\n data={[\n { value: \"10\", label: \"10\" },\n { value: \"25\", label: \"25\" },\n { value: \"50\", label: \"50\" },\n { value: \"100\", label: \"100\" },\n ]}\n />\n </Flex>\n <Flex>\n <Pagination\n size={\"sm\"}\n withEdges={hasTotal}\n withPages={hasTotal}\n total={hasTotal ? totalPages : isLast !== false ? page : page + 1}\n value={page}\n onChange={onPageChange}\n />\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTablePagination;\n","import { ActionButton, ui } from \"@alepha/ui\";\nimport { Checkbox, Flex, Popover, ScrollArea, Text } from \"@mantine/core\";\nimport { IconColumns } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { useState } from \"react\";\nimport {\n type ColumnVisibility,\n type DataTableColumn,\n DEFAULT_MAX_VISIBLE_COLUMNS,\n} from \"../interfaces/types.ts\";\n\nexport interface ColumnPickerProps<T extends object, Filters extends TObject> {\n columns: { [key: string]: DataTableColumn<T, Filters> };\n visibility: ColumnVisibility;\n onVisibilityChange: (visibility: ColumnVisibility) => void;\n}\n\nconst ColumnPicker = <T extends object, Filters extends TObject>({\n columns,\n visibility,\n onVisibilityChange,\n}: ColumnPickerProps<T, Filters>) => {\n const [opened, setOpened] = useState(false);\n const columnEntries = Object.entries(columns);\n\n const handleShowAll = () => {\n const newVisibility = columnEntries.reduce(\n (acc, [key]) => ({ ...acc, [key]: true }),\n {} as ColumnVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleDefault = () => {\n let count = 0;\n const newVisibility = columnEntries.reduce((acc, [key, col]) => {\n if (col.defaultHidden) {\n acc[key] = false;\n } else if (count < DEFAULT_MAX_VISIBLE_COLUMNS) {\n acc[key] = true;\n count++;\n } else {\n acc[key] = false;\n }\n return acc;\n }, {} as ColumnVisibility);\n onVisibilityChange(newVisibility);\n };\n\n const handleToggle = (key: string, checked: boolean) => {\n onVisibilityChange({\n ...visibility,\n [key]: checked,\n });\n };\n\n const visibleCount = columnEntries.filter(\n ([key]) => visibility[key] !== false,\n ).length;\n\n return (\n <Popover\n width={280}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={opened}\n onChange={setOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <div>\n <ActionButton\n variant={\"minimal\"}\n icon={IconColumns}\n onClick={() => setOpened((o) => !o)}\n />\n </div>\n </Popover.Target>\n <Popover.Dropdown\n bg=\"transparent\"\n p=\"xs\"\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <Flex\n direction=\"column\"\n gap=\"xs\"\n bg={ui.colors.surface}\n p=\"sm\"\n bdrs=\"sm\"\n >\n <Flex justify=\"space-between\">\n <Text size=\"sm\" fw={500}>\n Columns ({visibleCount}/{columnEntries.length})\n </Text>\n <Flex gap={4}>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleShowAll}\n >\n All\n </ActionButton>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleDefault}\n >\n Default\n </ActionButton>\n </Flex>\n </Flex>\n\n <ScrollArea.Autosize mah={300}>\n <Flex direction=\"column\" gap={4}>\n {columnEntries.map(([key, col]) => (\n <Checkbox\n key={key}\n label={col.label || key}\n checked={visibility[key] !== false}\n onChange={(e) => handleToggle(key, e.currentTarget.checked)}\n size=\"sm\"\n />\n ))}\n </Flex>\n </ScrollArea.Autosize>\n </Flex>\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default ColumnPicker;\n","import { ActionButton, ui } from \"@alepha/ui\";\nimport { Checkbox, Flex, Popover, ScrollArea, Text } from \"@mantine/core\";\nimport { IconFilter } from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { useState } from \"react\";\nimport type { FilterVisibility } from \"../interfaces/types.ts\";\n\nexport interface FilterPickerProps {\n schema: TObject;\n visibility: FilterVisibility;\n onVisibilityChange: (visibility: FilterVisibility) => void;\n}\n\nconst getFieldLabel = (schema: TObject, key: string): string => {\n const prop = schema.properties[key];\n if (prop && typeof prop === \"object\" && \"title\" in prop && prop.title) {\n return prop.title as string;\n }\n // Convert camelCase to Title Case\n return key\n .replace(/([A-Z])/g, \" $1\")\n .replace(/^./, (str) => str.toUpperCase())\n .trim();\n};\n\nconst FilterPicker = ({\n schema,\n visibility,\n onVisibilityChange,\n}: FilterPickerProps) => {\n const [opened, setOpened] = useState(false);\n const filterKeys = Object.keys(schema.properties);\n\n const handleShowAll = () => {\n const newVisibility = filterKeys.reduce(\n (acc, key) => ({ ...acc, [key]: true }),\n {} as FilterVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleHideAll = () => {\n const newVisibility = filterKeys.reduce(\n (acc, key) => ({ ...acc, [key]: false }),\n {} as FilterVisibility,\n );\n onVisibilityChange(newVisibility);\n };\n\n const handleToggle = (key: string, checked: boolean) => {\n onVisibilityChange({\n ...visibility,\n [key]: checked,\n });\n };\n\n const visibleCount = filterKeys.filter((key) => visibility[key]).length;\n\n return (\n <Popover\n width={280}\n position=\"bottom-start\"\n shadow=\"md\"\n opened={opened}\n onChange={setOpened}\n closeOnClickOutside\n closeOnEscape\n transitionProps={{\n transition: \"fade-up\",\n duration: 200,\n timingFunction: \"ease\",\n }}\n >\n <Popover.Target>\n <div>\n <ActionButton\n variant={\"minimal\"}\n icon={IconFilter}\n onClick={() => setOpened((o) => !o)}\n />\n </div>\n </Popover.Target>\n <Popover.Dropdown\n bg=\"transparent\"\n p=\"xs\"\n bd={`1px solid ${ui.colors.border}`}\n style={{\n backdropFilter: \"blur(20px)\",\n }}\n >\n <Flex\n direction=\"column\"\n gap=\"xs\"\n bg={ui.colors.surface}\n p=\"sm\"\n bdrs=\"sm\"\n >\n <Flex justify=\"space-between\">\n <Text size=\"sm\" fw={500}>\n Filters ({visibleCount}/{filterKeys.length})\n </Text>\n <Flex gap={4}>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleShowAll}\n >\n All\n </ActionButton>\n <ActionButton\n size=\"compact-xs\"\n variant={\"minimal\"}\n onClick={handleHideAll}\n >\n None\n </ActionButton>\n </Flex>\n </Flex>\n\n <ScrollArea.Autosize mah={300}>\n <Flex direction=\"column\" gap={4}>\n {filterKeys.map((key) => (\n <Checkbox\n key={key}\n label={getFieldLabel(schema, key)}\n checked={visibility[key] === true}\n onChange={(e) => handleToggle(key, e.currentTarget.checked)}\n size=\"sm\"\n />\n ))}\n </Flex>\n </ScrollArea.Autosize>\n </Flex>\n </Popover.Dropdown>\n </Popover>\n );\n};\n\nexport default FilterPicker;\n","import {\n ActionButton,\n type ActionProps,\n Flex,\n isComponentType,\n} from \"@alepha/ui\";\nimport { Badge, Divider } from \"@mantine/core\";\nimport {\n IconClipboard,\n IconDownload,\n IconRefresh,\n IconX,\n} from \"@tabler/icons-react\";\nimport type { TObject } from \"alepha\";\nimport { isValidElement, type ReactNode, useCallback } from \"react\";\nimport type {\n CheckboxAction,\n CheckboxActionContext,\n ColumnVisibility,\n DataTableColumn,\n FilterVisibility,\n} from \"../interfaces/types.ts\";\nimport ColumnPicker from \"./ColumnPicker.tsx\";\nimport FilterPicker from \"./FilterPicker.tsx\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst escapeCsvField = (value: string): string => {\n if (value.includes(\",\") || value.includes('\"') || value.includes(\"\\n\")) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n};\n\nconst extractText = (node: ReactNode): string => {\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(extractText).join(\"\");\n if (typeof node === \"object\" && \"props\" in node) {\n return extractText((node as any).props.children);\n }\n return \"\";\n};\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface DataTableToolbarProps<\n T extends object,\n Filters extends TObject,\n> {\n columns: { [key: string]: DataTableColumn<T, Filters> };\n filters?: TObject;\n columnVisibility: ColumnVisibility;\n filterVisibility: FilterVisibility;\n onColumnVisibilityChange: (visibility: ColumnVisibility) => void;\n onFilterVisibilityChange: (visibility: FilterVisibility) => void;\n actions?: Array<ActionProps & { label?: ReactNode }>;\n onRefresh?: () => void;\n items: T[];\n withExport?: boolean;\n // Checkbox-related props\n selectedItems?: T[];\n checkboxActions?: Array<CheckboxAction<T>>;\n onClearSelection?: () => void;\n}\n\nconst DataTableToolbar = <T extends object, Filters extends TObject>({\n columns,\n filters,\n columnVisibility,\n filterVisibility,\n onColumnVisibilityChange,\n onFilterVisibilityChange,\n actions,\n onRefresh,\n items,\n withExport,\n selectedItems = [],\n checkboxActions,\n onClearSelection,\n}: DataTableToolbarProps<T, Filters>) => {\n const hasSelection = selectedItems.length > 0;\n\n const exportableColumns = useCallback(() => {\n return Object.entries(columns).filter(\n ([key]) => columnVisibility[key] !== false,\n );\n }, [columns, columnVisibility]);\n\n const buildRows = useCallback((): string[][] => {\n const cols = exportableColumns();\n return items.map((item) =>\n cols.map(([_key, col]) => {\n if (!col.value) return \"\";\n const node = col.value(item, {} as any);\n return extractText(node);\n }),\n );\n }, [items, exportableColumns]);\n\n const buildCsv = useCallback((): string => {\n const cols = exportableColumns();\n const header = cols.map(([_key, col]) => escapeCsvField(col.label));\n const rows = buildRows().map((row) => row.map(escapeCsvField));\n return [header.join(\",\"), ...rows.map((r) => r.join(\",\"))].join(\"\\n\");\n }, [exportableColumns, buildRows]);\n\n const exportCsv = useCallback(() => {\n const csv = buildCsv();\n const blob = new Blob([csv], { type: \"text/csv;charset=utf-8;\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = \"export.csv\";\n a.click();\n URL.revokeObjectURL(url);\n }, [buildCsv]);\n\n const exportClipboard = useCallback(async () => {\n const cols = exportableColumns();\n const header = cols.map(([_key, col]) => col.label);\n const rows = buildRows();\n const text = [header.join(\"\\t\"), ...rows.map((r) => r.join(\"\\t\"))].join(\n \"\\n\",\n );\n await navigator.clipboard.writeText(text);\n }, [exportableColumns, buildRows]);\n\n const handleCheckboxAction = async (action: CheckboxAction<T>) => {\n const ctx: CheckboxActionContext<T> = {\n selectedItems,\n clearSelection: onClearSelection || (() => {}),\n };\n await action.onClick(ctx);\n };\n\n return (\n <Flex p=\"xs\">\n <Flex gap={4} align=\"center\">\n {filters && (\n <FilterPicker\n schema={filters}\n visibility={filterVisibility}\n onVisibilityChange={onFilterVisibilityChange}\n />\n )}\n <ColumnPicker\n columns={columns}\n visibility={columnVisibility}\n onVisibilityChange={onColumnVisibilityChange}\n />\n {withExport && (\n <ActionButton\n variant={\"minimal\"}\n icon={IconDownload}\n menu={{\n items: [\n {\n label: \"Export as CSV\",\n icon: <IconDownload size={14} />,\n onClick: exportCsv,\n },\n {\n label: \"Copy to clipboard\",\n icon: <IconClipboard size={14} />,\n onClick: exportClipboard,\n },\n ],\n }}\n />\n )}\n\n {hasSelection && (\n <>\n <Divider orientation=\"vertical\" mx=\"xs\" />\n <Badge variant=\"light\" size=\"lg\">\n {selectedItems.length} selected\n </Badge>\n <ActionButton\n variant={\"minimal\"}\n size=\"compact-sm\"\n icon={IconX}\n onClick={onClearSelection}\n >\n Clear\n </ActionButton>\n {checkboxActions?.map((action, index) => (\n <ActionButton\n key={index}\n variant=\"light\"\n size=\"compact-sm\"\n intent={action.intent}\n icon={\n action.icon && isComponentType(action.icon)\n ? action.icon\n : undefined\n }\n onClick={() => handleCheckboxAction(action)}\n >\n {action.label}\n </ActionButton>\n ))}\n </>\n )}\n </Flex>\n <Flex flex={1} />\n <Flex gap=\"xs\">\n {actions?.map((props, index) =>\n !isValidElement(props) ? (\n <ActionButton key={index} {...(props as ActionProps)}>\n {(props as ActionProps & { label?: ReactNode }).label}\n </ActionButton>\n ) : (\n props\n ),\n )}\n <ActionButton\n variant={\"minimal\"}\n icon={IconRefresh}\n onClick={onRefresh}\n />\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTableToolbar;\n","import { useCallback, useMemo, useState } from \"react\";\n\nexport interface UseTableSelectionReturn<T> {\n selectedItems: T[];\n allSelected: boolean;\n someSelected: boolean;\n toggleItem: (item: T) => void;\n toggleAll: () => void;\n clear: () => void;\n isSelected: (item: T) => boolean;\n}\n\nexport const useTableSelection = <T>(\n items: T[],\n getItemKey: (item: T) => string,\n enabled: boolean,\n): UseTableSelectionReturn<T> => {\n const [selectedKeys, setSelectedKeys] = useState<Set<string>>(new Set());\n\n const selectedItems = useMemo(() => {\n if (!enabled) return [];\n return items.filter((item) => selectedKeys.has(getItemKey(item)));\n }, [items, selectedKeys, getItemKey, enabled]);\n\n const allSelected = useMemo(() => {\n if (items.length === 0) return false;\n return items.every((item) => selectedKeys.has(getItemKey(item)));\n }, [items, selectedKeys, getItemKey]);\n\n const someSelected = useMemo(() => {\n if (items.length === 0) return false;\n const count = items.filter((item) =>\n selectedKeys.has(getItemKey(item)),\n ).length;\n return count > 0 && count < items.length;\n }, [items, selectedKeys, getItemKey]);\n\n const toggleItem = useCallback(\n (item: T) => {\n const key = getItemKey(item);\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n },\n [getItemKey],\n );\n\n const toggleAll = useCallback(() => {\n if (allSelected) {\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n for (const item of items) next.delete(getItemKey(item));\n return next;\n });\n } else {\n setSelectedKeys((prev) => {\n const next = new Set(prev);\n for (const item of items) next.add(getItemKey(item));\n return next;\n });\n }\n }, [allSelected, items, getItemKey]);\n\n const clear = useCallback(() => setSelectedKeys(new Set()), []);\n\n const isSelected = useCallback(\n (item: T) => selectedKeys.has(getItemKey(item)),\n [selectedKeys, getItemKey],\n );\n\n return {\n selectedItems,\n allSelected,\n someSelected,\n toggleItem,\n toggleAll,\n clear,\n isSelected,\n };\n};\n","import { ActionButton, Flex, isComponentType, Text, ui } from \"@alepha/ui\";\nimport { Checkbox, Drawer, Loader, Table, UnstyledButton } from \"@mantine/core\";\nimport {\n IconArrowDown,\n IconArrowsSort,\n IconArrowUp,\n IconChevronDown,\n IconChevronRight,\n IconDotsVertical,\n} from \"@tabler/icons-react\";\nimport { Alepha, type Static, type TObject, t } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useInject } from \"alepha/react\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n ColumnVisibility,\n DataTableColumnContext,\n DataTableProps,\n FilterVisibility,\n MaybePage,\n} from \"../interfaces/types.ts\";\nimport { DEFAULT_MAX_VISIBLE_COLUMNS } from \"../interfaces/types.ts\";\nimport DataTableFilters, {\n type DataTableFiltersProps,\n} from \"./DataTableFilters.tsx\";\nimport DataTablePagination from \"./DataTablePagination.tsx\";\nimport DataTableToolbar from \"./DataTableToolbar.tsx\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\ntype SortDirection = \"asc\" | \"desc\" | null;\n\n/**\n * Parse the sort string to get direction for a specific field.\n * Alepha convention: 'field' = ASC, '-field' = DESC\n */\nconst getSortDirection = (\n sortString: string | undefined,\n field: string,\n): SortDirection => {\n if (!sortString) return null;\n const parts = sortString.split(\",\").map((s) => s.trim());\n for (const part of parts) {\n if (part === field) return \"asc\";\n if (part === `-${field}`) return \"desc\";\n }\n return null;\n};\n\n/**\n * Toggle sort for a field in the sort string.\n * Cycles: null -> asc -> desc -> null\n */\nconst toggleSort = (\n sortString: string | undefined,\n field: string,\n): string | undefined => {\n const current = getSortDirection(sortString, field);\n\n // Remove existing sort for this field\n const parts = (sortString || \"\")\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s && s !== field && s !== `-${field}`);\n\n if (current === null) {\n // No sort -> ASC\n parts.unshift(field);\n } else if (current === \"asc\") {\n // ASC -> DESC\n parts.unshift(`-${field}`);\n }\n // DESC -> remove (already filtered out above)\n\n return parts.length > 0 ? parts.join(\",\") : undefined;\n};\n\nconst toAriaSort = (\n dir: SortDirection,\n): \"ascending\" | \"descending\" | \"none\" => {\n if (dir === \"asc\") return \"ascending\";\n if (dir === \"desc\") return \"descending\";\n return \"none\";\n};\n\nconst FIT_STYLE = {\n width: 1,\n whiteSpace: \"nowrap\",\n minWidth: \"fit-content\",\n} as const;\n\nconst DataTable = <T extends object, Filters extends TObject>(\n props: DataTableProps<T, Filters>,\n) => {\n const [items, setItems] = useState<MaybePage<T>>(\n typeof props.items === \"function\" ? { content: [] } : props.items,\n );\n const itemsRef = useRef(items);\n const [loaded, setLoaded] = useState(\n typeof props.items !== \"function\" || !props.submitOnInit,\n );\n\n const defaultSize = props.defaultSize || (props.infinityScroll ? 100 : 10);\n const [page, setPage] = useState(1);\n const [size, setSize] = useState(String(defaultSize));\n const [currentPage, setCurrentPage] = useState(0);\n const alepha = useInject(Alepha);\n itemsRef.current = items;\n const sentinelRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Column visibility state\n const [columnVisibility, setColumnVisibility] = useState<ColumnVisibility>(\n () => {\n const entries = Object.entries(props.columns);\n let visibleCount = 0;\n return entries.reduce((acc, [key, col]) => {\n if (col.defaultHidden) {\n acc[key] = false;\n } else if (visibleCount < DEFAULT_MAX_VISIBLE_COLUMNS) {\n acc[key] = true;\n visibleCount++;\n } else {\n acc[key] = false;\n }\n return acc;\n }, {} as ColumnVisibility);\n },\n );\n\n // Filter visibility state — default: none visible\n const [filterVisibility, setFilterVisibility] = useState<FilterVisibility>(\n () => {\n if (!props.filters?.properties) return {};\n const defaults = new Set(props.defaultFilters ?? []);\n return Object.keys(props.filters.properties).reduce(\n (acc, key) => ({ ...acc, [key]: defaults.has(key) }),\n {} as FilterVisibility,\n );\n },\n );\n\n // Compute visible columns\n const visibleColumns = useMemo(() => {\n return Object.entries(props.columns).filter(\n ([key]) => columnVisibility[key] !== false,\n );\n }, [props.columns, columnVisibility]);\n\n // Current sort string\n const [sortString, setSortString] = useState<string | undefined>(undefined);\n\n // Handle column header click for sorting\n const handleSortClick = (columnKey: string, sortKey?: string) => {\n const field = sortKey || columnKey;\n const newSort = toggleSort(sortString, field);\n setSortString(newSort);\n form.input.sort.set(newSort);\n form.input.page.set(0); // Reset to first page when sorting changes\n };\n\n // Item key resolver — prefers explicit prop, falls back to .id, then JSON\n const getItemKey = useCallback(\n (item: T): string => {\n if (props.getItemKey) return props.getItemKey(item);\n if (\"id\" in item) return String((item as Record<string, unknown>).id);\n return JSON.stringify(item);\n },\n [props.getItemKey],\n );\n\n // Checkbox selection (extracted hook)\n const selection = useTableSelection(\n items.content as T[],\n getItemKey,\n props.withCheckbox ?? false,\n );\n\n // Panel — normalize shorthand vs object form\n const panelConfig = useMemo(() => {\n if (!props.panel) return null;\n if (typeof props.panel === \"function\") {\n return { render: props.panel, can: undefined };\n }\n return props.panel;\n }, [props.panel]);\n\n // Drawer — normalize shorthand vs object form\n const [drawerItem, setDrawerItem] = useState<T | null>(null);\n const drawerConfig = useMemo(() => {\n if (!props.drawer) return null;\n if (typeof props.drawer === \"function\") {\n return { render: props.drawer, can: undefined, props: undefined };\n }\n return props.drawer;\n }, [props.drawer]);\n\n // Panel expand state\n const [expandedKeys, setExpandedKeys] = useState<Set<string>>(new Set());\n\n const toggleExpand = useCallback((key: string) => {\n setExpandedKeys((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n\n const form = useForm(\n {\n schema: t.object({\n ...(props.filters ? props.filters.properties : {}),\n page: t.number({ default: 0 }),\n size: t.number({ default: defaultSize }),\n sort: t.optional(t.string()),\n }),\n handler: async (values) => {\n if (typeof props.items === \"function\") {\n const response = await props.items(\n values as Static<Filters> & {\n page: number;\n size: number;\n sort?: string;\n },\n {\n items: itemsRef.current.content,\n },\n );\n\n if (props.infinityScroll && values.page > 0) {\n // Append new items to existing ones for infinity scroll\n setItems((prev) => ({\n ...response,\n content: [...prev.content, ...response.content],\n }));\n } else {\n setItems(response);\n }\n\n setCurrentPage(values.page);\n if (!loaded) setLoaded(true);\n }\n },\n onReset: async () => {\n setPage(1);\n setSize(String(defaultSize));\n await form.submit();\n },\n onChange: async (key, value) => {\n if (key === \"page\") {\n setPage(value + 1);\n await form.submit();\n return;\n }\n\n if (key === \"size\") {\n setSize(String(value));\n form.input.page.set(0);\n return;\n }\n\n props.onFilterChange?.(\n key,\n value,\n form as unknown as FormModel<Filters>,\n );\n\n if (props.skipSubmitOnChange) return;\n\n form.input.page.set(0);\n\n const delay = props.debounce ?? 300;\n if (delay > 0) {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n form.submit();\n }, delay);\n } else {\n await form.submit();\n }\n },\n },\n [],\n );\n\n const dt = useInject(DateTimeProvider);\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n };\n }, []);\n\n useEffect(() => {\n if (props.submitOnInit) {\n form.submit();\n }\n if (props.submitEvery) {\n const it = dt.createInterval(() => {\n form.submit();\n }, props.submitEvery);\n return () => dt.clearInterval(it);\n }\n }, []);\n\n useEffect(() => {\n if (typeof props.items !== \"function\") {\n setItems(props.items);\n }\n }, [props.items]);\n\n // Infinity scroll via IntersectionObserver\n useEffect(() => {\n if (!props.infinityScroll || typeof props.items !== \"function\") return;\n\n const sentinel = sentinelRef.current;\n if (!sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (!entries[0].isIntersecting || form.submitting) return;\n\n const totalPages = items.page?.totalPages ?? 1;\n if (currentPage + 1 < totalPages) {\n form.input.page.set(currentPage + 1);\n }\n },\n { rootMargin: \"300px\" },\n );\n\n observer.observe(sentinel);\n return () => observer.disconnect();\n }, [\n props.infinityScroll,\n form.submitting,\n items.page?.totalPages,\n currentPage,\n form,\n ]);\n\n // Total column count (for colSpan)\n const totalColumns =\n visibleColumns.length +\n (panelConfig ? 1 : 0) +\n (props.withCheckbox ? 1 : 0) +\n (props.rowActions ? 1 : 0);\n\n // Checkbox header column\n const checkboxHeader = props.withCheckbox ? (\n <Table.Th style={{ width: 40 }}>\n <Checkbox\n checked={selection.allSelected}\n indeterminate={selection.someSelected}\n onChange={selection.toggleAll}\n aria-label=\"Select all\"\n />\n </Table.Th>\n ) : null;\n\n const head = visibleColumns.map(([key, col]) => {\n const sortField = col.sortKey || key;\n const sortDir = col.sortable\n ? getSortDirection(sortString, sortField)\n : null;\n\n return (\n <Table.Th\n key={key}\n onClick={\n col.sortable ? () => handleSortClick(key, col.sortKey) : undefined\n }\n aria-sort={col.sortable ? toAriaSort(sortDir) : undefined}\n style={{\n ...(col.fit ? FIT_STYLE : {}),\n ...(col.sortable ? { cursor: \"pointer\", userSelect: \"none\" } : {}),\n }}\n >\n <Flex align=\"center\" gap={4}>\n <Text bold muted size=\"xs\">\n {col.label}\n </Text>\n {col.sortable && (\n <Flex c=\"dimmed\">\n {sortDir === \"asc\" && <IconArrowUp size={ui.sizes.icon.xs} />}\n {sortDir === \"desc\" && <IconArrowDown size={ui.sizes.icon.xs} />}\n {sortDir === null && <IconArrowsSort size={ui.sizes.icon.xs} />}\n </Flex>\n )}\n </Flex>\n </Table.Th>\n );\n });\n\n const rows = items.content.flatMap((item, index) => {\n const trProps = props.tableTrProps ? props.tableTrProps(item as T) : {};\n const itemKey = getItemKey(item as T);\n const isSelected = selection.isSelected(item as T);\n const showPanel =\n panelConfig && (panelConfig.can ? panelConfig.can(item as T) : true);\n const isExpanded = expandedKeys.has(itemKey);\n const canOpenDrawer =\n drawerConfig && (drawerConfig.can ? drawerConfig.can(item as T) : true);\n\n const elements = [\n <Table.Tr\n key={itemKey}\n {...trProps}\n style={{\n ...(canOpenDrawer ? { cursor: \"pointer\" } : {}),\n ...(trProps.style ?? {}),\n }}\n onClick={(e) => {\n if (canOpenDrawer) setDrawerItem(item as T);\n trProps.onClick?.(e);\n }}\n >\n {panelConfig && (\n <Table.Td style={{ width: 36, textAlign: \"center\" }} py={2} px={0}>\n {showPanel && (\n <UnstyledButton\n onClick={(e) => {\n e.stopPropagation();\n toggleExpand(itemKey);\n }}\n style={{ display: \"inline-flex\" }}\n >\n <Flex c=\"dimmed\" align=\"center\" justify=\"center\">\n {isExpanded ? (\n <IconChevronDown size={ui.sizes.icon.sm} />\n ) : (\n <IconChevronRight size={ui.sizes.icon.sm} />\n )}\n </Flex>\n </UnstyledButton>\n )}\n </Table.Td>\n )}\n {props.withCheckbox && (\n <Table.Td style={{ width: 40 }} onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={isSelected}\n onChange={() => selection.toggleItem(item as T)}\n aria-label=\"Select row\"\n />\n </Table.Td>\n )}\n {visibleColumns.map(([key, col]) => {\n const ctx = {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n } as DataTableColumnContext<Filters>;\n\n const content = col.value?.(item as T, ctx);\n\n return (\n <Table.Td key={key} style={col.fit ? FIT_STYLE : undefined}>\n {col.action ? (\n <ActionButton\n td={\"inherit\"}\n unstyled\n {...col.action(item as T)}\n >\n {content}\n </ActionButton>\n ) : (\n content\n )}\n </Table.Td>\n );\n })}\n {props.rowActions &&\n (() => {\n const ctx = {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n } as DataTableColumnContext<Filters>;\n const actions = props.rowActions!(item as T, ctx).filter(\n (a) => a.visible !== false,\n );\n if (actions.length === 0) return <Table.Td style={FIT_STYLE} />;\n return (\n <Table.Td\n py={2}\n px={4}\n style={FIT_STYLE}\n onClick={(e) => e.stopPropagation()}\n >\n <ActionButton\n variant={\"minimal\"}\n size=\"xs\"\n icon={IconDotsVertical}\n menu={{\n items: actions.map((action) => {\n const Icon = action.icon;\n return {\n label:\n action.label ??\n (typeof action.tooltip === \"string\"\n ? action.tooltip\n : undefined),\n icon:\n Icon && isComponentType(Icon) ? (\n <Icon size={14} />\n ) : (\n (Icon as ReactNode)\n ),\n onClick: (action as any).onClick\n ? async () => {\n await (action as any).onClick();\n if (!action.skipRefresh) {\n await form.submit();\n }\n }\n : undefined,\n color: action.color,\n };\n }),\n }}\n />\n </Table.Td>\n );\n })()}\n </Table.Tr>,\n ];\n\n if (panelConfig && showPanel && isExpanded) {\n elements.push(\n <Table.Tr key={`${itemKey}-panel`}>\n <Table.Td colSpan={totalColumns} p={0}>\n {panelConfig.render(item as T)}\n </Table.Td>\n </Table.Tr>,\n );\n }\n\n return elements;\n });\n\n const filterSchema = useMemo(() => {\n if (!props.filters) return null;\n return t.omit(form.options.schema, [\"page\", \"size\", \"sort\"]);\n }, [props.filters, form.options.schema]);\n\n return (\n <Flex\n gap={\"xs\"}\n flex={1}\n p={0}\n direction=\"column\"\n style={{ overflow: \"hidden\" }}\n >\n <Flex rounded bordered elevated shadowed={\"xs\"} col>\n <DataTableToolbar\n columns={props.columns}\n filters={props.filters}\n columnVisibility={columnVisibility}\n filterVisibility={filterVisibility}\n onColumnVisibilityChange={setColumnVisibility}\n onFilterVisibilityChange={setFilterVisibility}\n actions={props.actions}\n onRefresh={() => form.submit()}\n items={items.content as T[]}\n withExport={props.withExport}\n selectedItems={selection.selectedItems}\n checkboxActions={props.checkboxActions}\n onClearSelection={selection.clear}\n />\n\n {filterSchema && props.filters && (\n <DataTableFilters\n schema={filterSchema}\n form={form as unknown as FormModel<TObject>}\n typeFormProps={\n props.typeFormProps as DataTableFiltersProps[\"typeFormProps\"]\n }\n filterVisibility={filterVisibility}\n />\n )}\n </Flex>\n\n <Flex\n col\n rounded\n bordered\n elevated\n shadowed={\"xs\"}\n flex={1}\n style={{ minHeight: 0 }}\n >\n <Flex className=\"overflow-auto\" flex={1} style={{ minHeight: 0 }} col>\n <Table\n aria-label=\"Data table\"\n withRowBorders\n highlightOnHover\n {...props.tableProps}\n >\n <Table.Thead\n bdrs={\"md\"}\n style={{\n position: \"sticky\",\n top: 0,\n zIndex: 1,\n }}\n >\n <Table.Tr>\n {panelConfig && <Table.Th style={{ width: 36 }} />}\n {checkboxHeader}\n {head}\n {props.rowActions && <Table.Th style={FIT_STYLE} />}\n </Table.Tr>\n </Table.Thead>\n <Table.Tbody>\n {!loaded || form.submitting ? (\n <Table.Tr>\n <Table.Td colSpan={totalColumns || 1} py=\"sm\">\n <Flex justify=\"center\" p={\"md\"}>\n <Loader size=\"sm\" type=\"dots\" />\n </Flex>\n </Table.Td>\n </Table.Tr>\n ) : rows.length === 0 ? (\n <Table.Tr>\n <Table.Td colSpan={totalColumns || 1} py=\"xl\">\n <Flex justify=\"center\">\n <Text c=\"dimmed\" size=\"sm\">\n {props.emptyLabel ?? \"No results\"}\n </Text>\n </Flex>\n </Table.Td>\n </Table.Tr>\n ) : (\n rows\n )}\n </Table.Tbody>\n </Table>\n </Flex>\n\n {props.infinityScroll && <div ref={sentinelRef} />}\n\n {!props.infinityScroll && (\n <DataTablePagination\n page={page}\n size={size}\n totalPages={items.page?.totalPages}\n totalElements={items.page?.totalElements}\n isFirst={items.page?.isFirst}\n isLast={items.page?.isLast}\n offset={items.page?.offset ?? 0}\n numberOfElements={items.content.length}\n onPageChange={(value) => {\n form.input.page.set(value - 1);\n }}\n onSizeChange={(value) => {\n form.input.size.set(value);\n }}\n />\n )}\n\n {drawerConfig && (\n <Drawer\n opened={drawerItem !== null}\n onClose={() => setDrawerItem(null)}\n position=\"right\"\n size=\"xl\"\n {...drawerConfig.props}\n >\n {drawerItem && drawerConfig.render(drawerItem)}\n </Drawer>\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default DataTable;\n","import type { TObject, TProperties, TSchema } from \"alepha\";\n\nexport interface SchemaField {\n name: string;\n path: string;\n type: string;\n enum?: readonly any[];\n format?: string;\n description?: string;\n nested?: SchemaField[];\n}\n\n/**\n * Extract field information from a TypeBox schema for query building.\n * Supports nested objects and provides field metadata for autocomplete.\n */\nexport function extractSchemaFields(\n schema: TObject | TProperties,\n prefix = \"\",\n): SchemaField[] {\n const fields: SchemaField[] = [];\n\n // Safety check\n if (!schema || typeof schema !== \"object\") {\n return fields;\n }\n\n // Handle TObject wrapper\n const properties =\n \"properties\" in schema ? schema.properties : (schema as TProperties);\n\n // Safety check for properties\n if (!properties || typeof properties !== \"object\") {\n return fields;\n }\n\n for (const [key, value] of Object.entries(properties)) {\n // Skip if value is not an object (type guard)\n if (typeof value !== \"object\" || value === null) {\n continue;\n }\n\n const fieldSchema = value as TSchema & {\n format?: string;\n enum?: readonly any[];\n description?: string;\n };\n\n const path = prefix ? `${prefix}.${key}` : key;\n\n // Determine the display type - use format for datetime-related fields\n const format = \"format\" in fieldSchema ? fieldSchema.format : undefined;\n const baseType =\n \"type\" in fieldSchema ? (fieldSchema.type as string) : \"object\";\n\n let displayType = baseType;\n if (format === \"date-time\") {\n displayType = \"datetime\";\n } else if (format === \"date\") {\n displayType = \"date\";\n } else if (format === \"time\") {\n displayType = \"time\";\n } else if (format === \"duration\") {\n displayType = \"duration\";\n }\n\n const field: SchemaField = {\n name: key,\n path,\n type: displayType,\n format,\n description:\n \"description\" in fieldSchema ? fieldSchema.description : undefined,\n };\n\n // Handle enum\n if (\"enum\" in fieldSchema && fieldSchema.enum) {\n field.enum = fieldSchema.enum;\n field.type = \"enum\";\n }\n\n // Handle nested objects\n if (\n \"type\" in fieldSchema &&\n fieldSchema.type === \"object\" &&\n \"properties\" in fieldSchema &&\n typeof fieldSchema.properties === \"object\"\n ) {\n field.nested = extractSchemaFields(\n fieldSchema.properties as TProperties,\n path,\n );\n }\n\n fields.push(field);\n\n // Also add nested fields to the flat list for autocomplete\n if (field.nested) {\n fields.push(...field.nested);\n }\n }\n\n return fields;\n}\n\n/**\n * Get suggested operators based on field type\n */\nexport function getOperatorsForField(field: SchemaField): string[] {\n const allOperators = [\"=\", \"!=\"];\n\n if (field.enum) {\n // Enum fields: equality and IN array\n return [...allOperators, \"in\"];\n }\n\n switch (field.type) {\n case \"string\":\n case \"text\":\n // String fields: equality and null checks (wildcards supported in = operator)\n return [...allOperators, \"null\"];\n\n case \"number\":\n case \"integer\":\n // Numeric fields: all comparison operators\n return [...allOperators, \">\", \">=\", \"<\", \"<=\"];\n\n case \"boolean\":\n // Boolean fields: only equality\n return allOperators;\n\n case \"datetime\":\n case \"date\":\n // Date fields: all comparison operators\n return [...allOperators, \">\", \">=\", \"<\", \"<=\"];\n\n default:\n return [...allOperators, \"null\"];\n }\n}\n\n/**\n * Get operator symbol and description\n */\nexport const OPERATOR_INFO: Record<\n string,\n { symbol: string; label: string; example: string }\n> = {\n eq: { symbol: \"=\", label: \"equals\", example: \"name=John\" },\n ne: { symbol: \"!=\", label: \"not equals\", example: \"status!=archived\" },\n gt: { symbol: \">\", label: \"greater than\", example: \"age>18\" },\n gte: { symbol: \">=\", label: \"greater or equal\", example: \"age>=18\" },\n lt: { symbol: \"<\", label: \"less than\", example: \"age<65\" },\n lte: { symbol: \"<=\", label: \"less or equal\", example: \"age<=65\" },\n null: { symbol: \"=null\", label: \"is null\", example: \"deletedAt=null\" },\n notNull: {\n symbol: \"!=null\",\n label: \"is not null\",\n example: \"email!=null\",\n },\n in: {\n symbol: \"[...]\",\n label: \"in array\",\n example: \"status=[active,pending]\",\n },\n};\n","import {\n IconAt,\n IconCalendar,\n IconClock,\n IconColorPicker,\n IconFile,\n IconHash,\n IconKey,\n IconLetterCase,\n IconLink,\n IconList,\n IconMail,\n IconPalette,\n IconPhone,\n IconSelector,\n IconToggleLeft,\n} from \"@tabler/icons-react\";\nimport type { ReactElement } from \"react\";\nimport { ui } from \"../constants/ui.ts\";\n\nexport type IconSize = keyof typeof ui.sizes.icon;\n\n/**\n * Get the default icon for an input based on its type, format, or name.\n */\nexport const getDefaultIcon = (params: {\n type?: string;\n format?: string;\n name?: string;\n isEnum?: boolean;\n isArray?: boolean;\n size?: IconSize;\n}): ReactElement => {\n const { type, format, name, isEnum, isArray, size = \"xs\" } = params;\n const iconSize = ui.sizes.icon[size] - 4; // TODO: better mapping\n\n // Format-based icons (highest priority)\n if (format) {\n switch (format) {\n case \"email\":\n return <IconMail size={iconSize} />;\n case \"url\":\n case \"uri\":\n return <IconLink size={iconSize} />;\n case \"tel\":\n case \"phone\":\n return <IconPhone size={iconSize} />;\n case \"date\":\n return <IconCalendar size={iconSize} />;\n case \"date-time\":\n return <IconCalendar size={iconSize} />;\n case \"time\":\n return <IconClock size={iconSize} />;\n case \"color\":\n return <IconColorPicker size={iconSize} />;\n case \"uuid\":\n return <IconKey size={iconSize} />;\n }\n }\n\n // Name-based icons (medium priority)\n if (name) {\n const nameLower = name.toLowerCase();\n if (nameLower.includes(\"password\") || nameLower.includes(\"secret\")) {\n return <IconKey size={iconSize} />;\n }\n if (nameLower.includes(\"email\") || nameLower.includes(\"mail\")) {\n return <IconMail size={iconSize} />;\n }\n if (nameLower.includes(\"url\") || nameLower.includes(\"link\")) {\n return <IconLink size={iconSize} />;\n }\n if (nameLower.includes(\"phone\") || nameLower.includes(\"tel\")) {\n return <IconPhone size={iconSize} />;\n }\n if (nameLower.includes(\"color\")) {\n return <IconPalette size={iconSize} />;\n }\n if (nameLower.includes(\"file\") || nameLower.includes(\"upload\")) {\n return <IconFile size={iconSize} />;\n }\n if (nameLower.includes(\"date\")) {\n return <IconCalendar size={iconSize} />;\n }\n if (nameLower.includes(\"time\")) {\n return <IconClock size={iconSize} />;\n }\n }\n\n // Type-based icons (lowest priority)\n if (isEnum || isArray) {\n return <IconSelector size={iconSize} />;\n }\n\n if (type) {\n switch (type) {\n case \"boolean\":\n return <IconToggleLeft size={iconSize} />;\n case \"number\":\n case \"integer\":\n return <IconHash size={iconSize} />;\n case \"array\":\n return <IconList size={iconSize} />;\n case \"string\":\n return <IconLetterCase size={iconSize} />;\n }\n }\n\n // Default icon\n return <IconAt size={iconSize} />;\n};\n","/**\n * Capitalizes the first letter of a string.\n *\n * @example\n * capitalize(\"hello\") // \"Hello\"\n */\nexport const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\n/**\n * Converts camelCase or snake_case to Title Case with spaces.\n *\n * @example\n * toTitleCase(\"userName\") // \"User Name\"\n * toTitleCase(\"first_name\") // \"First Name\"\n * toTitleCase(\"email\") // \"Email\"\n */\nexport const toTitleCase = (str: string): string => {\n return str\n .replace(/([a-z])([A-Z])/g, \"$1 $2\") // camelCase -> camel Case\n .replace(/_/g, \" \") // snake_case -> snake case\n .replace(/\\b\\w/g, (c) => c.toUpperCase()); // capitalize words\n};\n\n/**\n * Converts a path or identifier string into a pretty display name.\n * For paths like \"/contacts/0/name\", extracts just the field name \"Name\".\n * Handles camelCase and snake_case conversion to Title Case.\n *\n * @example\n * prettyName(\"/userName\") // \"User Name\"\n * prettyName(\"/contacts/0/email\") // \"Email\"\n * prettyName(\"/address/streetName\") // \"Street Name\"\n * prettyName(\"first_name\") // \"First Name\"\n */\nexport const prettyName = (name: string): string => {\n // Split by slash and filter out empty strings and numeric indices\n const segments = name.split(\"/\").filter((s) => s && !/^\\d+$/.test(s));\n\n // Use the last non-numeric segment as the field name\n const fieldName = segments[segments.length - 1] || name.replaceAll(\"/\", \"\");\n\n return toTitleCase(fieldName);\n};\n","import { $module, type Static } from \"alepha\";\nimport { AlephaReactForm } from \"alepha/react/form\";\nimport { AlephaReactHead } from \"alepha/react/head\";\nimport { AlephaReactI18n } from \"alepha/react/i18n\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { alephaSidebarAtom } from \"./atoms/alephaSidebarAtom.ts\";\nimport { alephaThemeAtom } from \"./atoms/alephaThemeAtom.ts\";\nimport { alephaThemeOverridesAtom } from \"./atoms/alephaThemeOverridesAtom.ts\";\nimport { ThemeProvider } from \"./providers/ThemeProvider.ts\";\nimport { DialogService } from \"./services/DialogService.tsx\";\nimport { ToastService } from \"./services/ToastService.tsx\";\nimport { UiRouter } from \"./UiRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./atoms/alephaSidebarAtom.ts\";\nexport * from \"./atoms/alephaThemeAtom.ts\";\nexport * from \"./atoms/alephaThemeListAtom.ts\";\nexport * from \"./atoms/alephaThemeOverridesAtom.ts\";\nexport * from \"./atoms/themes/default.ts\";\nexport * from \"./atoms/themes/midnight.ts\";\nexport type { AlephaMantineProviderProps } from \"./components/AlephaMantineProvider.tsx\";\nexport { default as AlephaMantineProvider } from \"./components/AlephaMantineProvider.tsx\";\nexport type {\n ActionClickButtonProps,\n ActionCommonProps,\n ActionMenuConfig,\n ActionMenuItem,\n ActionNavigationButtonProps,\n ActionProps,\n ActionSubmitButtonProps,\n} from \"./components/buttons/ActionButton.tsx\";\nexport { default as ActionButton } from \"./components/buttons/ActionButton.tsx\";\nexport { default as BurgerButton } from \"./components/buttons/BurgerButton.tsx\";\nexport type { ClipboardButtonProps } from \"./components/buttons/ClipboardButton.tsx\";\nexport { default as ClipboardButton } from \"./components/buttons/ClipboardButton.tsx\";\nexport { default as DarkModeButton } from \"./components/buttons/DarkModeButton.tsx\";\nexport { default as LanguageButton } from \"./components/buttons/LanguageButton.tsx\";\nexport type { OmnibarButtonProps } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as OmnibarButton } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as ThemeButton } from \"./components/buttons/ThemeButton.tsx\";\nexport { default as SidebarCollapseButton } from \"./components/buttons/ToggleSidebarButton.tsx\";\nexport type {\n DetailDrawerProps,\n DetailDrawerStatus,\n DetailDrawerTab,\n} from \"./components/data/DetailDrawer.tsx\";\nexport { default as DetailDrawer } from \"./components/data/DetailDrawer.tsx\";\nexport type {\n DetailListItem,\n DetailListProps,\n} from \"./components/data/DetailList.tsx\";\nexport { default as DetailList } from \"./components/data/DetailList.tsx\";\nexport type {\n StatCardItem,\n StatCardsProps,\n} from \"./components/data/StatCards.tsx\";\nexport { default as StatCards } from \"./components/data/StatCards.tsx\";\nexport { default as AlertDialog } from \"./components/dialogs/AlertDialog.tsx\";\nexport { default as ConfirmDialog } from \"./components/dialogs/ConfirmDialog.tsx\";\nexport { default as PromptDialog } from \"./components/dialogs/PromptDialog.tsx\";\nexport type { FlexProps } from \"./components/Flex.tsx\";\nexport { default as Flex } from \"./components/Flex.tsx\";\nexport type {\n AppBarBack,\n AppBarBurger,\n AppBarDark,\n AppBarDivider,\n AppBarElement,\n AppBarItem,\n AppBarLang,\n AppBarLogo,\n AppBarProps,\n AppBarSearch,\n AppBarSpacer,\n} from \"./components/layout/AppBar.tsx\";\nexport { default as AppBar } from \"./components/layout/AppBar.tsx\";\nexport type { BreadcrumbProps } from \"./components/layout/Breadcrumb.tsx\";\nexport { default as Breadcrumbs } from \"./components/layout/Breadcrumb.tsx\";\nexport type { ContainerProps } from \"./components/layout/Container.tsx\";\nexport { default as Container } from \"./components/layout/Container.tsx\";\nexport {\n type DashboardShellProps,\n type DashboardShellProps as AdminShellProps,\n default as DashboardShell,\n default as AdminShell,\n} from \"./components/layout/DashboardShell.tsx\";\nexport type { OmnibarProps } from \"./components/layout/Omnibar.tsx\";\nexport { default as Omnibar } from \"./components/layout/Omnibar.tsx\";\nexport type {\n SidebarAbstractItem,\n SidebarButtonTheme,\n SidebarDivider,\n SidebarElement,\n SidebarMenuItem,\n SidebarNode,\n SidebarProps,\n SidebarSearch,\n SidebarSection,\n SidebarSpacer,\n SidebarTheme,\n} from \"./components/layout/Sidebar.tsx\";\nexport { Sidebar } from \"./components/layout/Sidebar.tsx\";\nexport { SidebarCollapsedItem } from \"./components/layout/SidebarCollapsedItem.tsx\";\nexport type { SidebarItemProps } from \"./components/layout/SidebarItem.tsx\";\nexport { SidebarItem } from \"./components/layout/SidebarItem.tsx\";\nexport type { SectionProps } from \"./components/Section.tsx\";\nexport { default as Section } from \"./components/Section.tsx\";\nexport type { SectionHeaderProps } from \"./components/SectionHeader.tsx\";\nexport { default as SectionHeader } from \"./components/SectionHeader.tsx\";\nexport type { TextProps } from \"./components/Text.tsx\";\nexport { default as Text } from \"./components/Text.tsx\";\nexport * from \"./constants/ui.ts\";\n// Form\nexport * from \"./form/index.ts\";\nexport * from \"./helpers/isComponentType.ts\";\nexport * from \"./helpers/renderIcon.tsx\";\nexport { useDialog } from \"./hooks/useDialog.ts\";\nexport { type ThemeExpert, useTheme } from \"./hooks/useTheme.ts\";\nexport { useToast } from \"./hooks/useToast.ts\";\nexport * from \"./interfaces/AlephaIntent.ts\";\n// JSON\nexport * from \"./json/index.ts\";\nexport * from \"./primitives/$ui.ts\";\nexport * from \"./providers/ThemeProvider.ts\";\nexport type {\n AlertDialogOptions,\n AlertDialogProps,\n BaseDialogOptions,\n ConfirmDialogOptions,\n ConfirmDialogProps,\n PromptDialogOptions,\n PromptDialogProps,\n} from \"./services/DialogService.tsx\";\nexport { DialogService } from \"./services/DialogService.tsx\";\nexport { ToastService } from \"./services/ToastService.tsx\";\n// Table\nexport * from \"./table/index.ts\";\nexport * from \"./UiRouter.ts\";\nexport * from \"./utils/extractSchemaFields.ts\";\nexport * from \"./utils/icons.tsx\";\nexport * from \"./utils/string.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"alepha\" {\n interface State {\n [alephaSidebarAtom.key]?: Static<typeof alephaSidebarAtom.schema>;\n [alephaThemeAtom.key]?: Static<typeof alephaThemeAtom.schema>;\n [alephaThemeOverridesAtom.key]?: Static<\n typeof alephaThemeOverridesAtom.schema\n >;\n }\n}\n\ndeclare module \"alepha/react/router\" {\n interface PagePrimitiveOptions {\n /**\n * Human-readable title for the page.\n * - for Sidebar navigation\n * - for Omnibar navigation\n * (soon)\n * - for Breadcrumbs\n * - for document title (with AlephaReactHead)\n */\n label?: string;\n\n /**\n * Optional description of the page.\n */\n description?: string;\n\n /**\n * Optional icon for the page.\n */\n icon?: ReactNode | ComponentType;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Core UI components based on Mantine UI v8.\n *\n * **Features:**\n * - Mantine integration with theme support\n * - ActionButton, BurgerButton, ClipboardButton, DarkModeButton, LanguageButton, ThemeButton\n * - AlertDialog, ConfirmDialog, PromptDialog\n * - Form controls: Control, ControlArray, ControlDate, ControlNumber, ControlObject, ControlSelect, ControlQueryBuilder\n * - TypeForm for automatic form generation from TypeBox schemas\n * - DashboardShell layout component\n * - AppBar with configurable elements\n * - Sidebar navigation with sections and menu items\n * - Omnibar for command palette / search\n * - DataTable with filtering, sorting, pagination\n * - Toast notifications\n * - Theme system with dark mode\n *\n * @module alepha.ui\n */\nexport const AlephaUI = $module({\n name: \"alepha.ui\",\n services: [DialogService, ToastService, ThemeProvider, UiRouter],\n register: (alepha) => {\n alepha.with(AlephaReactI18n);\n alepha.with(AlephaReactHead);\n alepha.with(AlephaReactForm);\n alepha.with(ThemeProvider);\n alepha.with(DialogService);\n alepha.with(ToastService);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,oBAAoB,MAAM;CACrC,MAAM;CACN,QAAQ,EAAE,OAAO;EAIf,QAAQ,EAAE,SAAS;EAInB,WAAW,EAAE,SAAS;EAKtB,eAAe,EAAE,QAAQ;EAKzB,gBAAgB,EAAE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ACJ,IAAI;EACL;CACD,SAAS;EACP,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACL;CACD,QAAQ;EAEN,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GACH;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CAED,YAAY;EACV,QAAQ,OAAO,OAAO;GACpB,cAAc,EACZ,IAAI,KACL;GACD,QAAQ,EACN,MAAM;IACJ,QAAQ;IACR,eAAe;IACf,eAAe;IACf,UAAU;IACX,EACF;GACF,CAAC;EAEF,YAAY,WAAW,OAAO,EAC5B,QAAQ,EACN,MAAM,EACJ,QAAQ,0BACT,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO,EAClB,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,MAAM,KAAK,OAAO,EAChB,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,WAAW,UAAU,OAAO,EAC1B,QAAQ,EACN,OAAO,EACL,QAAQ,iDACT,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO;GAClB,cAAc;IACZ,IAAI;IACJ,SAAS;IACV;GACD,QAAQ,EACN,MAAM;IACJ,eAAe;IACf,eAAe;IACf,UAAU;IACV,QAAQ;IACT,EACF;GACF,CAAC;EACH;CACF;;;;;;;;;;ACnLD,MAAa,gBAA6B;CACxC,MAAM;CACN,aAAa;CACb,oBAAoB;CACpB,cAAc;CACd,cAAc;EAAE,OAAO;EAAG,MAAM;EAAG;CACnC,cAAc;CACd,YACE;CACF,qBACE;CACF,UAAU;EACR,YACE;EACF,YAAY;EACZ,UAAU;EACV,OAAO;GACL,IAAI;IAAE,UAAU;IAAQ,YAAY;IAAQ;GAC5C,IAAI;IAAE,UAAU;IAAU,YAAY;IAAO;GAC7C,IAAI;IAAE,UAAU;IAAW,YAAY;IAAO;GAC9C,IAAI;IAAE,UAAU;IAAQ,YAAY;IAAO;GAC3C,IAAI;IAAE,UAAU;IAAY,YAAY;IAAO;GAC/C,IAAI;IAAE,UAAU;IAAW,YAAY;IAAO;GAC/C;EACF;CACD,eAAe;CACf,QAAQ;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACL;CACD,SAAS;EACP,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACL;CACD,QAAQ;EAEN,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,KAAK;GACH;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CAED,YAAY;EACV,QAAQ,OAAO,OAAO;GACpB,cAAc,EACZ,IAAI,KACL;GACD,QAAQ,EACN,MAAM,EACJ,YAAY,mDACb,EACF;GACF,CAAC;EAEF,YAAY,WAAW,OAAO,EAC5B,QAAQ,EACN,MAAM,EACJ,YAAY,mDACb,EACF,EACF,CAAC;E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GACA;GACD;EAED,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAED,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CAMD,YAAY;EACV,QAAQ,OAAO,OAAO;GACpB,cAAc,EACZ,IAAI,KACL;GACD,QAAQ,EACN,MAAM;IACJ,QAAQ;IACR,WAAW;IACX,YAAY;IACb,EACF;GACF,CAAC;EAEF,YAAY,WAAW,OAAO,EAC5B,QAAQ,EACN,MAAM;GACJ,QAAQ;GACR,WAAW;GACZ,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO;GAClB,cAAc,EACZ,QAAQ,MACT;GACD,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF;GACF,CAAC;EAEF,MAAM,KAAK,OAAO;GAChB,cAAc,EACZ,QAAQ,MACT;GACD,QAAQ,EACN,MAAM,EACJ,QAAQ,iDACT,EACF;GACF,CAAC;EAEF,WAAW,UAAU,OAAO,EAC1B,QAAQ,EACN,OAAO;GACL,QAAQ;GACR,YAAY;GACb,EACF,EACF,CAAC;EAEF,OAAO,MAAM,OAAO;GAClB,cAAc,EACZ,IAAI,KACL;GACD,QAAQ,EACN,MAAM,EACJ,QAAQ,0BACT,EACF;GACF,CAAC;EACH;CACF;;;;;;;;;AC5MD,MAAa,gBAA6B;CACxC,MAAM;CACN,aAAa;CACb,oBAAoB;CACpB,cAAc;CACd,cAAc;EAAE,OAAO;EAAG,MAAM;EAAG;CACnC,cAAc;CACd,YACE;CACF,qBACE;CACF,UAAU;EACR,YACE;EACF,YAAY;EACZ,UAAU;EACV,OAAO;GACL,IAAI;IA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