alepha 0.10.7 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ui.d.ts CHANGED
@@ -2,26 +2,61 @@ import * as _alepha_core0 from "alepha";
2
2
  import { TObject } from "alepha";
3
3
  import * as _alepha_react0 from "alepha/react";
4
4
  import { RouterGoOptions, UseActiveOptions } from "alepha/react";
5
+ import { ModalsProviderProps } from "@mantine/modals";
6
+ import { AutocompleteProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, FileInputProps, Flex, MantineProviderProps, ModalProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SwitchProps, TableProps, TagsInputProps, TextInputProps, TextareaProps, TooltipProps } from "@mantine/core";
7
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
8
+ import React$1, { ComponentType, FC, ReactNode } from "react";
5
9
  import * as _mantine_notifications0 from "@mantine/notifications";
6
10
  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";
9
11
  import { FormModel, InputField } from "alepha/react/form";
10
- import { ComponentType, ReactNode } from "react";
11
- import { ModalsProviderProps } from "@mantine/modals";
12
12
  import { NavigationProgressProps } from "@mantine/nprogress";
13
13
  import { SpotlightActionData } from "@mantine/spotlight";
14
14
  import { DateInputProps, DateTimePickerProps, TimeInputProps } from "@mantine/dates";
15
15
 
16
+ //#region src/utils/parseInput.d.ts
17
+ interface GenericControlProps {
18
+ input: InputField;
19
+ title?: string;
20
+ description?: string;
21
+ icon?: ReactNode;
22
+ }
23
+ //#endregion
24
+ //#region src/components/ControlSelect.d.ts
25
+ type SelectValueLabel = string | {
26
+ value: string;
27
+ label: string;
28
+ icon?: string;
29
+ };
30
+ interface ControlSelectProps extends GenericControlProps {
31
+ select?: boolean | SelectProps;
32
+ multi?: boolean | MultiSelectProps;
33
+ tags?: boolean | TagsInputProps;
34
+ autocomplete?: boolean | AutocompleteProps;
35
+ segmented?: boolean | Partial<SegmentedControlProps>;
36
+ loader?: () => Promise<SelectValueLabel[]>;
37
+ }
38
+ /**
39
+ * ControlSelect component for handling Select, MultiSelect, and TagsInput.
40
+ *
41
+ * Features:
42
+ * - Basic Select with enum support
43
+ * - MultiSelect for array of enums
44
+ * - TagsInput for array of strings (no enum)
45
+ * - Future: Lazy loading
46
+ * - Future: Searchable/filterable options
47
+ * - Future: Custom option rendering
48
+ *
49
+ * Automatically detects enum values and array types from schema.
50
+ */
51
+ declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime6.JSX.Element | null;
52
+ //#endregion
16
53
  //#region src/components/Control.d.ts
