@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.
Files changed (34) hide show
  1. package/README.md +17 -306
  2. package/dist/{AlephaMantineProvider-DCF5kidi.cjs → AlephaMantineProvider-CGpgWDt8.cjs} +1 -1
  3. package/dist/{AlephaMantineProvider-CzMrw7V3.js → AlephaMantineProvider-D8cHYAge.js} +3 -1
  4. package/dist/AlephaMantineProvider-D8cHYAge.js.map +1 -0
  5. package/dist/{AlephaMantineProvider-DlOEv9f0.cjs → AlephaMantineProvider-DuvZFAuk.cjs} +3 -1
  6. package/dist/AlephaMantineProvider-DuvZFAuk.cjs.map +1 -0
  7. package/dist/AlephaMantineProvider-twBqV4IO.js +3 -0
  8. package/dist/index.cjs +43 -40
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +36 -28
  11. package/dist/index.d.cts.map +1 -1
  12. package/dist/index.d.ts +17 -9
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +26 -24
  15. package/dist/index.js.map +1 -1
  16. package/package.json +55 -74
  17. package/src/components/buttons/ActionButton.tsx +1 -1
  18. package/src/components/buttons/LanguageButton.tsx +1 -1
  19. package/src/components/form/Control.tsx +1 -1
  20. package/src/components/form/ControlDate.tsx +1 -1
  21. package/src/components/form/ControlNumber.tsx +1 -1
  22. package/src/components/form/ControlQueryBuilder.tsx +2 -2
  23. package/src/components/form/ControlSelect.tsx +1 -1
  24. package/src/components/form/TypeForm.tsx +3 -3
  25. package/src/components/layout/AdminShell.tsx +1 -1
  26. package/src/components/table/DataTable.tsx +11 -11
  27. package/src/hooks/useDialog.ts +2 -0
  28. package/src/hooks/useToast.ts +2 -0
  29. package/src/index.ts +9 -5
  30. package/src/utils/extractSchemaFields.ts +1 -1
  31. package/src/utils/parseInput.ts +2 -2
  32. package/dist/AlephaMantineProvider-B4TwQ4tY.js +0 -3
  33. package/dist/AlephaMantineProvider-CzMrw7V3.js.map +0 -1
  34. package/dist/AlephaMantineProvider-DlOEv9f0.cjs.map +0 -1
