@alepha/ui 0.10.6 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlephaMantineProvider-EemOtraW.js +3 -0
- package/dist/AlephaMantineProvider-WfiC2EH6.js +95 -0
- package/dist/AlephaMantineProvider-WfiC2EH6.js.map +1 -0
- package/dist/index.d.ts +236 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +520 -81
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
- package/src/RootRouter.ts +8 -0
- package/src/components/Action.tsx +134 -134
- package/src/components/AlephaMantineProvider.tsx +34 -31
- package/src/components/Control.tsx +383 -229
- package/src/components/ControlDate.tsx +112 -0
- package/src/components/ControlSelect.tsx +134 -0
- package/src/components/DarkModeButton.tsx +75 -0
- package/src/components/Omnibar.tsx +76 -0
- package/src/components/TypeForm.tsx +158 -0
- package/src/hooks/useToast.ts +14 -0
- package/src/index.ts +25 -9
- package/src/services/ToastService.tsx +71 -0
- package/src/utils/icons.tsx +121 -0
- package/src/utils/string.ts +21 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { NestedView, useRouterEvents } from "@alepha/react";
|
|
2
|
+
import { Notifications } from "@mantine/notifications";
|
|
3
|
+
import { IconDashboard, IconFileText, IconHome, IconSearch, IconSettings, IconUser } from "@tabler/icons-react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ColorSchemeScript, MantineProvider } from "@mantine/core";
|
|
6
|
+
import { ModalsProvider } from "@mantine/modals";
|
|
7
|
+
import { NavigationProgress, nprogress } from "@mantine/nprogress";
|
|
8
|
+
import { Spotlight } from "@mantine/spotlight";
|
|
9
|
+
|
|
10
|
+
//#region src/components/Omnibar.tsx
|
|
11
|
+
const defaultActions = [
|
|
12
|
+
{
|
|
13
|
+
id: "home",
|
|
14
|
+
label: "Home",
|
|
15
|
+
description: "Go to home page",
|
|
16
|
+
onClick: () => console.log("Home"),
|
|
17
|
+
leftSection: /* @__PURE__ */ jsx(IconHome, { size: 20 })
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "dashboard",
|
|
21
|
+
label: "Dashboard",
|
|
22
|
+
description: "View your dashboard",
|
|
23
|
+
onClick: () => console.log("Dashboard"),
|
|
24
|
+
leftSection: /* @__PURE__ */ jsx(IconDashboard, { size: 20 })
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "documents",
|
|
28
|
+
label: "Documents",
|
|
29
|
+
description: "Browse all documents",
|
|
30
|
+
onClick: () => console.log("Documents"),
|
|
31
|
+
leftSection: /* @__PURE__ */ jsx(IconFileText, { size: 20 })
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "profile",
|
|
35
|
+
label: "Profile",
|
|
36
|
+
description: "View and edit your profile",
|
|
37
|
+
onClick: () => console.log("Profile"),
|
|
38
|
+
leftSection: /* @__PURE__ */ jsx(IconUser, { size: 20 })
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "settings",
|
|
42
|
+
label: "Settings",
|
|
43
|
+
description: "Manage application settings",
|
|
44
|
+
onClick: () => console.log("Settings"),
|
|
45
|
+
leftSection: /* @__PURE__ */ jsx(IconSettings, { size: 20 })
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
const Omnibar = (props) => {
|
|
49
|
+
const actions = props.actions ?? defaultActions;
|
|
50
|
+
const shortcut = props.shortcut ?? "mod+K";
|
|
51
|
+
const searchPlaceholder = props.searchPlaceholder ?? "Search...";
|
|
52
|
+
const nothingFound = props.nothingFound ?? "Nothing found...";
|
|
53
|
+
return /* @__PURE__ */ jsx(Spotlight, {
|
|
54
|
+
actions,
|
|
55
|
+
shortcut,
|
|
56
|
+
searchProps: {
|
|
57
|
+
leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 20 }),
|
|
58
|
+
placeholder: searchPlaceholder
|
|
59
|
+
},
|
|
60
|
+
nothingFound
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var Omnibar_default = Omnibar;
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/components/AlephaMantineProvider.tsx
|
|
67
|
+
const AlephaMantineProvider = (props) => {
|
|
68
|
+
useRouterEvents({
|
|
69
|
+
onBegin: () => {
|
|
70
|
+
nprogress.start();
|
|
71
|
+
},
|
|
72
|
+
onEnd: () => {
|
|
73
|
+
nprogress.complete();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ColorSchemeScript, {
|
|
77
|
+
defaultColorScheme: props.mantine?.defaultColorScheme,
|
|
78
|
+
...props.colorSchemeScript
|
|
79
|
+
}), /* @__PURE__ */ jsxs(MantineProvider, {
|
|
80
|
+
...props.mantine,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Notifications, { ...props.notifications }),
|
|
83
|
+
/* @__PURE__ */ jsx(NavigationProgress, { ...props.navigationProgress }),
|
|
84
|
+
/* @__PURE__ */ jsxs(ModalsProvider, {
|
|
85
|
+
...props.modals,
|
|
86
|
+
children: [/* @__PURE__ */ jsx(Omnibar_default, { ...props.omnibar }), props.children ?? /* @__PURE__ */ jsx(NestedView, {})]
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
})] });
|
|
90
|
+
};
|
|
91
|
+
var AlephaMantineProvider_default = AlephaMantineProvider;
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { Omnibar_default as n, AlephaMantineProvider_default as t };
|
|
95
|
+
//# sourceMappingURL=AlephaMantineProvider-WfiC2EH6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlephaMantineProvider-WfiC2EH6.js","names":["defaultActions: SpotlightActionData[]","Omnibar"],"sources":["../src/components/Omnibar.tsx","../src/components/AlephaMantineProvider.tsx"],"sourcesContent":["import { Spotlight, type SpotlightActionData } from \"@mantine/spotlight\";\nimport {\n IconDashboard,\n IconFileText,\n IconHome,\n IconSearch,\n IconSettings,\n IconUser,\n} from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface OmnibarProps {\n actions?: SpotlightActionData[];\n shortcut?: string | string[];\n searchPlaceholder?: string;\n nothingFound?: ReactNode;\n}\n\nconst defaultActions: SpotlightActionData[] = [\n {\n id: \"home\",\n label: \"Home\",\n description: \"Go to home page\",\n onClick: () => console.log(\"Home\"),\n leftSection: <IconHome size={20} />,\n },\n {\n id: \"dashboard\",\n label: \"Dashboard\",\n description: \"View your dashboard\",\n onClick: () => console.log(\"Dashboard\"),\n leftSection: <IconDashboard size={20} />,\n },\n {\n id: \"documents\",\n label: \"Documents\",\n description: \"Browse all documents\",\n onClick: () => console.log(\"Documents\"),\n leftSection: <IconFileText size={20} />,\n },\n {\n id: \"profile\",\n label: \"Profile\",\n description: \"View and edit your profile\",\n onClick: () => console.log(\"Profile\"),\n leftSection: <IconUser size={20} />,\n },\n {\n id: \"settings\",\n label: \"Settings\",\n description: \"Manage application settings\",\n onClick: () => console.log(\"Settings\"),\n leftSection: <IconSettings size={20} />,\n },\n];\n\nconst Omnibar = (props: OmnibarProps) => {\n const actions = props.actions ?? defaultActions;\n const shortcut = props.shortcut ?? \"mod+K\";\n const searchPlaceholder = props.searchPlaceholder ?? \"Search...\";\n const nothingFound = props.nothingFound ?? \"Nothing found...\";\n\n return (\n <Spotlight\n actions={actions}\n shortcut={shortcut}\n searchProps={{\n leftSection: <IconSearch size={20} />,\n placeholder: searchPlaceholder,\n }}\n nothingFound={nothingFound}\n />\n );\n};\n\nexport default Omnibar;\n","import { NestedView, useRouterEvents } 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 Omnibar, { type OmnibarProps } from \"./Omnibar\";\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 useRouterEvents({\n onBegin: () => {\n nprogress.start();\n },\n onEnd: () => {\n nprogress.complete();\n },\n });\n\n return (\n <>\n <ColorSchemeScript\n defaultColorScheme={props.mantine?.defaultColorScheme}\n {...props.colorSchemeScript}\n />\n <MantineProvider {...props.mantine}>\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":";;;;;;;;;;AAkBA,MAAMA,iBAAwC;CAC5C;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,eAAe,QAAQ,IAAI,OAAO;EAClC,aAAa,oBAAC,YAAS,MAAM,KAAM;EACpC;CACD;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,eAAe,QAAQ,IAAI,YAAY;EACvC,aAAa,oBAAC,iBAAc,MAAM,KAAM;EACzC;CACD;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,eAAe,QAAQ,IAAI,YAAY;EACvC,aAAa,oBAAC,gBAAa,MAAM,KAAM;EACxC;CACD;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,eAAe,QAAQ,IAAI,UAAU;EACrC,aAAa,oBAAC,YAAS,MAAM,KAAM;EACpC;CACD;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,eAAe,QAAQ,IAAI,WAAW;EACtC,aAAa,oBAAC,gBAAa,MAAM,KAAM;EACxC;CACF;AAED,MAAM,WAAW,UAAwB;CACvC,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,oBAAoB,MAAM,qBAAqB;CACrD,MAAM,eAAe,MAAM,gBAAgB;AAE3C,QACE,oBAAC;EACU;EACC;EACV,aAAa;GACX,aAAa,oBAAC,cAAW,MAAM,KAAM;GACrC,aAAa;GACd;EACa;GACd;;AAIN,sBAAe;;;;ACpDf,MAAM,yBAAyB,UAAsC;AACnE,iBAAgB;EACd,eAAe;AACb,aAAU,OAAO;;EAEnB,aAAa;AACX,aAAU,UAAU;;EAEvB,CAAC;AAEF,QACE,4CACE,oBAAC;EACC,oBAAoB,MAAM,SAAS;EACnC,GAAI,MAAM;GACV,EACF,qBAAC;EAAgB,GAAI,MAAM;;GACzB,oBAAC,iBAAc,GAAI,MAAM,gBAAiB;GAC1C,oBAAC,sBAAmB,GAAI,MAAM,qBAAsB;GACpD,qBAAC;IAAe,GAAI,MAAM;eACxB,oBAACC,mBAAQ,GAAI,MAAM,UAAW,EAC7B,MAAM,YAAY,oBAAC,eAAa;KAClB;;GACD,IACjB;;AAIP,oCAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,68 @@
|
|
|
1
1
|
import * as _alepha_core0 from "@alepha/core";
|
|
2
|
+
import { TObject } from "@alepha/core";
|
|
3
|
+
import * as _alepha_react0 from "@alepha/react";
|
|
2
4
|
import { RouterGoOptions, UseActiveOptions } from "@alepha/react";
|
|
3
|
-
import "@mantine/
|
|
4
|
-
import "@mantine/
|
|
5
|
-
import "
|
|
6
|
-
import "@mantine/
|
|
5
|
+
import * as _mantine_notifications0 from "@mantine/notifications";
|
|
6
|
+
import { NotificationData, NotificationsProps } from "@mantine/notifications";
|
|
7
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
import { AutocompleteProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, FileInputProps, Flex, MantineProviderProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SwitchProps, TagsInputProps, TextInputProps, TextareaProps } from "@mantine/core";
|
|
7
9
|
import { FormModel, InputField } from "@alepha/react-form";
|
|
8
|
-
import { AutocompleteProps, ButtonProps, ColorSchemeScriptProps, MantineProviderProps, PasswordInputProps, SegmentedControlProps, SelectProps, SwitchProps, TextInputProps, TextareaProps } from "@mantine/core";
|
|
9
10
|
import { ComponentType, ReactNode } from "react";
|
|
10
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
11
11
|
import { ModalsProviderProps } from "@mantine/modals";
|
|
12
|
-
import { NotificationsProps } from "@mantine/notifications";
|
|
13
12
|
import { NavigationProgressProps } from "@mantine/nprogress";
|
|
13
|
+
import { SpotlightActionData } from "@mantine/spotlight";
|
|
14
|
+
import { DateInputProps, DateTimePickerProps, TimeInputProps } from "@mantine/dates";
|
|
14
15
|
|
|
16
|
+
//#region src/components/Control.d.ts
|
|
17
|
+
interface ControlProps extends GenericControlProps {
|
|
18
|
+
text?: TextInputProps;
|
|
19
|
+
area?: boolean | TextareaProps;
|
|
20
|
+
select?: boolean | SelectProps;
|
|
21
|
+
autocomplete?: boolean | AutocompleteProps;
|
|
22
|
+
password?: boolean | PasswordInputProps;
|
|
23
|
+
switch?: boolean | SwitchProps;
|
|
24
|
+
segmented?: boolean | Partial<SegmentedControlProps>;
|
|
25
|
+
number?: boolean | NumberInputProps;
|
|
26
|
+
file?: boolean | FileInputProps;
|
|
27
|
+
color?: boolean | ColorInputProps;
|
|
28
|
+
date?: boolean | DateInputProps;
|
|
29
|
+
datetime?: boolean | DateTimePickerProps;
|
|
30
|
+
time?: boolean | TimeInputProps;
|
|
31
|
+
custom?: ComponentType<CustomControlProps>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generic form control that renders the appropriate input based on the schema and props.
|
|
35
|
+
*
|
|
36
|
+
* Supports:
|
|
37
|
+
* - TextInput (with format detection: email, url, tel)
|
|
38
|
+
* - Textarea
|
|
39
|
+
* - NumberInput (for number/integer types)
|
|
40
|
+
* - FileInput
|
|
41
|
+
* - ColorInput (for color format)
|
|
42
|
+
* - Select (for enum types)
|
|
43
|
+
* - Autocomplete
|
|
44
|
+
* - PasswordInput
|
|
45
|
+
* - Switch (for boolean types)
|
|
46
|
+
* - SegmentedControl (for enum types)
|
|
47
|
+
* - DateInput (for date format)
|
|
48
|
+
* - DateTimePicker (for date-time format)
|
|
49
|
+
* - TimeInput (for time format)
|
|
50
|
+
* - Custom component
|
|
51
|
+
*
|
|
52
|
+
* Automatically handles labels, descriptions, error messages, required state, and default icons.
|
|
53
|
+
*/
|
|
54
|
+
declare const Control: (props: ControlProps) => react_jsx_runtime0.JSX.Element | null;
|
|
55
|
+
interface GenericControlProps {
|
|
56
|
+
input: InputField;
|
|
57
|
+
title?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
icon?: ReactNode;
|
|
60
|
+
}
|
|
61
|
+
type CustomControlProps = {
|
|
62
|
+
defaultValue: any;
|
|
63
|
+
onChange: (value: any) => void;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
15
66
|
//#region src/components/Action.d.ts
|
|
16
67
|
interface ActionCommonProps extends ButtonProps {
|
|
17
68
|
children?: ReactNode;
|
|
@@ -41,6 +92,15 @@ interface ActiveHrefProps extends ButtonProps {
|
|
|
41
92
|
routerGoOptions?: RouterGoOptions;
|
|
42
93
|
}
|
|
43
94
|
//#endregion
|
|
95
|
+
//#region src/components/Omnibar.d.ts
|
|
96
|
+
interface OmnibarProps {
|
|
97
|
+
actions?: SpotlightActionData[];
|
|
98
|
+
shortcut?: string | string[];
|
|
99
|
+
searchPlaceholder?: string;
|
|
100
|
+
nothingFound?: ReactNode;
|
|
101
|
+
}
|
|
102
|
+
declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime0.JSX.Element;
|
|
103
|
+
//#endregion
|
|
44
104
|
//#region src/components/AlephaMantineProvider.d.ts
|
|
45
105
|
interface AlephaMantineProviderProps {
|
|
46
106
|
children?: ReactNode;
|
|
@@ -49,46 +109,186 @@ interface AlephaMantineProviderProps {
|
|
|
49
109
|
navigationProgress?: NavigationProgressProps;
|
|
50
110
|
notifications?: NotificationsProps;
|
|
51
111
|
modals?: ModalsProviderProps;
|
|
112
|
+
omnibar?: OmnibarProps;
|
|
52
113
|
}
|
|
53
114
|
declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime0.JSX.Element;
|
|
54
115
|
//#endregion
|
|
55
|
-
//#region src/components/
|
|
56
|
-
interface
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
116
|
+
//#region src/components/ControlDate.d.ts
|
|
117
|
+
interface ControlDateProps extends GenericControlProps {
|
|
118
|
+
date?: boolean | DateInputProps;
|
|
119
|
+
datetime?: boolean | DateTimePickerProps;
|
|
120
|
+
time?: boolean | TimeInputProps;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* ControlDate component for handling date, datetime, and time inputs.
|
|
124
|
+
*
|
|
125
|
+
* Features:
|
|
126
|
+
* - DateInput for date format
|
|
127
|
+
* - DateTimePicker for date-time format
|
|
128
|
+
* - TimeInput for time format
|
|
129
|
+
*
|
|
130
|
+
* Automatically detects date formats from schema and renders appropriate picker.
|
|
131
|
+
*/
|
|
132
|
+
declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime0.JSX.Element | null;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/components/ControlSelect.d.ts
|
|
135
|
+
interface ControlSelectProps extends GenericControlProps {
|
|
63
136
|
select?: boolean | SelectProps;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
switch?: boolean | SwitchProps;
|
|
67
|
-
segmented?: boolean | Partial<SegmentedControlProps>;
|
|
68
|
-
custom?: ComponentType<CustomControlProps>;
|
|
137
|
+
multi?: boolean | MultiSelectProps;
|
|
138
|
+
tags?: boolean | TagsInputProps;
|
|
69
139
|
}
|
|
70
140
|
/**
|
|
71
|
-
*
|
|
141
|
+
* ControlSelect component for handling Select, MultiSelect, and TagsInput.
|
|
72
142
|
*
|
|
73
|
-
*
|
|
74
|
-
* -
|
|
75
|
-
* -
|
|
76
|
-
* -
|
|
77
|
-
* -
|
|
78
|
-
* -
|
|
79
|
-
* -
|
|
80
|
-
* - SegmentedControl (for enum types)
|
|
81
|
-
* - Custom component
|
|
143
|
+
* Features:
|
|
144
|
+
* - Basic Select with enum support
|
|
145
|
+
* - MultiSelect for array of enums
|
|
146
|
+
* - TagsInput for array of strings (no enum)
|
|
147
|
+
* - Future: Lazy loading
|
|
148
|
+
* - Future: Searchable/filterable options
|
|
149
|
+
* - Future: Custom option rendering
|
|
82
150
|
*
|
|
83
|
-
* Automatically
|
|
151
|
+
* Automatically detects enum values and array types from schema.
|
|
84
152
|
*/
|
|
85
|
-
declare const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
153
|
+
declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime0.JSX.Element | null;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/components/DarkModeButton.d.ts
|
|
156
|
+
interface DarkModeButtonProps {
|
|
157
|
+
mode?: "minimal" | "segmented";
|
|
158
|
+
size?: string | number;
|
|
159
|
+
variant?: "filled" | "light" | "outline" | "default" | "subtle" | "transparent";
|
|
160
|
+
}
|
|
161
|
+
declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime0.JSX.Element;
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/components/TypeForm.d.ts
|
|
164
|
+
interface TypeFormProps<T$1 extends TObject> {
|
|
165
|
+
form: FormModel<T$1>;
|
|
166
|
+
columns?: number | {
|
|
167
|
+
base?: number;
|
|
168
|
+
xs?: number;
|
|
169
|
+
sm?: number;
|
|
170
|
+
md?: number;
|
|
171
|
+
lg?: number;
|
|
172
|
+
xl?: number;
|
|
173
|
+
};
|
|
174
|
+
children?: (input: FormModel<T$1>["input"]) => ReactNode;
|
|
175
|
+
controlProps?: Partial<Omit<ControlProps, "input">>;
|
|
176
|
+
skipFormElement?: boolean;
|
|
177
|
+
skipSubmitButton?: boolean;
|
|
178
|
+
submitButtonProps?: Partial<Omit<ActionSubmitProps, "form">>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* TypeForm component that automatically renders all form inputs based on schema.
|
|
182
|
+
* Uses the Control component to render individual fields and Mantine Grid for responsive layout.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* import { t } from "alepha";
|
|
187
|
+
* import { useForm } from "@alepha/react-form";
|
|
188
|
+
* import { TypeForm } from "@alepha/ui";
|
|
189
|
+
*
|
|
190
|
+
* const form = useForm({
|
|
191
|
+
* schema: t.object({
|
|
192
|
+
* username: t.text(),
|
|
193
|
+
* email: t.text(),
|
|
194
|
+
* age: t.integer(),
|
|
195
|
+
* subscribe: t.boolean(),
|
|
196
|
+
* }),
|
|
197
|
+
* handler: (values) => {
|
|
198
|
+
* console.log(values);
|
|
199
|
+
* },
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* return <TypeForm form={form} columns={2} />;
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime0.JSX.Element | null;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/services/ToastService.d.ts
|
|
208
|
+
interface ToastServiceOptions {
|
|
209
|
+
default?: Partial<NotificationData>;
|
|
210
|
+
}
|
|
211
|
+
declare class ToastService {
|
|
212
|
+
protected readonly raw: {
|
|
213
|
+
readonly show: typeof _mantine_notifications0.showNotification;
|
|
214
|
+
readonly hide: typeof _mantine_notifications0.hideNotification;
|
|
215
|
+
readonly update: typeof _mantine_notifications0.updateNotification;
|
|
216
|
+
readonly clean: typeof _mantine_notifications0.cleanNotifications;
|
|
217
|
+
readonly cleanQueue: typeof _mantine_notifications0.cleanNotificationsQueue;
|
|
218
|
+
readonly updateState: typeof _mantine_notifications0.updateNotificationsState;
|
|
219
|
+
};
|
|
220
|
+
readonly options: ToastServiceOptions;
|
|
221
|
+
show(options: NotificationData): void;
|
|
222
|
+
info(options: Partial<NotificationData>): void;
|
|
223
|
+
success(options: Partial<NotificationData>): void;
|
|
224
|
+
warning(options: Partial<NotificationData>): void;
|
|
225
|
+
danger(options: Partial<NotificationData>): void;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/hooks/useToast.d.ts
|
|
229
|
+
/**
|
|
230
|
+
* Use this hook to access the Toast Service for showing notifications.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* const toast = useToast();
|
|
234
|
+
* toast.success({ message: "Operation completed successfully!" });
|
|
235
|
+
* toast.error({ title: "Error", message: "Something went wrong" });
|
|
236
|
+
*/
|
|
237
|
+
declare const useToast: () => ToastService;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/RootRouter.d.ts
|
|
240
|
+
declare class RootRouter {
|
|
241
|
+
readonly root: _alepha_react0.PageDescriptor<_alepha_react0.PageConfigSchema, any, _alepha_react0.TPropsParentDefault>;
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/utils/icons.d.ts
|
|
245
|
+
/**
|
|
246
|
+
* Icon size presets following Mantine's size conventions
|
|
247
|
+
*/
|
|
248
|
+
declare const ICON_SIZES: {
|
|
249
|
+
readonly xs: 12;
|
|
250
|
+
readonly sm: 16;
|
|
251
|
+
readonly md: 20;
|
|
252
|
+
readonly lg: 24;
|
|
253
|
+
readonly xl: 28;
|
|
89
254
|
};
|
|
255
|
+
type IconSize = keyof typeof ICON_SIZES;
|
|
256
|
+
/**
|
|
257
|
+
* Get the default icon for an input based on its type, format, or name.
|
|
258
|
+
*/
|
|
259
|
+
declare const getDefaultIcon: (params: {
|
|
260
|
+
type?: string;
|
|
261
|
+
format?: string;
|
|
262
|
+
name?: string;
|
|
263
|
+
isEnum?: boolean;
|
|
264
|
+
isArray?: boolean;
|
|
265
|
+
size?: IconSize;
|
|
266
|
+
}) => ReactNode;
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/utils/string.d.ts
|
|
269
|
+
/**
|
|
270
|
+
* Capitalizes the first letter of a string.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* capitalize("hello") // "Hello"
|
|
274
|
+
*/
|
|
275
|
+
declare const capitalize: (str: string) => string;
|
|
276
|
+
/**
|
|
277
|
+
* Converts a path or identifier string into a pretty display name.
|
|
278
|
+
* Removes slashes and capitalizes the first letter.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* prettyName("/userName") // "UserName"
|
|
282
|
+
* prettyName("email") // "Email"
|
|
283
|
+
*/
|
|
284
|
+
declare const prettyName: (name: string) => string;
|
|
90
285
|
//#endregion
|
|
91
286
|
//#region src/index.d.ts
|
|
287
|
+
declare module "typebox" {
|
|
288
|
+
interface TSchemaOptions {
|
|
289
|
+
$control?: Omit<ControlProps, "input">;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
92
292
|
/**
|
|
93
293
|
*
|
|
94
294
|
*
|
|
@@ -96,5 +296,5 @@ type CustomControlProps = {
|
|
|
96
296
|
*/
|
|
97
297
|
declare const AlephaUI: _alepha_core0.Service<_alepha_core0.Module<{}>>;
|
|
98
298
|
//#endregion
|
|
99
|
-
export { Action, AlephaMantineProvider, AlephaUI, Control };
|
|
299
|
+
export { Action, AlephaMantineProvider, AlephaUI, Control, ControlDate, ControlSelect, DarkModeButton, Flex, ICON_SIZES, IconSize, Omnibar, RootRouter, ToastService, TypeForm, capitalize, getDefaultIcon, prettyName, useToast };
|
|
100
300
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/Action.tsx","../src/components/AlephaMantineProvider.tsx","../src/components/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/Control.tsx","../src/components/Action.tsx","../src/components/Omnibar.tsx","../src/components/AlephaMantineProvider.tsx","../src/components/ControlDate.tsx","../src/components/ControlSelect.tsx","../src/components/DarkModeButton.tsx","../src/components/TypeForm.tsx","../src/services/ToastService.tsx","../src/hooks/useToast.ts","../src/RootRouter.ts","../src/utils/icons.tsx","../src/utils/string.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;UAwCiB,YAAA,SAAqB;SAC7B;mBACU;qBACE;2BACM;uBACJ;qBACF;wBACG,QAAQ;qBACX;mBACF;oBACC;EAVH,IAAA,CAAA,EAAA,OAAA,GAWE,cAXW;EACrB,QAAA,CAAA,EAAA,OAAA,GAWc,mBAXd;EACU,IAAA,CAAA,EAAA,OAAA,GAWA,cAXA;EACE,MAAA,CAAA,EAWV,aAXU,CAWI,kBAXJ,CAAA;;;;;;;;;;;;;;;;AAYpB;AA2SD;AAuEA;;;;AC9ZA;AAcA,cDqDM,OCrDiB,EAAA,CAAA,KAAA,EDqDC,YCrDD,EAAA,GDqDa,kBAAA,CAAA,GAAA,CAAA,OAAA,GCrDb,IAAA;AACpB,UDwUc,mBAAA,CCxUd;EAAkB,KAAA,EDyUZ,UCzUY;EAAmB,KAAA,CAAA,EAAA,MAAA;EAAiB,WAAA,CAAA,EAAA,MAAA;EAInD,IAAA,CAAA,EDwUG,SCjRR;AAMD;ACnCM,KFiXM,kBAAA,GEjXY;;;;;;UD7CP,iBAAA,SAA0B;aAC9B;;;;;;;;;;;ED4BI,CAAA;;AAEE,KCjBP,WAAA,GAAc,iBDiBP,GAAA,CChBhB,eDgBgB,GChBE,gBDgBF,GChBqB,iBDgBrB,GAAA,CAAA,CAAA,CAAA;cCZb,MDae,EAAA,CAAA,MAAA,ECbG,WDaH,EAAA,GCbc,kBAAA,CAAA,GAAA,CAAA,OD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