@alepha/ui 0.11.10 → 0.11.12
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/README.md +17 -306
- package/dist/{AlephaMantineProvider-DCF5kidi.cjs → AlephaMantineProvider-CGpgWDt8.cjs} +1 -1
- package/dist/{AlephaMantineProvider-CzMrw7V3.js → AlephaMantineProvider-D8cHYAge.js} +3 -1
- package/dist/AlephaMantineProvider-D8cHYAge.js.map +1 -0
- package/dist/{AlephaMantineProvider-DlOEv9f0.cjs → AlephaMantineProvider-DuvZFAuk.cjs} +3 -1
- package/dist/AlephaMantineProvider-DuvZFAuk.cjs.map +1 -0
- package/dist/AlephaMantineProvider-twBqV4IO.js +3 -0
- package/dist/index.cjs +43 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +17 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -24
- package/dist/index.js.map +1 -1
- package/package.json +55 -74
- package/src/components/buttons/ActionButton.tsx +1 -1
- package/src/components/buttons/LanguageButton.tsx +1 -1
- package/src/components/form/Control.tsx +1 -1
- package/src/components/form/ControlDate.tsx +1 -1
- package/src/components/form/ControlNumber.tsx +1 -1
- package/src/components/form/ControlQueryBuilder.tsx +2 -2
- package/src/components/form/ControlSelect.tsx +1 -1
- package/src/components/form/TypeForm.tsx +3 -3
- package/src/components/layout/AdminShell.tsx +1 -1
- package/src/components/table/DataTable.tsx +11 -11
- package/src/hooks/useDialog.ts +2 -0
- package/src/hooks/useToast.ts +2 -0
- package/src/index.ts +9 -5
- package/src/utils/extractSchemaFields.ts +1 -1
- package/src/utils/parseInput.ts +2 -2
- package/dist/AlephaMantineProvider-B4TwQ4tY.js +0 -3
- package/dist/AlephaMantineProvider-CzMrw7V3.js.map +0 -1
- package/dist/AlephaMantineProvider-DlOEv9f0.cjs.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Text","Box","ActionIcon","IconChevronDown","IconChevronRight","Collapse","CopyButton","Tooltip","IconCheck","IconCopy","Text","Group","Button","Text","Group","Button","Text","TextInput","Group","Button","AlertDialog","ConfirmDialog","PromptDialog","modals","Flex","JsonViewer","Menu","IconChevronRight","menuItemProps: MenuItemProps & ButtonHTMLAttributes<unknown>","ThemeIcon","IconCheck","icon","Flex","Button","defaultTooltipProps: Partial<TooltipProps>","Tooltip","SegmentedControl","Flex","IconSun","IconMoon","ActionButton","ActionButton","spotlight","Kbd","Flex","IconSearch","Text","IconMail","IconLink","IconPhone","IconCalendar","IconClock","IconColorPicker","IconKey","IconPalette","IconFile","IconSelector","IconToggleLeft","IconHash","IconList","IconLetterCase","IconAt","TypeBoxError","inputProps: InputProps","DateTimePicker","DateInput","TimeInput","Input","Slider","NumberInput","fields: SchemaField[]","field: SchemaField","OPERATOR_INFO: Record<\n string,\n { symbol: string; label: string; example: string }\n>","value","Popover","TextInput","IconInfoTriangle","IconFilter","ActionIcon","IconX","Group","Stack","Text","ActionButton","Divider","Flex","Badge","itemsEnum: string[] | undefined","items: any","segmentedControlProps: Partial<SegmentedControlProps>","Input","Flex","SegmentedControl","Autocomplete","TagsInput","data","MultiSelect","Select","ControlQueryBuilder","Input","Flex","ControlNumber","FileInput","ColorInput","ControlSelect","Switch","PasswordInput","Textarea","ControlDate","TextInput","schema: any","schema","Grid","Control","Flex","ActionButton","Burger","ActionButton","IconLanguage","BurgerButton","DarkModeButton","OmnibarButton","LanguageButton","Flex","Divider","Flex","OmnibarButton","ThemeIcon","Text","item","ActionButton","IconChevronDown","IconChevronRight","IconSquareRounded","AppShell","AppBar","NestedView","Alepha","t","DateTimeProvider","Table","ActionButton","Flex","TypeForm","Pagination","Select","ToastService","AlephaReactI18n","AlephaReactHead","AlephaReactForm"],"sources":["../src/RootRouter.ts","../src/components/data/JsonViewer.tsx","../src/components/dialogs/AlertDialog.tsx","../src/components/dialogs/ConfirmDialog.tsx","../src/components/dialogs/PromptDialog.tsx","../src/constants/ui.ts","../src/services/DialogService.tsx","../src/components/buttons/ActionButton.tsx","../src/components/buttons/DarkModeButton.tsx","../src/components/buttons/OmnibarButton.tsx","../src/utils/icons.tsx","../src/utils/string.ts","../src/utils/parseInput.ts","../src/components/form/ControlDate.tsx","../src/components/form/ControlNumber.tsx","../src/utils/extractSchemaFields.ts","../src/components/form/ControlQueryBuilder.tsx","../src/components/form/ControlSelect.tsx","../src/components/form/Control.tsx","../src/components/form/TypeForm.tsx","../src/components/buttons/BurgerButton.tsx","../src/components/buttons/LanguageButton.tsx","../src/components/layout/AppBar.tsx","../src/components/layout/Sidebar.tsx","../src/components/layout/AdminShell.tsx","../src/components/table/DataTable.tsx","../src/hooks/useDialog.ts","../src/index.ts"],"sourcesContent":["import { $page } from \"@alepha/react\";\n\nexport class RootRouter {\n public readonly root = $page({\n path: \"/\",\n lazy: () => import(\"./components/layout/AlephaMantineProvider.tsx\"),\n });\n}\n","import {\n ActionIcon,\n Box,\n Collapse,\n CopyButton,\n type MantineSize,\n Text,\n Tooltip,\n} from \"@mantine/core\";\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronRight,\n IconCopy,\n} from \"@tabler/icons-react\";\nimport { type ReactNode, useState } from \"react\";\n\ninterface JsonViewerProps {\n data: any;\n defaultExpanded?: boolean;\n maxDepth?: number;\n copyable?: boolean;\n size?: MantineSize;\n}\n\ninterface JsonNodeProps {\n name?: string;\n value: any;\n depth: number;\n maxDepth: number;\n isLast?: boolean;\n isArrayItem?: boolean;\n size?: MantineSize;\n}\n\nconst getSizeConfig = (size: MantineSize = \"sm\") => {\n const configs = {\n xs: { text: \"xs\", icon: 12, indent: 16, gap: 2 },\n sm: { text: \"sm\", icon: 14, indent: 20, gap: 4 },\n md: { text: \"md\", icon: 16, indent: 24, gap: 6 },\n lg: { text: \"lg\", icon: 18, indent: 28, gap: 8 },\n xl: { text: \"xl\", icon: 20, indent: 32, gap: 10 },\n };\n return configs[size] || configs.sm;\n};\n\nconst JsonNode = ({\n name,\n value,\n depth,\n maxDepth,\n isLast = false,\n isArrayItem = false,\n size = \"sm\",\n}: JsonNodeProps) => {\n const [expanded, setExpanded] = useState(depth < 2);\n const sizeConfig = getSizeConfig(size);\n\n 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\n const valueType = getValueType(value);\n\n const renderPrimitive = (val: any): ReactNode => {\n const type = getValueType(val);\n\n switch (type) {\n case \"string\":\n return (\n <Text\n component=\"span\"\n c=\"teal\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n \"{val}\"\n </Text>\n );\n case \"number\":\n return (\n <Text\n component=\"span\"\n c=\"blue\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {val}\n </Text>\n );\n case \"boolean\":\n return (\n <Text\n component=\"span\"\n c=\"violet\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {String(val)}\n </Text>\n );\n case \"null\":\n return (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n null\n </Text>\n );\n case \"undefined\":\n return (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n undefined\n </Text>\n );\n default:\n return (\n <Text\n component=\"span\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {String(val)}\n </Text>\n );\n }\n };\n\n const renderKey = () => {\n if (!name) return null;\n return (\n <Text\n component=\"span\"\n c=\"cyan\"\n ff=\"monospace\"\n fw={500}\n size={sizeConfig.text}\n >\n {isArrayItem ? `[${name}]` : `\"${name}\"`}:\n </Text>\n );\n };\n\n if (valueType === \"object\" || valueType === \"array\") {\n const isObject = valueType === \"object\";\n const entries = isObject\n ? Object.entries(value)\n : value.map((v: any, i: number) => [i, v]);\n const isEmpty = entries.length === 0;\n const canExpand = depth < maxDepth && !isEmpty;\n\n const preview = isObject ? \"{...}\" : \"[...]\";\n const brackets = isObject ? [\"{\", \"}\"] : [\"[\", \"]\"];\n\n return (\n <Box>\n <Box\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: sizeConfig.gap,\n minWidth: \"max-content\",\n }}\n >\n {canExpand && (\n <ActionIcon\n size=\"xs\"\n variant=\"transparent\"\n c=\"dimmed\"\n onClick={() => setExpanded(!expanded)}\n style={{ cursor: \"pointer\", flexShrink: 0 }}\n >\n {expanded ? (\n <IconChevronDown size={sizeConfig.icon} />\n ) : (\n <IconChevronRight size={sizeConfig.icon} />\n )}\n </ActionIcon>\n )}\n {!canExpand && (\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n )}\n <Box style={{ flexShrink: 0 }}>{renderKey()}</Box>{\" \"}\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[0]}\n </Text>\n {!expanded && !isEmpty && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n fs=\"italic\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {preview}\n </Text>\n )}\n {(isEmpty || !expanded) && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[1]}\n </Text>\n )}\n {!isEmpty && !expanded && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {entries.length} {entries.length === 1 ? \"item\" : \"items\"}\n </Text>\n )}\n </Box>\n\n <Collapse in={expanded && canExpand}>\n <Box\n pl={sizeConfig.indent}\n style={{\n borderLeft: \"1px solid var(--mantine-color-default-border)\",\n marginLeft: Math.floor((sizeConfig.icon + 6) / 2),\n }}\n >\n {entries.map(\n ([key, val]: [string | number, any], index: number) => (\n <JsonNode\n key={String(key)}\n name={String(key)}\n value={val}\n depth={depth + 1}\n maxDepth={maxDepth}\n isLast={index === entries.length - 1}\n isArrayItem={!isObject}\n size={size}\n />\n ),\n )}\n </Box>\n <Box style={{ display: \"flex\", minWidth: \"max-content\" }}>\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n <Text\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[1]}\n </Text>\n </Box>\n </Collapse>\n </Box>\n );\n }\n\n return (\n <Box\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: sizeConfig.gap,\n minWidth: \"max-content\",\n }}\n >\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n <Box style={{ flexShrink: 0 }}>{renderKey()}</Box>\n <Box style={{ flexShrink: 0 }}>{renderPrimitive(value)}</Box>\n {!isLast && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n ,\n </Text>\n )}\n </Box>\n );\n};\n\nexport const JsonViewer = ({\n data,\n defaultExpanded = true,\n maxDepth = 10,\n copyable = true,\n size = \"sm\",\n}: JsonViewerProps) => {\n const sizeConfig = getSizeConfig(size);\n const copyIconSize = sizeConfig.icon + 2;\n\n return (\n <Box pos=\"relative\" w={\"100%\"}>\n {copyable && (\n <Box pos=\"absolute\" top={0} right={0} style={{ zIndex: 1 }}>\n <CopyButton value={JSON.stringify(data, null, 2)}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? \"Copied\" : \"Copy JSON\"}>\n <ActionIcon\n color={copied ? \"teal\" : \"gray\"}\n variant=\"subtle\"\n onClick={copy}\n size={size}\n >\n {copied ? (\n <IconCheck size={copyIconSize} />\n ) : (\n <IconCopy size={copyIconSize} />\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Box>\n )}\n <Box pt={copyable ? 30 : 0} style={{ overflowX: \"auto\" }}>\n <JsonNode value={data} depth={0} maxDepth={maxDepth} size={size} />\n </Box>\n </Box>\n );\n};\n\nexport default JsonViewer;\n","import { Button, Group, Text } from \"@mantine/core\";\nimport type { AlertDialogProps } from \"../../services/DialogService\";\n\nconst AlertDialog = ({ options, onClose }: AlertDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Group justify=\"flex-end\">\n <Button onClick={onClose}>{options?.okLabel || \"OK\"}</Button>\n </Group>\n </>\n);\n\nexport default AlertDialog;\n","import { Button, Group, Text } from \"@mantine/core\";\nimport type { ConfirmDialogProps } from \"../../services/DialogService\";\n\nconst ConfirmDialog = ({ options, onConfirm }: ConfirmDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Group 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 </Group>\n </>\n);\n\nexport default ConfirmDialog;\n","import { Button, Group, Text, TextInput } from \"@mantine/core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { PromptDialogProps } from \"../../services/DialogService\";\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 <Group 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 </Group>\n </>\n );\n};\n\nexport default PromptDialog;\n","export const ui = {\n colors: {\n transparent: \"transparent\",\n background: \"var(--alepha-background)\",\n surface: \"var(--alepha-surface)\",\n elevated: \"var(--alepha-elevated)\",\n border: \"var(--alepha-border)\",\n },\n};\n","import { Flex, type ModalProps } from \"@mantine/core\";\nimport { modals } from \"@mantine/modals\";\nimport type { ReactNode } from \"react\";\nimport JsonViewer from \"../components/data/JsonViewer.tsx\";\nimport AlertDialog from \"../components/dialogs/AlertDialog\";\nimport ConfirmDialog from \"../components/dialogs/ConfirmDialog\";\nimport PromptDialog from \"../components/dialogs/PromptDialog\";\nimport { ui } from \"../constants/ui.ts\";\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 const modalId = this.open({\n ...options,\n title: options?.title || \"Alert\",\n content: (\n <AlertDialog\n options={options}\n onClose={() => {\n this.close(modalId);\n resolve();\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 const modalId = this.open({\n ...options,\n title: options?.title || \"Confirm\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n content: (\n <ConfirmDialog\n options={options}\n onConfirm={(confirmed) => {\n this.close(modalId);\n resolve(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 const modalId = this.open({\n ...options,\n title: options?.title || \"Input\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n content: (\n <PromptDialog\n options={options}\n onSubmit={(value) => {\n this.close(modalId);\n resolve(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 /**\n * Show a JSON editor/viewer dialog\n */\n public json(data?: any, options?: BaseDialogOptions): void {\n this.open({\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 }\n\n /**\n * Show a form dialog for structured input\n */\n public form(options?: BaseDialogOptions): Promise<any> {\n // Implementation to be added\n return Promise.resolve(null);\n }\n\n /**\n * Show a loading/progress dialog with optional progress percentage\n */\n public loading(options?: BaseDialogOptions & { progress?: number }): void {\n // Implementation to be added\n }\n\n /**\n * Show an image viewer/gallery dialog\n */\n public image(src: string | string[], options?: BaseDialogOptions): void {\n // Implementation to be added\n }\n}\n","import {\n type RouterGoOptions,\n type UseActionReturn,\n type UseActiveOptions,\n useAction,\n useActive,\n useRouter,\n} from \"@alepha/react\";\nimport { type FormModel, useFormState } from \"@alepha/react-form\";\nimport {\n Button,\n type ButtonProps,\n Flex,\n Menu,\n type MenuItemProps,\n type MenuProps,\n type MenuTargetProps,\n ThemeIcon,\n type ThemeIconProps,\n Tooltip,\n type TooltipProps,\n} from \"@mantine/core\";\nimport { IconCheck, IconChevronRight } from \"@tabler/icons-react\";\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\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 menuProps?: MenuProps;\n}\n\nexport interface ActionCommonProps extends ButtonProps {\n children?: ReactNode;\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 | 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;\n\n /**\n * Additional props to pass to the ThemeIcon wrapping the icon.\n */\n themeIconProps?: ThemeIconProps;\n}\n\nexport type ActionProps = ActionCommonProps &\n (\n | ActionNavigationButtonProps\n | ActionClickButtonProps\n | ActionSubmitButtonProps\n | ActionHookButtonProps\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={item.icon}\n onClick={item.onClick}\n color={item.color}\n rightSection={\n item.active ? (\n <ThemeIcon size={\"xs\"} variant={\"transparent\"}>\n <IconCheck />\n </ThemeIcon>\n ) : undefined\n }\n {...menuItemProps}\n >\n {item.label}\n </Menu.Item>\n );\n};\n\nconst ActionButton = (_props: ActionProps) => {\n const props = { variant: \"subtle\", ..._props };\n const { tooltip, menu, icon, ...restProps } = props;\n\n if (props.icon) {\n const icon = (\n <ThemeIcon\n w={24} // TODO: make size configurable\n variant={\"transparent\"}\n size={\"sm\"}\n c={\"var(--mantine-color-text)\"}\n {...props.themeIconProps}\n >\n {props.icon}\n </ThemeIcon>\n );\n if (!props.children) {\n restProps.children = icon;\n restProps.p ??= \"xs\";\n } else {\n restProps.leftSection = icon;\n }\n }\n\n if (props.leftSection && !props.children) {\n restProps.className ??= \"mantine-Action-iconOnly\";\n restProps.p ??= \"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 px={\"xs\"} {...rest} tooltip={tooltip} menu={menu}>\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\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\"\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}\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 = (props: ActionClickButtonProps) => {\n const action = useAction(\n {\n handler: async (e: any) => {\n await props.onClick(e);\n },\n },\n [props.onClick],\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?: RouterGoOptions;\n classNameActive?: string;\n variantActive?: ButtonProps[\"variant\"];\n target?: string;\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 routerGoOptions,\n ...buttonProps\n } = props;\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 const className = buttonProps.className || \"\";\n if (isActive && options !== false && classNameActive) {\n buttonProps.className = `${className} ${classNameActive}`.trim();\n }\n\n return (\n <Button\n component={\"a\"}\n loading={isPending}\n {...buttonProps}\n {...anchorProps}\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 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","import {\n Flex,\n type MantineBreakpoint,\n SegmentedControl,\n type SegmentedControlProps,\n useComputedColorScheme,\n useMantineColorScheme,\n} from \"@mantine/core\";\nimport { IconMoon, IconSun } from \"@tabler/icons-react\";\nimport { useEffect, useState } from \"react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface DarkModeButtonProps {\n mode?: \"minimal\" | \"segmented\";\n size?: MantineBreakpoint;\n variant?:\n | \"filled\"\n | \"light\"\n | \"outline\"\n | \"default\"\n | \"subtle\"\n | \"transparent\";\n\n fullWidth?: boolean;\n\n segmentedProps?: Partial<SegmentedControlProps>;\n actionProps?: Partial<ActionProps>;\n}\n\nconst DarkModeButton = (props: DarkModeButtonProps) => {\n const { setColorScheme } = useMantineColorScheme();\n const computedColorScheme = useComputedColorScheme(\"light\");\n const [colorScheme, setColorScheme2] = useState(\"default\");\n const mode = props.mode ?? \"minimal\";\n\n useEffect(() => {\n setColorScheme2(computedColorScheme);\n }, [computedColorScheme]);\n\n const toggleColorScheme = () => {\n setColorScheme(computedColorScheme === \"dark\" ? \"light\" : \"dark\");\n };\n\n if (mode === \"segmented\") {\n return (\n <SegmentedControl\n value={colorScheme}\n onChange={(value) => setColorScheme(value as \"light\" | \"dark\")}\n data={[\n {\n value: \"light\",\n label: (\n <Flex h={20} align=\"center\" justify=\"center\">\n <IconSun size={16} />\n </Flex>\n ),\n },\n {\n value: \"dark\",\n label: (\n <Flex h={20} align=\"center\" justify=\"center\">\n <IconMoon size={16} />\n </Flex>\n ),\n },\n ]}\n w={props.fullWidth ? \"100%\" : undefined}\n {...props.segmentedProps}\n />\n );\n }\n\n return (\n <ActionButton\n onClick={toggleColorScheme}\n variant={props.variant ?? \"outline\"}\n size={props.size ?? \"sm\"}\n aria-label=\"Toggle color scheme\"\n px={\"xs\"}\n fullWidth={props.fullWidth ?? false}\n icon={\n colorScheme === \"dark\" ? (\n <IconSun size={20} />\n ) : colorScheme === \"light\" ? (\n <IconMoon size={20} />\n ) : (\n <Flex h={20} w={20} />\n )\n }\n {...props.actionProps}\n />\n );\n};\n\nexport default DarkModeButton;\n","import { Flex, Kbd, Text } from \"@mantine/core\";\nimport { spotlight } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-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 return (\n <ActionButton\n variant={\"outline\"}\n miw={256}\n onClick={spotlight.open}\n justify={\"space-between\"}\n rightSection={<Kbd size={\"sm\"}>⌘+K</Kbd>}\n radius={\"md\"}\n {...props.actionProps}\n >\n <Flex align={\"center\"} gap={\"xs\"}>\n <IconSearch size={16} color={\"gray\"} />\n <Text size={\"xs\"} c={\"dimmed\"}>\n Search...\n </Text>\n </Flex>\n </ActionButton>\n );\n};\n\nexport default OmnibarButton;\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 { ReactNode } from \"react\";\n\n/**\n * Icon size presets following Mantine's size conventions\n */\nexport const ICON_SIZES = {\n xs: 12,\n sm: 16,\n md: 20,\n lg: 24,\n xl: 28,\n} as const;\n\nexport type IconSize = keyof typeof ICON_SIZES;\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}): ReactNode => {\n const { type, format, name, isEnum, isArray, size = \"sm\" } = params;\n const iconSize = ICON_SIZES[size];\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 a path or identifier string into a pretty display name.\n * Removes slashes and capitalizes the first letter.\n *\n * @example\n * prettyName(\"/userName\") // \"UserName\"\n * prettyName(\"email\") // \"Email\"\n */\nexport const prettyName = (name: string): string => {\n return capitalize(name.replaceAll(\"/\", \"\"));\n};\n","import { type TObject, TypeBoxError } from \"@alepha/core\";\nimport type { InputField } from \"@alepha/react-form\";\nimport type { ReactNode } from \"react\";\nimport type { ControlProps } from \"../components/form/Control.tsx\";\nimport { getDefaultIcon } from \"./icons.tsx\";\nimport { prettyName } from \"./string.ts\";\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.title ??\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 =\n 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 });\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 inputProps: InputProps = {\n label,\n description,\n error,\n required,\n disabled,\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: InputField;\n title?: string;\n description?: string;\n icon?: ReactNode;\n}\n\nexport interface ControlInput {\n id?: string;\n icon: ReactNode;\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 { useFormState } from \"@alepha/react-form\";\nimport {\n DateInput,\n type DateInputProps,\n DateTimePicker,\n type DateTimePickerProps,\n TimeInput,\n type TimeInputProps,\n} from \"@mantine/dates\";\nimport {\n type GenericControlProps,\n parseInput,\n} 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 { 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 defaultValue={\n props.input.props.defaultValue\n ? new Date(props.input.props.defaultValue)\n : undefined\n }\n onChange={(value) => {\n props.input.set(value ? new Date(value).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 defaultValue={\n props.input.props.defaultValue\n ? new Date(props.input.props.defaultValue)\n : undefined\n }\n onChange={(value) => {\n props.input.set(\n value ? new Date(value).toISOString().slice(0, 10) : undefined,\n );\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 defaultValue={props.input.props.defaultValue}\n onChange={(event) => {\n props.input.set(event.currentTarget.value);\n }}\n {...timeInputProps}\n />\n );\n }\n //endregion\n\n // Fallback - shouldn't happen\n return null;\n};\n\nexport default ControlDate;\n","import { useEvents } from \"@alepha/react\";\nimport { useFormState } from \"@alepha/react-form\";\nimport {\n Input,\n NumberInput,\n type NumberInputProps,\n Slider,\n type SliderProps,\n} from \"@mantine/core\";\nimport { useRef, useState } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} 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 { inputProps, id, icon } = parseInput(props, form);\n const ref = useRef<HTMLInputElement | null>(null);\n\n // HTML Reset doesn't trigger on <NumberInput /> so we handle it manually\n\n const [value, setValue] = useState<number | undefined>(\n props.input.props.defaultValue,\n );\n\n useEvents(\n {\n \"form:reset\": (event) => {\n if (event.id === props.input?.form.id && ref.current) {\n setValue(props.input.props.defaultValue);\n }\n },\n },\n [props.input],\n );\n\n if (!props.input?.props) {\n return null;\n }\n\n const { type, ...inputPropsWithoutType } = props.input.props;\n\n if (props.sliderProps) {\n return (\n <Input.Wrapper {...inputProps}>\n <div\n style={{\n height: 32,\n padding: 8,\n }}\n >\n <Slider\n {...inputProps}\n ref={ref}\n id={id}\n {...inputPropsWithoutType}\n {...props.sliderProps}\n value={value}\n onChange={(val) => {\n setValue(val);\n props.input.set(val);\n }}\n />\n </div>\n </Input.Wrapper>\n );\n }\n\n return (\n <NumberInput\n {...inputProps}\n ref={ref}\n id={id}\n leftSection={icon}\n {...inputPropsWithoutType}\n {...props.numberInputProps}\n value={value ?? \"\"}\n onChange={(val) => {\n const newValue = val !== null ? Number(val) : undefined;\n setValue(newValue);\n props.input.set(newValue);\n }}\n />\n );\n};\n\nexport default ControlNumber;\n","import type { TObject, TProperties, TSchema } from \"@alepha/core\";\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, like, and null checks\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 like: { symbol: \"~\", label: \"like (case-sensitive)\", example: \"name~John\" },\n ilike: {\n symbol: \"~*\",\n label: \"like (case-insensitive)\",\n example: \"name~*john\",\n },\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 type { TObject } from \"@alepha/core\";\nimport { parseQueryString } from \"@alepha/postgres\";\nimport { useEvents } from \"@alepha/react\";\nimport {\n ActionIcon,\n Badge,\n Divider,\n Flex,\n Group,\n Popover,\n Stack,\n Text,\n TextInput,\n type TextInputProps,\n} from \"@mantine/core\";\nimport { IconFilter, IconInfoTriangle, IconX } from \"@tabler/icons-react\";\nimport { useRef, useState } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport {\n extractSchemaFields,\n OPERATOR_INFO,\n type SchemaField,\n} from \"../../utils/extractSchemaFields.ts\";\nimport ActionButton from \"../buttons/ActionButton.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 = ({\n schema,\n value = \"\",\n onChange,\n placeholder = \"Enter query or click for assistance...\",\n ...textInputProps\n}: ControlQueryBuilderProps) => {\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 <QueryHelp fields={fields} onInsert={handleInsert} />\n </Popover.Dropdown>\n </Popover>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n// Query Help Component\n// ---------------------------------------------------------------------------------------------------------------------\n\ninterface QueryHelpProps {\n fields: SchemaField[];\n onInsert: (text: string) => void;\n}\n\nfunction QueryHelp({ fields, onInsert }: QueryHelpProps) {\n return (\n <Group\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 <Stack gap=\"md\" style={{ flex: 1 }}>\n {/* Available Operators */}\n <Stack gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Operators\n </Text>\n <Stack gap={4}>\n {Object.entries(OPERATOR_INFO).map(([key, info]) => (\n <Group 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 </Group>\n ))}\n </Stack>\n </Stack>\n\n <Divider />\n\n {/* Logic Operators */}\n <Stack gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Logic\n </Text>\n <Stack gap={4}>\n <Group 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 </Group>\n <Group 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 </Group>\n </Stack>\n </Stack>\n </Stack>\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 <Group 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 </Group>\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 </Group>\n );\n}\n\nexport default ControlQueryBuilder;\n","import { useFormState } from \"@alepha/react-form\";\nimport {\n Autocomplete,\n type AutocompleteProps,\n Flex,\n Input,\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 { useEffect, useState } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} from \"../../utils/parseInput.ts\";\n\nexport type SelectValueLabel =\n | string\n | { value: string; label: string; icon?: string };\n\nexport interface ControlSelectProps extends GenericControlProps {\n select?: boolean | SelectProps;\n multi?: boolean | MultiSelectProps;\n tags?: boolean | TagsInputProps;\n autocomplete?: boolean | AutocompleteProps;\n segmented?: boolean | Partial<SegmentedControlProps>;\n\n loader?: () => Promise<SelectValueLabel[]>;\n}\n\n/**\n * ControlSelect component for handling Select, MultiSelect, and TagsInput.\n *\n * Features:\n * - Basic Select with enum support\n * - MultiSelect for array of enums\n * - TagsInput for array of strings (no enum)\n * - Future: Lazy loading\n * - Future: Searchable/filterable options\n * - Future: Custom option rendering\n *\n * Automatically detects enum values and array types from schema.\n */\nconst ControlSelect = (props: ControlSelectProps) => {\n const form = useFormState(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 // For arrays, check if items have enum (MultiSelect) or not (TagsInput)\n let itemsEnum: string[] | undefined;\n if (isArray && \"items\" in props.input.schema && props.input.schema.items) {\n const items: any = props.input.schema.items;\n if (\"enum\" in items && Array.isArray(items.enum)) {\n itemsEnum = items.enum;\n }\n }\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 const [data, setData] = useState<SelectValueLabel[]>([]);\n\n useEffect(() => {\n if (!props.input?.props) {\n return;\n }\n\n if (props.loader) {\n props.loader().then(setData);\n } else {\n setData(enumValues);\n }\n }, [props.input, props.loader]);\n\n if (!props.input?.props) {\n return null;\n }\n\n if (props.segmented) {\n const segmentedControlProps: Partial<SegmentedControlProps> =\n typeof props.segmented === \"object\" ? props.segmented : {};\n\n return (\n <Input.Wrapper {...inputProps}>\n <Flex>\n <SegmentedControl\n disabled={inputProps.disabled}\n defaultValue={String(props.input.props.defaultValue)}\n {...segmentedControlProps}\n onChange={(value) => {\n props.input.set(value);\n }}\n data={data.slice(0, 10)}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n\n if (props.autocomplete) {\n const autocompleteProps =\n typeof props.autocomplete === \"object\" ? props.autocomplete : {};\n\n return (\n <Autocomplete\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n {...props.input.props}\n {...autocompleteProps}\n />\n );\n }\n\n // region <TagsInput/> - for array of strings without enum\n if ((isArray && !itemsEnum) || props.tags) {\n const tagsInputProps = typeof props.tags === \"object\" ? props.tags : {};\n return (\n <TagsInput\n {...inputProps}\n id={id}\n leftSection={icon}\n defaultValue={\n Array.isArray(props.input.props.defaultValue)\n ? props.input.props.defaultValue\n : []\n }\n onChange={(value) => {\n props.input.set(value);\n }}\n {...tagsInputProps}\n />\n );\n }\n // endregion\n\n // region <MultiSelect/> - for array of enums\n if ((isArray && itemsEnum) || props.multi) {\n const data =\n itemsEnum?.map((value: string) => ({\n value,\n label: value,\n })) || [];\n\n const multiSelectProps = typeof props.multi === \"object\" ? props.multi : {};\n\n return (\n <MultiSelect\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n defaultValue={\n Array.isArray(props.input.props.defaultValue)\n ? props.input.props.defaultValue\n : []\n }\n onChange={(value) => {\n props.input.set(value);\n }}\n {...multiSelectProps}\n />\n );\n }\n // endregion\n\n // region <Select/> - for single enum value\n const selectProps = typeof props.select === \"object\" ? props.select : {};\n\n return (\n <Select\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n {...props.input.props}\n {...selectProps}\n />\n );\n // endregion\n};\n\nexport default ControlSelect;\n","import { useFormState } from \"@alepha/react-form\";\nimport {\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 type { ComponentType } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} from \"../../utils/parseInput.ts\";\nimport ControlDate from \"./ControlDate.tsx\";\nimport ControlNumber, { type ControlNumberProps } from \"./ControlNumber.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 custom?: ComponentType<CustomControlProps>;\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 * - 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 { inputProps, id, icon, format, schema } = parseInput(_props, form);\n if (!_props.input?.props) {\n return null;\n }\n\n const props = {\n ..._props,\n ...schema.$control,\n };\n\n //region <QueryBuilder/>\n if (props.query) {\n return (\n <ControlQueryBuilder\n {...props.input.props}\n {...inputProps}\n schema={props.query}\n value={props.input.props.value}\n onChange={(value) => {\n props.input.set(value);\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 defaultValue={props.input.props.defaultValue}\n onChange={(value) => {\n props.input.set(value);\n }}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n //endregion\n\n //region <NumberInput/>\n if (\n props.number ||\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 return (\n <ControlNumber\n input={props.input}\n title={props.title}\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 id={id}\n leftSection={icon}\n onChange={(file) => {\n props.input.set(file);\n }}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 const isEnum =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n props.input.schema.enum;\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n if (isEnum || isArray || props.select) {\n const opts = typeof props.select === \"object\" ? props.select : {};\n return (\n <ControlSelect\n input={props.input}\n title={props.title}\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 props.switch\n ) {\n const switchProps = typeof props.switch === \"object\" ? props.switch : {};\n\n return (\n <Switch\n {...inputProps}\n id={id}\n color={\"blue\"}\n defaultChecked={props.input.props.defaultValue}\n {...props.input.props}\n {...switchProps}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 input={props.input}\n title={props.title}\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 undefined;\n }\n };\n\n return (\n <TextInput\n {...inputProps}\n id={id}\n leftSection={icon}\n type={getInputType()}\n {...props.input.props}\n {...textInputProps}\n />\n );\n //endregion\n};\n\nexport default Control;\n\nexport type CustomControlProps = {\n defaultValue: any;\n onChange: (value: any) => void;\n};\n","import type { TObject } from \"@alepha/core\";\nimport type { FormModel } from \"@alepha/react-form\";\nimport { Flex, Grid } from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport ActionButton, {\n type ActionSubmitButtonProps,\n} from \"../buttons/ActionButton.tsx\";\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 controlProps?: Partial<Omit<ControlProps, \"input\">>;\n skipFormElement?: boolean;\n skipSubmitButton?: boolean;\n submitButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n resetButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\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 * @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 * }),\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 skipFormElement = false,\n skipSubmitButton = false,\n submitButtonProps,\n } = props;\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 out unsupported field types (objects only, arrays are now supported)\n const supportedFields = fieldNames.filter((fieldName) => {\n const field = form.input[fieldName as keyof typeof form.input];\n if (!field || typeof field !== \"object\" || !(\"schema\" in field)) {\n return false;\n }\n\n const schema: any = field.schema;\n\n // Skip if it's an object (not supported by Control)\n // Arrays are now supported via ControlSelect (MultiSelect/TagsInput)\n if (\"type\" in schema) {\n if (schema.type === \"object\") {\n return false;\n }\n }\n\n // Check if it has properties (nested object)\n if (\"properties\" in schema && schema.properties) {\n return false;\n }\n\n return true;\n });\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\n // Type guard to ensure field has the expected structure\n if (!field || typeof field !== \"object\" || !(\"schema\" in field)) {\n return null;\n }\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={field as any} {...controlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n };\n\n const content = (\n <Flex direction={\"column\"} gap={\"sm\"}>\n {renderFields()}\n {!skipSubmitButton && (\n <Flex gap={\"sm\"}>\n <ActionButton form={form} {...submitButtonProps}>\n {submitButtonProps?.children ?? \"Submit\"}\n </ActionButton>\n <ActionButton type={\"reset\"}>Reset</ActionButton>\n </Flex>\n )}\n </Flex>\n );\n\n if (skipFormElement) {\n return content;\n }\n\n return <form {...form.props}>{content}</form>;\n};\n\nexport default TypeForm;\n","import { useStore } from \"@alepha/react\";\nimport { Burger, type BurgerProps } from \"@mantine/core\";\n\nexport interface BurgerButtonProps extends BurgerProps {}\n\nconst BurgerButton = (props: BurgerButtonProps) => {\n const [opened, setOpened] = useStore(\"alepha.ui.sidebar.opened\");\n\n return (\n <Burger\n opened={opened}\n onClick={() => setOpened(!opened)}\n hiddenFrom=\"sm\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport default BurgerButton;\n","import { useI18n } from \"@alepha/react-i18n\";\nimport { IconLanguage } from \"@tabler/icons-react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface LanguageButtonProps {\n languages?: string[];\n actionProps?: ActionProps;\n}\n\nconst LanguageButton = (props: LanguageButtonProps) => {\n const i18n = useI18n();\n return (\n <ActionButton\n icon={<IconLanguage />}\n variant={\"outline\"}\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.actionProps}\n />\n );\n};\n\nexport default LanguageButton;\n","import { Divider, Flex, type FlexProps } from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport BurgerButton from \"../buttons/BurgerButton.tsx\";\nimport DarkModeButton, {\n type DarkModeButtonProps,\n} from \"../buttons/DarkModeButton.tsx\";\nimport LanguageButton, {\n type LanguageButtonProps,\n} from \"../buttons/LanguageButton.tsx\";\nimport OmnibarButton, {\n type OmnibarButtonProps,\n} from \"../buttons/OmnibarButton.tsx\";\n\nexport type AppBarItem =\n | AppBarElement\n | AppBarBurger\n | AppBarDark\n | AppBarSearch\n | AppBarLang\n | AppBarSpacer\n | AppBarDivider;\n\nexport interface AppBarElement {\n position: \"left\" | \"center\" | \"right\";\n element: ReactNode;\n}\n\nexport interface AppBarBurger {\n position: \"left\" | \"center\" | \"right\";\n type: \"burger\";\n}\n\nexport interface AppBarDark {\n position: \"left\" | \"center\" | \"right\";\n type: \"dark\";\n props?: DarkModeButtonProps;\n}\n\nexport interface AppBarSearch {\n position: \"left\" | \"center\" | \"right\";\n type: \"search\";\n props?: OmnibarButtonProps;\n}\n\nexport interface AppBarLang {\n position: \"left\" | \"center\" | \"right\";\n type: \"lang\";\n props?: LanguageButtonProps;\n}\n\nexport interface AppBarSpacer {\n position: \"left\" | \"center\" | \"right\";\n type: \"spacer\";\n}\n\nexport interface AppBarDivider {\n position: \"left\" | \"center\" | \"right\";\n type: \"divider\";\n}\n\nexport interface AppBarProps {\n flexProps?: FlexProps;\n items?: AppBarItem[];\n}\n\nconst AppBar = (props: AppBarProps) => {\n const { items = [] } = props;\n\n const renderItem = (item: AppBarItem, index: number) => {\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 === \"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 }\n if (\"element\" in item) {\n return item.element;\n }\n return null;\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 return (\n <Flex\n h=\"100%\"\n align=\"center\"\n px=\"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} gap=\"md\" 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\nexport default AppBar;\n","import { useEvents, useRouter } from \"@alepha/react\";\nimport {\n Flex,\n type FlexProps,\n type MantineBreakpoint,\n Text,\n ThemeIcon,\n} from \"@mantine/core\";\nimport {\n IconChevronDown,\n IconChevronRight,\n IconSquareRounded,\n} from \"@tabler/icons-react\";\nimport { type ReactNode, useCallback, useState } from \"react\";\nimport ActionButton, { type ActionProps } from \"../buttons/ActionButton.tsx\";\nimport OmnibarButton from \"../buttons/OmnibarButton.tsx\";\n\nexport interface SidebarProps {\n menu?: SidebarNode[];\n top?: SidebarNode[];\n bottom?: SidebarNode[];\n onItemClick?: (item: SidebarMenuItem) => void;\n onSearchClick?: () => void;\n theme?: SidebarTheme;\n flexProps?: Partial<FlexProps>;\n collapsed?: boolean;\n gap?: MantineBreakpoint;\n}\n\nexport const Sidebar = (props: SidebarProps) => {\n const router = useRouter();\n const { top = [], bottom = [], onItemClick } = props;\n\n const renderNode = (item: SidebarNode, key: number) => {\n if (\"type\" in item) {\n if (item.type === \"spacer\") {\n return <Flex key={key} h={16} />;\n }\n\n if (item.type === \"divider\") {\n return (\n <Flex\n key={key}\n h={1}\n bg={\"var(--alepha-border)\"}\n my={\"md\"}\n mx={\"sm\"}\n />\n );\n }\n\n if (item.type === \"search\") {\n return <OmnibarButton collapsed={props.collapsed} key={key} />;\n }\n\n if (item.type === \"section\") {\n if (props.collapsed) return;\n return (\n <Flex mt={\"md\"} mb={\"xs\"} align={\"center\"} gap={\"xs\"}>\n <ThemeIcon c={\"dimmed\"} size={\"xs\"} variant={\"transparent\"}>\n {item.icon}\n </ThemeIcon>\n <Text\n key={key}\n size={\"xs\"}\n c={\"dimmed\"}\n tt={\"uppercase\"}\n fw={\"bold\"}\n >\n {item.label}\n </Text>\n </Flex>\n );\n }\n }\n\n if (\"element\" in item) {\n return <Flex key={key}>{item.element}</Flex>;\n }\n\n if (props.collapsed) {\n return (\n <SidebarCollapsedItem\n key={key}\n item={item}\n level={0}\n onItemClick={onItemClick}\n theme={props.theme ?? {}}\n />\n );\n }\n\n return (\n <SidebarItem\n key={key}\n item={item}\n level={0}\n onItemClick={onItemClick}\n theme={props.theme ?? {}}\n />\n );\n };\n\n const padding = \"md\";\n const gap = props.gap;\n const menu =\n props.menu ??\n (router.concretePages.map((page) => ({\n label: page.label ?? page.name,\n description: page.description,\n icon: page.icon,\n href: page.path,\n })) as SidebarMenuItem[]);\n\n return (\n <Flex\n flex={1}\n py={padding}\n direction={\"column\"}\n className={\"overflow-auto\"}\n {...props.flexProps}\n >\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {top.map((item, index) => renderNode(item, index))}\n {menu\n .filter((it) => it.position === \"top\")\n .map((item, index) => renderNode(item, index + top.length))}\n </Flex>\n <Flex\n gap={gap}\n px={padding}\n direction={\"column\"}\n flex={1}\n className={\"overflow-auto\"}\n >\n {menu\n .filter((it) => !it.position)\n .map((item, index) => renderNode(item, index))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {bottom.map((item, index) => renderNode(item, index))}\n {menu\n .filter((it) => it.position === \"bottom\")\n .map((item, index) => renderNode(item, index + bottom.length))}\n </Flex>\n </Flex>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\nexport const SidebarItem = (props: SidebarItemProps) => {\n const { item, level } = props;\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(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(item)) {\n setIsOpen(true);\n }\n },\n },\n [],\n );\n\n if (level > maxLevel) return null;\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (item.children && item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(item);\n item.onClick?.();\n }\n };\n\n return (\n <Flex direction={\"column\"} ps={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 variant={\"subtle\"}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (level === 0 ? \"sm\" : \"xs\")\n }\n variantActive={\"default\"}\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 {item.icon && (\n <ThemeIcon\n size={level === 0 ? \"sm\" : \"xs\"}\n variant={\"transparent\"}\n >\n {item.icon}\n </ThemeIcon>\n )}\n <Flex direction={\"column\"}>\n <Flex>{item.label}</Flex>\n {item.description && (\n <Text size={\"xs\"} c={\"dimmed\"}>\n {item.description}\n </Text>\n )}\n </Flex>\n </Flex>\n }\n rightSection={\n 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 {item.children && isOpen && (\n <Flex direction={\"column\"} data-parent-level={level}>\n <Flex\n style={{\n position: \"absolute\",\n width: 1,\n background:\n \"linear-gradient(to bottom, transparent, var(--alepha-border), transparent)\",\n top: 48,\n left: 20 + 32 * level,\n bottom: 16,\n }}\n />\n {item.children.map((child, index) => (\n <SidebarItem\n key={index}\n item={child}\n level={level + 1}\n onItemClick={props.onItemClick}\n theme={props.theme}\n />\n ))}\n </Flex>\n )}\n </Flex>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\nconst SidebarCollapsedItem = (props: SidebarItemProps) => {\n const { item, level } = props;\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(item));\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (item.children && item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(item);\n item.onClick?.();\n }\n };\n\n return (\n <ActionButton\n variant={\"subtle\"}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (level === 0 ? \"sm\" : \"xs\")\n }\n variantActive={\"default\"}\n radius={props.item.theme?.radius ?? props.theme.button?.radius ?? \"md\"}\n onClick={handleItemClick}\n icon={item.icon ?? <IconSquareRounded />}\n href={props.item.href}\n target={props.item.target}\n menu={\n item.children\n ? {\n position: \"right\",\n on: \"hover\",\n items: item.children.map((child) => ({\n label: child.label,\n href: child.href,\n icon: child.icon,\n children: child.children,\n })),\n }\n : undefined\n }\n {...props.item.actionProps}\n />\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type SidebarNode =\n | SidebarMenuItem\n | SidebarSpacer\n | SidebarDivider\n | SidebarSearch\n | SidebarElement\n | SidebarSection;\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}\n\nexport interface SidebarSearch extends SidebarAbstractItem {\n type: \"search\";\n}\n\nexport interface SidebarSection extends SidebarAbstractItem {\n type: \"section\";\n label: string;\n icon?: ReactNode;\n}\n\nexport interface SidebarMenuItem extends SidebarAbstractItem {\n label: string | ReactNode;\n description?: string;\n icon?: ReactNode;\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}\n\nexport interface SidebarButtonTheme {\n radius?: MantineBreakpoint;\n size?: MantineBreakpoint;\n}\n\nexport interface SidebarTheme {\n button?: SidebarButtonTheme;\n search?: SidebarButtonTheme;\n}\n","import { NestedView, useEvents, useStore } from \"@alepha/react\";\nimport {\n AppShell,\n type AppShellFooterProps,\n type AppShellHeaderProps,\n type AppShellMainProps,\n type AppShellNavbarProps,\n type AppShellProps,\n} from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport AppBar, { type AppBarProps } from \"./AppBar.tsx\";\nimport { Sidebar, type SidebarProps } from \"./Sidebar.tsx\";\n\nexport interface AdminShellProps {\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\ndeclare module \"@alepha/core\" {\n interface State {\n /**\n * Whether the sidebar is opened or closed.\n */\n \"alepha.ui.sidebar.opened\"?: boolean;\n\n /**\n * Whether the sidebar is collapsed (narrow) or expanded (wide).\n */\n \"alepha.ui.sidebar.collapsed\"?: boolean;\n }\n}\n\nconst AdminShell = (props: AdminShellProps) => {\n const [opened, setOpened] = useStore(\"alepha.ui.sidebar.opened\");\n const [collapsed] = useStore(\n \"alepha.ui.sidebar.collapsed\",\n props.sidebarProps?.collapsed,\n );\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n setOpened(false);\n },\n },\n [],\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 return (\n <AppShell\n padding=\"md\"\n header={{ height: 60 }}\n navbar={\n props.sidebarProps !== undefined\n ? {\n width: collapsed ? { base: 72 } : { base: 300 },\n breakpoint: \"sm\",\n collapsed: { mobile: !opened },\n }\n : undefined\n }\n footer={props.footer ? { height: 60 } : undefined}\n {...props.appShellProps}\n >\n <AppShell.Header bg={ui.colors.surface} {...props.appShellHeaderProps}>\n {props.header ?? (\n <AppBar items={defaultAppBarItems} {...props.appBarProps} />\n )}\n </AppShell.Header>\n\n {props.sidebarProps !== undefined && (\n <AppShell.Navbar bg={ui.colors.surface} {...props.appShellNavbarProps}>\n <Sidebar collapsed={collapsed} {...props.sidebarProps} />\n </AppShell.Navbar>\n )}\n\n <AppShell.Main {...props.appShellMainProps}>\n {props.children ?? <NestedView />}\n </AppShell.Main>\n\n {props.footer && (\n <AppShell.Footer bg={ui.colors.surface} {...props.appShellFooterProps}>\n {props.footer}\n </AppShell.Footer>\n )}\n </AppShell>\n );\n};\n\nexport default AdminShell;\n","import {\n Alepha,\n type Async,\n type Page,\n type PageMetadata,\n type Static,\n type TObject,\n t,\n} from \"@alepha/core\";\nimport { DateTimeProvider, type DurationLike } from \"@alepha/datetime\";\nimport { useInject } from \"@alepha/react\";\nimport { type FormModel, useForm } from \"@alepha/react-form\";\nimport {\n Flex,\n Pagination,\n Select,\n Table,\n type TableProps,\n type TableTrProps,\n} from \"@mantine/core\";\nimport { useDebouncedCallback } from \"@mantine/hooks\";\nimport { type ReactNode, useEffect, useState } from \"react\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport TypeForm, { type TypeFormProps } from \"../form/TypeForm.tsx\";\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\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\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 * Optional filters to apply to the data.\n */\n filters?: TObject;\n\n panel?: (item: T) => ReactNode;\n canPanel?: (item: T) => boolean;\n\n submitOnInit?: boolean;\n submitEvery?: DurationLike;\n\n withLineNumbers?: boolean;\n withCheckbox?: boolean;\n checkboxActions?: any[];\n\n actions?: any[];\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\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\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\"\n ? {\n content: [],\n }\n : props.items,\n );\n\n const defaultSize = props.infinityScroll ? 100 : props.defaultSize || 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\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, args) => {\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: items.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 }\n },\n onReset: async () => {\n setPage(1);\n setSize(\"10\");\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?.(key, value, form as any);\n },\n },\n [items],\n );\n\n const submitDebounce = useDebouncedCallback(() => form.submit(), {\n delay: 800,\n });\n\n const dt = useInject(DateTimeProvider);\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 detection\n useEffect(() => {\n if (!props.infinityScroll || typeof props.items !== \"function\") return;\n\n const handleScroll = () => {\n if (form.submitting) return;\n\n const scrollTop = window.scrollY;\n const windowHeight = window.innerHeight;\n const docHeight = document.documentElement.scrollHeight;\n\n const isNearBottom = scrollTop + windowHeight >= docHeight - 300;\n\n if (isNearBottom) {\n const totalPages = items.page?.totalPages ?? 1;\n\n if (currentPage + 1 < totalPages) {\n form.input.page.set(currentPage + 1);\n }\n }\n };\n\n window.addEventListener(\"scroll\", handleScroll);\n return () => window.removeEventListener(\"scroll\", handleScroll);\n }, [\n props.infinityScroll,\n form.submitting,\n items.page?.totalPages,\n currentPage,\n form,\n ]);\n\n const head = Object.entries(props.columns).map(([key, col]) => (\n <Table.Th\n key={key}\n style={{\n ...(col.fit\n ? {\n width: \"1%\",\n whiteSpace: \"nowrap\",\n }\n : {}),\n }}\n >\n <ActionButton justify={\"space-between\"} radius={0} fullWidth size={\"xs\"}>\n {col.label}\n </ActionButton>\n </Table.Th>\n ));\n\n const rows = items.content.map((item, index) => {\n const trProps = props.tableTrProps\n ? props.tableTrProps(item as T)\n : ({} as TableTrProps);\n return (\n <Table.Tr key={JSON.stringify(item)} {...trProps}>\n {Object.entries(props.columns).map(([key, col]) => (\n <Table.Td key={key}>\n {col.value(item as T, {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n })}\n </Table.Td>\n ))}\n </Table.Tr>\n );\n });\n\n const schema = t.omit(form.options.schema, [\"page\", \"size\", \"sort\"]);\n\n return (\n <Flex direction={\"column\"} gap={\"sm\"} flex={1}>\n {props.filters ? (\n <TypeForm\n {...props.typeFormProps}\n form={form as unknown as FormModel<Filters>}\n schema={schema}\n />\n ) : null}\n\n <Flex flex={1} className={\"overflow-auto\"}>\n <Table\n striped\n withRowBorders\n withColumnBorders\n withTableBorder\n stripedColor={\"\"}\n {...props.tableProps}\n >\n <Table.Thead>\n <Table.Tr>{head}</Table.Tr>\n </Table.Thead>\n <Table.Tbody>{rows}</Table.Tbody>\n </Table>\n </Flex>\n\n {!props.infinityScroll && (\n <Flex justify={\"space-between\"} align={\"center\"}>\n <Pagination\n withEdges\n total={items.page?.totalPages ?? 1}\n value={page}\n onChange={(value) => {\n form.input.page.set(value - 1);\n }}\n />\n <Flex>\n <Select\n value={size}\n onChange={(value) => {\n form.input.size.set(Number(value));\n }}\n data={[\n { value: \"5\", label: \"5\" },\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 )}\n </Flex>\n );\n};\n\nexport default DataTable;\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 * 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 */\nexport const useDialog = (): DialogService => {\n return useInject(DialogService);\n};\n","import { $module } from \"@alepha/core\";\nimport { AlephaReactForm } from \"@alepha/react-form\";\nimport { AlephaReactHead } from \"@alepha/react-head\";\nimport { AlephaReactI18n } from \"@alepha/react-i18n\";\nimport type { ReactNode } from \"react\";\nimport type { ControlProps } from \"./components/form/Control.tsx\";\nimport { RootRouter } from \"./RootRouter.ts\";\nimport { DialogService } from \"./services/DialogService.tsx\";\nimport { ToastService } from \"./services/ToastService.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport { Flex, Text } from \"@mantine/core\";\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 DarkModeButton } from \"./components/buttons/DarkModeButton.tsx\";\nexport { default as OmnibarButton } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as JsonViewer } from \"./components/data/JsonViewer.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 { default as Control } from \"./components/form/Control.tsx\";\nexport { default as ControlDate } from \"./components/form/ControlDate.tsx\";\nexport { default as ControlQueryBuilder } from \"./components/form/ControlQueryBuilder.tsx\";\nexport { default as ControlSelect } from \"./components/form/ControlSelect.tsx\";\nexport { default as TypeForm } from \"./components/form/TypeForm.tsx\";\nexport { default as AdminShell } from \"./components/layout/AdminShell.tsx\";\nexport { default as AlephaMantineProvider } from \"./components/layout/AlephaMantineProvider.tsx\";\nexport type {\n AppBarBurger,\n AppBarDark,\n AppBarDivider,\n AppBarElement,\n AppBarItem,\n AppBarLang,\n AppBarProps,\n AppBarSearch,\n AppBarSpacer,\n} from \"./components/layout/AppBar.tsx\";\nexport { default as AppBar } from \"./components/layout/AppBar.tsx\";\nexport { default as Omnibar } from \"./components/layout/Omnibar.tsx\";\nexport type {\n SidebarAbstractItem,\n SidebarButtonTheme,\n SidebarDivider,\n SidebarElement,\n SidebarItemProps,\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 type {\n DataTableColumn,\n DataTableProps,\n} from \"./components/table/DataTable.tsx\";\nexport { default as DataTable } from \"./components/table/DataTable.tsx\";\nexport * from \"./constants/ui.ts\";\nexport { useDialog } from \"./hooks/useDialog.ts\";\nexport { useToast } from \"./hooks/useToast.ts\";\nexport * from \"./RootRouter.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\";\nexport * from \"./utils/extractSchemaFields.ts\";\nexport * from \"./utils/icons.tsx\";\nexport * from \"./utils/string.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"typebox\" {\n interface TSchemaOptions {\n $control?: Omit<ControlProps, \"input\">;\n }\n}\n\ndeclare module \"@alepha/react\" {\n interface PageDescriptorOptions {\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;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Mantine\n *\n * @module alepha.ui\n */\nexport const AlephaUI = $module({\n name: \"alepha.ui\",\n services: [DialogService, ToastService, RootRouter],\n register: (alepha) => {\n alepha.with(AlephaReactI18n);\n alepha.with(AlephaReactHead);\n alepha.with(AlephaReactForm);\n alepha.with(DialogService);\n alepha.with(ToastService);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,IAAa,aAAb,MAAwB;CACtB,AAAgB,iCAAa;EAC3B,MAAM;EACN,iDAAY;EACb,CAAC;;;;;AC6BJ,MAAM,iBAAiB,OAAoB,SAAS;CAClD,MAAM,UAAU;EACd,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAG;EAChD,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GA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OAAO;KACP,WAAW,UAAU;AACnB,WAAK,MAAM,KAAK,IAAI,QAAQ,EAAE;;MAEhC,EACF,2CAACF,iCACC,2CAACG;KACC,OAAO;KACP,WAAW,UAAU;AACnB,WAAK,MAAM,KAAK,IAAI,OAAO,MAAM,CAAC;;KAEpC,MAAM;MACJ;OAAE,OAAO;OAAK,OAAO;OAAK;MAC1B;OAAE,OAAO;OAAM,OAAO;OAAM;MAC5B;OAAE,OAAO;OAAM,OAAO;OAAM;MAC5B;OAAE,OAAO;OAAM,OAAO;OAAM;MAC5B;OAAE,OAAO;OAAO,OAAO;OAAO;MAC/B;MACD,GACG;KACF;;GAEJ;;AAIX,wBAAe;;;;;;;;;;;;;ACvUf,MAAa,kBAAiC;AAC5C,sCAAiB,cAAc;;;;;;;;;;ACkHjC,MAAa,sCAAmB;CAC9B,MAAM;CACN,UAAU;EAAC;EAAeC;EAAc;EAAW;CACnD,WAAW,WAAW;AACpB,SAAO,KAAKC,oCAAgB;AAC5B,SAAO,KAAKC,oCAAgB;AAC5B,SAAO,KAAKC,oCAAgB;AAC5B,SAAO,KAAK,cAAc;AAC1B,SAAO,KAAKH,2CAAa;;CAE5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Text","Box","ActionIcon","IconChevronDown","IconChevronRight","Collapse","CopyButton","Tooltip","IconCheck","IconCopy","Text","Group","Button","Text","Group","Button","Text","TextInput","Group","Button","AlertDialog","ConfirmDialog","PromptDialog","modals","Flex","JsonViewer","Menu","IconChevronRight","menuItemProps: MenuItemProps & ButtonHTMLAttributes<unknown>","ThemeIcon","IconCheck","icon","Flex","Button","defaultTooltipProps: Partial<TooltipProps>","Tooltip","Burger","SegmentedControl","Flex","IconSun","IconMoon","ActionButton","ActionButton","spotlight","Kbd","Flex","IconSearch","Text","IconMail","IconLink","IconPhone","IconCalendar","IconClock","IconColorPicker","IconKey","IconPalette","IconFile","IconSelector","IconToggleLeft","IconHash","IconList","IconLetterCase","IconAt","TypeBoxError","inputProps: InputProps","DateTimePicker","DateInput","TimeInput","Input","Slider","NumberInput","fields: SchemaField[]","field: SchemaField","OPERATOR_INFO: Record<\n string,\n { symbol: string; label: string; example: string }\n>","value","Popover","TextInput","IconInfoTriangle","IconFilter","ActionIcon","IconX","Group","Stack","Text","ActionButton","Divider","Flex","Badge","itemsEnum: string[] | undefined","items: any","segmentedControlProps: Partial<SegmentedControlProps>","Input","Flex","SegmentedControl","Autocomplete","TagsInput","data","MultiSelect","Select","ControlQueryBuilder","Input","Flex","ControlNumber","FileInput","ColorInput","ControlSelect","Switch","PasswordInput","Textarea","ControlDate","TextInput","schema: any","schema","Grid","Control","Flex","ActionButton","ActionButton","IconLanguage","BurgerButton","DarkModeButton","OmnibarButton","LanguageButton","Flex","Divider","Flex","OmnibarButton","ThemeIcon","Text","item","ActionButton","IconChevronDown","IconChevronRight","IconSquareRounded","AppShell","AppBar","NestedView","alepha","Alepha","t","DateTimeProvider","Table","ActionButton","Flex","TypeForm","Pagination","Select","ToastService","AlephaReactI18n","AlephaReactHead","AlephaReactForm"],"sources":["../src/RootRouter.ts","../src/components/data/JsonViewer.tsx","../src/components/dialogs/AlertDialog.tsx","../src/components/dialogs/ConfirmDialog.tsx","../src/components/dialogs/PromptDialog.tsx","../src/constants/ui.ts","../src/services/DialogService.tsx","../src/components/buttons/ActionButton.tsx","../src/components/buttons/BurgerButton.tsx","../src/components/buttons/DarkModeButton.tsx","../src/components/buttons/OmnibarButton.tsx","../src/utils/icons.tsx","../src/utils/string.ts","../src/utils/parseInput.ts","../src/components/form/ControlDate.tsx","../src/components/form/ControlNumber.tsx","../src/utils/extractSchemaFields.ts","../src/components/form/ControlQueryBuilder.tsx","../src/components/form/ControlSelect.tsx","../src/components/form/Control.tsx","../src/components/form/TypeForm.tsx","../src/components/buttons/LanguageButton.tsx","../src/components/layout/AppBar.tsx","../src/components/layout/Sidebar.tsx","../src/components/layout/AdminShell.tsx","../src/components/table/DataTable.tsx","../src/hooks/useDialog.ts","../src/index.ts"],"sourcesContent":["import { $page } from \"@alepha/react\";\n\nexport class RootRouter {\n public readonly root = $page({\n path: \"/\",\n lazy: () => import(\"./components/layout/AlephaMantineProvider.tsx\"),\n });\n}\n","import {\n ActionIcon,\n Box,\n Collapse,\n CopyButton,\n type MantineSize,\n Text,\n Tooltip,\n} from \"@mantine/core\";\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronRight,\n IconCopy,\n} from \"@tabler/icons-react\";\nimport { type ReactNode, useState } from \"react\";\n\ninterface JsonViewerProps {\n data: any;\n defaultExpanded?: boolean;\n maxDepth?: number;\n copyable?: boolean;\n size?: MantineSize;\n}\n\ninterface JsonNodeProps {\n name?: string;\n value: any;\n depth: number;\n maxDepth: number;\n isLast?: boolean;\n isArrayItem?: boolean;\n size?: MantineSize;\n}\n\nconst getSizeConfig = (size: MantineSize = \"sm\") => {\n const configs = {\n xs: { text: \"xs\", icon: 12, indent: 16, gap: 2 },\n sm: { text: \"sm\", icon: 14, indent: 20, gap: 4 },\n md: { text: \"md\", icon: 16, indent: 24, gap: 6 },\n lg: { text: \"lg\", icon: 18, indent: 28, gap: 8 },\n xl: { text: \"xl\", icon: 20, indent: 32, gap: 10 },\n };\n return configs[size] || configs.sm;\n};\n\nconst JsonNode = ({\n name,\n value,\n depth,\n maxDepth,\n isLast = false,\n isArrayItem = false,\n size = \"sm\",\n}: JsonNodeProps) => {\n const [expanded, setExpanded] = useState(depth < 2);\n const sizeConfig = getSizeConfig(size);\n\n 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\n const valueType = getValueType(value);\n\n const renderPrimitive = (val: any): ReactNode => {\n const type = getValueType(val);\n\n switch (type) {\n case \"string\":\n return (\n <Text\n component=\"span\"\n c=\"teal\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n \"{val}\"\n </Text>\n );\n case \"number\":\n return (\n <Text\n component=\"span\"\n c=\"blue\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {val}\n </Text>\n );\n case \"boolean\":\n return (\n <Text\n component=\"span\"\n c=\"violet\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {String(val)}\n </Text>\n );\n case \"null\":\n return (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n null\n </Text>\n );\n case \"undefined\":\n return (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n undefined\n </Text>\n );\n default:\n return (\n <Text\n component=\"span\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ whiteSpace: \"nowrap\" }}\n >\n {String(val)}\n </Text>\n );\n }\n };\n\n const renderKey = () => {\n if (!name) return null;\n return (\n <Text\n component=\"span\"\n c=\"cyan\"\n ff=\"monospace\"\n fw={500}\n size={sizeConfig.text}\n >\n {isArrayItem ? `[${name}]` : `\"${name}\"`}:\n </Text>\n );\n };\n\n if (valueType === \"object\" || valueType === \"array\") {\n const isObject = valueType === \"object\";\n const entries = isObject\n ? Object.entries(value)\n : value.map((v: any, i: number) => [i, v]);\n const isEmpty = entries.length === 0;\n const canExpand = depth < maxDepth && !isEmpty;\n\n const preview = isObject ? \"{...}\" : \"[...]\";\n const brackets = isObject ? [\"{\", \"}\"] : [\"[\", \"]\"];\n\n return (\n <Box>\n <Box\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: sizeConfig.gap,\n minWidth: \"max-content\",\n }}\n >\n {canExpand && (\n <ActionIcon\n size=\"xs\"\n variant=\"transparent\"\n c=\"dimmed\"\n onClick={() => setExpanded(!expanded)}\n style={{ cursor: \"pointer\", flexShrink: 0 }}\n >\n {expanded ? (\n <IconChevronDown size={sizeConfig.icon} />\n ) : (\n <IconChevronRight size={sizeConfig.icon} />\n )}\n </ActionIcon>\n )}\n {!canExpand && (\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n )}\n <Box style={{ flexShrink: 0 }}>{renderKey()}</Box>{\" \"}\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[0]}\n </Text>\n {!expanded && !isEmpty && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n fs=\"italic\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {preview}\n </Text>\n )}\n {(isEmpty || !expanded) && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[1]}\n </Text>\n )}\n {!isEmpty && !expanded && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {entries.length} {entries.length === 1 ? \"item\" : \"items\"}\n </Text>\n )}\n </Box>\n\n <Collapse in={expanded && canExpand}>\n <Box\n pl={sizeConfig.indent}\n style={{\n borderLeft: \"1px solid var(--mantine-color-default-border)\",\n marginLeft: Math.floor((sizeConfig.icon + 6) / 2),\n }}\n >\n {entries.map(\n ([key, val]: [string | number, any], index: number) => (\n <JsonNode\n key={String(key)}\n name={String(key)}\n value={val}\n depth={depth + 1}\n maxDepth={maxDepth}\n isLast={index === entries.length - 1}\n isArrayItem={!isObject}\n size={size}\n />\n ),\n )}\n </Box>\n <Box style={{ display: \"flex\", minWidth: \"max-content\" }}>\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n <Text\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n {brackets[1]}\n </Text>\n </Box>\n </Collapse>\n </Box>\n );\n }\n\n return (\n <Box\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: sizeConfig.gap,\n minWidth: \"max-content\",\n }}\n >\n <Box w={sizeConfig.icon + 6} style={{ flexShrink: 0 }} />\n <Box style={{ flexShrink: 0 }}>{renderKey()}</Box>\n <Box style={{ flexShrink: 0 }}>{renderPrimitive(value)}</Box>\n {!isLast && (\n <Text\n component=\"span\"\n c=\"dimmed\"\n ff=\"monospace\"\n size={sizeConfig.text}\n style={{ flexShrink: 0 }}\n >\n ,\n </Text>\n )}\n </Box>\n );\n};\n\nexport const JsonViewer = ({\n data,\n defaultExpanded = true,\n maxDepth = 10,\n copyable = true,\n size = \"sm\",\n}: JsonViewerProps) => {\n const sizeConfig = getSizeConfig(size);\n const copyIconSize = sizeConfig.icon + 2;\n\n return (\n <Box pos=\"relative\" w={\"100%\"}>\n {copyable && (\n <Box pos=\"absolute\" top={0} right={0} style={{ zIndex: 1 }}>\n <CopyButton value={JSON.stringify(data, null, 2)}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? \"Copied\" : \"Copy JSON\"}>\n <ActionIcon\n color={copied ? \"teal\" : \"gray\"}\n variant=\"subtle\"\n onClick={copy}\n size={size}\n >\n {copied ? (\n <IconCheck size={copyIconSize} />\n ) : (\n <IconCopy size={copyIconSize} />\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Box>\n )}\n <Box pt={copyable ? 30 : 0} style={{ overflowX: \"auto\" }}>\n <JsonNode value={data} depth={0} maxDepth={maxDepth} size={size} />\n </Box>\n </Box>\n );\n};\n\nexport default JsonViewer;\n","import { Button, Group, Text } from \"@mantine/core\";\nimport type { AlertDialogProps } from \"../../services/DialogService\";\n\nconst AlertDialog = ({ options, onClose }: AlertDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Group justify=\"flex-end\">\n <Button onClick={onClose}>{options?.okLabel || \"OK\"}</Button>\n </Group>\n </>\n);\n\nexport default AlertDialog;\n","import { Button, Group, Text } from \"@mantine/core\";\nimport type { ConfirmDialogProps } from \"../../services/DialogService\";\n\nconst ConfirmDialog = ({ options, onConfirm }: ConfirmDialogProps) => (\n <>\n {options?.message && <Text mb=\"md\">{options.message}</Text>}\n <Group 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 </Group>\n </>\n);\n\nexport default ConfirmDialog;\n","import { Button, Group, Text, TextInput } from \"@mantine/core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { PromptDialogProps } from \"../../services/DialogService\";\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 <Group 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 </Group>\n </>\n );\n};\n\nexport default PromptDialog;\n","export const ui = {\n colors: {\n transparent: \"transparent\",\n background: \"var(--alepha-background)\",\n surface: \"var(--alepha-surface)\",\n elevated: \"var(--alepha-elevated)\",\n border: \"var(--alepha-border)\",\n },\n};\n","import { Flex, type ModalProps } from \"@mantine/core\";\nimport { modals } from \"@mantine/modals\";\nimport type { ReactNode } from \"react\";\nimport JsonViewer from \"../components/data/JsonViewer.tsx\";\nimport AlertDialog from \"../components/dialogs/AlertDialog\";\nimport ConfirmDialog from \"../components/dialogs/ConfirmDialog\";\nimport PromptDialog from \"../components/dialogs/PromptDialog\";\nimport { ui } from \"../constants/ui.ts\";\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 const modalId = this.open({\n ...options,\n title: options?.title || \"Alert\",\n content: (\n <AlertDialog\n options={options}\n onClose={() => {\n this.close(modalId);\n resolve();\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 const modalId = this.open({\n ...options,\n title: options?.title || \"Confirm\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n content: (\n <ConfirmDialog\n options={options}\n onConfirm={(confirmed) => {\n this.close(modalId);\n resolve(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 const modalId = this.open({\n ...options,\n title: options?.title || \"Input\",\n closeOnClickOutside: false,\n closeOnEscape: false,\n content: (\n <PromptDialog\n options={options}\n onSubmit={(value) => {\n this.close(modalId);\n resolve(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 /**\n * Show a JSON editor/viewer dialog\n */\n public json(data?: any, options?: BaseDialogOptions): void {\n this.open({\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 }\n\n /**\n * Show a form dialog for structured input\n */\n public form(options?: BaseDialogOptions): Promise<any> {\n // Implementation to be added\n return Promise.resolve(null);\n }\n\n /**\n * Show a loading/progress dialog with optional progress percentage\n */\n public loading(options?: BaseDialogOptions & { progress?: number }): void {\n // Implementation to be added\n }\n\n /**\n * Show an image viewer/gallery dialog\n */\n public image(src: string | string[], options?: BaseDialogOptions): void {\n // Implementation to be added\n }\n}\n","import {\n type RouterGoOptions,\n type UseActionReturn,\n type UseActiveOptions,\n useAction,\n useActive,\n useRouter,\n} from \"@alepha/react\";\nimport { type FormModel, useFormState } from \"@alepha/react/form\";\nimport {\n Button,\n type ButtonProps,\n Flex,\n Menu,\n type MenuItemProps,\n type MenuProps,\n type MenuTargetProps,\n ThemeIcon,\n type ThemeIconProps,\n Tooltip,\n type TooltipProps,\n} from \"@mantine/core\";\nimport { IconCheck, IconChevronRight } from \"@tabler/icons-react\";\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\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 menuProps?: MenuProps;\n}\n\nexport interface ActionCommonProps extends ButtonProps {\n children?: ReactNode;\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 | 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;\n\n /**\n * Additional props to pass to the ThemeIcon wrapping the icon.\n */\n themeIconProps?: ThemeIconProps;\n}\n\nexport type ActionProps = ActionCommonProps &\n (\n | ActionNavigationButtonProps\n | ActionClickButtonProps\n | ActionSubmitButtonProps\n | ActionHookButtonProps\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={item.icon}\n onClick={item.onClick}\n color={item.color}\n rightSection={\n item.active ? (\n <ThemeIcon size={\"xs\"} variant={\"transparent\"}>\n <IconCheck />\n </ThemeIcon>\n ) : undefined\n }\n {...menuItemProps}\n >\n {item.label}\n </Menu.Item>\n );\n};\n\nconst ActionButton = (_props: ActionProps) => {\n const props = { variant: \"subtle\", ..._props };\n const { tooltip, menu, icon, ...restProps } = props;\n\n if (props.icon) {\n const icon = (\n <ThemeIcon\n w={24} // TODO: make size configurable\n variant={\"transparent\"}\n size={\"sm\"}\n c={\"var(--mantine-color-text)\"}\n {...props.themeIconProps}\n >\n {props.icon}\n </ThemeIcon>\n );\n if (!props.children) {\n restProps.children = icon;\n restProps.p ??= \"xs\";\n } else {\n restProps.leftSection = icon;\n }\n }\n\n if (props.leftSection && !props.children) {\n restProps.className ??= \"mantine-Action-iconOnly\";\n restProps.p ??= \"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 px={\"xs\"} {...rest} tooltip={tooltip} menu={menu}>\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\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\"\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}\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 = (props: ActionClickButtonProps) => {\n const action = useAction(\n {\n handler: async (e: any) => {\n await props.onClick(e);\n },\n },\n [props.onClick],\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?: RouterGoOptions;\n classNameActive?: string;\n variantActive?: ButtonProps[\"variant\"];\n target?: string;\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 routerGoOptions,\n ...buttonProps\n } = props;\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 const className = buttonProps.className || \"\";\n if (isActive && options !== false && classNameActive) {\n buttonProps.className = `${className} ${classNameActive}`.trim();\n }\n\n return (\n <Button\n component={\"a\"}\n loading={isPending}\n {...buttonProps}\n {...anchorProps}\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 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","import { useStore } from \"@alepha/react\";\nimport { Burger, type BurgerProps } from \"@mantine/core\";\n\nexport interface BurgerButtonProps extends BurgerProps {}\n\nconst BurgerButton = (props: BurgerButtonProps) => {\n const [opened, setOpened] = useStore(\"alepha.ui.sidebar.opened\");\n\n return (\n <Burger\n opened={opened}\n onClick={() => setOpened(!opened)}\n hiddenFrom=\"sm\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport default BurgerButton;\n","import {\n Flex,\n type MantineBreakpoint,\n SegmentedControl,\n type SegmentedControlProps,\n useComputedColorScheme,\n useMantineColorScheme,\n} from \"@mantine/core\";\nimport { IconMoon, IconSun } from \"@tabler/icons-react\";\nimport { useEffect, useState } from \"react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface DarkModeButtonProps {\n mode?: \"minimal\" | \"segmented\";\n size?: MantineBreakpoint;\n variant?:\n | \"filled\"\n | \"light\"\n | \"outline\"\n | \"default\"\n | \"subtle\"\n | \"transparent\";\n\n fullWidth?: boolean;\n\n segmentedProps?: Partial<SegmentedControlProps>;\n actionProps?: Partial<ActionProps>;\n}\n\nconst DarkModeButton = (props: DarkModeButtonProps) => {\n const { setColorScheme } = useMantineColorScheme();\n const computedColorScheme = useComputedColorScheme(\"light\");\n const [colorScheme, setColorScheme2] = useState(\"default\");\n const mode = props.mode ?? \"minimal\";\n\n useEffect(() => {\n setColorScheme2(computedColorScheme);\n }, [computedColorScheme]);\n\n const toggleColorScheme = () => {\n setColorScheme(computedColorScheme === \"dark\" ? \"light\" : \"dark\");\n };\n\n if (mode === \"segmented\") {\n return (\n <SegmentedControl\n value={colorScheme}\n onChange={(value) => setColorScheme(value as \"light\" | \"dark\")}\n data={[\n {\n value: \"light\",\n label: (\n <Flex h={20} align=\"center\" justify=\"center\">\n <IconSun size={16} />\n </Flex>\n ),\n },\n {\n value: \"dark\",\n label: (\n <Flex h={20} align=\"center\" justify=\"center\">\n <IconMoon size={16} />\n </Flex>\n ),\n },\n ]}\n w={props.fullWidth ? \"100%\" : undefined}\n {...props.segmentedProps}\n />\n );\n }\n\n return (\n <ActionButton\n onClick={toggleColorScheme}\n variant={props.variant ?? \"outline\"}\n size={props.size ?? \"sm\"}\n aria-label=\"Toggle color scheme\"\n px={\"xs\"}\n fullWidth={props.fullWidth ?? false}\n icon={\n colorScheme === \"dark\" ? (\n <IconSun size={20} />\n ) : colorScheme === \"light\" ? (\n <IconMoon size={20} />\n ) : (\n <Flex h={20} w={20} />\n )\n }\n {...props.actionProps}\n />\n );\n};\n\nexport default DarkModeButton;\n","import { Flex, Kbd, Text } from \"@mantine/core\";\nimport { spotlight } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-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 return (\n <ActionButton\n variant={\"outline\"}\n miw={256}\n onClick={spotlight.open}\n justify={\"space-between\"}\n rightSection={<Kbd size={\"sm\"}>⌘+K</Kbd>}\n radius={\"md\"}\n {...props.actionProps}\n >\n <Flex align={\"center\"} gap={\"xs\"}>\n <IconSearch size={16} color={\"gray\"} />\n <Text size={\"xs\"} c={\"dimmed\"}>\n Search...\n </Text>\n </Flex>\n </ActionButton>\n );\n};\n\nexport default OmnibarButton;\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 { ReactNode } from \"react\";\n\n/**\n * Icon size presets following Mantine's size conventions\n */\nexport const ICON_SIZES = {\n xs: 12,\n sm: 16,\n md: 20,\n lg: 24,\n xl: 28,\n} as const;\n\nexport type IconSize = keyof typeof ICON_SIZES;\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}): ReactNode => {\n const { type, format, name, isEnum, isArray, size = \"sm\" } = params;\n const iconSize = ICON_SIZES[size];\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 a path or identifier string into a pretty display name.\n * Removes slashes and capitalizes the first letter.\n *\n * @example\n * prettyName(\"/userName\") // \"UserName\"\n * prettyName(\"email\") // \"Email\"\n */\nexport const prettyName = (name: string): string => {\n return capitalize(name.replaceAll(\"/\", \"\"));\n};\n","import type { InputField } from \"@alepha/react/form\";\nimport { type TObject, TypeBoxError } from \"alepha\";\nimport type { ReactNode } from \"react\";\nimport type { ControlProps } from \"../components/form/Control.tsx\";\nimport { getDefaultIcon } from \"./icons.tsx\";\nimport { prettyName } from \"./string.ts\";\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.title ??\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 =\n 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 });\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 inputProps: InputProps = {\n label,\n description,\n error,\n required,\n disabled,\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: InputField;\n title?: string;\n description?: string;\n icon?: ReactNode;\n}\n\nexport interface ControlInput {\n id?: string;\n icon: ReactNode;\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 { useFormState } from \"@alepha/react/form\";\nimport {\n DateInput,\n type DateInputProps,\n DateTimePicker,\n type DateTimePickerProps,\n TimeInput,\n type TimeInputProps,\n} from \"@mantine/dates\";\nimport {\n type GenericControlProps,\n parseInput,\n} 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 { 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 defaultValue={\n props.input.props.defaultValue\n ? new Date(props.input.props.defaultValue)\n : undefined\n }\n onChange={(value) => {\n props.input.set(value ? new Date(value).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 defaultValue={\n props.input.props.defaultValue\n ? new Date(props.input.props.defaultValue)\n : undefined\n }\n onChange={(value) => {\n props.input.set(\n value ? new Date(value).toISOString().slice(0, 10) : undefined,\n );\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 defaultValue={props.input.props.defaultValue}\n onChange={(event) => {\n props.input.set(event.currentTarget.value);\n }}\n {...timeInputProps}\n />\n );\n }\n //endregion\n\n // Fallback - shouldn't happen\n return null;\n};\n\nexport default ControlDate;\n","import { useEvents } from \"@alepha/react\";\nimport { useFormState } from \"@alepha/react/form\";\nimport {\n Input,\n NumberInput,\n type NumberInputProps,\n Slider,\n type SliderProps,\n} from \"@mantine/core\";\nimport { useRef, useState } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} 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 { inputProps, id, icon } = parseInput(props, form);\n const ref = useRef<HTMLInputElement | null>(null);\n\n // HTML Reset doesn't trigger on <NumberInput /> so we handle it manually\n\n const [value, setValue] = useState<number | undefined>(\n props.input.props.defaultValue,\n );\n\n useEvents(\n {\n \"form:reset\": (event) => {\n if (event.id === props.input?.form.id && ref.current) {\n setValue(props.input.props.defaultValue);\n }\n },\n },\n [props.input],\n );\n\n if (!props.input?.props) {\n return null;\n }\n\n const { type, ...inputPropsWithoutType } = props.input.props;\n\n if (props.sliderProps) {\n return (\n <Input.Wrapper {...inputProps}>\n <div\n style={{\n height: 32,\n padding: 8,\n }}\n >\n <Slider\n {...inputProps}\n ref={ref}\n id={id}\n {...inputPropsWithoutType}\n {...props.sliderProps}\n value={value}\n onChange={(val) => {\n setValue(val);\n props.input.set(val);\n }}\n />\n </div>\n </Input.Wrapper>\n );\n }\n\n return (\n <NumberInput\n {...inputProps}\n ref={ref}\n id={id}\n leftSection={icon}\n {...inputPropsWithoutType}\n {...props.numberInputProps}\n value={value ?? \"\"}\n onChange={(val) => {\n const newValue = val !== null ? Number(val) : undefined;\n setValue(newValue);\n props.input.set(newValue);\n }}\n />\n );\n};\n\nexport default ControlNumber;\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, like, and null checks\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 like: { symbol: \"~\", label: \"like (case-sensitive)\", example: \"name~John\" },\n ilike: {\n symbol: \"~*\",\n label: \"like (case-insensitive)\",\n example: \"name~*john\",\n },\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 { useEvents } from \"@alepha/react\";\nimport {\n ActionIcon,\n Badge,\n Divider,\n Flex,\n Group,\n Popover,\n Stack,\n Text,\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 { useRef, useState } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport {\n extractSchemaFields,\n OPERATOR_INFO,\n type SchemaField,\n} from \"../../utils/extractSchemaFields.ts\";\nimport ActionButton from \"../buttons/ActionButton.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 = ({\n schema,\n value = \"\",\n onChange,\n placeholder = \"Enter query or click for assistance...\",\n ...textInputProps\n}: ControlQueryBuilderProps) => {\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 <QueryHelp fields={fields} onInsert={handleInsert} />\n </Popover.Dropdown>\n </Popover>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n// Query Help Component\n// ---------------------------------------------------------------------------------------------------------------------\n\ninterface QueryHelpProps {\n fields: SchemaField[];\n onInsert: (text: string) => void;\n}\n\nfunction QueryHelp({ fields, onInsert }: QueryHelpProps) {\n return (\n <Group\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 <Stack gap=\"md\" style={{ flex: 1 }}>\n {/* Available Operators */}\n <Stack gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Operators\n </Text>\n <Stack gap={4}>\n {Object.entries(OPERATOR_INFO).map(([key, info]) => (\n <Group 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 </Group>\n ))}\n </Stack>\n </Stack>\n\n <Divider />\n\n {/* Logic Operators */}\n <Stack gap=\"xs\">\n <Text size=\"sm\" fw={600}>\n Logic\n </Text>\n <Stack gap={4}>\n <Group 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 </Group>\n <Group 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 </Group>\n </Stack>\n </Stack>\n </Stack>\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 <Group 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 </Group>\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 </Group>\n );\n}\n\nexport default ControlQueryBuilder;\n","import { useFormState } from \"@alepha/react/form\";\nimport {\n Autocomplete,\n type AutocompleteProps,\n Flex,\n Input,\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 { useEffect, useState } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} from \"../../utils/parseInput.ts\";\n\nexport type SelectValueLabel =\n | string\n | { value: string; label: string; icon?: string };\n\nexport interface ControlSelectProps extends GenericControlProps {\n select?: boolean | SelectProps;\n multi?: boolean | MultiSelectProps;\n tags?: boolean | TagsInputProps;\n autocomplete?: boolean | AutocompleteProps;\n segmented?: boolean | Partial<SegmentedControlProps>;\n\n loader?: () => Promise<SelectValueLabel[]>;\n}\n\n/**\n * ControlSelect component for handling Select, MultiSelect, and TagsInput.\n *\n * Features:\n * - Basic Select with enum support\n * - MultiSelect for array of enums\n * - TagsInput for array of strings (no enum)\n * - Future: Lazy loading\n * - Future: Searchable/filterable options\n * - Future: Custom option rendering\n *\n * Automatically detects enum values and array types from schema.\n */\nconst ControlSelect = (props: ControlSelectProps) => {\n const form = useFormState(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 // For arrays, check if items have enum (MultiSelect) or not (TagsInput)\n let itemsEnum: string[] | undefined;\n if (isArray && \"items\" in props.input.schema && props.input.schema.items) {\n const items: any = props.input.schema.items;\n if (\"enum\" in items && Array.isArray(items.enum)) {\n itemsEnum = items.enum;\n }\n }\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 const [data, setData] = useState<SelectValueLabel[]>([]);\n\n useEffect(() => {\n if (!props.input?.props) {\n return;\n }\n\n if (props.loader) {\n props.loader().then(setData);\n } else {\n setData(enumValues);\n }\n }, [props.input, props.loader]);\n\n if (!props.input?.props) {\n return null;\n }\n\n if (props.segmented) {\n const segmentedControlProps: Partial<SegmentedControlProps> =\n typeof props.segmented === \"object\" ? props.segmented : {};\n\n return (\n <Input.Wrapper {...inputProps}>\n <Flex>\n <SegmentedControl\n disabled={inputProps.disabled}\n defaultValue={String(props.input.props.defaultValue)}\n {...segmentedControlProps}\n onChange={(value) => {\n props.input.set(value);\n }}\n data={data.slice(0, 10)}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n\n if (props.autocomplete) {\n const autocompleteProps =\n typeof props.autocomplete === \"object\" ? props.autocomplete : {};\n\n return (\n <Autocomplete\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n {...props.input.props}\n {...autocompleteProps}\n />\n );\n }\n\n // region <TagsInput/> - for array of strings without enum\n if ((isArray && !itemsEnum) || props.tags) {\n const tagsInputProps = typeof props.tags === \"object\" ? props.tags : {};\n return (\n <TagsInput\n {...inputProps}\n id={id}\n leftSection={icon}\n defaultValue={\n Array.isArray(props.input.props.defaultValue)\n ? props.input.props.defaultValue\n : []\n }\n onChange={(value) => {\n props.input.set(value);\n }}\n {...tagsInputProps}\n />\n );\n }\n // endregion\n\n // region <MultiSelect/> - for array of enums\n if ((isArray && itemsEnum) || props.multi) {\n const data =\n itemsEnum?.map((value: string) => ({\n value,\n label: value,\n })) || [];\n\n const multiSelectProps = typeof props.multi === \"object\" ? props.multi : {};\n\n return (\n <MultiSelect\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n defaultValue={\n Array.isArray(props.input.props.defaultValue)\n ? props.input.props.defaultValue\n : []\n }\n onChange={(value) => {\n props.input.set(value);\n }}\n {...multiSelectProps}\n />\n );\n }\n // endregion\n\n // region <Select/> - for single enum value\n const selectProps = typeof props.select === \"object\" ? props.select : {};\n\n return (\n <Select\n {...inputProps}\n id={id}\n leftSection={icon}\n data={data}\n {...props.input.props}\n {...selectProps}\n />\n );\n // endregion\n};\n\nexport default ControlSelect;\n","import { useFormState } from \"@alepha/react/form\";\nimport {\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 type { ComponentType } from \"react\";\nimport {\n type GenericControlProps,\n parseInput,\n} from \"../../utils/parseInput.ts\";\nimport ControlDate from \"./ControlDate.tsx\";\nimport ControlNumber, { type ControlNumberProps } from \"./ControlNumber.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 custom?: ComponentType<CustomControlProps>;\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 * - 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 { inputProps, id, icon, format, schema } = parseInput(_props, form);\n if (!_props.input?.props) {\n return null;\n }\n\n const props = {\n ..._props,\n ...schema.$control,\n };\n\n //region <QueryBuilder/>\n if (props.query) {\n return (\n <ControlQueryBuilder\n {...props.input.props}\n {...inputProps}\n schema={props.query}\n value={props.input.props.value}\n onChange={(value) => {\n props.input.set(value);\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 defaultValue={props.input.props.defaultValue}\n onChange={(value) => {\n props.input.set(value);\n }}\n />\n </Flex>\n </Input.Wrapper>\n );\n }\n //endregion\n\n //region <NumberInput/>\n if (\n props.number ||\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 return (\n <ControlNumber\n input={props.input}\n title={props.title}\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 id={id}\n leftSection={icon}\n onChange={(file) => {\n props.input.set(file);\n }}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 const isEnum =\n props.input.schema &&\n \"enum\" in props.input.schema &&\n props.input.schema.enum;\n const isArray =\n props.input.schema &&\n \"type\" in props.input.schema &&\n props.input.schema.type === \"array\";\n\n if (isEnum || isArray || props.select) {\n const opts = typeof props.select === \"object\" ? props.select : {};\n return (\n <ControlSelect\n input={props.input}\n title={props.title}\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 props.switch\n ) {\n const switchProps = typeof props.switch === \"object\" ? props.switch : {};\n\n return (\n <Switch\n {...inputProps}\n id={id}\n color={\"blue\"}\n defaultChecked={props.input.props.defaultValue}\n {...props.input.props}\n {...switchProps}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 id={id}\n leftSection={icon}\n {...props.input.props}\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 input={props.input}\n title={props.title}\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 undefined;\n }\n };\n\n return (\n <TextInput\n {...inputProps}\n id={id}\n leftSection={icon}\n type={getInputType()}\n {...props.input.props}\n {...textInputProps}\n />\n );\n //endregion\n};\n\nexport default Control;\n\nexport type CustomControlProps = {\n defaultValue: any;\n onChange: (value: any) => void;\n};\n","import type { FormModel } from \"@alepha/react/form\";\nimport { Flex, Grid } from \"@mantine/core\";\nimport type { TObject } from \"alepha\";\nimport type { ReactNode } from \"react\";\nimport ActionButton, {\n type ActionSubmitButtonProps,\n} from \"../buttons/ActionButton.tsx\";\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 controlProps?: Partial<Omit<ControlProps, \"input\">>;\n skipFormElement?: boolean;\n skipSubmitButton?: boolean;\n submitButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\n resetButtonProps?: Partial<Omit<ActionSubmitButtonProps, \"form\">>;\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 * @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 * }),\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 skipFormElement = false,\n skipSubmitButton = false,\n submitButtonProps,\n } = props;\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 out unsupported field types (objects only, arrays are now supported)\n const supportedFields = fieldNames.filter((fieldName) => {\n const field = form.input[fieldName as keyof typeof form.input];\n if (!field || typeof field !== \"object\" || !(\"schema\" in field)) {\n return false;\n }\n\n const schema: any = field.schema;\n\n // Skip if it's an object (not supported by Control)\n // Arrays are now supported via ControlSelect (MultiSelect/TagsInput)\n if (\"type\" in schema) {\n if (schema.type === \"object\") {\n return false;\n }\n }\n\n // Check if it has properties (nested object)\n if (\"properties\" in schema && schema.properties) {\n return false;\n }\n\n return true;\n });\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\n // Type guard to ensure field has the expected structure\n if (!field || typeof field !== \"object\" || !(\"schema\" in field)) {\n return null;\n }\n\n return (\n <Grid.Col key={fieldName} span={colSpan}>\n <Control input={field as any} {...controlProps} />\n </Grid.Col>\n );\n })}\n </Grid>\n );\n };\n\n const content = (\n <Flex direction={\"column\"} gap={\"sm\"}>\n {renderFields()}\n {!skipSubmitButton && (\n <Flex gap={\"sm\"}>\n <ActionButton form={form} {...submitButtonProps}>\n {submitButtonProps?.children ?? \"Submit\"}\n </ActionButton>\n <ActionButton type={\"reset\"}>Reset</ActionButton>\n </Flex>\n )}\n </Flex>\n );\n\n if (skipFormElement) {\n return content;\n }\n\n return <form {...form.props}>{content}</form>;\n};\n\nexport default TypeForm;\n","import { useI18n } from \"@alepha/react/i18n\";\nimport { IconLanguage } from \"@tabler/icons-react\";\nimport ActionButton, { type ActionProps } from \"./ActionButton.tsx\";\n\nexport interface LanguageButtonProps {\n languages?: string[];\n actionProps?: ActionProps;\n}\n\nconst LanguageButton = (props: LanguageButtonProps) => {\n const i18n = useI18n();\n return (\n <ActionButton\n icon={<IconLanguage />}\n variant={\"outline\"}\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.actionProps}\n />\n );\n};\n\nexport default LanguageButton;\n","import { Divider, Flex, type FlexProps } from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport BurgerButton from \"../buttons/BurgerButton.tsx\";\nimport DarkModeButton, {\n type DarkModeButtonProps,\n} from \"../buttons/DarkModeButton.tsx\";\nimport LanguageButton, {\n type LanguageButtonProps,\n} from \"../buttons/LanguageButton.tsx\";\nimport OmnibarButton, {\n type OmnibarButtonProps,\n} from \"../buttons/OmnibarButton.tsx\";\n\nexport type AppBarItem =\n | AppBarElement\n | AppBarBurger\n | AppBarDark\n | AppBarSearch\n | AppBarLang\n | AppBarSpacer\n | AppBarDivider;\n\nexport interface AppBarElement {\n position: \"left\" | \"center\" | \"right\";\n element: ReactNode;\n}\n\nexport interface AppBarBurger {\n position: \"left\" | \"center\" | \"right\";\n type: \"burger\";\n}\n\nexport interface AppBarDark {\n position: \"left\" | \"center\" | \"right\";\n type: \"dark\";\n props?: DarkModeButtonProps;\n}\n\nexport interface AppBarSearch {\n position: \"left\" | \"center\" | \"right\";\n type: \"search\";\n props?: OmnibarButtonProps;\n}\n\nexport interface AppBarLang {\n position: \"left\" | \"center\" | \"right\";\n type: \"lang\";\n props?: LanguageButtonProps;\n}\n\nexport interface AppBarSpacer {\n position: \"left\" | \"center\" | \"right\";\n type: \"spacer\";\n}\n\nexport interface AppBarDivider {\n position: \"left\" | \"center\" | \"right\";\n type: \"divider\";\n}\n\nexport interface AppBarProps {\n flexProps?: FlexProps;\n items?: AppBarItem[];\n}\n\nconst AppBar = (props: AppBarProps) => {\n const { items = [] } = props;\n\n const renderItem = (item: AppBarItem, index: number) => {\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 === \"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 }\n if (\"element\" in item) {\n return item.element;\n }\n return null;\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 return (\n <Flex\n h=\"100%\"\n align=\"center\"\n px=\"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} gap=\"md\" 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\nexport default AppBar;\n","import { useEvents, useRouter } from \"@alepha/react\";\nimport {\n Flex,\n type FlexProps,\n type MantineBreakpoint,\n Text,\n ThemeIcon,\n} from \"@mantine/core\";\nimport {\n IconChevronDown,\n IconChevronRight,\n IconSquareRounded,\n} from \"@tabler/icons-react\";\nimport { type ReactNode, useCallback, useState } from \"react\";\nimport ActionButton, { type ActionProps } from \"../buttons/ActionButton.tsx\";\nimport OmnibarButton from \"../buttons/OmnibarButton.tsx\";\n\nexport interface SidebarProps {\n menu?: SidebarNode[];\n top?: SidebarNode[];\n bottom?: SidebarNode[];\n onItemClick?: (item: SidebarMenuItem) => void;\n onSearchClick?: () => void;\n theme?: SidebarTheme;\n flexProps?: Partial<FlexProps>;\n collapsed?: boolean;\n gap?: MantineBreakpoint;\n}\n\nexport const Sidebar = (props: SidebarProps) => {\n const router = useRouter();\n const { top = [], bottom = [], onItemClick } = props;\n\n const renderNode = (item: SidebarNode, key: number) => {\n if (\"type\" in item) {\n if (item.type === \"spacer\") {\n return <Flex key={key} h={16} />;\n }\n\n if (item.type === \"divider\") {\n return (\n <Flex\n key={key}\n h={1}\n bg={\"var(--alepha-border)\"}\n my={\"md\"}\n mx={\"sm\"}\n />\n );\n }\n\n if (item.type === \"search\") {\n return <OmnibarButton collapsed={props.collapsed} key={key} />;\n }\n\n if (item.type === \"section\") {\n if (props.collapsed) return;\n return (\n <Flex mt={\"md\"} mb={\"xs\"} align={\"center\"} gap={\"xs\"}>\n <ThemeIcon c={\"dimmed\"} size={\"xs\"} variant={\"transparent\"}>\n {item.icon}\n </ThemeIcon>\n <Text\n key={key}\n size={\"xs\"}\n c={\"dimmed\"}\n tt={\"uppercase\"}\n fw={\"bold\"}\n >\n {item.label}\n </Text>\n </Flex>\n );\n }\n }\n\n if (\"element\" in item) {\n return <Flex key={key}>{item.element}</Flex>;\n }\n\n if (props.collapsed) {\n return (\n <SidebarCollapsedItem\n key={key}\n item={item}\n level={0}\n onItemClick={onItemClick}\n theme={props.theme ?? {}}\n />\n );\n }\n\n return (\n <SidebarItem\n key={key}\n item={item}\n level={0}\n onItemClick={onItemClick}\n theme={props.theme ?? {}}\n />\n );\n };\n\n const padding = \"md\";\n const gap = props.gap;\n const menu =\n props.menu ??\n (router.concretePages.map((page) => ({\n label: page.label ?? page.name,\n description: page.description,\n icon: page.icon,\n href: page.path,\n })) as SidebarMenuItem[]);\n\n return (\n <Flex\n flex={1}\n py={padding}\n direction={\"column\"}\n className={\"overflow-auto\"}\n {...props.flexProps}\n >\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {top.map((item, index) => renderNode(item, index))}\n {menu\n .filter((it) => it.position === \"top\")\n .map((item, index) => renderNode(item, index + top.length))}\n </Flex>\n <Flex\n gap={gap}\n px={padding}\n direction={\"column\"}\n flex={1}\n className={\"overflow-auto\"}\n >\n {menu\n .filter((it) => !it.position)\n .map((item, index) => renderNode(item, index))}\n </Flex>\n <Flex gap={gap} px={padding} direction={\"column\"}>\n {bottom.map((item, index) => renderNode(item, index))}\n {menu\n .filter((it) => it.position === \"bottom\")\n .map((item, index) => renderNode(item, index + bottom.length))}\n </Flex>\n </Flex>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\nexport const SidebarItem = (props: SidebarItemProps) => {\n const { item, level } = props;\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(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(item)) {\n setIsOpen(true);\n }\n },\n },\n [],\n );\n\n if (level > maxLevel) return null;\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (item.children && item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(item);\n item.onClick?.();\n }\n };\n\n return (\n <Flex direction={\"column\"} ps={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 variant={\"subtle\"}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (level === 0 ? \"sm\" : \"xs\")\n }\n variantActive={\"default\"}\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 {item.icon && (\n <ThemeIcon\n size={level === 0 ? \"sm\" : \"xs\"}\n variant={\"transparent\"}\n >\n {item.icon}\n </ThemeIcon>\n )}\n <Flex direction={\"column\"}>\n <Flex>{item.label}</Flex>\n {item.description && (\n <Text size={\"xs\"} c={\"dimmed\"}>\n {item.description}\n </Text>\n )}\n </Flex>\n </Flex>\n }\n rightSection={\n 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 {item.children && isOpen && (\n <Flex direction={\"column\"} data-parent-level={level}>\n <Flex\n style={{\n position: \"absolute\",\n width: 1,\n background:\n \"linear-gradient(to bottom, transparent, var(--alepha-border), transparent)\",\n top: 48,\n left: 20 + 32 * level,\n bottom: 16,\n }}\n />\n {item.children.map((child, index) => (\n <SidebarItem\n key={index}\n item={child}\n level={level + 1}\n onItemClick={props.onItemClick}\n theme={props.theme}\n />\n ))}\n </Flex>\n )}\n </Flex>\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface SidebarItemProps {\n item: SidebarMenuItem;\n level: number;\n onItemClick?: (item: SidebarMenuItem) => void;\n theme: SidebarTheme;\n}\n\nconst SidebarCollapsedItem = (props: SidebarItemProps) => {\n const { item, level } = props;\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(item));\n\n const handleItemClick = (e: MouseEvent) => {\n if (!props.item.target) {\n e.preventDefault();\n }\n if (item.children && item.children.length > 0) {\n setIsOpen(!isOpen);\n } else {\n props.onItemClick?.(item);\n item.onClick?.();\n }\n };\n\n return (\n <ActionButton\n variant={\"subtle\"}\n size={\n props.item.theme?.size ??\n props.theme.button?.size ??\n (level === 0 ? \"sm\" : \"xs\")\n }\n variantActive={\"default\"}\n radius={props.item.theme?.radius ?? props.theme.button?.radius ?? \"md\"}\n onClick={handleItemClick}\n icon={item.icon ?? <IconSquareRounded />}\n href={props.item.href}\n target={props.item.target}\n menu={\n item.children\n ? {\n position: \"right\",\n on: \"hover\",\n items: item.children.map((child) => ({\n label: child.label,\n href: child.href,\n icon: child.icon,\n children: child.children,\n })),\n }\n : undefined\n }\n {...props.item.actionProps}\n />\n );\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type SidebarNode =\n | SidebarMenuItem\n | SidebarSpacer\n | SidebarDivider\n | SidebarSearch\n | SidebarElement\n | SidebarSection;\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}\n\nexport interface SidebarSearch extends SidebarAbstractItem {\n type: \"search\";\n}\n\nexport interface SidebarSection extends SidebarAbstractItem {\n type: \"section\";\n label: string;\n icon?: ReactNode;\n}\n\nexport interface SidebarMenuItem extends SidebarAbstractItem {\n label: string | ReactNode;\n description?: string;\n icon?: ReactNode;\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}\n\nexport interface SidebarButtonTheme {\n radius?: MantineBreakpoint;\n size?: MantineBreakpoint;\n}\n\nexport interface SidebarTheme {\n button?: SidebarButtonTheme;\n search?: SidebarButtonTheme;\n}\n","import { NestedView, useEvents, useStore } from \"@alepha/react\";\nimport {\n AppShell,\n type AppShellFooterProps,\n type AppShellHeaderProps,\n type AppShellMainProps,\n type AppShellNavbarProps,\n type AppShellProps,\n} from \"@mantine/core\";\nimport type { ReactNode } from \"react\";\nimport { ui } from \"../../constants/ui.ts\";\nimport AppBar, { type AppBarProps } from \"./AppBar.tsx\";\nimport { Sidebar, type SidebarProps } from \"./Sidebar.tsx\";\n\nexport interface AdminShellProps {\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\ndeclare module \"alepha\" {\n interface State {\n /**\n * Whether the sidebar is opened or closed.\n */\n \"alepha.ui.sidebar.opened\"?: boolean;\n\n /**\n * Whether the sidebar is collapsed (narrow) or expanded (wide).\n */\n \"alepha.ui.sidebar.collapsed\"?: boolean;\n }\n}\n\nconst AdminShell = (props: AdminShellProps) => {\n const [opened, setOpened] = useStore(\"alepha.ui.sidebar.opened\");\n const [collapsed] = useStore(\n \"alepha.ui.sidebar.collapsed\",\n props.sidebarProps?.collapsed,\n );\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n setOpened(false);\n },\n },\n [],\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 return (\n <AppShell\n padding=\"md\"\n header={{ height: 60 }}\n navbar={\n props.sidebarProps !== undefined\n ? {\n width: collapsed ? { base: 72 } : { base: 300 },\n breakpoint: \"sm\",\n collapsed: { mobile: !opened },\n }\n : undefined\n }\n footer={props.footer ? { height: 60 } : undefined}\n {...props.appShellProps}\n >\n <AppShell.Header bg={ui.colors.surface} {...props.appShellHeaderProps}>\n {props.header ?? (\n <AppBar items={defaultAppBarItems} {...props.appBarProps} />\n )}\n </AppShell.Header>\n\n {props.sidebarProps !== undefined && (\n <AppShell.Navbar bg={ui.colors.surface} {...props.appShellNavbarProps}>\n <Sidebar collapsed={collapsed} {...props.sidebarProps} />\n </AppShell.Navbar>\n )}\n\n <AppShell.Main {...props.appShellMainProps}>\n {props.children ?? <NestedView />}\n </AppShell.Main>\n\n {props.footer && (\n <AppShell.Footer bg={ui.colors.surface} {...props.appShellFooterProps}>\n {props.footer}\n </AppShell.Footer>\n )}\n </AppShell>\n );\n};\n\nexport default AdminShell;\n","import { useInject } from \"@alepha/react\";\nimport { type FormModel, useForm } from \"@alepha/react/form\";\nimport {\n Flex,\n Pagination,\n Select,\n Table,\n type TableProps,\n type TableTrProps,\n} from \"@mantine/core\";\nimport { useDebouncedCallback } from \"@mantine/hooks\";\nimport {\n Alepha,\n type Async,\n type Page,\n type PageMetadata,\n type Static,\n type TObject,\n t,\n} from \"alepha\";\nimport { DateTimeProvider, type DurationLike } from \"alepha/datetime\";\nimport { type ReactNode, useEffect, useState } from \"react\";\nimport ActionButton from \"../buttons/ActionButton.tsx\";\nimport TypeForm, { type TypeFormProps } from \"../form/TypeForm.tsx\";\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\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\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 * Optional filters to apply to the data.\n */\n filters?: TObject;\n\n panel?: (item: T) => ReactNode;\n canPanel?: (item: T) => boolean;\n\n submitOnInit?: boolean;\n submitEvery?: DurationLike;\n\n withLineNumbers?: boolean;\n withCheckbox?: boolean;\n checkboxActions?: any[];\n\n actions?: any[];\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\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\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\"\n ? {\n content: [],\n }\n : props.items,\n );\n\n const defaultSize = props.infinityScroll ? 100 : props.defaultSize || 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\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, args) => {\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: items.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 }\n },\n onReset: async () => {\n setPage(1);\n setSize(\"10\");\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?.(key, value, form as any);\n },\n },\n [items],\n );\n\n const submitDebounce = useDebouncedCallback(() => form.submit(), {\n delay: 800,\n });\n\n const dt = useInject(DateTimeProvider);\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 detection\n useEffect(() => {\n if (!props.infinityScroll || typeof props.items !== \"function\") return;\n\n const handleScroll = () => {\n if (form.submitting) return;\n\n const scrollTop = window.scrollY;\n const windowHeight = window.innerHeight;\n const docHeight = document.documentElement.scrollHeight;\n\n const isNearBottom = scrollTop + windowHeight >= docHeight - 300;\n\n if (isNearBottom) {\n const totalPages = items.page?.totalPages ?? 1;\n\n if (currentPage + 1 < totalPages) {\n form.input.page.set(currentPage + 1);\n }\n }\n };\n\n window.addEventListener(\"scroll\", handleScroll);\n return () => window.removeEventListener(\"scroll\", handleScroll);\n }, [\n props.infinityScroll,\n form.submitting,\n items.page?.totalPages,\n currentPage,\n form,\n ]);\n\n const head = Object.entries(props.columns).map(([key, col]) => (\n <Table.Th\n key={key}\n style={{\n ...(col.fit\n ? {\n width: \"1%\",\n whiteSpace: \"nowrap\",\n }\n : {}),\n }}\n >\n <ActionButton justify={\"space-between\"} radius={0} fullWidth size={\"xs\"}>\n {col.label}\n </ActionButton>\n </Table.Th>\n ));\n\n const rows = items.content.map((item, index) => {\n const trProps = props.tableTrProps\n ? props.tableTrProps(item as T)\n : ({} as TableTrProps);\n return (\n <Table.Tr key={JSON.stringify(item)} {...trProps}>\n {Object.entries(props.columns).map(([key, col]) => (\n <Table.Td key={key}>\n {col.value(item as T, {\n index,\n form: form as unknown as FormModel<Filters>,\n alepha,\n })}\n </Table.Td>\n ))}\n </Table.Tr>\n );\n });\n\n const schema = t.omit(form.options.schema, [\"page\", \"size\", \"sort\"]);\n\n return (\n <Flex direction={\"column\"} gap={\"sm\"} flex={1}>\n {props.filters ? (\n <TypeForm\n {...props.typeFormProps}\n form={form as unknown as FormModel<Filters>}\n schema={schema}\n />\n ) : null}\n\n <Flex flex={1} className={\"overflow-auto\"}>\n <Table\n striped\n withRowBorders\n withColumnBorders\n withTableBorder\n stripedColor={\"\"}\n {...props.tableProps}\n >\n <Table.Thead>\n <Table.Tr>{head}</Table.Tr>\n </Table.Thead>\n <Table.Tbody>{rows}</Table.Tbody>\n </Table>\n </Flex>\n\n {!props.infinityScroll && (\n <Flex justify={\"space-between\"} align={\"center\"}>\n <Pagination\n withEdges\n total={items.page?.totalPages ?? 1}\n value={page}\n onChange={(value) => {\n form.input.page.set(value - 1);\n }}\n />\n <Flex>\n <Select\n value={size}\n onChange={(value) => {\n form.input.size.set(Number(value));\n }}\n data={[\n { value: \"5\", label: \"5\" },\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 )}\n </Flex>\n );\n};\n\nexport default DataTable;\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 { AlephaReactForm } from \"@alepha/react/form\";\nimport { AlephaReactHead } from \"@alepha/react/head\";\nimport { AlephaReactI18n } from \"@alepha/react/i18n\";\nimport { $module } from \"alepha\";\nimport type { ReactNode } from \"react\";\nimport type { ControlProps } from \"./components/form/Control.tsx\";\nimport { RootRouter } from \"./RootRouter.ts\";\nimport { DialogService } from \"./services/DialogService.tsx\";\nimport { ToastService } from \"./services/ToastService.tsx\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport { Flex, Text } from \"@mantine/core\";\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 { default as DarkModeButton } from \"./components/buttons/DarkModeButton.tsx\";\nexport { default as OmnibarButton } from \"./components/buttons/OmnibarButton.tsx\";\nexport { default as JsonViewer } from \"./components/data/JsonViewer.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 { default as Control } from \"./components/form/Control.tsx\";\nexport { default as ControlDate } from \"./components/form/ControlDate.tsx\";\nexport { default as ControlQueryBuilder } from \"./components/form/ControlQueryBuilder.tsx\";\nexport { default as ControlSelect } from \"./components/form/ControlSelect.tsx\";\nexport { default as TypeForm } from \"./components/form/TypeForm.tsx\";\nexport {\n type AdminShellProps,\n default as AdminShell,\n} from \"./components/layout/AdminShell.tsx\";\nexport { default as AlephaMantineProvider } from \"./components/layout/AlephaMantineProvider.tsx\";\nexport type {\n AppBarBurger,\n AppBarDark,\n AppBarDivider,\n AppBarElement,\n AppBarItem,\n AppBarLang,\n AppBarProps,\n AppBarSearch,\n AppBarSpacer,\n} from \"./components/layout/AppBar.tsx\";\nexport { default as AppBar } from \"./components/layout/AppBar.tsx\";\nexport { default as Omnibar } from \"./components/layout/Omnibar.tsx\";\nexport type {\n SidebarAbstractItem,\n SidebarButtonTheme,\n SidebarDivider,\n SidebarElement,\n SidebarItemProps,\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 type {\n DataTableColumn,\n DataTableProps,\n} from \"./components/table/DataTable.tsx\";\nexport { default as DataTable } from \"./components/table/DataTable.tsx\";\nexport * from \"./constants/ui.ts\";\nexport { useDialog } from \"./hooks/useDialog.ts\";\nexport { useToast } from \"./hooks/useToast.ts\";\nexport * from \"./RootRouter.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\";\nexport * from \"./utils/extractSchemaFields.ts\";\nexport * from \"./utils/icons.tsx\";\nexport * from \"./utils/string.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"typebox\" {\n interface TSchemaOptions {\n $control?: Omit<ControlProps, \"input\">;\n }\n}\n\ndeclare module \"@alepha/react\" {\n interface PageDescriptorOptions {\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;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Mantine\n *\n * @module alepha.ui\n */\nexport const AlephaUI = $module({\n name: \"alepha.ui\",\n services: [DialogService, ToastService, RootRouter],\n register: (alepha) => {\n alepha.with(AlephaReactI18n);\n alepha.with(AlephaReactHead);\n alepha.with(AlephaReactForm);\n alepha.with(DialogService);\n alepha.with(ToastService);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,IAAa,aAAb,MAAwB;CACtB,AAAgB,iCAAa;EAC3B,MAAM;EACN,iDAAY;EACb,CAAC;;;;;AC6BJ,MAAM,iBAAiB,OAAoB,SAAS;CAClD,MAAM,UAAU;EACd,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAG;EAChD,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAG;EAChD,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAG;EAChD,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAG;EAChD,IAAI;GAAE,MAAM;GAAM,MAAM;GAAI,QAAQ;GAAI,KAAK;GAAI;EAClD;AACD,QAAO,QAAQ,SAAS,QAAQ;;AAGlC,MAAM,YAAY,EAChB,MACA,OACA,OACA,UACA,SAAS,OACT,cAAc,OACd,OAAO,WACY;CACnB,MAAM,CAAC,UAAU,mCAAwB,QAAQ,EAAE;CACnD,MAAM,aAAa,cAAc,KAAK;CAEtC,MAAM,gBAAgB,QAAqB;AACzC,MAAI,QAAQ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