@djangocfg/ui-core 2.1.148 → 2.1.150

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.
@@ -0,0 +1,59 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export type DialogType = 'alert' | 'confirm' | 'prompt';
4
+
5
+ export type DialogVariant = 'default' | 'destructive' | 'warning' | 'success';
6
+
7
+ export interface DialogOptions {
8
+ /** Dialog title (optional for simple messages) */
9
+ title?: string;
10
+ /** Main message text */
11
+ message: string;
12
+ /** Confirm button text */
13
+ confirmText?: string;
14
+ /** Cancel button text (for confirm/prompt) */
15
+ cancelText?: string;
16
+ /** Visual variant */
17
+ variant?: DialogVariant;
18
+ /** Default value (for prompt) */
19
+ defaultValue?: string;
20
+ /** Input placeholder (for prompt) */
21
+ placeholder?: string;
22
+ /** Input type (for prompt): text, email, number, etc. */
23
+ inputType?: string;
24
+ /** Custom icon component */
25
+ icon?: ReactNode;
26
+ /** Prevent closing on overlay click */
27
+ preventClose?: boolean;
28
+ }
29
+
30
+ export interface DialogRequest {
31
+ id: string;
32
+ type: DialogType;
33
+ options: DialogOptions;
34
+ resolve: (value: boolean | string | null) => void;
35
+ }
36
+
37
+ export interface DialogRequestPayload {
38
+ id: string;
39
+ type: DialogType;
40
+ options: DialogOptions;
41
+ }
42
+
43
+ export interface DialogResponsePayload {
44
+ id: string;
45
+ result: boolean | string | null;
46
+ }
47
+
48
+ /** Global window.dialog API */
49
+ export interface DialogAPI {
50
+ alert: (message: string | DialogOptions) => Promise<void>;
51
+ confirm: (message: string | DialogOptions) => Promise<boolean>;
52
+ prompt: (message: string | DialogOptions) => Promise<string | null>;
53
+ }
54
+
55
+ declare global {
56
+ interface Window {
57
+ dialog: DialogAPI;
58
+ }
59
+ }
package/src/lib/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./utils";
2
2
  export * from "./og-image";
3
3
  export * from "./logger";
4
+ export * from "./dialog-service";