17
54
  interface ControlProps extends GenericControlProps {
18
55
  text?: TextInputProps;
19
56
  area?: boolean | TextareaProps;
20
- select?: boolean | SelectProps;
21
- autocomplete?: boolean | AutocompleteProps;
57
+ select?: boolean | Partial<ControlSelectProps>;
22
58
  password?: boolean | PasswordInputProps;
23
59
  switch?: boolean | SwitchProps;
24
- segmented?: boolean | Partial<SegmentedControlProps>;
25
60
  number?: boolean | NumberInputProps;
26
61
  file?: boolean | FileInputProps;
27
62
  color?: boolean | ColorInputProps;
@@ -51,22 +86,69 @@ interface ControlProps extends GenericControlProps {
51
86
  *
52
87
  * Automatically handles labels, descriptions, error messages, required state, and default icons.
53
88
  */
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
- }
89
+ declare const Control: (_props: ControlProps) => react_jsx_runtime6.JSX.Element | null;
61
90
  type CustomControlProps = {
62
91
  defaultValue: any;
63
92
  onChange: (value: any) => void;
64
93
  };
65
94
  //#endregion
66
95
  //#region src/components/Action.d.ts
96
+ interface ActionMenuItem {
97
+ /**
98
+ * Menu item type
99
+ */
100
+ type?: "item" | "divider" | "label";
101
+ /**
102
+ * Label text for the menu item
103
+ */
104
+ label?: string;
105
+ /**
106
+ * Icon element to display before the label
107
+ */
108
+ icon?: ReactNode;
109
+ /**
110
+ * Click handler for menu items
111
+ */
112
+ onClick?: () => void;
113
+ /**
114
+ * Color for the menu item (e.g., "red" for danger actions)
115
+ */
116
+ color?: string;
117
+ /**
118
+ * Nested submenu items
119
+ */
120
+ children?: ActionMenuItem[];
121
+ }
122
+ interface ActionMenuConfig {
123
+ /**
124
+ * Array of menu items to display
125
+ */
126
+ items: ActionMenuItem[];
127
+ /**
128
+ * Menu position relative to the button
129
+ */
130
+ position?: "bottom" | "bottom-start" | "bottom-end" | "top" | "top-start" | "top-end" | "left" | "right";
131
+ /**
132
+ * Menu width
133
+ */
134
+ width?: number | string;
135
+ /**
136
+ * Menu shadow
137
+ */
138
+ shadow?: "xs" | "sm" | "md" | "lg" | "xl";
139
+ }
67
140
  interface ActionCommonProps extends ButtonProps {
68
141
  children?: ReactNode;
69
142
  textVisibleFrom?: "xs" | "sm" | "md" | "lg" | "xl";
143
+ /**
144
+ * Tooltip to display on hover. Can be a string for simple tooltips
145
+ * or a TooltipProps object for advanced configuration.
146
+ */
147
+ tooltip?: string | TooltipProps;
148
+ /**
149
+ * Menu configuration. When provided, the action will display a dropdown menu.
150
+ */
151
+ menu?: ActionMenuConfig;
70
152
  /**
71
153
  * If set, a confirmation dialog will be shown before performing the action.
72
154
  * If `true`, a default title and message will be used.
@@ -79,7 +161,7 @@ interface ActionCommonProps extends ButtonProps {
79
161
  };
80
162
  }
81
163
  type ActionProps = ActionCommonProps & (ActiveHrefProps | ActionClickProps | ActionSubmitProps | {});
82
- declare const Action: (_props: ActionProps) => react_jsx_runtime0.JSX.Element;
164
+ declare const Action: (_props: ActionProps) => react_jsx_runtime6.JSX.Element;
83
165
  interface ActionSubmitProps extends ButtonProps {
84
166
  form: FormModel<any>;
85
167
  }
@@ -99,7 +181,7 @@ interface OmnibarProps {
99
181
  searchPlaceholder?: string;
100
182
  nothingFound?: ReactNode;
101
183
  }
102
- declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime0.JSX.Element;
184
+ declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime6.JSX.Element;
103
185
  //#endregion
104
186
  //#region src/components/AlephaMantineProvider.d.ts
105
187
  interface AlephaMantineProviderProps {
@@ -111,7 +193,7 @@ interface AlephaMantineProviderProps {
111
193
  modals?: ModalsProviderProps;
112
194
  omnibar?: OmnibarProps;
113
195
  }
114
- declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime0.JSX.Element;
196
+ declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime6.JSX.Element;
115
197
  //#endregion
116
198
  //#region src/components/ControlDate.d.ts
117
199
  interface ControlDateProps extends GenericControlProps {
@@ -129,28 +211,7 @@ interface ControlDateProps extends GenericControlProps {
129
211
  *
130
212
  * Automatically detects date formats from schema and renders appropriate picker.
131
213
  */
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 {
136
- select?: boolean | SelectProps;
137
- multi?: boolean | MultiSelectProps;
138
- tags?: boolean | TagsInputProps;
139
- }
140
- /**
141
- * ControlSelect component for handling Select, MultiSelect, and TagsInput.
142
- *
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
150
- *
151
- * Automatically detects enum values and array types from schema.
152
- */
153
- declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime0.JSX.Element | null;
214
+ declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime6.JSX.Element | null;
154
215
  //#endregion
155
216
  //#region src/components/DarkModeButton.d.ts
156
217
  interface DarkModeButtonProps {
@@ -158,11 +219,256 @@ interface DarkModeButtonProps {
158
219
  size?: string | number;
159
220
  variant?: "filled" | "light" | "outline" | "default" | "subtle" | "transparent";
160
221
  }
161
- declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime0.JSX.Element;
222
+ declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime6.JSX.Element;
223
+ //#endregion
224
+ //#region src/components/DataTable.d.ts
225
+ type SortDirection = "asc" | "desc" | null;
226
+ interface DataTableColumn<T = any> {
227
+ accessor: keyof T | string;
228
+ title?: string;
229
+ width?: number | string;
230
+ sortable?: boolean;
231
+ filterable?: boolean;
232
+ hidden?: boolean;
233
+ render?: (value: any, record: T, index: number) => React$1.ReactNode;
234
+ renderHeader?: () => React$1.ReactNode;
235
+ align?: "left" | "center" | "right";
236
+ ellipsis?: boolean;
237
+ className?: string;
238
+ headerClassName?: string;
239
+ }
240
+ interface DataTableSort {
241
+ column: string;
242
+ direction: SortDirection;
243
+ }
244
+ interface DataTableFilter {
245
+ column: string;
246
+ value: string;
247
+ operator?: "contains" | "equals" | "startsWith" | "endsWith";
248
+ }
249
+ interface DataTableProps<T = any> extends Omit<TableProps, "data"> {
250
+ data: T[];
251
+ columns: DataTableColumn<T>[];
252
+ loading?: boolean;
253
+ emptyMessage?: string;
254
+ selectable?: boolean;
255
+ selectedRows?: T[];
256
+ onRowSelect?: (rows: T[]) => void;
257
+ sortable?: boolean;
258
+ sort?: DataTableSort;
259
+ onSortChange?: (sort: DataTableSort) => void;
260
+ filterable?: boolean;
261
+ filters?: DataTableFilter[];
262
+ onFiltersChange?: (filters: DataTableFilter[]) => void;
263
+ filterPlaceholder?: string;
264
+ paginate?: boolean;
265
+ page?: number;
266
+ pageSize?: number;
267
+ totalRecords?: number;
268
+ pageSizeOptions?: number[];
269
+ onPageChange?: (page: number) => void;
270
+ onPageSizeChange?: (size: number) => void;
271
+ rowActions?: (record: T, index: number) => React$1.ReactNode;
272
+ onRowClick?: (record: T, index: number) => void;
273
+ rowClassName?: (record: T, index: number) => string;
274
+ showHeader?: boolean;
275
+ showFooter?: boolean;
276
+ stickyHeader?: boolean;
277
+ striped?: boolean;
278
+ highlightOnHover?: boolean;
279
+ showToolbar?: boolean;
280
+ title?: string;
281
+ actions?: React$1.ReactNode;
282
+ showColumnToggle?: boolean;
283
+ showRefresh?: boolean;
284
+ onRefresh?: () => void;
285
+ showExport?: boolean;
286
+ onExport?: () => void;
287
+ height?: number | string;
288
+ minHeight?: number | string;
289
+ maxHeight?: number | string;
290
+ }
291
+ declare function DataTable<T = any>({
292
+ data,
293
+ columns: initialColumns,
294
+ loading,
295
+ emptyMessage,
296
+ selectable,
297
+ selectedRows,
298
+ onRowSelect,
299
+ sortable,
300
+ sort,
301
+ onSortChange,
302
+ filterable,
303
+ filters,
304
+ onFiltersChange,
305
+ filterPlaceholder,
306
+ paginate,
307
+ page,
308
+ pageSize,
309
+ totalRecords,
310
+ pageSizeOptions,
311
+ onPageChange,
312
+ onPageSizeChange,
313
+ rowActions,
314
+ onRowClick,
315
+ rowClassName,
316
+ showHeader,
317
+ showFooter,
318
+ stickyHeader,
319
+ striped,
320
+ highlightOnHover,
321
+ showToolbar,
322
+ title,
323
+ actions,
324
+ showColumnToggle,
325
+ showRefresh,
326
+ onRefresh,
327
+ showExport,
328
+ onExport,
329
+ height,
330
+ minHeight,
331
+ maxHeight,
332
+ ...tableProps
333
+ }: DataTableProps<T>): react_jsx_runtime6.JSX.Element;
334
+ //#endregion
335
+ //#region src/services/DialogService.d.ts
336
+ interface BaseDialogOptions extends Partial<ModalProps> {
337
+ title?: ReactNode;
338
+ message?: ReactNode;
339
+ content?: any;
340
+ }
341
+ interface AlertDialogOptions extends BaseDialogOptions {
342
+ okLabel?: string;
343
+ }
344
+ interface ConfirmDialogOptions extends BaseDialogOptions {
345
+ confirmLabel?: string;
346
+ cancelLabel?: string;
347
+ confirmColor?: string;
348
+ }
349
+ interface PromptDialogOptions extends BaseDialogOptions {
350
+ placeholder?: string;
351
+ defaultValue?: string;
352
+ label?: string;
353
+ required?: boolean;
354
+ submitLabel?: string;
355
+ cancelLabel?: string;
356
+ }
357
+ interface AlertDialogProps {
358
+ options?: AlertDialogOptions;
359
+ onClose: () => void;
360
+ }
361
+ interface ConfirmDialogProps {
362
+ options?: ConfirmDialogOptions;
363
+ onConfirm: (confirmed: boolean) => void;
364
+ }
365
+ interface PromptDialogProps {
366
+ options?: PromptDialogOptions;
367
+ onSubmit: (value: string | null) => void;
368
+ }
369
+ interface DialogServiceOptions {
370
+ default?: Partial<BaseDialogOptions>;
371
+ }
372
+ declare class DialogService {
373
+ readonly options: DialogServiceOptions;
374
+ /**
375
+ * Show an alert dialog with a message
376
+ */
377
+ alert(options?: AlertDialogOptions): Promise<void>;
378
+ /**
379
+ * Show a confirmation dialog that returns a promise
380
+ */
381
+ confirm(options?: ConfirmDialogOptions): Promise<boolean>;
382
+ /**
383
+ * Show a prompt dialog to get user input
384
+ */
385
+ prompt(options?: PromptDialogOptions): Promise<string | null>;
386
+ /**
387
+ * Open a custom dialog with provided content
388
+ */
389
+ open(options?: BaseDialogOptions): string;
390
+ /**
391
+ * Show a JSON editor/viewer dialog
392
+ */
393
+ json(data?: any, options?: BaseDialogOptions): void;
394
+ /**
395
+ * Show a form dialog for structured input
396
+ */
397
+ form(options?: BaseDialogOptions): Promise<any>;
398
+ /**
399
+ * Close the currently open dialog or a specific dialog by ID
400
+ */
401
+ close(modalId?: string): void;
402
+ /**
403
+ * Show a loading/progress dialog with optional progress percentage
404
+ */
405
+ loading(options?: BaseDialogOptions & {
406
+ progress?: number;
407
+ }): void;
408
+ /**
409
+ * Show an image viewer/gallery dialog
410
+ */
411
+ image(src: string | string[], options?: BaseDialogOptions): void;
412
+ /**
413
+ * Show a table/data grid dialog for displaying tabular data
414
+ */
415
+ table(data: any[], options?: BaseDialogOptions & {
416
+ columns?: any[];
417
+ }): void;
418
+ /**
419
+ * Show a multi-step wizard dialog
420
+ */
421
+ wizard(steps: any[], options?: BaseDialogOptions): Promise<any>;
422
+ }
423
+ //#endregion
424
+ //#region src/components/dialogs/AlertDialog.d.ts
425
+ declare function AlertDialog({
426
+ options,
427
+ onClose
428
+ }: AlertDialogProps): react_jsx_runtime6.JSX.Element;
429
+ //#endregion
430
+ //#region src/components/dialogs/ConfirmDialog.d.ts
431
+ declare function ConfirmDialog({
432
+ options,
433
+ onConfirm
434
+ }: ConfirmDialogProps): react_jsx_runtime6.JSX.Element;
435
+ //#endregion
436
+ //#region src/components/dialogs/PromptDialog.d.ts
437
+ declare function PromptDialog({
438
+ options,
439
+ onSubmit
440
+ }: PromptDialogProps): react_jsx_runtime6.JSX.Element;
441
+ //#endregion
442
+ //#region src/components/Sidebar.d.ts
443
+ interface MenuItem {
444
+ id: string;
445
+ label: string;
446
+ icon?: ReactNode;
447
+ href?: string;
448
+ activeStartsWith?: boolean;
449
+ onClick?: () => void;
450
+ children?: MenuItem[];
451
+ }
452
+ interface SidebarProps {
453
+ menu: MenuItem[];
454
+ defaultOpenIds?: string[];
455
+ onItemClick?: (item: MenuItem) => void;
456
+ showSearchButton?: boolean;
457
+ onSearchClick?: () => void;
458
+ }
459
+ declare const Sidebar: FC<SidebarProps>;
460
+ interface SidebarItemProps {
461
+ item: MenuItem;
462
+ level: number;
463
+ openIds: Set<string>;
464
+ onToggle: (id: string) => void;
465
+ onItemClick?: (item: MenuItem) => void;
466
+ }
467
+ declare const SidebarItem: React.FC<SidebarItemProps>;
162
468
  //#endregion
163
469
  //#region src/components/TypeForm.d.ts
164
- interface TypeFormProps<T$1 extends TObject> {
165
- form: FormModel<T$1>;
470
+ interface TypeFormProps<T extends TObject> {
471
+ form: FormModel<T>;
166
472
  columns?: number | {
167
473
  base?: number;
168
474
  xs?: number;
@@ -171,11 +477,12 @@ interface TypeFormProps<T$1 extends TObject> {
171
477
  lg?: number;
172
478
  xl?: number;
173
479
  };
174
- children?: (input: FormModel<T$1>["input"]) => ReactNode;
480
+ children?: (input: FormModel<T>["input"]) => ReactNode;
175
481
  controlProps?: Partial<Omit<ControlProps, "input">>;
176
482
  skipFormElement?: boolean;
177
483
  skipSubmitButton?: boolean;
178
484
  submitButtonProps?: Partial<Omit<ActionSubmitProps, "form">>;
485
+ resetButtonProps?: Partial<Omit<ActionSubmitProps, "form">>;
179
486
  }
180
487
  /**
181
488
  * TypeForm component that automatically renders all form inputs based on schema.
@@ -202,7 +509,19 @@ interface TypeFormProps<T$1 extends TObject> {
202
509
  * return <TypeForm form={form} columns={2} />;
203
510
  * ```
204
511
  */
205
- declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime0.JSX.Element | null;
512
+ declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime6.JSX.Element | null;
513
+ //#endregion
514
+ //#region src/hooks/useDialog.d.ts
515
+ /**
516
+ * Use this hook to access the Dialog Service for showing various dialog types.
517
+ *
518
+ * @example
519
+ * const dialog = useDialog();
520
+ * await dialog.alert({ title: "Alert", message: "This is an alert message" });
521
+ * const confirmed = await dialog.confirm({ title: "Confirm", message: "Are you sure?" });
522
+ * const input = await dialog.prompt({ title: "Input", message: "Enter your name:" });
523
+ */
524
+ declare const useDialog: () => DialogService;
206
525
  //#endregion
207
526
  //#region src/services/ToastService.d.ts
208
527
  interface ToastServiceOptions {
@@ -290,11 +609,11 @@ declare module "typebox" {
290
609
  }
291
610
  }
292
611
  /**
293
- *
612
+ * Mantine
294
613
  *
295
614
  * @module alepha.ui
296
615
  */
297
616
  declare const AlephaUI: _alepha_core0.Service<_alepha_core0.Module<{}>>;
298
617
  //#endregion
299
- export { Action, AlephaMantineProvider, AlephaUI, Control, ControlDate, ControlSelect, DarkModeButton, Flex, ICON_SIZES, IconSize, Omnibar, RootRouter, ToastService, TypeForm, capitalize, getDefaultIcon, prettyName, useToast };
618
+ export { Action, AlephaMantineProvider, AlephaUI, AlertDialog, type AlertDialogOptions, type AlertDialogProps, type BaseDialogOptions, ConfirmDialog, type ConfirmDialogOptions, type ConfirmDialogProps, Control, ControlDate, ControlSelect, DarkModeButton, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableSort, DialogService, Flex, ICON_SIZES, IconSize, type MenuItem, Omnibar, PromptDialog, type PromptDialogOptions, type PromptDialogProps, RootRouter, Sidebar, SidebarItem, type SidebarItemProps, type SidebarProps, ToastService, TypeForm, capitalize, getDefaultIcon, prettyName, useDialog, useToast };
300
619
  //# sourceMappingURL=index.d.ts.map
package/vite.d.ts CHANGED
@@ -1,8 +1,13 @@
1
+ import { Alepha } from "alepha";
1
2
  import { Options } from "@vitejs/plugin-react";
2
3
  import { BrotliOptions, ZlibOptions } from "node:zlib";
3
- import { Alepha } from "alepha";
4
4
  import { Plugin, UserConfig } from "vite";
5
5
 
6
+ //#region src/helpers/getEntryFiles.d.ts
7
+ declare const getClientEntry: (root?: string) => Promise<string | undefined>;
8
+ declare const getServerEntry: (root?: string) => Promise<string>;
9
+ declare function extractFirstModuleScriptSrc(html: string): string;
10
+ //#endregion
6
11
  //#region src/viteCompress.d.ts
7
12
  interface ViteCompressOptions {
8
13
  /**
@@ -188,5 +193,5 @@ declare global {
188
193
  //# sourceMappingURL=index.d.ts.map
189
194
 
190
195
  //#endregion
191
- export { VercelConfig, ViteAlephaBuildOptions, ViteAlephaBuildVercelOptions, ViteAlephaDevOptions, ViteAlephaOptions, ViteCompressOptions, compressFile, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteCompress };
196
+ export { VercelConfig, ViteAlephaBuildOptions, ViteAlephaBuildVercelOptions, ViteAlephaDevOptions, ViteAlephaOptions, ViteCompressOptions, compressFile, extractFirstModuleScriptSrc, getClientEntry, getServerEntry, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteCompress };
192
197
  //# sourceMappingURL=index.d.ts.map