package/package.json CHANGED
@@ -1,76 +1,57 @@
1
1
  {
2
- "name": "@alepha/ui",
3
- "keywords": [
4
- "alepha",
5
- "ui",
6
- "mantine"
7
- ],
8
- "author": "Feunard",
9
- "version": "0.11.10",
10
- "type": "module",
11
- "engines": {
12
- "node": ">=22.0.0"
13
- },
14
- "license": "MIT",
15
- "main": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "style": "./styles.css",
18
- "files": [
19
- "dist",
20
- "src"
21
- ],
22
- "dependencies": {
23
- "@alepha/core": "0.11.10",
24
- "@alepha/datetime": "0.11.10",
25
- "@alepha/postgres": "0.11.10",
26
- "@alepha/react": "0.11.10",
27
- "@alepha/react-form": "0.11.10",
28
- "@alepha/react-head": "0.11.10",
29
- "@alepha/react-i18n": "0.11.10",
30
- "@alepha/server": "0.11.10",
31
- "@mantine/core": "^8.3.7",
32
- "@mantine/dates": "^8.3.7",
33
- "@mantine/hooks": "^8.3.7",
34
- "@mantine/modals": "^8.3.7",
35
- "@mantine/notifications": "^8.3.7",
36
- "@mantine/nprogress": "^8.3.7",
37
- "@mantine/spotlight": "^8.3.7",
38
- "@tabler/icons-react": "^3.35.0",
39
- "dayjs": "^1.11.19"
40
- },
41
- "devDependencies": {
42
- "@alepha/vite": "0.11.10",
43
- "@biomejs/biome": "^2.3.5",
44
- "alepha": "0.11.10",
45
- "react": "^19.2.0",
46
- "react-dom": "^19.2.0",
47
- "tsdown": "^0.16.4",
48
- "typescript": "^5.9.3",
49
- "vite": "^7.2.2",
50
- "vitest": "^4.0.9"
51
- },
52
- "peerDependencies": {
53
- "react": "*",
54
- "react-dom": "*"
55
- },
56
- "scripts": {
57
- "dev": "alepha dev",
58
- "test": "vitest run",
59
- "lint": "biome check --fix",
60
- "build": "tsdown -c=../../tsdown.config.ts",
61
- "typecheck": "tsc --noEmit"
62
- },
63
- "repository": {
64
- "type": "git",
65
- "url": "git+https://github.com/feunard/alepha.git"
66
- },
67
- "homepage": "https://github.com/feunard/alepha",
68
- "module": "./dist/index.js",
69
- "exports": {
70
- ".": {
71
- "types": "./dist/index.d.ts",
72
- "import": "./dist/index.js",
73
- "require": "./dist/index.cjs"
74
- }
75
- }
2
+ "name": "@alepha/ui",
3
+ "keywords": [
4
+ "alepha",
5
+ "ui",
6
+ "mantine"
7
+ ],
8
+ "author": "Feunard",
9
+ "version": "0.11.12",
10
+ "type": "module",
11
+ "engines": {
12
+ "node": ">=22.0.0"
13
+ },
14
+ "license": "MIT",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "style": "./styles.css",
18
+ "files": [
19
+ "dist",
20
+ "src"
21
+ ],
22
+ "dependencies": {
23
+ "@alepha/react": "0.11.12",
24
+ "@mantine/core": "^8.3.7",
25
+ "@mantine/dates": "^8.3.7",
26
+ "@mantine/hooks": "^8.3.7",
27
+ "@mantine/modals": "^8.3.7",
28
+ "@mantine/notifications": "^8.3.7",
29
+ "@mantine/nprogress": "^8.3.7",
30
+ "@mantine/spotlight": "^8.3.7",
31
+ "@tabler/icons-react": "^3.35.0",
32
+ "alepha": "0.11.12",
33
+ "dayjs": "^1.11.19"
34
+ },
35
+ "devDependencies": {
36
+ "react": "^19.2.0",
37
+ "react-dom": "^19.2.0",
38
+ "tsdown": "^0.16.4"
39
+ },
40
+ "peerDependencies": {
41
+ "react": "*",
42
+ "react-dom": "*"
43
+ },
44
+ "scripts": {
45
+ "dev": "alepha dev",
46
+ "lint": "alepha lint",
47
+ "typecheck": "alepha typecheck",
48
+ "test": "alepha test",
49
+ "build": "tsdown -c=../../tsdown.config.ts"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/feunard/alepha.git"
54
+ },
55
+ "homepage": "https://github.com/feunard/alepha",
56
+ "module": "./dist/index.js"
76
57
  }
@@ -6,7 +6,7 @@ import {
6
6
  useActive,
7
7
  useRouter,
8
8
  } from "@alepha/react";
