reifyui 0.2.0 → 0.3.0

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/index.d.ts CHANGED
@@ -99,6 +99,41 @@ export interface TaskListProps {
99
99
  export const TaskList: ComponentType<TaskListProps>;
100
100
  export function taskStatusGroup(status: string): 'working' | 'done' | 'failed' | 'idle';
101
101
 
102
+ // ── dialogs (alert / confirm / prompt, in-app) ───────────────────────────────
103
+ export type DialogVariant = 'destructive' | 'error' | 'warning' | 'success';
104
+ export interface DialogLabels {
105
+ confirm?: string; cancel?: string; ok?: string; create?: string; required?: string;
106
+ }
107
+ export interface AlertOptions {
108
+ title?: string; message?: ReactNode; variant?: DialogVariant; confirmLabel?: string;
109
+ }
110
+ export interface ConfirmOptions extends AlertOptions {
111
+ destructive?: boolean; cancelLabel?: string;
112
+ }
113
+ export interface PromptOptions extends ConfirmOptions {
114
+ label?: string; placeholder?: string; help?: ReactNode;
115
+ defaultValue?: string; inputType?: string;
116
+ multiline?: boolean; rows?: number; required?: boolean;
117
+ /** Return an error message to reject, or null/undefined to accept. */
118
+ validate?: (value: string) => string | null | undefined;
119
+ }
120
+ export interface CreateType { kind: string; label: string; color?: string; icon?: ReactNode; }
121
+ export interface CreateOptions extends PromptOptions {
122
+ types?: CreateType[]; defaultKind?: string;
123
+ }
124
+ export interface DialogApi {
125
+ alert(opts: AlertOptions): Promise<boolean>;
126
+ confirm(opts: ConfirmOptions): Promise<boolean>;
127
+ /** Resolves to the entered string, or null when cancelled. */
128
+ prompt(opts: PromptOptions): Promise<string | null>;
129
+ create(opts: CreateOptions): Promise<{ kind: string; name: string } | null>;
130
+ labels: Required<DialogLabels>;
131
+ }
132
+ export const DialogHost: ComponentType<{
133
+ children?: ReactNode; locale?: 'en' | 'zh'; labels?: DialogLabels;
134
+ }>;
135
+ export function useDialog(): DialogApi;
136
+
102
137
  // ── auth client (optional; couples to a /v1/auth-style backend) ──────────────
103
138
  export interface AuthConfig { engine: string; product: string; loginHash?: string; }
104
139
  export function configureAuth(cfg: Partial<AuthConfig> & { product: string; engine: string }): void;