9
- import { type FormModel, useFormState } from "@alepha/react-form";
9
+ import { type FormModel, useFormState } from "@alepha/react/form";
10
10
  import {
11
11
  Button,
12
12
  type ButtonProps,
@@ -1,4 +1,4 @@
1
- import { useI18n } from "@alepha/react-i18n";
1
+ import { useI18n } from "@alepha/react/i18n";
2
2
  import { IconLanguage } from "@tabler/icons-react";
3
3
  import ActionButton, { type ActionProps } from "./ActionButton.tsx";
4
4
 
@@ -1,4 +1,4 @@
1
- import { useFormState } from "@alepha/react-form";
1
+ import { useFormState } from "@alepha/react/form";
2
2
  import {
3
3
  ColorInput,
4
4
  type ColorInputProps,
@@ -1,4 +1,4 @@
1
- import { useFormState } from "@alepha/react-form";
1
+ import { useFormState } from "@alepha/react/form";
2
2
  import {
3
3
  DateInput,
4
4
  type DateInputProps,
@@ -1,5 +1,5 @@
1
1
  import { useEvents } from "@alepha/react";
2
- import { useFormState } from "@alepha/react-form";
2
+ import { useFormState } from "@alepha/react/form";
3
3
  import {
4
4
  Input,
5
5
  NumberInput,
@@ -1,5 +1,3 @@
1
- import type { TObject } from "@alepha/core";
2
- import { parseQueryString } from "@alepha/postgres";
3
1
  import { useEvents } from "@alepha/react";
4
2
  import {
5
3
  ActionIcon,
@@ -14,6 +12,8 @@ import {
14
12
  type TextInputProps,
15
13
  } from "@mantine/core";
16
14
  import { IconFilter, IconInfoTriangle, IconX } from "@tabler/icons-react";
15
+ import type { TObject } from "alepha";
16
+ import { parseQueryString } from "alepha/orm";
17
17
  import { useRef, useState } from "react";
18
18
  import { ui } from "../../constants/ui.ts";
19
19
  import {
@@ -1,4 +1,4 @@
1
- import { useFormState } from "@alepha/react-form";
1
+ import { useFormState } from "@alepha/react/form";
2
2
  import {
3
3
  Autocomplete,
4
4
  type AutocompleteProps,
@@ -1,6 +1,6 @@
1
- import type { TObject } from "@alepha/core";
2
- import type { FormModel } from "@alepha/react-form";
1
+ import type { FormModel } from "@alepha/react/form";
3
2
  import { Flex, Grid } from "@mantine/core";
3
+ import type { TObject } from "alepha";
4
4
  import type { ReactNode } from "react";
5
5
  import ActionButton, {
6
6
  type ActionSubmitButtonProps,
@@ -35,7 +35,7 @@ export interface TypeFormProps<T extends TObject> {
35
35
  * @example
36
36
  * ```tsx
37
37
  * import { t } from "alepha";
38
- * import { useForm } from "@alepha/react-form";
38
+ * import { useForm } from "@alepha/react/form";
39
39
  * import { TypeForm } from "@alepha/ui";
40
40
  *
41
41
  * const form = useForm({
@@ -25,7 +25,7 @@ export interface AdminShellProps {
25
25
  children?: ReactNode;
26
26
  }
27
27
 
28
- declare module "@alepha/core" {
28
+ declare module "alepha" {
29
29
  interface State {
30
30
  /**
31
31
  * Whether the sidebar is opened or closed.
@@ -1,15 +1,5 @@
1
- import {
2
- Alepha,
3
- type Async,
4
- type Page,
5
- type PageMetadata,
6
- type Static,
7
- type TObject,
8
- t,
9
- } from "@alepha/core";
10
- import { DateTimeProvider, type DurationLike } from "@alepha/datetime";
11
1
  import { useInject } from "@alepha/react";
12
- import { type FormModel, useForm } from "@alepha/react-form";
2
+ import { type FormModel, useForm } from "@alepha/react/form";
13
3
  import {
14
4
  Flex,
15
5
  Pagination,
@@ -19,6 +9,16 @@ import {
19
9
  type TableTrProps,
20
10
  } from "@mantine/core";
21
11
  import { useDebouncedCallback } from "@mantine/hooks";
12
+ import {
13
+ Alepha,
14
+ type Async,
15
+ type Page,
16
+ type PageMetadata,
17
+ type Static,
18
+ type TObject,
19
+ t,
20
+ } from "alepha";
21
+ import { DateTimeProvider, type DurationLike } from "alepha/datetime";
22
22
  import { type ReactNode, useEffect, useState } from "react";
23
23
  import ActionButton from "../buttons/ActionButton.tsx";
24
24
  import TypeForm, { type TypeFormProps } from "../form/TypeForm.tsx";
@@ -5,10 +5,12 @@ import { DialogService } from "../services/DialogService.tsx";
5
5
  * Use this hook to access the Dialog Service for showing various dialog types.
6
6
  *
7
7
  * @example
8
+ * ```tsx
8
9
  * const dialog = useDialog();
9
10
  * await dialog.alert({ title: "Alert", message: "This is an alert message" });
10
11
  * const confirmed = await dialog.confirm({ title: "Confirm", message: "Are you sure?" });
11
12
  * const input = await dialog.prompt({ title: "Input", message: "Enter your name:" });
13
+ * ```
12
14
  */
13
15
  export const useDialog = (): DialogService => {
14
16
  return useInject(DialogService);
@@ -5,9 +5,11 @@ import { ToastService } from "../services/ToastService.tsx";
5
5
  * Use this hook to access the Toast Service for showing notifications.
6
6
  *
7
7
  * @example
8
+ * ```tsx
8
9
  * const toast = useToast();
9
10
  * toast.success({ message: "Operation completed successfully!" });
10
11
  * toast.error({ title: "Error", message: "Something went wrong" });
12
+ * ```
11
13
  */
12
14
  export const useToast = (): ToastService => {
13
15
  return useInject(ToastService);
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { $module } from "@alepha/core";
2
- import { AlephaReactForm } from "@alepha/react-form";
3
- import { AlephaReactHead } from "@alepha/react-head";
4
- import { AlephaReactI18n } from "@alepha/react-i18n";
1
+ import { AlephaReactForm } from "@alepha/react/form";
2
+ import { AlephaReactHead } from "@alepha/react/head";
3
+ import { AlephaReactI18n } from "@alepha/react/i18n";
4
+ import { $module } from "alepha";
5
5
  import type { ReactNode } from "react";
6
6
  import type { ControlProps } from "./components/form/Control.tsx";
7
7
  import { RootRouter } from "./RootRouter.ts";
@@ -21,6 +21,7 @@ export type {
21
21
  ActionSubmitButtonProps,
22
22
  } from "./components/buttons/ActionButton.tsx";
23
23
  export { default as ActionButton } from "./components/buttons/ActionButton.tsx";
24
+ export { default as BurgerButton } from "./components/buttons/BurgerButton.tsx";
24
25
  export { default as DarkModeButton } from "./components/buttons/DarkModeButton.tsx";
25
26
  export { default as OmnibarButton } from "./components/buttons/OmnibarButton.tsx";
26
27
  export { default as JsonViewer } from "./components/data/JsonViewer.tsx";
@@ -32,7 +33,10 @@ export { default as ControlDate } from "./components/form/ControlDate.tsx";
32
33
  export { default as ControlQueryBuilder } from "./components/form/ControlQueryBuilder.tsx";
33
34
  export { default as ControlSelect } from "./components/form/ControlSelect.tsx";
34
35
  export { default as TypeForm } from "./components/form/TypeForm.tsx";
35
- export { default as AdminShell } from "./components/layout/AdminShell.tsx";
36
+ export {
37
+ type AdminShellProps,
38
+ default as AdminShell,
39
+ } from "./components/layout/AdminShell.tsx";
36
40
  export { default as AlephaMantineProvider } from "./components/layout/AlephaMantineProvider.tsx";
37
41
  export type {
38
42
  AppBarBurger,
@@ -1,4 +1,4 @@
1
- import type { TObject, TProperties, TSchema } from "@alepha/core";
1
+ import type { TObject, TProperties, TSchema } from "alepha";
2
2
 
3
3
  export interface SchemaField {
4
4
  name: string;
@@ -1,5 +1,5 @@
1
- import { type TObject, TypeBoxError } from "@alepha/core";
2
- import type { InputField } from "@alepha/react-form";
1
+ import type { InputField } from "@alepha/react/form";
2
+ import { type TObject, TypeBoxError } from "alepha";
3
3
  import type { ReactNode } from "react";
4
4
  import type { ControlProps } from "../components/form/Control.tsx";
5
5
  import { getDefaultIcon } from "./icons.tsx";
@@ -1,3 +0,0 @@
1
- import { t as AlephaMantineProvider_default } from "./AlephaMantineProvider-CzMrw7V3.js";
2
-
3
- export { AlephaMantineProvider_default as default };
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlephaMantineProvider-CzMrw7V3.js","names":["Omnibar"],"sources":["../src/services/ToastService.tsx","../src/hooks/useToast.ts","../src/components/layout/Omnibar.tsx","../src/components/layout/AlephaMantineProvider.tsx"],"sourcesContent":["import type { NotificationData } from \"@mantine/notifications\";\nimport { notifications } from \"@mantine/notifications\";\nimport {\n IconAlertTriangle,\n IconCheck,\n IconInfoCircle,\n IconX,\n} from \"@tabler/icons-react\";\n\nexport interface ToastServiceOptions {\n default?: Partial<NotificationData>;\n}\n\nexport class ToastService {\n protected readonly raw = notifications;\n\n public readonly options: ToastServiceOptions = {\n default: {\n autoClose: 5000,\n withCloseButton: true,\n position: \"top-center\",\n },\n };\n\n public show(options: NotificationData) {\n notifications.show({\n ...this.options.default,\n ...options,\n });\n }\n\n public info(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"blue\",\n icon: <IconInfoCircle size={20} />,\n title: \"Info\",\n message: \"Information notification\",\n ...options,\n });\n }\n\n public success(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"green\",\n icon: <IconCheck size={16} />,\n title: \"Success\",\n message: \"Operation completed successfully\",\n ...options,\n });\n }\n\n public warning(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"yellow\",\n icon: <IconAlertTriangle size={20} />,\n title: \"Warning\",\n message: \"Please review this warning\",\n ...options,\n });\n }\n\n public danger(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"red\",\n icon: <IconX size={20} />,\n title: \"Error\",\n message: \"An error occurred\",\n ...options,\n });\n }\n}\n","import { useInject } from \"@alepha/react\";\nimport { ToastService } from \"../services/ToastService.tsx\";\n\n/**\n * Use this hook to access the Toast Service for showing notifications.\n *\n * @example\n * const toast = useToast();\n * toast.success({ message: \"Operation completed successfully!\" });\n * toast.error({ title: \"Error\", message: \"Something went wrong\" });\n */\nexport const useToast = (): ToastService => {\n return useInject(ToastService);\n};\n","import { useRouter } from \"@alepha/react\";\nimport { Spotlight, type SpotlightActionData } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { type ReactNode, useMemo } from \"react\";\n\nexport interface OmnibarProps {\n shortcut?: string | string[];\n searchPlaceholder?: string;\n nothingFound?: ReactNode;\n}\n\nconst Omnibar = (props: OmnibarProps) => {\n const shortcut = props.shortcut ?? \"mod+K\";\n const searchPlaceholder = props.searchPlaceholder ?? \"Search...\";\n const nothingFound = props.nothingFound ?? \"Nothing found...\";\n const router = useRouter();\n const actions: SpotlightActionData[] = useMemo(\n () =>\n router.concretePages.map((page) => ({\n id: page.name,\n label: page.label ?? page.name,\n description: page.description,\n onClick: () => router.go(page.path ?? page.name),\n leftSection: page.icon,\n })),\n [],\n );\n\n return (\n <Spotlight\n actions={actions}\n shortcut={shortcut}\n limit={10}\n searchProps={{\n leftSection: <IconSearch size={20} />,\n placeholder: searchPlaceholder,\n }}\n nothingFound={nothingFound}\n />\n );\n};\n\nexport default Omnibar;\n","import { NestedView, useEvents } from \"@alepha/react\";\nimport type {\n ColorSchemeScriptProps,\n MantineProviderProps,\n} from \"@mantine/core\";\nimport { ColorSchemeScript, MantineProvider } from \"@mantine/core\";\nimport { ModalsProvider, type ModalsProviderProps } from \"@mantine/modals\";\nimport { Notifications, type NotificationsProps } from \"@mantine/notifications\";\nimport type { NavigationProgressProps } from \"@mantine/nprogress\";\nimport { NavigationProgress, nprogress } from \"@mantine/nprogress\";\nimport type { ReactNode } from \"react\";\nimport { useToast } from \"../../hooks/useToast.ts\";\nimport Omnibar, { type OmnibarProps } from \"./Omnibar.tsx\";\n\nexport interface AlephaMantineProviderProps {\n children?: ReactNode;\n mantine?: MantineProviderProps;\n colorSchemeScript?: ColorSchemeScriptProps;\n navigationProgress?: NavigationProgressProps;\n notifications?: NotificationsProps;\n modals?: ModalsProviderProps;\n omnibar?: OmnibarProps;\n}\n\nconst AlephaMantineProvider = (props: AlephaMantineProviderProps) => {\n const toast = useToast();\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n nprogress.start();\n },\n \"react:transition:end\": () => {\n nprogress.complete();\n },\n \"react:action:error\": () => {\n toast.danger(\"An error occurred while processing your action.\");\n },\n },\n [],\n );\n\n return (\n <>\n <ColorSchemeScript\n defaultColorScheme={props.mantine?.defaultColorScheme}\n {...props.colorSchemeScript}\n />\n <MantineProvider\n {...props.mantine}\n theme={{\n primaryColor: \"gray\",\n primaryShade: {\n light: 9,\n dark: 8,\n },\n cursorType: \"pointer\",\n ...props.mantine?.theme,\n }}\n >\n <Notifications {...props.notifications} />\n <NavigationProgress {...props.navigationProgress} />\n <ModalsProvider {...props.modals}>\n <Omnibar {...props.omnibar} />\n {props.children ?? <NestedView />}\n </ModalsProvider>\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rD,MAAM,eAAe,MAAM,gBAAgB;CAC3C,MAAM,SAAS,WAAW;AAa1B,QACE,oBAAC;EACC,SAdmC,cAEnC,OAAO,cAAc,KAAK,UAAU;GAClC,IAAI,KAAK;GACT,OAAO,KAAK,SAAS,KAAK;GAC1B,aAAa,KAAK;GAClB,eAAe,OAAO,GAAG,KAAK,QAAQ,KAAK,KAAK;GAChD,aAAa,KAAK;GACnB,EAAE,EACL,EAAE,CACH;EAKa;EACV,OAAO;EACP,aAAa;GACX,aAAa,oBAAC,cAAW,MAAM,KAAM;GACrC,aAAa;GACd;EACa;GACd;;AAIN,sBAAe;;;;AClBf,MAAM,yBAAyB,UAAsC;CACnE,MAAM,QAAQ,UAAU;AAExB,WACE;EACE,gCAAgC;AAC9B,aAAU,OAAO;;EAEnB,8BAA8B;AAC5B,aAAU,UAAU;;EAEtB,4BAA4B;AAC1B,SAAM,OAAO,kDAAkD;;EAElE,EACD,EAAE,CACH;AAED,QACE,4CACE,oBAAC;EACC,oBAAoB,MAAM,SAAS;EACnC,GAAI,MAAM;GACV,EACF,qBAAC;EACC,GAAI,MAAM;EACV,OAAO;GACL,cAAc;GACd,cAAc;IACZ,OAAO;IACP,MAAM;IACP;GACD,YAAY;GACZ,GAAG,MAAM,SAAS;GACnB;;GAED,oBAAC,iBAAc,GAAI,MAAM,gBAAiB;GAC1C,oBAAC,sBAAmB,GAAI,MAAM,qBAAsB;GACpD,qBAAC;IAAe,GAAI,MAAM;eACxB,oBAACA,mBAAQ,GAAI,MAAM,UAAW,EAC7B,MAAM,YAAY,oBAAC,eAAa;KAClB;;GACD,IACjB;;AAIP,oCAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlephaMantineProvider-DlOEv9f0.cjs","names":["notifications","IconInfoCircle","IconCheck","IconAlertTriangle","IconX","Spotlight","IconSearch","ColorSchemeScript","MantineProvider","Notifications","NavigationProgress","ModalsProvider","Omnibar","NestedView"],"sources":["../src/services/ToastService.tsx","../src/hooks/useToast.ts","../src/components/layout/Omnibar.tsx","../src/components/layout/AlephaMantineProvider.tsx"],"sourcesContent":["import type { NotificationData } from \"@mantine/notifications\";\nimport { notifications } from \"@mantine/notifications\";\nimport {\n IconAlertTriangle,\n IconCheck,\n IconInfoCircle,\n IconX,\n} from \"@tabler/icons-react\";\n\nexport interface ToastServiceOptions {\n default?: Partial<NotificationData>;\n}\n\nexport class ToastService {\n protected readonly raw = notifications;\n\n public readonly options: ToastServiceOptions = {\n default: {\n autoClose: 5000,\n withCloseButton: true,\n position: \"top-center\",\n },\n };\n\n public show(options: NotificationData) {\n notifications.show({\n ...this.options.default,\n ...options,\n });\n }\n\n public info(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"blue\",\n icon: <IconInfoCircle size={20} />,\n title: \"Info\",\n message: \"Information notification\",\n ...options,\n });\n }\n\n public success(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"green\",\n icon: <IconCheck size={16} />,\n title: \"Success\",\n message: \"Operation completed successfully\",\n ...options,\n });\n }\n\n public warning(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"yellow\",\n icon: <IconAlertTriangle size={20} />,\n title: \"Warning\",\n message: \"Please review this warning\",\n ...options,\n });\n }\n\n public danger(options: Partial<NotificationData> | string) {\n if (typeof options === \"string\") {\n options = { message: options };\n }\n this.show({\n color: \"red\",\n icon: <IconX size={20} />,\n title: \"Error\",\n message: \"An error occurred\",\n ...options,\n });\n }\n}\n","import { useInject } from \"@alepha/react\";\nimport { ToastService } from \"../services/ToastService.tsx\";\n\n/**\n * Use this hook to access the Toast Service for showing notifications.\n *\n * @example\n * const toast = useToast();\n * toast.success({ message: \"Operation completed successfully!\" });\n * toast.error({ title: \"Error\", message: \"Something went wrong\" });\n */\nexport const useToast = (): ToastService => {\n return useInject(ToastService);\n};\n","import { useRouter } from \"@alepha/react\";\nimport { Spotlight, type SpotlightActionData } from \"@mantine/spotlight\";\nimport { IconSearch } from \"@tabler/icons-react\";\nimport { type ReactNode, useMemo } from \"react\";\n\nexport interface OmnibarProps {\n shortcut?: string | string[];\n searchPlaceholder?: string;\n nothingFound?: ReactNode;\n}\n\nconst Omnibar = (props: OmnibarProps) => {\n const shortcut = props.shortcut ?? \"mod+K\";\n const searchPlaceholder = props.searchPlaceholder ?? \"Search...\";\n const nothingFound = props.nothingFound ?? \"Nothing found...\";\n const router = useRouter();\n const actions: SpotlightActionData[] = useMemo(\n () =>\n router.concretePages.map((page) => ({\n id: page.name,\n label: page.label ?? page.name,\n description: page.description,\n onClick: () => router.go(page.path ?? page.name),\n leftSection: page.icon,\n })),\n [],\n );\n\n return (\n <Spotlight\n actions={actions}\n shortcut={shortcut}\n limit={10}\n searchProps={{\n leftSection: <IconSearch size={20} />,\n placeholder: searchPlaceholder,\n }}\n nothingFound={nothingFound}\n />\n );\n};\n\nexport default Omnibar;\n","import { NestedView, useEvents } from \"@alepha/react\";\nimport type {\n ColorSchemeScriptProps,\n MantineProviderProps,\n} from \"@mantine/core\";\nimport { ColorSchemeScript, MantineProvider } from \"@mantine/core\";\nimport { ModalsProvider, type ModalsProviderProps } from \"@mantine/modals\";\nimport { Notifications, type NotificationsProps } from \"@mantine/notifications\";\nimport type { NavigationProgressProps } from \"@mantine/nprogress\";\nimport { NavigationProgress, nprogress } from \"@mantine/nprogress\";\nimport type { ReactNode } from \"react\";\nimport { useToast } from \"../../hooks/useToast.ts\";\nimport Omnibar, { type OmnibarProps } from \"./Omnibar.tsx\";\n\nexport interface AlephaMantineProviderProps {\n children?: ReactNode;\n mantine?: MantineProviderProps;\n colorSchemeScript?: ColorSchemeScriptProps;\n navigationProgress?: NavigationProgressProps;\n notifications?: NotificationsProps;\n modals?: ModalsProviderProps;\n omnibar?: OmnibarProps;\n}\n\nconst AlephaMantineProvider = (props: AlephaMantineProviderProps) => {\n const toast = useToast();\n\n useEvents(\n {\n \"react:transition:begin\": () => {\n nprogress.start();\n },\n \"react:transition:end\": () => {\n nprogress.complete();\n },\n \"react:action:error\": () => {\n toast.danger(\"An error occurred while processing your action.\");\n },\n },\n [],\n );\n\n return (\n <>\n <ColorSchemeScript\n defaultColorScheme={props.mantine?.defaultColorScheme}\n {...props.colorSchemeScript}\n />\n <MantineProvider\n {...props.mantine}\n theme={{\n primaryColor: \"gray\",\n primaryShade: {\n light: 9,\n dark: 8,\n },\n cursorType: \"pointer\",\n ...props.mantine?.theme,\n }}\n >\n <Notifications {...props.notifications} />\n <NavigationProgress {...props.navigationProgress} />\n <ModalsProvider {...props.modals}>\n <Omnibar {...props.omnibar} />\n {props.children ?? <NestedView />}\n </ModalsProvider>\n </MantineProvider>\n </>\n );\n};\n\nexport default AlephaMantineProvider;\n"],"mappings":";;;;;;;;;;;AAaA,IAAa,eAAb,MAA0B;CACxB,AAAmB,MAAMA;CAEzB,AAAgB,UAA+B,EAC7C,SAAS;EACP,WAAW;EACX,iBAAiB;EACjB,UAAU;EACX,EACF;CAED,AAAO,KAAK,SAA2B;AACrC,wCAAc,KAAK;GACjB,GAAG,KAAK,QAAQ;GAChB,GAAG;GACJ,CAAC;;CAGJ,AAAO,KAAK,SAA6C;AACvD,MAAI,OAAO,YAAY,SACrB,WAAU,EAAE,SAAS,SAAS;AAEhC,OAAK,KAAK;GACR,OAAO;GACP,MAAM,2CAACC,uCAAe,MAAM,KAAM;GAClC,OAAO;GACP,SAAS;GACT,GAAG;GACJ,CAAC;;CAGJ,AAAO,QAAQ,SAA6C;AAC1D,MAAI,OAAO,YAAY,SACrB,WAAU,EAAE,SAAS,SAAS;AAEhC,OAAK,KAAK;GACR,OAAO;GACP,MAAM,2CAACC,kCAAU,MAAM,KAAM;GAC7B,OAAO;GACP,SAAS;GACT,GAAG;GACJ,CAAC;;CAGJ,AAAO,QAAQ,SAA6C;AAC1D,MAAI,OAAO,YAAY,SACrB,WAAU,EAAE,SAAS,SAAS;AAEhC,OAAK,KAAK;GACR,OAA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