@nubase/frontend 0.1.2 → 0.1.5
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.css +352 -34
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3391 -393
- package/dist/index.d.ts +3391 -393
- package/dist/index.js +17507 -6905
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17424 -6962
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +2152 -511
- package/package.json +54 -29
- package/README.md +0 -127
package/dist/index.d.mts
CHANGED
|
@@ -1,154 +1,183 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { FC, ReactNode, RefObject } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
2
|
+
import React__default, { ReactElement, FC, ReactNode, Key, RefObject } from 'react';
|
|
3
|
+
import * as _nubase_core from '@nubase/core';
|
|
4
|
+
import { ObjectSchema, Infer, ObjectShape, ObjectOutput, SchemaMetadata, Layout, ArraySchema, SeriesWidgetRequestSchema, ProportionalWidgetRequestSchema, KpiWidgetRequestSchema, TableWidgetRequestSchema, RequestSchema, InferRequestParams, InferRequestBody, InferResponseBody, BaseSchema } from '@nubase/core';
|
|
5
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
+
import { UseMutationOptions, UseQueryOptions, QueryClient } from '@tanstack/react-query';
|
|
7
|
+
import { AnyRouter } from '@tanstack/react-router';
|
|
6
8
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
9
|
import { VariantProps } from 'class-variance-authority';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
defaultRightWidth?: number;
|
|
18
|
-
}
|
|
19
|
-
declare const Dock: React__default.FC<DockProps>;
|
|
20
|
-
|
|
21
|
-
type SchemaFormProps<TSchema extends ObjectSchema<any>, TData extends Infer<TSchema> = Infer<TSchema>> = {
|
|
22
|
-
schema: TSchema;
|
|
23
|
-
onSubmit: (data: TData) => void | Promise<void>;
|
|
24
|
-
submitText?: string;
|
|
25
|
-
className?: string;
|
|
26
|
-
/** Specify which layout to use (if schema has layouts defined) */
|
|
27
|
-
layoutName?: string;
|
|
28
|
-
/** Options for computed metadata behavior */
|
|
29
|
-
computedMetadata?: {
|
|
30
|
-
/** Debounce delay in milliseconds for computed metadata updates (default: 300ms) */
|
|
31
|
-
debounceMs?: number;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
type SchemaFormRef<TSchema extends ObjectSchema<any>> = ReactFormExtendedApi<Infer<TSchema>, any, any, any, any, any, any, any, any, any>;
|
|
35
|
-
declare const SchemaForm: <TSchema extends ObjectSchema<any>>(props: SchemaFormProps<TSchema> & {
|
|
36
|
-
ref?: React__default.Ref<SchemaFormRef<TSchema>>;
|
|
37
|
-
}) => React__default.ReactElement;
|
|
10
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
11
|
+
import * as RechartsPrimitive from 'recharts';
|
|
12
|
+
import { Layout as Layout$1 } from 'react-grid-layout';
|
|
13
|
+
export { Layout, LayoutItem } from 'react-grid-layout';
|
|
14
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
15
|
+
import { ReactFormExtendedApi, AnyFieldApi } from '@tanstack/react-form';
|
|
16
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
17
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
18
|
+
import { ZodError } from 'zod';
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
isValidating: boolean;
|
|
45
|
-
isTouched: boolean;
|
|
46
|
-
isValid: boolean;
|
|
47
|
-
errors: (string | undefined)[];
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
handleChange: (value: any) => void;
|
|
51
|
-
handleBlur: () => void;
|
|
52
|
-
}
|
|
53
|
-
interface FormFieldRendererProps {
|
|
54
|
-
schema: BaseSchema<any>;
|
|
55
|
-
fieldState: FieldApi;
|
|
56
|
-
metadata: SchemaMetadata<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Interface for resource actions executor
|
|
22
|
+
*/
|
|
23
|
+
interface ResourceActionsExecutor {
|
|
24
|
+
execute: (action: ResourceAction, resourceType: string, selectedIds: (string | number)[]) => Promise<void>;
|
|
57
25
|
}
|
|
58
|
-
declare const FormFieldRenderer: React__default.FC<FormFieldRendererProps>;
|
|
59
26
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Represents an authenticated user in the system.
|
|
29
|
+
* Applications can extend this with additional fields as needed.
|
|
30
|
+
*/
|
|
31
|
+
interface AuthenticatedUser {
|
|
32
|
+
id: number;
|
|
33
|
+
email: string;
|
|
34
|
+
displayName: string;
|
|
63
35
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Authentication state managed by the AuthenticationController.
|
|
38
|
+
*/
|
|
39
|
+
interface AuthenticationState {
|
|
40
|
+
/** Current authentication status */
|
|
41
|
+
status: "loading" | "authenticated" | "unauthenticated";
|
|
42
|
+
/** The authenticated user, if any */
|
|
43
|
+
user: AuthenticatedUser | null;
|
|
44
|
+
/** Any error that occurred during authentication */
|
|
45
|
+
error: Error | null;
|
|
71
46
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Listener function for authentication state changes.
|
|
49
|
+
*/
|
|
50
|
+
type AuthenticationStateListener = (state: AuthenticationState) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Login credentials for email/password authentication.
|
|
53
|
+
*/
|
|
54
|
+
interface LoginCredentials {
|
|
55
|
+
email: string;
|
|
56
|
+
password: string;
|
|
57
|
+
/** Workspace slug for path-based multi-workspace */
|
|
58
|
+
workspace?: string;
|
|
79
59
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
required?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Workspace info returned during two-step login.
|
|
62
|
+
*/
|
|
63
|
+
interface WorkspaceInfo {
|
|
64
|
+
id: number;
|
|
65
|
+
slug: string;
|
|
66
|
+
name: string;
|
|
88
67
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Response from login start (step 1 of two-step auth).
|
|
70
|
+
*/
|
|
71
|
+
interface LoginStartResponse {
|
|
72
|
+
/** Temporary token for completing login */
|
|
73
|
+
loginToken: string;
|
|
74
|
+
/** User's email */
|
|
75
|
+
email: string;
|
|
76
|
+
/** List of workspaces the user belongs to */
|
|
77
|
+
workspaces: WorkspaceInfo[];
|
|
96
78
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
children: React__default.ReactElement<{
|
|
106
|
-
id?: string;
|
|
107
|
-
hasError?: boolean;
|
|
108
|
-
}>;
|
|
109
|
-
field?: AnyFieldApi | FieldApi;
|
|
79
|
+
/**
|
|
80
|
+
* Credentials for completing two-step login.
|
|
81
|
+
*/
|
|
82
|
+
interface LoginCompleteCredentials {
|
|
83
|
+
/** Temporary login token from login start */
|
|
84
|
+
loginToken: string;
|
|
85
|
+
/** Selected workspace slug */
|
|
86
|
+
workspace: string;
|
|
110
87
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Signup credentials for creating new user and workspace.
|
|
90
|
+
*/
|
|
91
|
+
interface SignupCredentials {
|
|
92
|
+
workspace: string;
|
|
93
|
+
workspaceName: string;
|
|
94
|
+
email: string;
|
|
95
|
+
displayName: string;
|
|
96
|
+
password: string;
|
|
120
97
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
98
|
+
/**
|
|
99
|
+
* AuthenticationController interface.
|
|
100
|
+
*
|
|
101
|
+
* This is the core abstraction for authentication in Nubase applications.
|
|
102
|
+
* Applications implement this interface to provide their own authentication logic.
|
|
103
|
+
*
|
|
104
|
+
* The controller manages authentication state and provides methods for:
|
|
105
|
+
* - Logging in and out
|
|
106
|
+
* - Checking current authentication status
|
|
107
|
+
* - Subscribing to state changes
|
|
108
|
+
*
|
|
109
|
+
* Future extensibility:
|
|
110
|
+
* - Social login providers (Google, GitHub, etc.)
|
|
111
|
+
* - Forgot password / password reset
|
|
112
|
+
* - Two-factor authentication
|
|
113
|
+
* - Session management
|
|
114
|
+
*/
|
|
115
|
+
interface AuthenticationController {
|
|
116
|
+
/**
|
|
117
|
+
* Get the current authentication state.
|
|
118
|
+
*/
|
|
119
|
+
getState(): AuthenticationState;
|
|
120
|
+
/**
|
|
121
|
+
* Subscribe to authentication state changes.
|
|
122
|
+
* Returns an unsubscribe function.
|
|
123
|
+
*/
|
|
124
|
+
subscribe(listener: AuthenticationStateListener): () => void;
|
|
125
|
+
/**
|
|
126
|
+
* Log in with email and password.
|
|
127
|
+
* On success, updates state to authenticated.
|
|
128
|
+
* On failure, throws an error.
|
|
129
|
+
*/
|
|
130
|
+
login(credentials: LoginCredentials): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Log out the current user.
|
|
133
|
+
* Clears authentication state.
|
|
134
|
+
*/
|
|
135
|
+
logout(): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Initialize the authentication controller.
|
|
138
|
+
* Called by NubaseApp on startup to check for existing sessions.
|
|
139
|
+
* Should check for stored credentials/tokens and restore session if valid.
|
|
140
|
+
*/
|
|
141
|
+
initialize(): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Start the two-step login process (optional).
|
|
144
|
+
* Step 1: Validates credentials and returns list of workspaces user belongs to.
|
|
145
|
+
* If not implemented, falls back to single-step login.
|
|
146
|
+
*/
|
|
147
|
+
loginStart?(credentials: {
|
|
148
|
+
email: string;
|
|
149
|
+
password: string;
|
|
150
|
+
}): Promise<LoginStartResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Complete the two-step login process (optional).
|
|
153
|
+
* Step 2: Select a workspace and complete authentication.
|
|
154
|
+
* If not implemented, falls back to single-step login.
|
|
155
|
+
*/
|
|
156
|
+
loginComplete?(credentials: LoginCompleteCredentials): Promise<WorkspaceInfo>;
|
|
157
|
+
/**
|
|
158
|
+
* Sign up a new user and create a new workspace (optional).
|
|
159
|
+
* Creates both the workspace and the initial admin user.
|
|
160
|
+
*/
|
|
161
|
+
signup?(credentials: SignupCredentials): Promise<void>;
|
|
135
162
|
}
|
|
136
|
-
declare const Select: React__default.ForwardRefExoticComponent<SelectProps<any> & React__default.RefAttributes<HTMLDivElement>>;
|
|
137
163
|
|
|
164
|
+
type ModalSize = "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
138
165
|
type ModalAlignment = "center" | "top";
|
|
139
|
-
type
|
|
140
|
-
open: boolean;
|
|
166
|
+
type BaseModalFrameProps = {
|
|
141
167
|
onClose: () => void;
|
|
142
|
-
|
|
168
|
+
};
|
|
169
|
+
type ModalConfig = {
|
|
170
|
+
content: ReactElement<BaseModalFrameProps>;
|
|
171
|
+
size?: ModalSize;
|
|
143
172
|
alignment?: ModalAlignment;
|
|
144
173
|
showBackdrop?: boolean;
|
|
145
|
-
showCloseButton?: boolean;
|
|
146
|
-
className?: string;
|
|
147
|
-
size?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
148
174
|
zIndex?: number;
|
|
149
|
-
|
|
175
|
+
onDismiss?: () => void;
|
|
176
|
+
};
|
|
177
|
+
type ModalInstance = {
|
|
178
|
+
id: string;
|
|
179
|
+
config: ModalConfig;
|
|
150
180
|
};
|
|
151
|
-
declare const Modal: FC<ModalProps>;
|
|
152
181
|
|
|
153
182
|
type DialogProps = {
|
|
154
183
|
open: boolean;
|
|
@@ -157,356 +186,874 @@ type DialogProps = {
|
|
|
157
186
|
title?: string;
|
|
158
187
|
children: ReactNode;
|
|
159
188
|
size?: "sm" | "md" | "lg" | "xl" | "2xl";
|
|
160
|
-
showCloseButton?: boolean;
|
|
161
189
|
className?: string;
|
|
162
190
|
alignment?: ModalAlignment;
|
|
163
191
|
confirmText?: string;
|
|
164
192
|
cancelText?: string;
|
|
165
|
-
confirmVariant?: "
|
|
193
|
+
confirmVariant?: "default" | "destructive";
|
|
166
194
|
showBackdrop?: boolean;
|
|
167
195
|
zIndex?: number;
|
|
168
196
|
};
|
|
169
197
|
declare const Dialog: FC<DialogProps>;
|
|
170
198
|
|
|
171
|
-
type DialogConfig =
|
|
199
|
+
type DialogConfig = {
|
|
172
200
|
title?: string;
|
|
173
201
|
content: ReactNode;
|
|
174
202
|
onConfirm?: () => void;
|
|
203
|
+
onCancel?: () => void;
|
|
204
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl";
|
|
205
|
+
className?: string;
|
|
206
|
+
alignment?: ModalAlignment;
|
|
207
|
+
confirmText?: string;
|
|
208
|
+
cancelText?: string;
|
|
209
|
+
confirmVariant?: "default" | "destructive";
|
|
210
|
+
showBackdrop?: boolean;
|
|
211
|
+
zIndex?: number;
|
|
175
212
|
};
|
|
176
|
-
|
|
177
|
-
|
|
213
|
+
type UseDialogResult = {
|
|
214
|
+
openDialog: (config: DialogConfig) => void;
|
|
178
215
|
hide: () => void;
|
|
179
216
|
isOpen: boolean;
|
|
180
|
-
DialogComponent:
|
|
217
|
+
DialogComponent: null;
|
|
181
218
|
};
|
|
219
|
+
declare const useDialog: () => UseDialogResult;
|
|
182
220
|
|
|
183
|
-
type
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
221
|
+
type ModalProps = {
|
|
222
|
+
open: boolean;
|
|
223
|
+
onClose: () => void;
|
|
224
|
+
content: ReactElement<BaseModalFrameProps>;
|
|
225
|
+
alignment?: ModalAlignment;
|
|
226
|
+
showBackdrop?: boolean;
|
|
227
|
+
size?: ModalSize;
|
|
228
|
+
zIndex?: number;
|
|
187
229
|
};
|
|
188
|
-
declare const
|
|
230
|
+
declare const Modal: FC<ModalProps>;
|
|
231
|
+
|
|
232
|
+
type ModalFrameProps = {
|
|
233
|
+
onClose?: () => void;
|
|
189
234
|
children: ReactNode;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
openModal: (component: ReactNode, options?: Omit<ModalConfig, "id" | "component">) => string;
|
|
193
|
-
closeModal: (id?: string) => void;
|
|
194
|
-
closeAllModals: () => void;
|
|
195
|
-
modalCount: number;
|
|
235
|
+
className?: string;
|
|
236
|
+
"data-testid"?: string;
|
|
196
237
|
};
|
|
238
|
+
declare const ModalFrame: FC<ModalFrameProps>;
|
|
197
239
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
duration?: number;
|
|
205
|
-
closable?: boolean;
|
|
206
|
-
promise?: Promise<any>;
|
|
207
|
-
loadingText?: ReactNode;
|
|
208
|
-
}
|
|
209
|
-
interface ToastOptions {
|
|
210
|
-
duration?: number;
|
|
211
|
-
closable?: boolean;
|
|
240
|
+
interface SchemaFormConfiguration<TSchema extends ObjectSchema<any> = ObjectSchema<any>, TData = any> {
|
|
241
|
+
api: ReactFormExtendedApi<TData, any, any, any, any, any, any, any, any, any, any, any>;
|
|
242
|
+
schema: TSchema;
|
|
243
|
+
mode: "edit" | "view" | "patch";
|
|
244
|
+
onPatch?: (fieldName: string, value: any) => Promise<void>;
|
|
245
|
+
formState: Record<string, any>;
|
|
212
246
|
}
|
|
213
|
-
|
|
214
|
-
|
|
247
|
+
type UseSchemaFormOptions<TSchema extends ObjectSchema<any>, TData extends Infer<TSchema> = Infer<TSchema>> = {
|
|
248
|
+
schema: TSchema;
|
|
249
|
+
onSubmit: (data: TData) => void | Promise<void>;
|
|
250
|
+
/** Form mode - edit, view, or patch. Defaults to edit. When patch mode is used, onPatch is required. */
|
|
251
|
+
mode?: "edit" | "view" | "patch";
|
|
252
|
+
/** Callback for patching individual fields in patch mode */
|
|
253
|
+
onPatch?: (fieldName: string, value: any) => Promise<void>;
|
|
254
|
+
/** Initial values for the form fields */
|
|
255
|
+
initialValues?: Partial<TData>;
|
|
256
|
+
};
|
|
257
|
+
declare function useSchemaForm<TSchema extends ObjectSchema<any>, TData extends Infer<TSchema> = Infer<TSchema>>(options: UseSchemaFormOptions<TSchema, TData>): SchemaFormConfiguration<TSchema>;
|
|
258
|
+
|
|
259
|
+
interface UseComputedMetadataOptions {
|
|
260
|
+
/** Debounce delay in milliseconds (default: 300ms) */
|
|
261
|
+
debounceMs?: number;
|
|
215
262
|
}
|
|
216
|
-
interface
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
263
|
+
interface UseComputedMetadataResult<TShape extends ObjectShape> {
|
|
264
|
+
/** Merged metadata for all properties (static + computed) */
|
|
265
|
+
metadata: Record<keyof TShape, SchemaMetadata<any>>;
|
|
266
|
+
/** Whether metadata is currently being computed */
|
|
267
|
+
isComputing: boolean;
|
|
268
|
+
/** Error that occurred during computation, if any */
|
|
269
|
+
error: Error | null;
|
|
220
270
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Hook that provides debounced computed metadata for a form schema.
|
|
273
|
+
*
|
|
274
|
+
* This hook:
|
|
275
|
+
* 1. Watches for changes in form data
|
|
276
|
+
* 2. Debounces the computation to avoid excessive recalculation
|
|
277
|
+
* 3. Merges static metadata with computed metadata
|
|
278
|
+
* 4. Returns the final merged metadata for all properties
|
|
279
|
+
*
|
|
280
|
+
* @param schema The ObjectSchema with potential computed metadata
|
|
281
|
+
* @param formData Current form data (partial object)
|
|
282
|
+
* @param options Configuration options
|
|
283
|
+
* @returns Object with merged metadata, loading state, and error state
|
|
284
|
+
*/
|
|
285
|
+
declare function useComputedMetadata<TShape extends ObjectShape>(schema: ObjectSchema<TShape>, formData: Partial<ObjectOutput<TShape>>, options?: UseComputedMetadataOptions): UseComputedMetadataResult<TShape>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Pure function version of useLayout for testing and non-React contexts.
|
|
289
|
+
* This function has the same logic as useLayout but without React hooks.
|
|
290
|
+
*/
|
|
291
|
+
declare function getLayout<TShape extends ObjectShape>(schema: ObjectSchema<TShape>, layoutName?: string): Layout<TShape>;
|
|
292
|
+
/**
|
|
293
|
+
* Hook to get a layout for a schema. If a layoutName is provided and exists in the schema,
|
|
294
|
+
* returns that layout. Otherwise, returns a default layout with all fields in a single group
|
|
295
|
+
* with size 12 (full width).
|
|
296
|
+
*/
|
|
297
|
+
declare function useLayout<TShape extends ObjectShape>(schema: ObjectSchema<TShape>, layoutName?: string): Layout<TShape>;
|
|
298
|
+
|
|
299
|
+
interface HttpResponse<T = any> {
|
|
300
|
+
status: number;
|
|
301
|
+
data: T;
|
|
225
302
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
addPromiseToast: <T>(promise: Promise<T>, callback: PromiseToastCallback<T>, options?: PromiseToastOptions) => string;
|
|
231
|
-
removeToast: (id: string) => void;
|
|
232
|
-
updateToast: (id: string, updates: Partial<ToastData>) => void;
|
|
303
|
+
interface HttpRequestConfig {
|
|
304
|
+
headers?: Record<string, string>;
|
|
305
|
+
timeout?: number;
|
|
306
|
+
params?: Record<string, any>;
|
|
233
307
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
308
|
+
declare class HttpClient {
|
|
309
|
+
private baseUrl;
|
|
310
|
+
constructor({ baseUrl }: {
|
|
311
|
+
baseUrl?: string;
|
|
312
|
+
});
|
|
313
|
+
private request;
|
|
314
|
+
get<T>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
315
|
+
post<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
316
|
+
put<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
317
|
+
patch<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
318
|
+
delete<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
238
319
|
}
|
|
239
|
-
declare const Toast: FC<ToastProps>;
|
|
240
320
|
|
|
241
|
-
interface
|
|
242
|
-
|
|
321
|
+
interface UseNubaseMutationOptions<TData = any, TVariables = any> {
|
|
322
|
+
/**
|
|
323
|
+
* Function that performs the mutation
|
|
324
|
+
* Should use the view's onSubmit function or similar
|
|
325
|
+
*/
|
|
326
|
+
mutationFn: (variables: TVariables, context: any) => Promise<HttpResponse<TData>>;
|
|
327
|
+
/**
|
|
328
|
+
* Query keys to invalidate after successful mutation
|
|
329
|
+
* Can be a string pattern or array of exact keys
|
|
330
|
+
*/
|
|
331
|
+
invalidateQueries?: (string | readonly unknown[])[];
|
|
332
|
+
/**
|
|
333
|
+
* Standard React Query mutation options
|
|
334
|
+
*/
|
|
335
|
+
options?: Omit<UseMutationOptions<HttpResponse<TData>, Error, TVariables>, "mutationFn">;
|
|
243
336
|
}
|
|
244
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Custom hook that integrates React Query mutations with Nubase's context system
|
|
339
|
+
* Automatically handles query invalidation after successful mutations
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* const createTicketMutation = useNubaseMutation({
|
|
344
|
+
* mutationFn: (data, context) => view.onSubmit({ data, context }),
|
|
345
|
+
* invalidateQueries: [
|
|
346
|
+
* ['resource', 'ticket', 'search'],
|
|
347
|
+
* ['resource', 'ticket', 'view']
|
|
348
|
+
* ],
|
|
349
|
+
* options: {
|
|
350
|
+
* onSuccess: (data) => {
|
|
351
|
+
* showToast('Ticket created successfully', 'success');
|
|
352
|
+
* }
|
|
353
|
+
* }
|
|
354
|
+
* });
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
declare function useNubaseMutation<TData = any, TVariables = any>({ mutationFn, invalidateQueries, options, }: UseNubaseMutationOptions<TData, TVariables>): _tanstack_react_query.UseMutationResult<HttpResponse<TData>, Error, TVariables, unknown>;
|
|
358
|
+
/**
|
|
359
|
+
* Hook specifically designed for resource creation operations
|
|
360
|
+
* Automatically invalidates related resource queries
|
|
361
|
+
*/
|
|
362
|
+
declare function useResourceCreateMutation<TData = any, TVariables = any>(resourceId: string, view: {
|
|
363
|
+
onSubmit: (args: {
|
|
364
|
+
data: TVariables;
|
|
365
|
+
context: any;
|
|
366
|
+
}) => Promise<HttpResponse<TData>>;
|
|
367
|
+
}, options?: Omit<UseMutationOptions<HttpResponse<TData>, Error, TVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<HttpResponse<TData>, Error, TVariables, unknown>;
|
|
368
|
+
/**
|
|
369
|
+
* Hook specifically designed for resource update/patch operations
|
|
370
|
+
* Automatically invalidates related resource queries
|
|
371
|
+
*/
|
|
372
|
+
declare function useResourceUpdateMutation<TData = any, TVariables = any>(resourceId: string, view: {
|
|
373
|
+
onPatch: (args: {
|
|
374
|
+
data: TVariables;
|
|
375
|
+
context: any;
|
|
376
|
+
}) => Promise<HttpResponse<TData>>;
|
|
377
|
+
}, options?: Omit<UseMutationOptions<HttpResponse<TData>, Error, TVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<HttpResponse<TData>, Error, TVariables, unknown>;
|
|
378
|
+
/**
|
|
379
|
+
* Hook specifically designed for resource deletion operations
|
|
380
|
+
* Automatically invalidates related resource queries
|
|
381
|
+
*/
|
|
382
|
+
declare function useResourceDeleteMutation<TData = any, TVariables = any>(_resourceId: string, view: {
|
|
383
|
+
onDelete: (args: {
|
|
384
|
+
data: TVariables;
|
|
385
|
+
context: any;
|
|
386
|
+
}) => Promise<HttpResponse<TData>>;
|
|
387
|
+
}, options?: Omit<UseMutationOptions<HttpResponse<TData>, Error, TVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<HttpResponse<TData>, Error, TVariables, unknown>;
|
|
388
|
+
/**
|
|
389
|
+
* Hook for invalidating specific resource queries manually
|
|
390
|
+
* Useful for custom invalidation scenarios
|
|
391
|
+
*/
|
|
392
|
+
declare function useResourceInvalidation(): {
|
|
393
|
+
/**
|
|
394
|
+
* Invalidate all queries for a specific resource
|
|
395
|
+
*/
|
|
396
|
+
invalidateResource: (resourceId: string) => Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Invalidate search queries for a specific resource
|
|
399
|
+
*/
|
|
400
|
+
invalidateResourceSearch: (resourceId: string) => Promise<void>;
|
|
401
|
+
/**
|
|
402
|
+
* Invalidate view queries for a specific resource
|
|
403
|
+
*/
|
|
404
|
+
invalidateResourceView: (resourceId: string, params?: Record<string, any>) => Promise<void>;
|
|
405
|
+
/**
|
|
406
|
+
* Invalidate all queries matching a pattern
|
|
407
|
+
*/
|
|
408
|
+
invalidateByPattern: (pattern: string) => Promise<void>;
|
|
409
|
+
};
|
|
245
410
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
411
|
+
interface UseNubaseQueryOptions<TData = any> {
|
|
412
|
+
/**
|
|
413
|
+
* Unique query key for this data fetching operation
|
|
414
|
+
* Should include relevant parameters that affect the data
|
|
415
|
+
*/
|
|
416
|
+
queryKey: readonly unknown[];
|
|
417
|
+
/**
|
|
418
|
+
* Function that returns a promise with the data
|
|
419
|
+
* Should use the view's onLoad function or similar
|
|
420
|
+
*/
|
|
421
|
+
queryFn: (context: any) => Promise<HttpResponse<TData>>;
|
|
422
|
+
/**
|
|
423
|
+
* Parameters that will be passed to the context
|
|
424
|
+
*/
|
|
425
|
+
params?: Record<string, any>;
|
|
426
|
+
/**
|
|
427
|
+
* Standard React Query options
|
|
428
|
+
*/
|
|
429
|
+
options?: Omit<UseQueryOptions<HttpResponse<TData>>, "queryKey" | "queryFn">;
|
|
249
430
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Custom hook that integrates React Query with Nubase's context and view system
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* const { data, isLoading, error } = useNubaseQuery({
|
|
437
|
+
* queryKey: ['tickets', 'search', params],
|
|
438
|
+
* queryFn: (context) => view.onLoad({ context }),
|
|
439
|
+
* params: searchParams,
|
|
440
|
+
* options: {
|
|
441
|
+
* enabled: !!searchParams,
|
|
442
|
+
* }
|
|
443
|
+
* });
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
declare function useNubaseQuery<TData = any>({ queryKey, queryFn, params, options, }: UseNubaseQueryOptions<TData>): _tanstack_react_query.UseQueryResult<HttpResponse<TData>, Error>;
|
|
447
|
+
/**
|
|
448
|
+
* Hook specifically designed for resource search views
|
|
449
|
+
* Automatically generates query keys and integrates with the view pattern
|
|
450
|
+
*/
|
|
451
|
+
declare function useResourceSearchQuery<TData = any>(resourceId: string, view: {
|
|
452
|
+
onLoad: (args: {
|
|
453
|
+
context: any;
|
|
454
|
+
}) => Promise<HttpResponse<TData>>;
|
|
455
|
+
}, params?: Record<string, any>, options?: Omit<UseQueryOptions<HttpResponse<TData>>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<HttpResponse<TData>, Error>;
|
|
456
|
+
/**
|
|
457
|
+
* Hook specifically designed for resource view operations
|
|
458
|
+
* Automatically generates query keys and integrates with the view pattern
|
|
459
|
+
*/
|
|
460
|
+
declare function useResourceViewQuery<TData = any>(resourceId: string, view: {
|
|
461
|
+
onLoad: (args: {
|
|
462
|
+
context: any;
|
|
463
|
+
}) => Promise<HttpResponse<TData>>;
|
|
464
|
+
}, params?: Record<string, any>, options?: Omit<UseQueryOptions<HttpResponse<TData>>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<HttpResponse<TData>, Error>;
|
|
254
465
|
|
|
255
|
-
interface
|
|
466
|
+
interface SchemaFormBodyProps {
|
|
467
|
+
form: SchemaFormConfiguration<any>;
|
|
256
468
|
className?: string;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
interface TreeNavigatorItem {
|
|
262
|
-
id: string;
|
|
263
|
-
icon: React.ReactNode;
|
|
264
|
-
title: string;
|
|
265
|
-
subtitle?: string;
|
|
266
|
-
onNavigate?: () => void;
|
|
267
|
-
href?: string;
|
|
268
|
-
onFocus?: () => void;
|
|
269
|
-
children?: TreeNavigatorItem[];
|
|
270
|
-
}
|
|
271
|
-
interface FlatItem extends TreeNavigatorItem {
|
|
272
|
-
level: number;
|
|
273
|
-
parentId?: string;
|
|
274
|
-
isExpanded?: boolean;
|
|
275
|
-
hasChildren: boolean;
|
|
276
|
-
}
|
|
277
|
-
interface TreeNavigatorItemComponentProps {
|
|
278
|
-
item: FlatItem;
|
|
279
|
-
index: number;
|
|
280
|
-
isSelected: boolean;
|
|
281
|
-
onToggleExpanded: (itemId: string) => void;
|
|
282
|
-
itemRef: (el: HTMLButtonElement | null) => void;
|
|
283
|
-
}
|
|
284
|
-
declare const TreeNavigatorItemComponent: ({ item, index, isSelected, onToggleExpanded, itemRef, }: TreeNavigatorItemComponentProps) => react_jsx_runtime.JSX.Element;
|
|
285
|
-
|
|
286
|
-
interface MainNavProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
287
|
-
items: TreeNavigatorItem[];
|
|
288
|
-
searchPlaceholder?: string;
|
|
289
|
-
}
|
|
290
|
-
declare const MainNav: React$1.ForwardRefExoticComponent<MainNavProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
291
|
-
|
|
292
|
-
interface NavItem {
|
|
293
|
-
id: string;
|
|
294
|
-
label: string;
|
|
295
|
-
children?: NavItem[];
|
|
296
|
-
href?: string;
|
|
297
|
-
onClick?: () => void;
|
|
298
|
-
disabled?: boolean;
|
|
299
|
-
badge?: string | number;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
interface NavItemsProps {
|
|
303
|
-
items: NavItem[];
|
|
304
|
-
level?: number;
|
|
305
|
-
expandedItems: string[];
|
|
306
|
-
activeItemId?: string;
|
|
307
|
-
onToggle: (id: string) => void;
|
|
308
|
-
onItemClick?: (item: NavItem) => void;
|
|
469
|
+
layoutName?: string;
|
|
470
|
+
computedMetadata?: {
|
|
471
|
+
debounceMs?: number;
|
|
472
|
+
};
|
|
309
473
|
}
|
|
310
|
-
declare const
|
|
474
|
+
declare const SchemaFormBody: React__default.FC<SchemaFormBodyProps>;
|
|
311
475
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
476
|
+
type ModalFrameSchemaFormProps<TSchema extends ObjectSchema<any>> = {
|
|
477
|
+
onClose?: () => void;
|
|
478
|
+
title?: ReactNode;
|
|
479
|
+
form: SchemaFormConfiguration<TSchema>;
|
|
480
|
+
schemaFormProps?: Omit<SchemaFormBodyProps, "form">;
|
|
481
|
+
submitText?: string;
|
|
482
|
+
renderCustomFooter?: (form: SchemaFormConfiguration<TSchema>) => ReactNode;
|
|
483
|
+
className?: string;
|
|
484
|
+
};
|
|
485
|
+
declare const ModalFrameSchemaForm: <TSchema extends ObjectSchema<any>>({ onClose, title, form, schemaFormProps, submitText, renderCustomFooter, className, }: ModalFrameSchemaFormProps<TSchema>) => ReturnType<FC>;
|
|
316
486
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
487
|
+
type ModalFrameStructuredProps = {
|
|
488
|
+
onClose?: () => void;
|
|
489
|
+
header?: ReactNode;
|
|
490
|
+
body?: ReactNode;
|
|
491
|
+
footer?: ReactNode;
|
|
492
|
+
className?: string;
|
|
493
|
+
};
|
|
494
|
+
declare const ModalFrameStructured: FC<ModalFrameStructuredProps>;
|
|
325
495
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
496
|
+
declare const ModalProvider: FC<{
|
|
497
|
+
children: ReactNode;
|
|
498
|
+
}>;
|
|
499
|
+
type UseModalResult = {
|
|
500
|
+
openModal: (config: ModalConfig) => string;
|
|
501
|
+
closeModal: (id?: string) => void;
|
|
502
|
+
closeAllModals: () => void;
|
|
503
|
+
modalCount: number;
|
|
330
504
|
};
|
|
331
|
-
declare const
|
|
332
|
-
declare const SearchableListNavigator: React$1.ForwardRefExoticComponent<SearchableTreeNavigatorProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
333
|
-
type SearchableListNavigatorProps = SearchableTreeNavigatorProps;
|
|
505
|
+
declare const useModal: () => UseModalResult;
|
|
334
506
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
507
|
+
/**
|
|
508
|
+
* Defines the layout of actions for views.
|
|
509
|
+
* An action layout is an array of action IDs and separators.
|
|
510
|
+
* This allows views to specify which actions to display and in what order.
|
|
511
|
+
*/
|
|
512
|
+
type ActionLayout<TActionIds extends string = string> = (TActionIds | "separator")[];
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Represents a single breadcrumb item in the navigation trail.
|
|
516
|
+
*/
|
|
517
|
+
type BreadcrumbItem$1 = string | {
|
|
518
|
+
label: string;
|
|
519
|
+
/**
|
|
520
|
+
* Optional navigation path. Can be:
|
|
521
|
+
* - A string path (e.g., "/r/ticket/search")
|
|
522
|
+
* - A ResourceLink for type-safe resource navigation
|
|
523
|
+
*/
|
|
524
|
+
to?: string | ResourceLink;
|
|
342
525
|
params?: Record<string, any>;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
patch<T>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
354
|
-
delete<T>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
355
|
-
}
|
|
526
|
+
search?: Record<string, any>;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Breadcrumb definition that can be static or dynamically generated based on context.
|
|
530
|
+
* Dynamic breadcrumbs have access to route parameters, loaded data, and other context.
|
|
531
|
+
*/
|
|
532
|
+
type BreadcrumbDefinition<TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TData = any> = BreadcrumbItem$1[] | ((context: {
|
|
533
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
534
|
+
data?: TData;
|
|
535
|
+
}) => BreadcrumbItem$1[]);
|
|
356
536
|
|
|
357
537
|
type ViewType = "object";
|
|
358
|
-
type ViewBase = {
|
|
538
|
+
type ViewBase<TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TData = any> = {
|
|
359
539
|
title: string;
|
|
360
540
|
id: string;
|
|
541
|
+
/**
|
|
542
|
+
* Optional breadcrumb navigation trail for this view.
|
|
543
|
+
*/
|
|
544
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema, TData>;
|
|
361
545
|
};
|
|
362
|
-
type
|
|
363
|
-
type: "create";
|
|
364
|
-
|
|
365
|
-
|
|
546
|
+
type ResourceCreateView<TSchema extends ObjectSchema<any> = ObjectSchema<any>, TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string> = ViewBase<TApiEndpoints, TParamsSchema> & {
|
|
547
|
+
type: "resource-create";
|
|
548
|
+
/**
|
|
549
|
+
* Schema for the form data to be posted when creating a resource.
|
|
550
|
+
*/
|
|
551
|
+
schemaPost: TSchema;
|
|
552
|
+
/**
|
|
553
|
+
* Optional schema for URL parameters this view expects.
|
|
554
|
+
*/
|
|
555
|
+
schemaParams?: TParamsSchema;
|
|
556
|
+
/**
|
|
557
|
+
* Optional actions to display for this view (e.g., save, cancel, reset).
|
|
558
|
+
*/
|
|
559
|
+
actions?: ActionLayout<TActionIds>;
|
|
560
|
+
/**
|
|
561
|
+
* Creates a new resource.
|
|
562
|
+
*/
|
|
563
|
+
onSubmit: ({ data, context, }: {
|
|
366
564
|
data: Infer<TSchema>;
|
|
367
|
-
|
|
565
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
368
566
|
}) => Promise<HttpResponse<any>>;
|
|
369
567
|
};
|
|
370
|
-
type
|
|
371
|
-
type: "view";
|
|
372
|
-
|
|
568
|
+
type ResourceViewView<TSchema extends ObjectSchema<any> = ObjectSchema<any>, TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string> = ViewBase<TApiEndpoints, TParamsSchema, Infer<TSchema>> & {
|
|
569
|
+
type: "resource-view";
|
|
570
|
+
/**
|
|
571
|
+
* Schema for the resource data retrieved from the server.
|
|
572
|
+
*/
|
|
573
|
+
schemaGet: TSchema;
|
|
574
|
+
/**
|
|
575
|
+
* Optional schema for URL parameters this view expects.
|
|
576
|
+
*/
|
|
577
|
+
schemaParams?: TParamsSchema;
|
|
578
|
+
/**
|
|
579
|
+
* Optional actions to display for this view (e.g., edit, delete, duplicate).
|
|
580
|
+
*/
|
|
581
|
+
actions?: ActionLayout<TActionIds>;
|
|
582
|
+
/**
|
|
583
|
+
* Loads the resource data.
|
|
584
|
+
*/
|
|
585
|
+
onLoad: ({ context, }: {
|
|
586
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
587
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
588
|
+
/**
|
|
589
|
+
* Patches a resource with partial data.
|
|
590
|
+
*/
|
|
591
|
+
onPatch: ({ data, context, }: {
|
|
592
|
+
data: Partial<Infer<TSchema>>;
|
|
593
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
594
|
+
}) => Promise<HttpResponse<any>>;
|
|
373
595
|
};
|
|
374
|
-
type
|
|
375
|
-
|
|
376
|
-
type NubaseFrontendConfig<TApiEndpoints = any> = {
|
|
377
|
-
appName: string;
|
|
378
|
-
mainMenu: TreeNavigatorItem[];
|
|
596
|
+
type ResourceSearchView<TSchema extends ArraySchema<any> = ArraySchema<any>, TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string> = ViewBase<TApiEndpoints, TParamsSchema> & {
|
|
597
|
+
type: "resource-search";
|
|
379
598
|
/**
|
|
380
|
-
*
|
|
599
|
+
* Schema for the search results data retrieved from the server.
|
|
381
600
|
*/
|
|
382
|
-
|
|
601
|
+
schemaGet: TSchema;
|
|
383
602
|
/**
|
|
384
|
-
*
|
|
385
|
-
* If not set, only full URLs will be used in HTTP requests.
|
|
603
|
+
* Optional schema for URL parameters this view expects.
|
|
386
604
|
*/
|
|
387
|
-
|
|
605
|
+
schemaParams?: TParamsSchema;
|
|
388
606
|
/**
|
|
389
|
-
*
|
|
390
|
-
* The framework will automatically create a typed API client from these endpoints.
|
|
391
|
-
* Supports nested structure like: { tickets: { createTicket: schema, ... }, users: { ... } }
|
|
607
|
+
* Optional actions to display above the table for bulk operations on selected items.
|
|
392
608
|
*/
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
609
|
+
tableActions?: ActionLayout<TActionIds>;
|
|
610
|
+
/**
|
|
611
|
+
* Optional actions to display in the dropdown for each row.
|
|
612
|
+
*/
|
|
613
|
+
rowActions?: ActionLayout<TActionIds>;
|
|
614
|
+
/**
|
|
615
|
+
* Loads the search results data.
|
|
616
|
+
*/
|
|
617
|
+
onLoad: ({ context, }: {
|
|
618
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
619
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
396
620
|
};
|
|
621
|
+
type View<TSchema extends ObjectSchema<any> | ArraySchema<any> = ObjectSchema<any>, TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string> = ResourceCreateView<TSchema extends ObjectSchema<any> ? TSchema : ObjectSchema<any>, TApiEndpoints, TParamsSchema, TActionIds> | ResourceViewView<TSchema extends ObjectSchema<any> ? TSchema : ObjectSchema<any>, TApiEndpoints, TParamsSchema, TActionIds> | ResourceSearchView<TSchema extends ArraySchema<any> ? TSchema : ArraySchema<any>, TApiEndpoints, TParamsSchema, TActionIds>;
|
|
397
622
|
|
|
398
|
-
|
|
399
|
-
|
|
623
|
+
/**
|
|
624
|
+
* A resource descriptor defines the views available for a resource entity.
|
|
625
|
+
* Views are directly accessible without an intermediate operation wrapper.
|
|
626
|
+
* Can be extended with additional properties as needed.
|
|
627
|
+
*/
|
|
628
|
+
type ResourceDescriptor<TViews extends Record<string, View<any, any, any, any>> = Record<string, View<any, any, any, any>>, TActions extends Record<string, Action> = Record<string, Action>> = {
|
|
629
|
+
id: string;
|
|
630
|
+
views: TViews;
|
|
631
|
+
/**
|
|
632
|
+
* Available actions for this resource, defined as an object mapping action IDs to action definitions.
|
|
633
|
+
* This allows views to reference actions by ID in a type-safe manner.
|
|
634
|
+
*/
|
|
635
|
+
actions?: TActions;
|
|
400
636
|
};
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
data: TData[];
|
|
406
|
-
columns: ColumnDef<TData>[];
|
|
407
|
-
loading?: boolean;
|
|
408
|
-
sorting?: SortingState;
|
|
409
|
-
onSortingChange?: OnChangeFn<SortingState>;
|
|
410
|
-
enableSorting?: boolean;
|
|
411
|
-
emptyMessage?: string;
|
|
412
|
-
loadingMessage?: string;
|
|
413
|
-
containerClassName?: string;
|
|
414
|
-
}
|
|
415
|
-
declare const Table: React__default.ForwardRefExoticComponent<TableProps<any> & React__default.RefAttributes<HTMLTableElement>>;
|
|
416
|
-
|
|
417
|
-
declare const paginationVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
418
|
-
interface PaginationProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
419
|
-
currentPage: number;
|
|
420
|
-
totalPages: number;
|
|
421
|
-
pageSize: number;
|
|
422
|
-
totalItems: number;
|
|
423
|
-
onPageChange: (page: number) => void;
|
|
424
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
425
|
-
pageSizeOptions?: number[];
|
|
426
|
-
showPageSizeSelector?: boolean;
|
|
427
|
-
showInfo?: boolean;
|
|
428
|
-
}
|
|
429
|
-
declare const Pagination: React__default.ForwardRefExoticComponent<PaginationProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
637
|
+
/**
|
|
638
|
+
* Standard view names for resources
|
|
639
|
+
*/
|
|
640
|
+
type StandardViews = "create" | "view" | "edit";
|
|
430
641
|
|
|
431
|
-
interface UseComputedMetadataOptions {
|
|
432
|
-
/** Debounce delay in milliseconds (default: 300ms) */
|
|
433
|
-
debounceMs?: number;
|
|
434
|
-
}
|
|
435
|
-
interface UseComputedMetadataResult<TShape extends ObjectShape> {
|
|
436
|
-
/** Merged metadata for all properties (static + computed) */
|
|
437
|
-
metadata: Record<keyof TShape, SchemaMetadata<any>>;
|
|
438
|
-
/** Whether metadata is currently being computed */
|
|
439
|
-
isComputing: boolean;
|
|
440
|
-
/** Error that occurred during computation, if any */
|
|
441
|
-
error: Error | null;
|
|
442
|
-
}
|
|
443
642
|
/**
|
|
444
|
-
*
|
|
643
|
+
* A type-safe link to a resource view.
|
|
445
644
|
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* 2. Debounces the computation to avoid excessive recalculation
|
|
449
|
-
* 3. Merges static metadata with computed metadata
|
|
450
|
-
* 4. Returns the final merged metadata for all properties
|
|
645
|
+
* ResourceLink objects are resolved at runtime to include the current workspace.
|
|
646
|
+
* This enables type-safe navigation to resource views without hardcoding paths.
|
|
451
647
|
*
|
|
452
|
-
* @
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```typescript
|
|
650
|
+
* // Create a link to the ticket search view
|
|
651
|
+
* const link = resourceLink(ticketResource, "search");
|
|
652
|
+
*
|
|
653
|
+
* // Use in menu configuration
|
|
654
|
+
* mainMenu: [
|
|
655
|
+
* { id: "tickets", label: "Tickets", href: resourceLink(ticketResource, "search") }
|
|
656
|
+
* ]
|
|
657
|
+
* ```
|
|
456
658
|
*/
|
|
457
|
-
|
|
458
|
-
|
|
659
|
+
interface ResourceLink<TResourceId extends string = string, TViewName extends string = string> {
|
|
660
|
+
/** Discriminator for identifying ResourceLink objects */
|
|
661
|
+
readonly __type: "resourceLink";
|
|
662
|
+
/** The resource ID (e.g., "ticket") */
|
|
663
|
+
readonly resourceId: TResourceId;
|
|
664
|
+
/** The view name on the resource (e.g., "search", "create", "view") */
|
|
665
|
+
readonly viewName: TViewName;
|
|
666
|
+
/** Optional search params to include in the URL */
|
|
667
|
+
readonly search?: Record<string, unknown>;
|
|
668
|
+
}
|
|
459
669
|
/**
|
|
460
|
-
*
|
|
461
|
-
*
|
|
670
|
+
* Creates a type-safe link to a resource view.
|
|
671
|
+
*
|
|
672
|
+
* The link is resolved at runtime to include the current workspace prefix.
|
|
673
|
+
* This ensures links work correctly across different workspaces without
|
|
674
|
+
* hardcoding the workspace slug.
|
|
675
|
+
*
|
|
676
|
+
* @param resource - The resource descriptor containing the view
|
|
677
|
+
* @param viewName - The name of the view to link to (type-safe based on resource's views)
|
|
678
|
+
* @param search - Optional search parameters to include in the URL
|
|
679
|
+
* @returns A ResourceLink object that can be used as a MenuItem href
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* ```typescript
|
|
683
|
+
* const ticketResource = createResource("ticket")
|
|
684
|
+
* .withViews({
|
|
685
|
+
* search: { type: "resource-search", ... },
|
|
686
|
+
* create: { type: "resource-create", ... },
|
|
687
|
+
* view: { type: "resource-view", ... }
|
|
688
|
+
* });
|
|
689
|
+
*
|
|
690
|
+
* // Type-safe: only "search", "create", or "view" are valid
|
|
691
|
+
* resourceLink(ticketResource, "search")
|
|
692
|
+
*
|
|
693
|
+
* // With search params
|
|
694
|
+
* resourceLink(ticketResource, "view", { id: 123 })
|
|
695
|
+
*
|
|
696
|
+
* // TypeScript error: "invalid" is not a valid view name
|
|
697
|
+
* resourceLink(ticketResource, "invalid") // ❌ Type error
|
|
698
|
+
* ```
|
|
462
699
|
*/
|
|
463
|
-
declare function
|
|
700
|
+
declare function resourceLink<TResource extends ResourceDescriptor<any, any>, TViewName extends keyof TResource["views"] & string>(resource: TResource, viewName: TViewName, search?: Record<string, unknown>): ResourceLink<string, TViewName>;
|
|
464
701
|
/**
|
|
465
|
-
*
|
|
466
|
-
* returns that layout. Otherwise, returns a default layout with all fields in a single group
|
|
467
|
-
* with size 12 (full width).
|
|
702
|
+
* Type guard to check if a value is a ResourceLink.
|
|
468
703
|
*/
|
|
469
|
-
declare function
|
|
470
|
-
|
|
704
|
+
declare function isResourceLink(value: unknown): value is ResourceLink;
|
|
471
705
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* This function combines clsx for conditional class handling with tailwind-merge
|
|
475
|
-
* to resolve Tailwind class conflicts. It's commonly used throughout the component
|
|
476
|
-
* library to merge default component styles with user-provided className props.
|
|
706
|
+
* Resolves a ResourceLink to a URL path.
|
|
477
707
|
*
|
|
478
|
-
* @param
|
|
479
|
-
* @
|
|
708
|
+
* @param link - The ResourceLink to resolve
|
|
709
|
+
* @param workspaceSlug - The current workspace slug (optional)
|
|
710
|
+
* @returns The resolved URL path
|
|
480
711
|
*
|
|
481
712
|
* @example
|
|
482
|
-
*
|
|
483
|
-
*
|
|
713
|
+
* ```typescript
|
|
714
|
+
* const link = resourceLink(ticketResource, "search");
|
|
715
|
+
* resolveResourceLink(link, "tavern")
|
|
716
|
+
* // Returns: "/tavern/r/ticket/search"
|
|
484
717
|
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
718
|
+
* resolveResourceLink(link)
|
|
719
|
+
* // Returns: "/r/ticket/search"
|
|
720
|
+
* ```
|
|
488
721
|
*/
|
|
489
|
-
declare function
|
|
490
|
-
|
|
722
|
+
declare function resolveResourceLink(link: ResourceLink, workspaceSlug?: string): string;
|
|
723
|
+
/**
|
|
724
|
+
* Resolves a ResourceLink's search params to a query string object.
|
|
725
|
+
*/
|
|
726
|
+
declare function getResourceLinkSearch(link: ResourceLink): Record<string, unknown> | undefined;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Standard icon type used throughout Nubase.
|
|
730
|
+
* Icons are passed as component types (not instantiated) for consistency and flexibility.
|
|
731
|
+
*/
|
|
732
|
+
type IconComponent = React__default.ComponentType<{
|
|
733
|
+
size?: number;
|
|
734
|
+
className?: string;
|
|
735
|
+
}>;
|
|
736
|
+
/**
|
|
737
|
+
* Unified menu item type that works for main navigation, command palettes,
|
|
738
|
+
* global actions, and any other menu-like UI.
|
|
739
|
+
*
|
|
740
|
+
* This replaces the previous TreeNavigatorItem and Action types with a single,
|
|
741
|
+
* consistent interface.
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* // Simple link navigation
|
|
745
|
+
* { id: "home", label: "Home", icon: Home, href: "/" }
|
|
746
|
+
*
|
|
747
|
+
* @example
|
|
748
|
+
* // Command-based action (derives label/icon from command)
|
|
749
|
+
* { id: "theme", command: commands.workbenchSetTheme }
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* // Command with overridden label
|
|
753
|
+
* { id: "create", label: "New Ticket", command: commands.workbenchOpenResourceOperation, commandArgs: { operation: "create" } }
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* // Hierarchical menu
|
|
757
|
+
* {
|
|
758
|
+
* id: "settings",
|
|
759
|
+
* label: "Settings",
|
|
760
|
+
* icon: Settings,
|
|
761
|
+
* children: [
|
|
762
|
+
* { id: "theme", command: commands.workbenchSetTheme },
|
|
763
|
+
* { id: "profile", label: "Profile", href: "/settings/profile" },
|
|
764
|
+
* ]
|
|
765
|
+
* }
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* // Direct handler (for simple cases)
|
|
769
|
+
* { id: "logout", label: "Sign Out", icon: LogOut, onExecute: () => signOut() }
|
|
770
|
+
*/
|
|
771
|
+
interface MenuItem {
|
|
772
|
+
id: string;
|
|
773
|
+
/**
|
|
774
|
+
* Display label for the menu item.
|
|
775
|
+
* Optional if `command` is provided - will be derived from command's `name`.
|
|
776
|
+
* Required for `href` or `onExecute` items.
|
|
777
|
+
*/
|
|
778
|
+
label?: string;
|
|
779
|
+
/**
|
|
780
|
+
* Optional subtitle/description shown below the label.
|
|
781
|
+
*/
|
|
782
|
+
subtitle?: string;
|
|
783
|
+
/**
|
|
784
|
+
* Icon component (not instantiated).
|
|
785
|
+
* Optional if `command` is provided - will be derived from command's `icon`.
|
|
786
|
+
*/
|
|
787
|
+
icon?: IconComponent;
|
|
788
|
+
/**
|
|
789
|
+
* Whether the menu item is disabled.
|
|
790
|
+
*/
|
|
791
|
+
disabled?: boolean;
|
|
792
|
+
/**
|
|
793
|
+
* Visual variant for the menu item.
|
|
794
|
+
*/
|
|
795
|
+
variant?: "default" | "destructive";
|
|
796
|
+
/**
|
|
797
|
+
* URL to navigate to. Uses client-side routing.
|
|
798
|
+
* Can be a string path or a ResourceLink for type-safe resource navigation.
|
|
799
|
+
* Mutually exclusive with `command` and `onExecute`.
|
|
800
|
+
*
|
|
801
|
+
* @example
|
|
802
|
+
* // String path
|
|
803
|
+
* { href: "/settings" }
|
|
804
|
+
*
|
|
805
|
+
* // Type-safe resource link
|
|
806
|
+
* { href: resourceLink(ticketResource, "search") }
|
|
807
|
+
*/
|
|
808
|
+
href?: string | ResourceLink;
|
|
809
|
+
/**
|
|
810
|
+
* Command to execute when the menu item is activated.
|
|
811
|
+
* Can be a command definition object or a command ID string.
|
|
812
|
+
* When provided, `label` and `icon` can be derived from the command.
|
|
813
|
+
* Mutually exclusive with `href` and `onExecute`.
|
|
814
|
+
*/
|
|
815
|
+
command?: TypedCommandDefinition<any> | string;
|
|
816
|
+
/**
|
|
817
|
+
* Arguments to pass to the command.
|
|
818
|
+
* Only used when `command` is provided.
|
|
819
|
+
*/
|
|
820
|
+
commandArgs?: Record<string, unknown>;
|
|
821
|
+
/**
|
|
822
|
+
* Direct handler function for simple actions.
|
|
823
|
+
* Mutually exclusive with `href` and `command`.
|
|
824
|
+
*/
|
|
825
|
+
onExecute?: () => void | Promise<void>;
|
|
826
|
+
/**
|
|
827
|
+
* Callback when this item receives focus (via keyboard navigation).
|
|
828
|
+
* Useful for preview effects (e.g., theme preview on hover/focus).
|
|
829
|
+
*/
|
|
830
|
+
onFocus?: () => void;
|
|
831
|
+
/**
|
|
832
|
+
* Child menu items for hierarchical menus.
|
|
833
|
+
* When present, the item acts as a parent/folder.
|
|
834
|
+
*/
|
|
835
|
+
children?: MenuItem[];
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Menu item or separator literal for creating grouped menus.
|
|
839
|
+
*/
|
|
840
|
+
type MenuItemOrSeparator = MenuItem | "separator";
|
|
841
|
+
|
|
842
|
+
type SeriesChartVariant = "line" | "bar" | "area";
|
|
843
|
+
type ProportionalChartVariant = "pie" | "donut";
|
|
844
|
+
interface WidgetLayoutConfig {
|
|
845
|
+
/** Column position (0-based) */
|
|
846
|
+
x: number;
|
|
847
|
+
/** Row position (0-based) */
|
|
848
|
+
y: number;
|
|
849
|
+
/** Width in grid columns */
|
|
850
|
+
w: number;
|
|
851
|
+
/** Height in grid rows */
|
|
852
|
+
h: number;
|
|
853
|
+
/** Minimum width in grid columns */
|
|
854
|
+
minW?: number;
|
|
855
|
+
/** Minimum height in grid rows */
|
|
856
|
+
minH?: number;
|
|
857
|
+
/** Maximum width in grid columns */
|
|
858
|
+
maxW?: number;
|
|
859
|
+
/** Maximum height in grid rows */
|
|
860
|
+
maxH?: number;
|
|
861
|
+
/** Whether the widget cannot be moved or resized */
|
|
862
|
+
static?: boolean;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Extract endpoint keys that return SeriesData.
|
|
866
|
+
* Matches endpoints created with createSeriesWidgetEndpoint.
|
|
867
|
+
*/
|
|
868
|
+
type SeriesEndpointKeys<TApiEndpoints> = {
|
|
869
|
+
[K in keyof TApiEndpoints]: TApiEndpoints[K] extends SeriesWidgetRequestSchema ? K : never;
|
|
870
|
+
}[keyof TApiEndpoints];
|
|
871
|
+
/**
|
|
872
|
+
* Extract endpoint keys that return ProportionalData.
|
|
873
|
+
* Matches endpoints created with createProportionalWidgetEndpoint.
|
|
874
|
+
*/
|
|
875
|
+
type ProportionalEndpointKeys<TApiEndpoints> = {
|
|
876
|
+
[K in keyof TApiEndpoints]: TApiEndpoints[K] extends ProportionalWidgetRequestSchema ? K : never;
|
|
877
|
+
}[keyof TApiEndpoints];
|
|
878
|
+
/**
|
|
879
|
+
* Extract endpoint keys that return KpiData.
|
|
880
|
+
* Matches endpoints created with createKpiWidgetEndpoint.
|
|
881
|
+
*/
|
|
882
|
+
type KpiEndpointKeys<TApiEndpoints> = {
|
|
883
|
+
[K in keyof TApiEndpoints]: TApiEndpoints[K] extends KpiWidgetRequestSchema ? K : never;
|
|
884
|
+
}[keyof TApiEndpoints];
|
|
885
|
+
/**
|
|
886
|
+
* Extract endpoint keys that return TableData.
|
|
887
|
+
* Matches endpoints created with createTableWidgetEndpoint.
|
|
888
|
+
*/
|
|
889
|
+
type TableEndpointKeys<TApiEndpoints> = {
|
|
890
|
+
[K in keyof TApiEndpoints]: TApiEndpoints[K] extends TableWidgetRequestSchema ? K : never;
|
|
891
|
+
}[keyof TApiEndpoints];
|
|
892
|
+
interface BaseWidgetDescriptor {
|
|
893
|
+
/** Unique identifier for this widget */
|
|
894
|
+
id: string;
|
|
895
|
+
/** Display title for the widget header */
|
|
896
|
+
title: string;
|
|
897
|
+
/** Optional icon for the widget header */
|
|
898
|
+
icon?: IconComponent;
|
|
899
|
+
/** Default grid layout position and size */
|
|
900
|
+
defaultLayout?: WidgetLayoutConfig;
|
|
901
|
+
/** Optional refresh interval in milliseconds */
|
|
902
|
+
refreshInterval?: number;
|
|
903
|
+
}
|
|
904
|
+
interface SeriesWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
|
|
905
|
+
type: "series";
|
|
906
|
+
/** The chart variant to render */
|
|
907
|
+
variant: SeriesChartVariant;
|
|
908
|
+
/**
|
|
909
|
+
* The API endpoint key that provides data for this widget.
|
|
910
|
+
* TypeScript will only allow endpoints that return SeriesData.
|
|
911
|
+
*/
|
|
912
|
+
endpoint: SeriesEndpointKeys<TApiEndpoints>;
|
|
913
|
+
}
|
|
914
|
+
interface ProportionalWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
|
|
915
|
+
type: "proportional";
|
|
916
|
+
/** The chart variant to render */
|
|
917
|
+
variant: ProportionalChartVariant;
|
|
918
|
+
/**
|
|
919
|
+
* The API endpoint key that provides data for this widget.
|
|
920
|
+
* TypeScript will only allow endpoints that return ProportionalData.
|
|
921
|
+
*/
|
|
922
|
+
endpoint: ProportionalEndpointKeys<TApiEndpoints>;
|
|
923
|
+
}
|
|
924
|
+
interface KpiWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
|
|
925
|
+
type: "kpi";
|
|
926
|
+
/**
|
|
927
|
+
* The API endpoint key that provides data for this widget.
|
|
928
|
+
* TypeScript will only allow endpoints that return KpiData.
|
|
929
|
+
*/
|
|
930
|
+
endpoint: KpiEndpointKeys<TApiEndpoints>;
|
|
931
|
+
}
|
|
932
|
+
interface TableWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
|
|
933
|
+
type: "table";
|
|
934
|
+
/**
|
|
935
|
+
* The API endpoint key that provides data for this widget.
|
|
936
|
+
* TypeScript will only allow endpoints that return TableData.
|
|
937
|
+
*/
|
|
938
|
+
endpoint: TableEndpointKeys<TApiEndpoints>;
|
|
939
|
+
/** Maximum rows to display */
|
|
940
|
+
maxRows?: number;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Union of all widget descriptor types.
|
|
944
|
+
* Each widget type enforces that its endpoint returns the correct data shape.
|
|
945
|
+
*/
|
|
946
|
+
type WidgetDescriptor<TApiEndpoints> = SeriesWidgetDescriptor<TApiEndpoints> | ProportionalWidgetDescriptor<TApiEndpoints> | KpiWidgetDescriptor<TApiEndpoints> | TableWidgetDescriptor<TApiEndpoints>;
|
|
947
|
+
interface DashboardGridConfig {
|
|
948
|
+
/** Number of columns in the grid */
|
|
949
|
+
cols?: number;
|
|
950
|
+
/** Height of a single row in pixels */
|
|
951
|
+
rowHeight?: number;
|
|
952
|
+
/** Margin between items [horizontal, vertical] in pixels */
|
|
953
|
+
margin?: [number, number];
|
|
954
|
+
/** Container padding [horizontal, vertical] in pixels */
|
|
955
|
+
containerPadding?: [number, number];
|
|
956
|
+
}
|
|
957
|
+
interface DashboardDescriptor<TApiEndpoints> {
|
|
958
|
+
/** Unique identifier for this dashboard */
|
|
959
|
+
id: string;
|
|
960
|
+
/** Display title for the dashboard */
|
|
961
|
+
title: string;
|
|
962
|
+
/** Optional icon for the dashboard */
|
|
963
|
+
icon?: IconComponent;
|
|
964
|
+
/** Widget configurations for this dashboard */
|
|
965
|
+
widgets: WidgetDescriptor<TApiEndpoints>[];
|
|
966
|
+
/** Optional grid configuration */
|
|
967
|
+
gridConfig?: DashboardGridConfig;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Global actions configuration type that supports separators for grouping.
|
|
972
|
+
* Uses the standardized ActionOrSeparator which supports both command and handler actions.
|
|
973
|
+
*/
|
|
974
|
+
type GlobalActionsConfig = ActionOrSeparator[];
|
|
975
|
+
|
|
976
|
+
type NubaseFrontendConfig<TApiEndpoints = any> = {
|
|
977
|
+
appName: string;
|
|
978
|
+
/**
|
|
979
|
+
* Main navigation menu items.
|
|
980
|
+
* Supports hierarchical structure with commands, links, or direct handlers.
|
|
981
|
+
*/
|
|
982
|
+
mainMenu: MenuItem[];
|
|
983
|
+
/**
|
|
984
|
+
* Maps a resource-id to a resource descriptor configuration.
|
|
985
|
+
* Resources define all available operations (create, view, edit, etc.) for entities.
|
|
986
|
+
*/
|
|
987
|
+
resources: Record<string, ResourceDescriptor<any>>;
|
|
988
|
+
/**
|
|
989
|
+
* Global actions that appear in the top bar.
|
|
990
|
+
* Actions execute commands with optional parameters and support separators for grouping.
|
|
991
|
+
*/
|
|
992
|
+
globalActions?: GlobalActionsConfig;
|
|
993
|
+
/**
|
|
994
|
+
* If set, this will be used as the base URL for all HTTP requests.
|
|
995
|
+
* If not set, only full URLs will be used in HTTP requests.
|
|
996
|
+
*/
|
|
997
|
+
apiBaseUrl?: string;
|
|
998
|
+
/**
|
|
999
|
+
* API endpoints definition for type-safe client generation.
|
|
1000
|
+
* The framework will automatically create a typed API client from these endpoints.
|
|
1001
|
+
* Supports nested structure like: { tickets: { createTicket: schema, ... }, users: { ... } }
|
|
1002
|
+
*/
|
|
1003
|
+
apiEndpoints?: TApiEndpoints;
|
|
1004
|
+
/**
|
|
1005
|
+
* Custom keybindings for the application.
|
|
1006
|
+
* If not provided, default keybindings will be used.
|
|
1007
|
+
* Use defaultKeybindings.extend() to extend defaults with custom bindings.
|
|
1008
|
+
*/
|
|
1009
|
+
keybindings?: Keybinding[];
|
|
1010
|
+
themeIds?: string[];
|
|
1011
|
+
defaultThemeId?: "light" | "dark";
|
|
1012
|
+
/**
|
|
1013
|
+
* Authentication controller for managing user authentication.
|
|
1014
|
+
* When provided, enables authentication features like auto-redirect to signin.
|
|
1015
|
+
*/
|
|
1016
|
+
authentication?: AuthenticationController;
|
|
1017
|
+
/**
|
|
1018
|
+
* Routes that don't require authentication.
|
|
1019
|
+
* Users can access these routes without being logged in.
|
|
1020
|
+
* Default: ['/signin']
|
|
1021
|
+
*/
|
|
1022
|
+
publicRoutes?: string[];
|
|
1023
|
+
/**
|
|
1024
|
+
* Dashboard configurations for the application.
|
|
1025
|
+
* Each dashboard contains widgets that render data from API endpoints.
|
|
1026
|
+
*
|
|
1027
|
+
* @example
|
|
1028
|
+
* ```typescript
|
|
1029
|
+
* dashboards: {
|
|
1030
|
+
* [analyticsDashboard.id]: analyticsDashboard,
|
|
1031
|
+
* }
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
dashboards?: Record<string, DashboardDescriptor<TApiEndpoints>>;
|
|
1035
|
+
};
|
|
1036
|
+
|
|
491
1037
|
type TypedMethodOptions<T extends RequestSchema> = {
|
|
492
1038
|
params?: InferRequestParams<T>;
|
|
493
1039
|
data?: InferRequestBody<T>;
|
|
494
1040
|
config?: HttpRequestConfig;
|
|
495
1041
|
};
|
|
496
|
-
type
|
|
1042
|
+
type ErrorListener = (error: Error) => void;
|
|
1043
|
+
type MethodSignature<T extends RequestSchema> = T["method"] extends "GET" ? (options?: Omit<TypedMethodOptions<T>, "data">) => Promise<HttpResponse<InferResponseBody<T>>> : T["requestBody"] extends ObjectSchema ? (options?: TypedMethodOptions<T>) => Promise<HttpResponse<InferResponseBody<T>>> : (options?: Omit<TypedMethodOptions<T>, "data">) => Promise<HttpResponse<InferResponseBody<T>>>;
|
|
497
1044
|
type TypedApiMethods<T> = {
|
|
498
1045
|
[K in keyof T]: T[K] extends RequestSchema ? MethodSignature<T[K]> : never;
|
|
499
1046
|
};
|
|
500
1047
|
declare class TypedApiClient<T> {
|
|
501
1048
|
private httpClient;
|
|
502
1049
|
private endpoints;
|
|
503
|
-
|
|
1050
|
+
private errorListener?;
|
|
1051
|
+
constructor(httpClient: HttpClient, endpoints: T, errorListener?: ErrorListener);
|
|
504
1052
|
private createFlatApiClient;
|
|
505
1053
|
private executeRequest;
|
|
506
1054
|
private isRequestSchema;
|
|
507
|
-
private capitalize;
|
|
508
1055
|
}
|
|
509
|
-
declare function createTypedApiClient<T>(httpClient: HttpClient, endpoints: T): TypedApiClient<T> & TypedApiMethods<T>;
|
|
1056
|
+
declare function createTypedApiClient<T>(httpClient: HttpClient, endpoints: T, errorListener?: ErrorListener): TypedApiClient<T> & TypedApiMethods<T>;
|
|
510
1057
|
|
|
511
1058
|
/**
|
|
512
1059
|
* Type helper to extract the typed API client type from an endpoints definition.
|
|
@@ -514,4 +1061,2455 @@ declare function createTypedApiClient<T>(httpClient: HttpClient, endpoints: T):
|
|
|
514
1061
|
*/
|
|
515
1062
|
type TypedApiClientFromEndpoints<T> = ReturnType<typeof createTypedApiClient<T>>;
|
|
516
1063
|
|
|
517
|
-
|
|
1064
|
+
interface NavigationHistoryEntry {
|
|
1065
|
+
id: string;
|
|
1066
|
+
path: string;
|
|
1067
|
+
pathname: string;
|
|
1068
|
+
search: string;
|
|
1069
|
+
searchParams: Record<string, any>;
|
|
1070
|
+
hash: string;
|
|
1071
|
+
timestamp: number;
|
|
1072
|
+
title: string;
|
|
1073
|
+
}
|
|
1074
|
+
declare class NavigationHistoryTracker {
|
|
1075
|
+
private history;
|
|
1076
|
+
private maxHistorySize;
|
|
1077
|
+
private unsubscribe;
|
|
1078
|
+
private router;
|
|
1079
|
+
private lastEntryId;
|
|
1080
|
+
private historyIdCounter;
|
|
1081
|
+
constructor(router: AnyRouter);
|
|
1082
|
+
private formatTitle;
|
|
1083
|
+
private parseSearchParams;
|
|
1084
|
+
private addCurrentLocation;
|
|
1085
|
+
private addEntry;
|
|
1086
|
+
private startTracking;
|
|
1087
|
+
getHistory(): NavigationHistoryEntry[];
|
|
1088
|
+
clearHistory(): void;
|
|
1089
|
+
dispose(): void;
|
|
1090
|
+
navigateToEntry(entry: NavigationHistoryEntry): void;
|
|
1091
|
+
formatTimeAgo(timestamp: number): string;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
interface NubaseTheme {
|
|
1095
|
+
id: string;
|
|
1096
|
+
name: string;
|
|
1097
|
+
type: "light" | "dark";
|
|
1098
|
+
colors: NubaseThemeColors;
|
|
1099
|
+
}
|
|
1100
|
+
type NubaseThemeColors = {
|
|
1101
|
+
background: string;
|
|
1102
|
+
foreground: string;
|
|
1103
|
+
card: string;
|
|
1104
|
+
cardForeground: string;
|
|
1105
|
+
popover: string;
|
|
1106
|
+
popoverForeground: string;
|
|
1107
|
+
primary: string;
|
|
1108
|
+
primaryForeground: string;
|
|
1109
|
+
secondary: string;
|
|
1110
|
+
secondaryForeground: string;
|
|
1111
|
+
muted: string;
|
|
1112
|
+
mutedForeground: string;
|
|
1113
|
+
accent: string;
|
|
1114
|
+
accentForeground: string;
|
|
1115
|
+
destructive: string;
|
|
1116
|
+
destructiveForeground: string;
|
|
1117
|
+
border: string;
|
|
1118
|
+
input: string;
|
|
1119
|
+
ring: string;
|
|
1120
|
+
chart1: string;
|
|
1121
|
+
chart2: string;
|
|
1122
|
+
chart3: string;
|
|
1123
|
+
chart4: string;
|
|
1124
|
+
chart5: string;
|
|
1125
|
+
sidebar: string;
|
|
1126
|
+
sidebarForeground: string;
|
|
1127
|
+
sidebarPrimary: string;
|
|
1128
|
+
sidebarPrimaryForeground: string;
|
|
1129
|
+
sidebarAccent: string;
|
|
1130
|
+
sidebarAccentForeground: string;
|
|
1131
|
+
sidebarBorder: string;
|
|
1132
|
+
sidebarRing: string;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
interface NubaseContextData<TApiEndpoints = any, TParamsSchema extends ObjectSchema<any> | undefined = undefined> {
|
|
1136
|
+
config: NubaseFrontendConfig<TApiEndpoints>;
|
|
1137
|
+
commands: CommandRegistry;
|
|
1138
|
+
resourceActions: ResourceActionsExecutor;
|
|
1139
|
+
keybindings: Keybinding[];
|
|
1140
|
+
/**
|
|
1141
|
+
* Typed HTTP client instance created from the configured API endpoints.
|
|
1142
|
+
* This is the client that views should use for type-safe API calls.
|
|
1143
|
+
*/
|
|
1144
|
+
http: TypedApiClientFromEndpoints<TApiEndpoints>;
|
|
1145
|
+
modal: UseModalResult;
|
|
1146
|
+
/**
|
|
1147
|
+
* Dialog provider for confirmation dialogs and alerts.
|
|
1148
|
+
*/
|
|
1149
|
+
dialog: UseDialogResult;
|
|
1150
|
+
/**
|
|
1151
|
+
* React Query client for cache management and query invalidation.
|
|
1152
|
+
*/
|
|
1153
|
+
queryClient: QueryClient;
|
|
1154
|
+
theming: {
|
|
1155
|
+
themeIds: string[];
|
|
1156
|
+
themeMap: Record<string, NubaseTheme>;
|
|
1157
|
+
activeThemeId: string;
|
|
1158
|
+
setActiveThemeId: (themeId: string) => void;
|
|
1159
|
+
};
|
|
1160
|
+
router: AnyRouter;
|
|
1161
|
+
/**
|
|
1162
|
+
* Navigation history tracker for tracking and accessing route history.
|
|
1163
|
+
*/
|
|
1164
|
+
navigationHistory: NavigationHistoryTracker;
|
|
1165
|
+
/**
|
|
1166
|
+
* URL parameters extracted and validated against the view's schemaParams.
|
|
1167
|
+
* Only present when the view defines a schemaParams.
|
|
1168
|
+
*/
|
|
1169
|
+
params: TParamsSchema extends ObjectSchema<any> ? Infer<TParamsSchema> : undefined;
|
|
1170
|
+
/**
|
|
1171
|
+
* Authentication controller for managing user authentication.
|
|
1172
|
+
* Null if no authentication is configured.
|
|
1173
|
+
*/
|
|
1174
|
+
authentication: AuthenticationController | null;
|
|
1175
|
+
/**
|
|
1176
|
+
* Current workspace slug extracted from the URL path (e.g., "tavern" from /tavern/r/ticket/create).
|
|
1177
|
+
* Used for path-based multi-workspace.
|
|
1178
|
+
*/
|
|
1179
|
+
workspace: string | null;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Type-safe command definition that uses Nubase schemas for argument validation.
|
|
1184
|
+
*
|
|
1185
|
+
* @template TArgsSchema - The schema type for command arguments, or undefined if no args
|
|
1186
|
+
*/
|
|
1187
|
+
interface TypedCommandDefinition<TArgsSchema extends BaseSchema<any> | undefined = undefined> {
|
|
1188
|
+
id: string;
|
|
1189
|
+
name: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Icon component (not instantiated) for this command.
|
|
1192
|
+
* Used in command palettes, menus, and anywhere the command is displayed.
|
|
1193
|
+
*/
|
|
1194
|
+
icon?: IconComponent;
|
|
1195
|
+
/**
|
|
1196
|
+
* Optional schema for validating command arguments.
|
|
1197
|
+
* If provided, arguments will be validated at runtime.
|
|
1198
|
+
*/
|
|
1199
|
+
argsSchema?: TArgsSchema;
|
|
1200
|
+
/**
|
|
1201
|
+
* Command execution function with type-safe arguments.
|
|
1202
|
+
* Args are typed based on the provided schema.
|
|
1203
|
+
*/
|
|
1204
|
+
execute: (context: NubaseContextData, args: TArgsSchema extends BaseSchema<any> ? Infer<TArgsSchema> : undefined) => void | Promise<void>;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Modern keybinding interface using typed actions.
|
|
1208
|
+
* Supports both handler and command actions with full type safety.
|
|
1209
|
+
*/
|
|
1210
|
+
interface ActionKeybinding {
|
|
1211
|
+
key: string | string[];
|
|
1212
|
+
action: Action;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Union type supporting both legacy command and modern action keybindings.
|
|
1216
|
+
* Provides backward compatibility while enabling type-safe actions.
|
|
1217
|
+
*/
|
|
1218
|
+
type Keybinding = {
|
|
1219
|
+
key: string | string[];
|
|
1220
|
+
command: string;
|
|
1221
|
+
commandArgs?: Record<string, unknown>;
|
|
1222
|
+
} | ActionKeybinding;
|
|
1223
|
+
interface CommandRegistry {
|
|
1224
|
+
register: (command: TypedCommandDefinition<any>) => void;
|
|
1225
|
+
execute: (commandId: string, args?: unknown) => Promise<void>;
|
|
1226
|
+
getCommand: (commandId: string) => TypedCommandDefinition<any> | undefined;
|
|
1227
|
+
getAllCommands: () => TypedCommandDefinition<any>[];
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Base action interface with common properties shared by all action types.
|
|
1232
|
+
*/
|
|
1233
|
+
interface BaseAction {
|
|
1234
|
+
id: string;
|
|
1235
|
+
label?: string;
|
|
1236
|
+
icon?: React__default.ComponentType<{
|
|
1237
|
+
size?: number;
|
|
1238
|
+
className?: string;
|
|
1239
|
+
}>;
|
|
1240
|
+
disabled?: boolean;
|
|
1241
|
+
variant?: "default" | "destructive";
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Context provided to handler actions when executed from row-level components
|
|
1245
|
+
*/
|
|
1246
|
+
interface ActionExecutionContext {
|
|
1247
|
+
rowData?: any;
|
|
1248
|
+
context?: any;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Context provided to resource actions when executed on selected resources
|
|
1252
|
+
*/
|
|
1253
|
+
interface ResourceActionExecutionContext {
|
|
1254
|
+
resourceType: string;
|
|
1255
|
+
selectedIds: (string | number)[];
|
|
1256
|
+
context?: any;
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Handler-based action that executes a function directly.
|
|
1260
|
+
* Best for simple actions and Storybook examples.
|
|
1261
|
+
* Can optionally receive execution context for row-level actions.
|
|
1262
|
+
*/
|
|
1263
|
+
interface HandlerAction extends BaseAction {
|
|
1264
|
+
type: "handler";
|
|
1265
|
+
onExecute: (executionContext?: ActionExecutionContext) => void | Promise<void>;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Command-based action that executes through the command registry.
|
|
1269
|
+
* Best for application-wide actions that need to be consistent and type-safe.
|
|
1270
|
+
* @template TCommand - The command definition type for type-safe argument inference
|
|
1271
|
+
*/
|
|
1272
|
+
interface CommandAction<TCommand = any> extends BaseAction {
|
|
1273
|
+
type: "command";
|
|
1274
|
+
command: string;
|
|
1275
|
+
commandArgs?: TCommand extends TypedCommandDefinition<infer TSchema> ? TSchema extends BaseSchema<any> ? Infer<TSchema> : undefined : Record<string, unknown>;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Resource-based action that executes on selected resources.
|
|
1279
|
+
* Best for bulk operations on multiple selected items (e.g., delete multiple tickets).
|
|
1280
|
+
* Requires ResourceContext to provide selected resource IDs.
|
|
1281
|
+
*/
|
|
1282
|
+
interface ResourceAction extends BaseAction {
|
|
1283
|
+
type: "resource";
|
|
1284
|
+
onExecute: (executionContext: ResourceActionExecutionContext) => void | Promise<void>;
|
|
1285
|
+
}
|
|
1286
|
+
/**
|
|
1287
|
+
* Union type for all supported action types.
|
|
1288
|
+
*/
|
|
1289
|
+
type Action = HandlerAction | CommandAction<any> | ResourceAction;
|
|
1290
|
+
/**
|
|
1291
|
+
* Type for action or separator - used consistently across all action components.
|
|
1292
|
+
*/
|
|
1293
|
+
type ActionOrSeparator = Action | "separator";
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Configuration for creating a resource action
|
|
1297
|
+
*/
|
|
1298
|
+
interface CreateResourceActionConfig {
|
|
1299
|
+
id: string;
|
|
1300
|
+
label?: string;
|
|
1301
|
+
icon?: React__default.ComponentType<{
|
|
1302
|
+
size?: number;
|
|
1303
|
+
className?: string;
|
|
1304
|
+
}>;
|
|
1305
|
+
disabled?: boolean;
|
|
1306
|
+
variant?: "default" | "destructive";
|
|
1307
|
+
onExecute: (context: ResourceActionExecutionContext) => void | Promise<void>;
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Helper function to create a type-safe resource action.
|
|
1311
|
+
* Resource actions operate on selected resources and receive the resource type and selected IDs.
|
|
1312
|
+
*
|
|
1313
|
+
* @param config - Configuration for the resource action
|
|
1314
|
+
* @returns A properly typed ResourceAction
|
|
1315
|
+
*
|
|
1316
|
+
* @example
|
|
1317
|
+
* ```typescript
|
|
1318
|
+
* const deleteTicketsAction = createResourceAction({
|
|
1319
|
+
* id: "delete-tickets",
|
|
1320
|
+
* label: "Delete Selected",
|
|
1321
|
+
* icon: TrashIcon,
|
|
1322
|
+
* variant: "destructive",
|
|
1323
|
+
* onExecute: async ({ selectedIds, context }) => {
|
|
1324
|
+
* // Bulk delete the selected tickets
|
|
1325
|
+
* await Promise.all(
|
|
1326
|
+
* selectedIds.map(id => context.http.deleteTicket({ params: { id } }))
|
|
1327
|
+
* );
|
|
1328
|
+
* showToast(`Deleted ${selectedIds.length} tickets`, "success");
|
|
1329
|
+
* },
|
|
1330
|
+
* });
|
|
1331
|
+
* ```
|
|
1332
|
+
*/
|
|
1333
|
+
declare function createResourceAction(config: CreateResourceActionConfig): ResourceAction;
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Hook for executing actions in a standardized way.
|
|
1337
|
+
* Gracefully handles missing Nubase context (for Storybook compatibility).
|
|
1338
|
+
* Also handles resource context for resource actions.
|
|
1339
|
+
*
|
|
1340
|
+
* @returns An object with an executeAction function
|
|
1341
|
+
*/
|
|
1342
|
+
declare function useActionExecutor(): {
|
|
1343
|
+
executeAction: (action: Action) => Promise<void>;
|
|
1344
|
+
/**
|
|
1345
|
+
* Whether command execution is available (context is present).
|
|
1346
|
+
* Useful for components that want to show different UI based on availability.
|
|
1347
|
+
*/
|
|
1348
|
+
hasCommandSupport: boolean;
|
|
1349
|
+
/**
|
|
1350
|
+
* Whether resource execution is available (both contexts are present).
|
|
1351
|
+
* Useful for components that want to show different UI based on availability.
|
|
1352
|
+
*/
|
|
1353
|
+
hasResourceSupport: boolean;
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* Type guard to check if an action is a HandlerAction.
|
|
1358
|
+
*/
|
|
1359
|
+
declare function isHandlerAction(action: Action): action is HandlerAction;
|
|
1360
|
+
/**
|
|
1361
|
+
* Type guard to check if an action is a CommandAction.
|
|
1362
|
+
*/
|
|
1363
|
+
declare function isCommandAction(action: Action): action is CommandAction;
|
|
1364
|
+
/**
|
|
1365
|
+
* Factory function for creating handler-based actions.
|
|
1366
|
+
*/
|
|
1367
|
+
declare function createHandlerAction(base: BaseAction, onExecute: () => void | Promise<void>): HandlerAction;
|
|
1368
|
+
/**
|
|
1369
|
+
* Factory function for creating type-safe command-based actions.
|
|
1370
|
+
* Supports both typed command definitions and legacy string commands.
|
|
1371
|
+
*/
|
|
1372
|
+
declare function createCommandAction<TCommand extends TypedCommandDefinition<any>>(base: BaseAction, command: TCommand, commandArgs?: TCommand extends TypedCommandDefinition<infer TSchema> ? TSchema extends _nubase_core.BaseSchema<any> ? _nubase_core.Infer<TSchema> : undefined : never): CommandAction<TCommand>;
|
|
1373
|
+
declare function createCommandAction(base: BaseAction, command: string, commandArgs?: Record<string, unknown>): CommandAction<any>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Utility to convert a list of actions with separators into grouped structure.
|
|
1376
|
+
* Splits actions at "separator" markers into separate arrays.
|
|
1377
|
+
*/
|
|
1378
|
+
declare function groupActionsBySeparators(actionsConfig: ActionOrSeparator[]): Action[][];
|
|
1379
|
+
|
|
1380
|
+
declare class CommandRegistryImpl implements CommandRegistry {
|
|
1381
|
+
private commands;
|
|
1382
|
+
private context;
|
|
1383
|
+
setContext(context: NubaseContextData): void;
|
|
1384
|
+
register(command: TypedCommandDefinition<any>): void;
|
|
1385
|
+
execute(commandId: string, args?: unknown): Promise<void>;
|
|
1386
|
+
getCommand(commandId: string): TypedCommandDefinition<any> | undefined;
|
|
1387
|
+
getAllCommands(): TypedCommandDefinition<any>[];
|
|
1388
|
+
clear(): void;
|
|
1389
|
+
}
|
|
1390
|
+
declare const commandRegistry: CommandRegistryImpl;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Factory function for creating type-safe command definitions.
|
|
1394
|
+
*
|
|
1395
|
+
* This function provides full TypeScript type inference for command arguments
|
|
1396
|
+
* based on the provided schema. Use this instead of directly creating
|
|
1397
|
+
* TypedCommandDefinition objects for better type safety.
|
|
1398
|
+
*
|
|
1399
|
+
* @param definition - The command definition with optional args schema
|
|
1400
|
+
* @returns A typed command definition with inferred argument types
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* // Command with no arguments
|
|
1405
|
+
* const simpleCommand = defineCommand({
|
|
1406
|
+
* id: "example.simple",
|
|
1407
|
+
* name: "Simple Command",
|
|
1408
|
+
* execute: (context) => {
|
|
1409
|
+
* // context is typed, args is undefined
|
|
1410
|
+
* },
|
|
1411
|
+
* });
|
|
1412
|
+
*
|
|
1413
|
+
* // Command with typed arguments
|
|
1414
|
+
* const typedCommand = defineCommand({
|
|
1415
|
+
* id: "example.typed",
|
|
1416
|
+
* name: "Typed Command",
|
|
1417
|
+
* argsSchema: nu.object({
|
|
1418
|
+
* resourceId: nu.string(),
|
|
1419
|
+
* count: nu.number().optional(),
|
|
1420
|
+
* }),
|
|
1421
|
+
* execute: (context, args) => {
|
|
1422
|
+
* // args is typed as { resourceId: string; count?: number | undefined }
|
|
1423
|
+
* console.log(args.resourceId); // Type-safe access
|
|
1424
|
+
* },
|
|
1425
|
+
* });
|
|
1426
|
+
* ```
|
|
1427
|
+
*/
|
|
1428
|
+
declare function createCommand<TArgsSchema extends BaseSchema<any> | undefined>(definition: TypedCommandDefinition<TArgsSchema>): TypedCommandDefinition<TArgsSchema>;
|
|
1429
|
+
|
|
1430
|
+
declare const workbenchOpenResourceOperation: TypedCommandDefinition<_nubase_core.OptionalSchema<_nubase_core.ObjectSchema<{
|
|
1431
|
+
resourceId: _nubase_core.OptionalSchema<_nubase_core.StringSchema>;
|
|
1432
|
+
operation: _nubase_core.OptionalSchema<_nubase_core.StringSchema>;
|
|
1433
|
+
}, null>>>;
|
|
1434
|
+
|
|
1435
|
+
declare const workbenchOpenResourceOperationInModal: TypedCommandDefinition<_nubase_core.OptionalSchema<_nubase_core.ObjectSchema<{
|
|
1436
|
+
resourceId: _nubase_core.OptionalSchema<_nubase_core.StringSchema>;
|
|
1437
|
+
operation: _nubase_core.OptionalSchema<_nubase_core.StringSchema>;
|
|
1438
|
+
}, null>>>;
|
|
1439
|
+
|
|
1440
|
+
declare const workbenchRunCommand: TypedCommandDefinition<_nubase_core.BaseSchema<any> | undefined>;
|
|
1441
|
+
|
|
1442
|
+
declare const workbenchSetTheme: TypedCommandDefinition<_nubase_core.OptionalSchema<_nubase_core.ObjectSchema<{
|
|
1443
|
+
themeId: _nubase_core.OptionalSchema<_nubase_core.StringSchema>;
|
|
1444
|
+
}, null>>>;
|
|
1445
|
+
|
|
1446
|
+
declare const workbenchViewHistory: TypedCommandDefinition<_nubase_core.BaseSchema<any> | undefined>;
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* Centralized exports for all command definitions.
|
|
1450
|
+
* This allows importing commands as a namespace: `import { commands } from "@nubase/frontend"`
|
|
1451
|
+
* Usage: `commands.workbenchSetTheme`, `commands.workbenchOpenResourceOperation`, etc.
|
|
1452
|
+
*/
|
|
1453
|
+
|
|
1454
|
+
declare const index_workbenchOpenResourceOperation: typeof workbenchOpenResourceOperation;
|
|
1455
|
+
declare const index_workbenchOpenResourceOperationInModal: typeof workbenchOpenResourceOperationInModal;
|
|
1456
|
+
declare const index_workbenchRunCommand: typeof workbenchRunCommand;
|
|
1457
|
+
declare const index_workbenchSetTheme: typeof workbenchSetTheme;
|
|
1458
|
+
declare const index_workbenchViewHistory: typeof workbenchViewHistory;
|
|
1459
|
+
declare namespace index {
|
|
1460
|
+
export { index_workbenchOpenResourceOperation as workbenchOpenResourceOperation, index_workbenchOpenResourceOperationInModal as workbenchOpenResourceOperationInModal, index_workbenchRunCommand as workbenchRunCommand, index_workbenchSetTheme as workbenchSetTheme, index_workbenchViewHistory as workbenchViewHistory };
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
declare const activityIndicatorVariants: (props?: ({
|
|
1464
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
1465
|
+
color?: "primary" | "secondary" | "surface" | "surfaceVariant" | "inherit" | null | undefined;
|
|
1466
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1467
|
+
interface ActivityIndicatorProps extends VariantProps<typeof activityIndicatorVariants> {
|
|
1468
|
+
className?: string;
|
|
1469
|
+
"aria-label"?: string;
|
|
1470
|
+
}
|
|
1471
|
+
declare const ActivityIndicator: React__default.FC<ActivityIndicatorProps>;
|
|
1472
|
+
|
|
1473
|
+
declare const actionBarVariants: (props?: ({
|
|
1474
|
+
variant?: "default" | null | undefined;
|
|
1475
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1476
|
+
interface ActionBarProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof actionBarVariants> {
|
|
1477
|
+
actions: ActionOrSeparator[];
|
|
1478
|
+
}
|
|
1479
|
+
declare const ActionBar: React__default.ForwardRefExoticComponent<ActionBarProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1480
|
+
|
|
1481
|
+
declare const actionBarContainerVariants: (props?: ({
|
|
1482
|
+
variant?: "default" | null | undefined;
|
|
1483
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1484
|
+
interface ActionBarContainerProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof actionBarContainerVariants> {
|
|
1485
|
+
}
|
|
1486
|
+
declare const ActionBarContainer: React__default.ForwardRefExoticComponent<ActionBarContainerProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1487
|
+
|
|
1488
|
+
declare const buttonBarVariants: (props?: ({
|
|
1489
|
+
alignment?: "center" | "left" | "right" | null | undefined;
|
|
1490
|
+
variant?: "transparent" | "muted" | null | undefined;
|
|
1491
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1492
|
+
interface ButtonBarProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof buttonBarVariants> {
|
|
1493
|
+
}
|
|
1494
|
+
declare const ButtonBar: React__default.ForwardRefExoticComponent<ButtonBarProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1495
|
+
|
|
1496
|
+
declare const calloutVariants: (props?: ({
|
|
1497
|
+
variant?: "info" | "danger" | null | undefined;
|
|
1498
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1499
|
+
interface CalloutProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof calloutVariants> {
|
|
1500
|
+
/** The content to display in the callout */
|
|
1501
|
+
children: React__default.ReactNode;
|
|
1502
|
+
/** Optional icon to display */
|
|
1503
|
+
icon?: React__default.ReactNode;
|
|
1504
|
+
}
|
|
1505
|
+
declare const Callout: React__default.FC<CalloutProps>;
|
|
1506
|
+
|
|
1507
|
+
type CardProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1508
|
+
declare const Card: React$1.ForwardRefExoticComponent<CardProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1509
|
+
type CardHeaderProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1510
|
+
declare const CardHeader: React$1.ForwardRefExoticComponent<CardHeaderProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1511
|
+
type CardTitleProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1512
|
+
declare const CardTitle: React$1.ForwardRefExoticComponent<CardTitleProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1513
|
+
type CardDescriptionProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1514
|
+
declare const CardDescription: React$1.ForwardRefExoticComponent<CardDescriptionProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1515
|
+
type CardActionProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1516
|
+
declare const CardAction: React$1.ForwardRefExoticComponent<CardActionProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1517
|
+
type CardContentProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1518
|
+
declare const CardContent: React$1.ForwardRefExoticComponent<CardContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1519
|
+
type CardFooterProps = React$1.HTMLAttributes<HTMLDivElement>;
|
|
1520
|
+
declare const CardFooter: React$1.ForwardRefExoticComponent<CardFooterProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1521
|
+
|
|
1522
|
+
declare const THEMES: {
|
|
1523
|
+
readonly light: "";
|
|
1524
|
+
readonly dark: ".dark";
|
|
1525
|
+
};
|
|
1526
|
+
type ChartConfig = {
|
|
1527
|
+
[k in string]: {
|
|
1528
|
+
label?: React$1.ReactNode;
|
|
1529
|
+
icon?: React$1.ComponentType;
|
|
1530
|
+
} & ({
|
|
1531
|
+
color?: string;
|
|
1532
|
+
theme?: never;
|
|
1533
|
+
} | {
|
|
1534
|
+
color?: never;
|
|
1535
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
1536
|
+
});
|
|
1537
|
+
};
|
|
1538
|
+
type ChartContextProps = {
|
|
1539
|
+
config: ChartConfig;
|
|
1540
|
+
};
|
|
1541
|
+
declare function useChart(): ChartContextProps;
|
|
1542
|
+
declare const ChartContainer: React$1.ForwardRefExoticComponent<Omit<React$1.ClassAttributes<HTMLDivElement> & React$1.HTMLAttributes<HTMLDivElement> & {
|
|
1543
|
+
config: ChartConfig;
|
|
1544
|
+
children: React$1.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
1545
|
+
}, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
1546
|
+
declare const ChartStyle: ({ id, config }: {
|
|
1547
|
+
id: string;
|
|
1548
|
+
config: ChartConfig;
|
|
1549
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
1550
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
1551
|
+
interface ChartTooltipContentProps extends React$1.ComponentProps<"div"> {
|
|
1552
|
+
active?: boolean;
|
|
1553
|
+
payload?: Array<{
|
|
1554
|
+
name?: string;
|
|
1555
|
+
value?: number | string;
|
|
1556
|
+
dataKey?: string | number;
|
|
1557
|
+
color?: string;
|
|
1558
|
+
payload?: Record<string, unknown>;
|
|
1559
|
+
}>;
|
|
1560
|
+
label?: string;
|
|
1561
|
+
labelFormatter?: (label: unknown, payload: unknown[]) => React$1.ReactNode;
|
|
1562
|
+
labelClassName?: string;
|
|
1563
|
+
formatter?: (value: unknown, name: unknown, item: unknown, index: number, payload: unknown) => React$1.ReactNode;
|
|
1564
|
+
color?: string;
|
|
1565
|
+
hideLabel?: boolean;
|
|
1566
|
+
hideIndicator?: boolean;
|
|
1567
|
+
indicator?: "line" | "dot" | "dashed";
|
|
1568
|
+
nameKey?: string;
|
|
1569
|
+
labelKey?: string;
|
|
1570
|
+
}
|
|
1571
|
+
declare const ChartTooltipContent: React$1.ForwardRefExoticComponent<Omit<ChartTooltipContentProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
1572
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
1573
|
+
interface ChartLegendContentProps extends React$1.ComponentProps<"div"> {
|
|
1574
|
+
payload?: Array<{
|
|
1575
|
+
value?: string;
|
|
1576
|
+
dataKey?: string | number;
|
|
1577
|
+
color?: string;
|
|
1578
|
+
}>;
|
|
1579
|
+
verticalAlign?: "top" | "bottom";
|
|
1580
|
+
hideIcon?: boolean;
|
|
1581
|
+
nameKey?: string;
|
|
1582
|
+
}
|
|
1583
|
+
declare const ChartLegendContent: React$1.ForwardRefExoticComponent<Omit<ChartLegendContentProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
1584
|
+
|
|
1585
|
+
interface ConnectedWidgetProps {
|
|
1586
|
+
widget: WidgetDescriptor<unknown>;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* ConnectedWidget handles data fetching and renders the appropriate content
|
|
1590
|
+
* inside a DashboardWidget based on the widget type.
|
|
1591
|
+
*
|
|
1592
|
+
* This component:
|
|
1593
|
+
* 1. Fetches data from the widget's endpoint
|
|
1594
|
+
* 2. Shows loading/error states
|
|
1595
|
+
* 3. Renders the appropriate content renderer based on widget type
|
|
1596
|
+
* 4. Wraps everything in the DashboardWidget presentation component
|
|
1597
|
+
*/
|
|
1598
|
+
declare function ConnectedWidget({ widget }: ConnectedWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1599
|
+
|
|
1600
|
+
interface DashboardDragConfig {
|
|
1601
|
+
/** Enable dragging */
|
|
1602
|
+
enabled?: boolean;
|
|
1603
|
+
/** CSS selector for drag handle */
|
|
1604
|
+
handle?: string;
|
|
1605
|
+
/** CSS selector for elements that should not trigger drag */
|
|
1606
|
+
cancel?: string;
|
|
1607
|
+
}
|
|
1608
|
+
interface DashboardResizeConfig {
|
|
1609
|
+
/** Enable resizing */
|
|
1610
|
+
enabled?: boolean;
|
|
1611
|
+
/** Which handles to show for resizing */
|
|
1612
|
+
handles?: Array<"s" | "w" | "e" | "n" | "sw" | "nw" | "se" | "ne">;
|
|
1613
|
+
}
|
|
1614
|
+
interface DashboardProps {
|
|
1615
|
+
/** The layout configuration for grid items */
|
|
1616
|
+
layout: Layout$1;
|
|
1617
|
+
/** Callback when layout changes */
|
|
1618
|
+
onLayoutChange?: (layout: Layout$1) => void;
|
|
1619
|
+
/** Grid configuration */
|
|
1620
|
+
gridConfig?: DashboardGridConfig;
|
|
1621
|
+
/** Drag configuration */
|
|
1622
|
+
dragConfig?: DashboardDragConfig;
|
|
1623
|
+
/** Resize configuration */
|
|
1624
|
+
resizeConfig?: DashboardResizeConfig;
|
|
1625
|
+
/** Additional class name for the dashboard container */
|
|
1626
|
+
className?: string;
|
|
1627
|
+
/** Dashboard widget children */
|
|
1628
|
+
children: React$1.ReactNode;
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Dashboard is a grid layout container for DashboardWidget components.
|
|
1632
|
+
* It uses react-grid-layout internally for drag-and-drop and resizing functionality.
|
|
1633
|
+
*/
|
|
1634
|
+
declare function Dashboard({ layout, onLayoutChange, gridConfig: gridConfigProp, dragConfig: dragConfigProp, resizeConfig: resizeConfigProp, className, children, }: DashboardProps): react_jsx_runtime.JSX.Element;
|
|
1635
|
+
|
|
1636
|
+
interface DashboardRendererProps {
|
|
1637
|
+
/** The dashboard descriptor to render */
|
|
1638
|
+
dashboard: DashboardDescriptor<any>;
|
|
1639
|
+
/** Optional controlled layout state */
|
|
1640
|
+
layout?: Layout$1;
|
|
1641
|
+
/** Callback when layout changes */
|
|
1642
|
+
onLayoutChange?: (layout: Layout$1) => void;
|
|
1643
|
+
/** Additional class name for the dashboard container */
|
|
1644
|
+
className?: string;
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Renders a complete dashboard from a DashboardDescriptor configuration.
|
|
1648
|
+
*
|
|
1649
|
+
* This component:
|
|
1650
|
+
* 1. Generates the layout from widget configurations
|
|
1651
|
+
* 2. Renders each widget as a ConnectedWidget (which handles data fetching)
|
|
1652
|
+
* 3. Manages layout state (controlled or uncontrolled)
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* ```tsx
|
|
1656
|
+
* import { analyticsDashboard } from "./dashboards/analytics";
|
|
1657
|
+
*
|
|
1658
|
+
* function AnalyticsPage() {
|
|
1659
|
+
* return (
|
|
1660
|
+
* <div className="p-4">
|
|
1661
|
+
* <DashboardRenderer dashboard={analyticsDashboard} />
|
|
1662
|
+
* </div>
|
|
1663
|
+
* );
|
|
1664
|
+
* }
|
|
1665
|
+
* ```
|
|
1666
|
+
*/
|
|
1667
|
+
declare function DashboardRenderer({ dashboard, layout: controlledLayout, onLayoutChange, className, }: DashboardRendererProps): react_jsx_runtime.JSX.Element;
|
|
1668
|
+
|
|
1669
|
+
interface DashboardWidgetProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
1670
|
+
/** The title of the widget */
|
|
1671
|
+
title: string;
|
|
1672
|
+
/** Optional icon component (not instantiated) shown before the title */
|
|
1673
|
+
icon?: IconComponent;
|
|
1674
|
+
/** Optional action elements (e.g., buttons) shown on the right side of the header */
|
|
1675
|
+
action?: React$1.ReactNode;
|
|
1676
|
+
/** Optional footer content */
|
|
1677
|
+
footer?: React$1.ReactNode;
|
|
1678
|
+
/** Whether the widget is draggable (shows drag handle) */
|
|
1679
|
+
draggable?: boolean;
|
|
1680
|
+
/** The widget content */
|
|
1681
|
+
children: React$1.ReactNode;
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* DashboardWidget is a Widget component adapted for use inside a Dashboard.
|
|
1685
|
+
* It includes a drag handle for repositioning within the grid layout.
|
|
1686
|
+
*/
|
|
1687
|
+
declare const DashboardWidget: React$1.ForwardRefExoticComponent<DashboardWidgetProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1688
|
+
|
|
1689
|
+
interface PartialPosition {
|
|
1690
|
+
readonly idx?: number | undefined;
|
|
1691
|
+
readonly rowIdx?: number | undefined;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
type DefaultColumnOptions<R, SR> = Pick<Column<R, SR>, "renderCell" | "renderHeaderCell" | "width" | "minWidth" | "maxWidth" | "resizable" | "sortable" | "draggable">;
|
|
1695
|
+
interface DataGridHandle {
|
|
1696
|
+
element: HTMLDivElement | null;
|
|
1697
|
+
scrollToCell: (position: PartialPosition) => void;
|
|
1698
|
+
selectCell: (position: Position, options?: SelectCellOptions) => void;
|
|
1699
|
+
}
|
|
1700
|
+
type SharedDivProps = Pick<React.ComponentProps<"div">, "role" | "aria-label" | "aria-labelledby" | "aria-description" | "aria-describedby" | "aria-rowcount" | "className" | "style">;
|
|
1701
|
+
interface DataGridProps<R, SR = unknown, K extends Key = Key> extends SharedDivProps {
|
|
1702
|
+
ref?: Maybe<React.Ref<DataGridHandle>>;
|
|
1703
|
+
/**
|
|
1704
|
+
* Grid and data Props
|
|
1705
|
+
*/
|
|
1706
|
+
/** An array of column definitions */
|
|
1707
|
+
columns: readonly ColumnOrColumnGroup<NoInfer<R>, NoInfer<SR>>[];
|
|
1708
|
+
/** A function called for each rendered row that should return a plain key/value pair object */
|
|
1709
|
+
rows: readonly R[];
|
|
1710
|
+
/** Rows pinned at the top of the grid for summary purposes */
|
|
1711
|
+
topSummaryRows?: Maybe<readonly SR[]>;
|
|
1712
|
+
/** Rows pinned at the bottom of the grid for summary purposes */
|
|
1713
|
+
bottomSummaryRows?: Maybe<readonly SR[]>;
|
|
1714
|
+
/** Function to return a unique key/identifier for each row */
|
|
1715
|
+
rowKeyGetter?: Maybe<(row: NoInfer<R>) => K>;
|
|
1716
|
+
/** Callback triggered when rows are changed */
|
|
1717
|
+
onRowsChange?: Maybe<(rows: NoInfer<R>[], data: RowsChangeData<NoInfer<R>, NoInfer<SR>>) => void>;
|
|
1718
|
+
/**
|
|
1719
|
+
* Dimensions props
|
|
1720
|
+
*/
|
|
1721
|
+
/**
|
|
1722
|
+
* Height of each row in pixels
|
|
1723
|
+
* @default 35
|
|
1724
|
+
*/
|
|
1725
|
+
rowHeight?: Maybe<number | ((row: NoInfer<R>) => number)>;
|
|
1726
|
+
/**
|
|
1727
|
+
* Height of the header row in pixels
|
|
1728
|
+
* @default 35
|
|
1729
|
+
*/
|
|
1730
|
+
headerRowHeight?: Maybe<number>;
|
|
1731
|
+
/**
|
|
1732
|
+
* Height of each summary row in pixels
|
|
1733
|
+
* @default 35
|
|
1734
|
+
*/
|
|
1735
|
+
summaryRowHeight?: Maybe<number>;
|
|
1736
|
+
/** A map of column widths */
|
|
1737
|
+
columnWidths?: Maybe<ColumnWidths>;
|
|
1738
|
+
/** Callback triggered when column widths change */
|
|
1739
|
+
onColumnWidthsChange?: Maybe<(columnWidths: ColumnWidths) => void>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Feature props
|
|
1742
|
+
*/
|
|
1743
|
+
/** A set of selected row keys */
|
|
1744
|
+
selectedRows?: Maybe<ReadonlySet<K>>;
|
|
1745
|
+
/** Function to determine if row selection is disabled for a specific row */
|
|
1746
|
+
isRowSelectionDisabled?: Maybe<(row: NoInfer<R>) => boolean>;
|
|
1747
|
+
/** Callback triggered when the selection changes */
|
|
1748
|
+
onSelectedRowsChange?: Maybe<(selectedRows: Set<NoInfer<K>>) => void>;
|
|
1749
|
+
/** An array of sorted columns */
|
|
1750
|
+
sortColumns?: Maybe<readonly SortColumn[]>;
|
|
1751
|
+
/** Callback triggered when sorting changes */
|
|
1752
|
+
onSortColumnsChange?: Maybe<(sortColumns: SortColumn[]) => void>;
|
|
1753
|
+
/** Default options applied to all columns */
|
|
1754
|
+
defaultColumnOptions?: Maybe<DefaultColumnOptions<NoInfer<R>, NoInfer<SR>>>;
|
|
1755
|
+
onFill?: Maybe<(event: FillEvent<NoInfer<R>>) => NoInfer<R>>;
|
|
1756
|
+
/**
|
|
1757
|
+
* Event props
|
|
1758
|
+
*/
|
|
1759
|
+
/** Callback triggered when a pointer becomes active in a cell */
|
|
1760
|
+
onCellMouseDown?: CellMouseEventHandler<R, SR>;
|
|
1761
|
+
/** Callback triggered when a cell is clicked */
|
|
1762
|
+
onCellClick?: CellMouseEventHandler<R, SR>;
|
|
1763
|
+
/** Callback triggered when a cell is double-clicked */
|
|
1764
|
+
onCellDoubleClick?: CellMouseEventHandler<R, SR>;
|
|
1765
|
+
/** Callback triggered when a cell is right-clicked */
|
|
1766
|
+
onCellContextMenu?: CellMouseEventHandler<R, SR>;
|
|
1767
|
+
/** Callback triggered when a key is pressed in a cell */
|
|
1768
|
+
onCellKeyDown?: Maybe<(args: CellKeyDownArgs<NoInfer<R>, NoInfer<SR>>, event: CellKeyboardEvent) => void>;
|
|
1769
|
+
/** Callback triggered when a cell's content is copied */
|
|
1770
|
+
onCellCopy?: Maybe<(args: CellCopyArgs<NoInfer<R>, NoInfer<SR>>, event: CellClipboardEvent) => void>;
|
|
1771
|
+
/** Callback triggered when content is pasted into a cell */
|
|
1772
|
+
onCellPaste?: Maybe<(args: CellPasteArgs<NoInfer<R>, NoInfer<SR>>, event: CellClipboardEvent) => NoInfer<R>>;
|
|
1773
|
+
/** Function called whenever cell selection is changed */
|
|
1774
|
+
onSelectedCellChange?: Maybe<(args: CellSelectArgs<NoInfer<R>, NoInfer<SR>>) => void>;
|
|
1775
|
+
/** Callback triggered when the grid is scrolled */
|
|
1776
|
+
onScroll?: Maybe<(event: React.UIEvent<HTMLDivElement>) => void>;
|
|
1777
|
+
/** Callback triggered when column is resized */
|
|
1778
|
+
onColumnResize?: Maybe<(column: CalculatedColumn<R, SR>, width: number) => void>;
|
|
1779
|
+
/** Callback triggered when columns are reordered */
|
|
1780
|
+
onColumnsReorder?: Maybe<(sourceColumnKey: string, targetColumnKey: string) => void>;
|
|
1781
|
+
/**
|
|
1782
|
+
* Toggles and modes
|
|
1783
|
+
*/
|
|
1784
|
+
/** @default true */
|
|
1785
|
+
enableVirtualization?: Maybe<boolean>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Miscellaneous
|
|
1788
|
+
*/
|
|
1789
|
+
/** Custom renderers for cells, rows, and other components */
|
|
1790
|
+
renderers?: Maybe<Renderers<NoInfer<R>, NoInfer<SR>>>;
|
|
1791
|
+
/** Function to apply custom class names to rows */
|
|
1792
|
+
rowClass?: Maybe<(row: NoInfer<R>, rowIdx: number) => Maybe<string>>;
|
|
1793
|
+
/** Custom class name for the header row */
|
|
1794
|
+
headerRowClass?: Maybe<string>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Text direction of the grid ('ltr' or 'rtl')
|
|
1797
|
+
* @default 'ltr'
|
|
1798
|
+
*/
|
|
1799
|
+
direction?: Maybe<Direction>;
|
|
1800
|
+
"data-testid"?: Maybe<string>;
|
|
1801
|
+
"data-cy"?: Maybe<string>;
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* Main API Component to render a data grid of rows and columns
|
|
1805
|
+
*
|
|
1806
|
+
* @example
|
|
1807
|
+
*
|
|
1808
|
+
* <DataGrid columns={columns} rows={rows} />
|
|
1809
|
+
*/
|
|
1810
|
+
declare function DataGrid<R, SR = unknown, K extends Key = Key>(props: DataGridProps<R, SR, K>): react_jsx_runtime.JSX.Element;
|
|
1811
|
+
|
|
1812
|
+
type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
1813
|
+
type Maybe<T> = T | undefined | null;
|
|
1814
|
+
interface Column<TRow, TSummaryRow = unknown> {
|
|
1815
|
+
/** The name of the column. Displayed in the header cell by default */
|
|
1816
|
+
readonly name: string | ReactElement;
|
|
1817
|
+
/** A unique key to distinguish each column */
|
|
1818
|
+
readonly key: string;
|
|
1819
|
+
/**
|
|
1820
|
+
* Column width. If not specified, it will be determined automatically based on grid width and specified widths of other columns
|
|
1821
|
+
* @default 'auto'
|
|
1822
|
+
*/
|
|
1823
|
+
readonly width?: Maybe<number | string>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Minimum column width in pixels
|
|
1826
|
+
* @default 50
|
|
1827
|
+
*/
|
|
1828
|
+
readonly minWidth?: Maybe<number>;
|
|
1829
|
+
/** Maximum column width in pixels */
|
|
1830
|
+
readonly maxWidth?: Maybe<number>;
|
|
1831
|
+
/** Class name(s) for the cell */
|
|
1832
|
+
readonly cellClass?: Maybe<string | ((row: TRow) => Maybe<string>)>;
|
|
1833
|
+
/** Class name(s) for the header cell */
|
|
1834
|
+
readonly headerCellClass?: Maybe<string>;
|
|
1835
|
+
/** Class name(s) for the summary cell */
|
|
1836
|
+
readonly summaryCellClass?: Maybe<string | ((row: TSummaryRow) => Maybe<string>)>;
|
|
1837
|
+
/** Render function to render the content of cells */
|
|
1838
|
+
readonly renderCell?: Maybe<(props: RenderCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
1839
|
+
/** Render function to render the content of the header cell */
|
|
1840
|
+
readonly renderHeaderCell?: Maybe<(props: RenderHeaderCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
1841
|
+
/** Render function to render the content of summary cells */
|
|
1842
|
+
readonly renderSummaryCell?: Maybe<(props: RenderSummaryCellProps<TSummaryRow, TRow>) => ReactNode>;
|
|
1843
|
+
/** Render function to render the content of group cells */
|
|
1844
|
+
readonly renderGroupCell?: Maybe<(props: RenderGroupCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
1845
|
+
/** Render function to render the content of edit cells. When set, the column is automatically set to be editable */
|
|
1846
|
+
readonly renderEditCell?: Maybe<(props: RenderEditCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
1847
|
+
/** Enables cell editing. If set and no editor property specified, then a textinput will be used as the cell editor */
|
|
1848
|
+
readonly editable?: Maybe<boolean | ((row: TRow) => boolean)>;
|
|
1849
|
+
readonly colSpan?: Maybe<(args: ColSpanArgs<TRow, TSummaryRow>) => Maybe<number>>;
|
|
1850
|
+
/** Determines whether column is frozen */
|
|
1851
|
+
readonly frozen?: Maybe<boolean>;
|
|
1852
|
+
/** Enable resizing of the column */
|
|
1853
|
+
readonly resizable?: Maybe<boolean>;
|
|
1854
|
+
/** Enable sorting of the column */
|
|
1855
|
+
readonly sortable?: Maybe<boolean>;
|
|
1856
|
+
/** Enable dragging of the column */
|
|
1857
|
+
readonly draggable?: Maybe<boolean>;
|
|
1858
|
+
/** Sets the column sort order to be descending instead of ascending the first time the column is sorted */
|
|
1859
|
+
readonly sortDescendingFirst?: Maybe<boolean>;
|
|
1860
|
+
/** Options for cell editing */
|
|
1861
|
+
readonly editorOptions?: Maybe<{
|
|
1862
|
+
/**
|
|
1863
|
+
* Render the cell content in addition to the edit cell.
|
|
1864
|
+
* Enable this option when the editor is rendered outside the grid, like a modal for example.
|
|
1865
|
+
* By default, the cell content is not rendered when the edit cell is open.
|
|
1866
|
+
* @default false
|
|
1867
|
+
*/
|
|
1868
|
+
readonly displayCellContent?: Maybe<boolean>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Commit changes when clicking outside the cell
|
|
1871
|
+
* @default true
|
|
1872
|
+
*/
|
|
1873
|
+
readonly commitOnOutsideClick?: Maybe<boolean>;
|
|
1874
|
+
/**
|
|
1875
|
+
* Close the editor when the row changes externally
|
|
1876
|
+
* @default true
|
|
1877
|
+
*/
|
|
1878
|
+
readonly closeOnExternalRowChange?: Maybe<boolean>;
|
|
1879
|
+
}>;
|
|
1880
|
+
}
|
|
1881
|
+
interface CalculatedColumn<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {
|
|
1882
|
+
readonly parent: CalculatedColumnParent<TRow, TSummaryRow> | undefined;
|
|
1883
|
+
readonly idx: number;
|
|
1884
|
+
readonly level: number;
|
|
1885
|
+
readonly width: number | string;
|
|
1886
|
+
readonly minWidth: number;
|
|
1887
|
+
readonly maxWidth: number | undefined;
|
|
1888
|
+
readonly resizable: boolean;
|
|
1889
|
+
readonly sortable: boolean;
|
|
1890
|
+
readonly draggable: boolean;
|
|
1891
|
+
readonly frozen: boolean;
|
|
1892
|
+
readonly renderCell: (props: RenderCellProps<TRow, TSummaryRow>) => ReactNode;
|
|
1893
|
+
readonly renderHeaderCell: (props: RenderHeaderCellProps<TRow, TSummaryRow>) => ReactNode;
|
|
1894
|
+
}
|
|
1895
|
+
interface ColumnGroup<R, SR = unknown> {
|
|
1896
|
+
/** The name of the column group, it will be displayed in the header cell */
|
|
1897
|
+
readonly name: string | ReactElement;
|
|
1898
|
+
readonly headerCellClass?: Maybe<string>;
|
|
1899
|
+
readonly children: readonly ColumnOrColumnGroup<R, SR>[];
|
|
1900
|
+
}
|
|
1901
|
+
interface CalculatedColumnParent<R, SR> {
|
|
1902
|
+
readonly name: string | ReactElement;
|
|
1903
|
+
readonly parent: CalculatedColumnParent<R, SR> | undefined;
|
|
1904
|
+
readonly idx: number;
|
|
1905
|
+
readonly colSpan: number;
|
|
1906
|
+
readonly level: number;
|
|
1907
|
+
readonly headerCellClass?: Maybe<string>;
|
|
1908
|
+
}
|
|
1909
|
+
type ColumnOrColumnGroup<R, SR = unknown> = Column<R, SR> | ColumnGroup<R, SR>;
|
|
1910
|
+
type CalculatedColumnOrColumnGroup<R, SR> = CalculatedColumnParent<R, SR> | CalculatedColumn<R, SR>;
|
|
1911
|
+
interface Position {
|
|
1912
|
+
readonly idx: number;
|
|
1913
|
+
readonly rowIdx: number;
|
|
1914
|
+
}
|
|
1915
|
+
interface RenderCellProps<TRow, TSummaryRow = unknown> {
|
|
1916
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1917
|
+
row: TRow;
|
|
1918
|
+
rowIdx: number;
|
|
1919
|
+
isCellEditable: boolean;
|
|
1920
|
+
tabIndex: number;
|
|
1921
|
+
onRowChange: (row: TRow) => void;
|
|
1922
|
+
}
|
|
1923
|
+
interface RenderSummaryCellProps<TSummaryRow, TRow = unknown> {
|
|
1924
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1925
|
+
row: TSummaryRow;
|
|
1926
|
+
tabIndex: number;
|
|
1927
|
+
}
|
|
1928
|
+
interface RenderGroupCellProps<TRow, TSummaryRow = unknown> {
|
|
1929
|
+
groupKey: unknown;
|
|
1930
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1931
|
+
row: GroupRow<TRow>;
|
|
1932
|
+
childRows: readonly TRow[];
|
|
1933
|
+
isExpanded: boolean;
|
|
1934
|
+
tabIndex: number;
|
|
1935
|
+
toggleGroup: () => void;
|
|
1936
|
+
}
|
|
1937
|
+
interface RenderEditCellProps<TRow, TSummaryRow = unknown> {
|
|
1938
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1939
|
+
row: TRow;
|
|
1940
|
+
rowIdx: number;
|
|
1941
|
+
onRowChange: (row: TRow, commitChanges?: boolean) => void;
|
|
1942
|
+
onClose: (commitChanges?: boolean, shouldFocusCell?: boolean) => void;
|
|
1943
|
+
}
|
|
1944
|
+
interface RenderHeaderCellProps<TRow, TSummaryRow = unknown> {
|
|
1945
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1946
|
+
sortDirection: SortDirection | undefined;
|
|
1947
|
+
priority: number | undefined;
|
|
1948
|
+
tabIndex: number;
|
|
1949
|
+
}
|
|
1950
|
+
interface BaseCellRendererProps<TRow, TSummaryRow = unknown> extends Omit$1<React.ComponentProps<"div">, "children">, Pick<DataGridProps<TRow, TSummaryRow>, "onCellMouseDown" | "onCellClick" | "onCellDoubleClick" | "onCellContextMenu"> {
|
|
1951
|
+
rowIdx: number;
|
|
1952
|
+
selectCell: (position: Position, options?: SelectCellOptions) => void;
|
|
1953
|
+
}
|
|
1954
|
+
interface CellRendererProps<TRow, TSummaryRow> extends BaseCellRendererProps<TRow, TSummaryRow> {
|
|
1955
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1956
|
+
row: TRow;
|
|
1957
|
+
colSpan: number | undefined;
|
|
1958
|
+
isDraggedOver: boolean;
|
|
1959
|
+
isCellSelected: boolean;
|
|
1960
|
+
onRowChange: (column: CalculatedColumn<TRow, TSummaryRow>, newRow: TRow) => void;
|
|
1961
|
+
}
|
|
1962
|
+
type CellEvent<E extends React.SyntheticEvent<HTMLDivElement>> = E & {
|
|
1963
|
+
preventGridDefault: () => void;
|
|
1964
|
+
isGridDefaultPrevented: () => boolean;
|
|
1965
|
+
};
|
|
1966
|
+
type CellMouseEvent = CellEvent<React.MouseEvent<HTMLDivElement>>;
|
|
1967
|
+
type CellKeyboardEvent = CellEvent<React.KeyboardEvent<HTMLDivElement>>;
|
|
1968
|
+
type CellClipboardEvent = React.ClipboardEvent<HTMLDivElement>;
|
|
1969
|
+
interface CellMouseArgs<TRow, TSummaryRow = unknown> {
|
|
1970
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1971
|
+
row: TRow;
|
|
1972
|
+
rowIdx: number;
|
|
1973
|
+
selectCell: (enableEditor?: boolean) => void;
|
|
1974
|
+
}
|
|
1975
|
+
interface SelectCellKeyDownArgs<TRow, TSummaryRow = unknown> {
|
|
1976
|
+
mode: "SELECT";
|
|
1977
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1978
|
+
row: TRow;
|
|
1979
|
+
rowIdx: number;
|
|
1980
|
+
selectCell: (position: Position, options?: SelectCellOptions) => void;
|
|
1981
|
+
}
|
|
1982
|
+
interface EditCellKeyDownArgs<TRow, TSummaryRow = unknown> {
|
|
1983
|
+
mode: "EDIT";
|
|
1984
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1985
|
+
row: TRow;
|
|
1986
|
+
rowIdx: number;
|
|
1987
|
+
navigate: () => void;
|
|
1988
|
+
onClose: (commitChanges?: boolean, shouldFocusCell?: boolean) => void;
|
|
1989
|
+
}
|
|
1990
|
+
type CellKeyDownArgs<TRow, TSummaryRow = unknown> = SelectCellKeyDownArgs<TRow, TSummaryRow> | EditCellKeyDownArgs<TRow, TSummaryRow>;
|
|
1991
|
+
interface CellSelectArgs<TRow, TSummaryRow = unknown> {
|
|
1992
|
+
rowIdx: number;
|
|
1993
|
+
row: TRow | undefined;
|
|
1994
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
1995
|
+
}
|
|
1996
|
+
type CellMouseEventHandler<R, SR> = Maybe<(args: CellMouseArgs<NoInfer<R>, NoInfer<SR>>, event: CellMouseEvent) => void>;
|
|
1997
|
+
interface BaseRenderRowProps<TRow, TSummaryRow = unknown> extends BaseCellRendererProps<TRow, TSummaryRow> {
|
|
1998
|
+
viewportColumns: readonly CalculatedColumn<TRow, TSummaryRow>[];
|
|
1999
|
+
rowIdx: number;
|
|
2000
|
+
selectedCellIdx: number | undefined;
|
|
2001
|
+
isRowSelectionDisabled: boolean;
|
|
2002
|
+
isRowSelected: boolean;
|
|
2003
|
+
gridRowStart: number;
|
|
2004
|
+
}
|
|
2005
|
+
interface RenderRowProps<TRow, TSummaryRow = unknown> extends BaseRenderRowProps<TRow, TSummaryRow> {
|
|
2006
|
+
row: TRow;
|
|
2007
|
+
lastFrozenColumnIndex: number;
|
|
2008
|
+
draggedOverCellIdx: number | undefined;
|
|
2009
|
+
selectedCellEditor: ReactElement<RenderEditCellProps<TRow>> | undefined;
|
|
2010
|
+
onRowChange: (column: CalculatedColumn<TRow, TSummaryRow>, rowIdx: number, newRow: TRow) => void;
|
|
2011
|
+
rowClass: Maybe<(row: TRow, rowIdx: number) => Maybe<string>>;
|
|
2012
|
+
}
|
|
2013
|
+
interface RowsChangeData<R, SR = unknown> {
|
|
2014
|
+
indexes: number[];
|
|
2015
|
+
column: CalculatedColumn<R, SR>;
|
|
2016
|
+
}
|
|
2017
|
+
interface SelectRowEvent<TRow> {
|
|
2018
|
+
row: TRow;
|
|
2019
|
+
checked: boolean;
|
|
2020
|
+
isShiftClick: boolean;
|
|
2021
|
+
}
|
|
2022
|
+
interface SelectHeaderRowEvent {
|
|
2023
|
+
checked: boolean;
|
|
2024
|
+
}
|
|
2025
|
+
interface FillEvent<TRow> {
|
|
2026
|
+
columnKey: string;
|
|
2027
|
+
sourceRow: TRow;
|
|
2028
|
+
targetRow: TRow;
|
|
2029
|
+
}
|
|
2030
|
+
interface CellCopyPasteArgs<TRow, TSummaryRow = unknown> {
|
|
2031
|
+
column: CalculatedColumn<TRow, TSummaryRow>;
|
|
2032
|
+
row: TRow;
|
|
2033
|
+
}
|
|
2034
|
+
type CellCopyArgs<TRow, TSummaryRow = unknown> = CellCopyPasteArgs<TRow, TSummaryRow>;
|
|
2035
|
+
type CellPasteArgs<TRow, TSummaryRow = unknown> = CellCopyPasteArgs<TRow, TSummaryRow>;
|
|
2036
|
+
interface GroupRow<TRow> {
|
|
2037
|
+
readonly childRows: readonly TRow[];
|
|
2038
|
+
readonly id: string;
|
|
2039
|
+
readonly parentId: unknown;
|
|
2040
|
+
readonly groupKey: unknown;
|
|
2041
|
+
readonly isExpanded: boolean;
|
|
2042
|
+
readonly level: number;
|
|
2043
|
+
readonly posInSet: number;
|
|
2044
|
+
readonly setSize: number;
|
|
2045
|
+
readonly startRowIndex: number;
|
|
2046
|
+
}
|
|
2047
|
+
interface SortColumn {
|
|
2048
|
+
readonly columnKey: string;
|
|
2049
|
+
readonly direction: SortDirection;
|
|
2050
|
+
}
|
|
2051
|
+
type SortDirection = "ASC" | "DESC";
|
|
2052
|
+
type ColSpanArgs<TRow, TSummaryRow> = {
|
|
2053
|
+
type: "HEADER";
|
|
2054
|
+
} | {
|
|
2055
|
+
type: "ROW";
|
|
2056
|
+
row: TRow;
|
|
2057
|
+
} | {
|
|
2058
|
+
type: "SUMMARY";
|
|
2059
|
+
row: TSummaryRow;
|
|
2060
|
+
};
|
|
2061
|
+
type RowHeightArgs<TRow> = {
|
|
2062
|
+
type: "ROW";
|
|
2063
|
+
row: TRow;
|
|
2064
|
+
} | {
|
|
2065
|
+
type: "GROUP";
|
|
2066
|
+
row: GroupRow<TRow>;
|
|
2067
|
+
};
|
|
2068
|
+
interface RenderSortIconProps {
|
|
2069
|
+
sortDirection: SortDirection | undefined;
|
|
2070
|
+
}
|
|
2071
|
+
interface RenderSortPriorityProps {
|
|
2072
|
+
priority: number | undefined;
|
|
2073
|
+
}
|
|
2074
|
+
interface RenderSortStatusProps extends RenderSortIconProps, RenderSortPriorityProps {
|
|
2075
|
+
}
|
|
2076
|
+
interface RenderCheckboxProps extends Pick<React.ComponentProps<"input">, "aria-label" | "aria-labelledby" | "checked" | "tabIndex" | "disabled"> {
|
|
2077
|
+
indeterminate?: boolean | undefined;
|
|
2078
|
+
onChange: (checked: boolean, shift: boolean) => void;
|
|
2079
|
+
}
|
|
2080
|
+
interface Renderers<TRow, TSummaryRow> {
|
|
2081
|
+
renderCell?: Maybe<(key: Key, props: CellRendererProps<TRow, TSummaryRow>) => ReactNode>;
|
|
2082
|
+
renderCheckbox?: Maybe<(props: RenderCheckboxProps) => ReactNode>;
|
|
2083
|
+
renderRow?: Maybe<(key: Key, props: RenderRowProps<TRow, TSummaryRow>) => ReactNode>;
|
|
2084
|
+
renderSortStatus?: Maybe<(props: RenderSortStatusProps) => ReactNode>;
|
|
2085
|
+
noRowsFallback?: Maybe<ReactNode>;
|
|
2086
|
+
}
|
|
2087
|
+
interface SelectCellOptions {
|
|
2088
|
+
enableEditor?: Maybe<boolean>;
|
|
2089
|
+
shouldFocusCell?: Maybe<boolean>;
|
|
2090
|
+
}
|
|
2091
|
+
interface ColumnWidth {
|
|
2092
|
+
readonly type: "resized" | "measured";
|
|
2093
|
+
readonly width: number;
|
|
2094
|
+
}
|
|
2095
|
+
type ColumnWidths = ReadonlyMap<string, ColumnWidth>;
|
|
2096
|
+
type Direction = "ltr" | "rtl";
|
|
2097
|
+
|
|
2098
|
+
declare const CellComponent: <R, SR>(props: CellRendererProps<R, SR>) => React.JSX.Element;
|
|
2099
|
+
|
|
2100
|
+
declare const SELECT_COLUMN_KEY = "rdg-select-column";
|
|
2101
|
+
declare const SelectColumn: Column<any, any>;
|
|
2102
|
+
declare const ACTION_COLUMN_KEY = "rdg-action-column";
|
|
2103
|
+
/**
|
|
2104
|
+
* Creates an action column for a DataGrid that displays a dropdown menu with actions for each row.
|
|
2105
|
+
* @param actions - Array of actions or separators to display for each row
|
|
2106
|
+
* @param context - Optional context to pass to actions for HTTP calls and other operations
|
|
2107
|
+
* @param idField - Optional ID field name for resource actions (defaults to "id")
|
|
2108
|
+
* @returns Column configuration for the DataGrid
|
|
2109
|
+
*/
|
|
2110
|
+
declare function createActionColumn<R>(actions: ActionOrSeparator[], context?: any, idField?: string): Column<R, any>;
|
|
2111
|
+
|
|
2112
|
+
interface ActionCellFormatterProps<R> {
|
|
2113
|
+
actions: ActionOrSeparator[];
|
|
2114
|
+
row?: R;
|
|
2115
|
+
context?: any;
|
|
2116
|
+
}
|
|
2117
|
+
declare function ActionCellFormatter<R>({ row, actions, context, idField, }: ActionCellFormatterProps<R> & {
|
|
2118
|
+
idField?: string;
|
|
2119
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
2120
|
+
declare function ActionCellRendererCell<R>(props: RenderCellProps<R> & {
|
|
2121
|
+
actions: ActionOrSeparator[];
|
|
2122
|
+
context?: any;
|
|
2123
|
+
idField?: string;
|
|
2124
|
+
}): react_jsx_runtime.JSX.Element;
|
|
2125
|
+
declare function ActionCellRendererGroup<R>(_props: RenderGroupCellProps<R> & {
|
|
2126
|
+
actions: ActionOrSeparator[];
|
|
2127
|
+
context?: any;
|
|
2128
|
+
}): null;
|
|
2129
|
+
|
|
2130
|
+
declare function renderCheckbox({ onChange, indeterminate, ...props }: RenderCheckboxProps): react_jsx_runtime.JSX.Element;
|
|
2131
|
+
|
|
2132
|
+
declare function renderToggleGroup<R, SR>(props: RenderGroupCellProps<R, SR>): react_jsx_runtime.JSX.Element;
|
|
2133
|
+
declare function ToggleGroup<R, SR>({ groupKey, isExpanded, tabIndex, toggleGroup, }: RenderGroupCellProps<R, SR>): react_jsx_runtime.JSX.Element;
|
|
2134
|
+
|
|
2135
|
+
declare function renderValue<R, SR>(props: RenderCellProps<R, SR>): React$1.ReactNode;
|
|
2136
|
+
|
|
2137
|
+
type SharedInputProps = Pick<RenderCheckboxProps, "disabled" | "tabIndex" | "aria-label" | "aria-labelledby" | "indeterminate" | "onChange">;
|
|
2138
|
+
interface SelectCellFormatterProps extends SharedInputProps {
|
|
2139
|
+
value: boolean;
|
|
2140
|
+
}
|
|
2141
|
+
declare function SelectCellFormatter({ value, tabIndex, indeterminate, disabled, onChange, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: SelectCellFormatterProps): React$1.ReactNode;
|
|
2142
|
+
|
|
2143
|
+
declare const DataGridDefaultRenderersContext: React$1.Context<Maybe<Renderers<any, any>>>;
|
|
2144
|
+
|
|
2145
|
+
declare function textEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: RenderEditCellProps<TRow, TSummaryRow>): react_jsx_runtime.JSX.Element;
|
|
2146
|
+
|
|
2147
|
+
declare function useRowSelection(): {
|
|
2148
|
+
isRowSelectionDisabled: boolean;
|
|
2149
|
+
isRowSelected: boolean;
|
|
2150
|
+
onRowSelectionChange: (selectRowEvent: SelectRowEvent<any>) => void;
|
|
2151
|
+
};
|
|
2152
|
+
declare function useHeaderRowSelection(): {
|
|
2153
|
+
isIndeterminate: boolean;
|
|
2154
|
+
isRowSelected: boolean;
|
|
2155
|
+
onRowSelectionChange: (selectRowEvent: SelectHeaderRowEvent) => void;
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
declare const RowComponent: <R, SR>(props: RenderRowProps<R, SR>) => React.JSX.Element;
|
|
2159
|
+
|
|
2160
|
+
declare function renderHeaderCell<R, SR>({ column, sortDirection, priority, }: RenderHeaderCellProps<R, SR>): string | react_jsx_runtime.JSX.Element;
|
|
2161
|
+
|
|
2162
|
+
declare function renderSortIcon({ sortDirection }: RenderSortIconProps): react_jsx_runtime.JSX.Element | null;
|
|
2163
|
+
declare function renderSortPriority({ priority }: RenderSortPriorityProps): number | undefined;
|
|
2164
|
+
|
|
2165
|
+
interface TreeDataGridProps<R, SR = unknown, K extends Key = Key> extends Omit$1<DataGridProps<R, SR, K>, "columns" | "role" | "aria-rowcount" | "rowHeight" | "onFill" | "isRowSelectionDisabled"> {
|
|
2166
|
+
columns: readonly Column<NoInfer<R>, NoInfer<SR>>[];
|
|
2167
|
+
rowHeight?: Maybe<number | ((args: RowHeightArgs<NoInfer<R>>) => number)>;
|
|
2168
|
+
groupBy: readonly string[];
|
|
2169
|
+
rowGrouper: (rows: readonly NoInfer<R>[], columnKey: string) => Record<string, readonly NoInfer<R>[]>;
|
|
2170
|
+
expandedGroupIds: ReadonlySet<unknown>;
|
|
2171
|
+
onExpandedGroupIdsChange: (expandedGroupIds: Set<unknown>) => void;
|
|
2172
|
+
groupIdGetter?: Maybe<(groupKey: string, parentId?: string) => string>;
|
|
2173
|
+
}
|
|
2174
|
+
declare function TreeDataGrid<R, SR = unknown, K extends Key = Key>({ columns: rawColumns, rows: rawRows, rowHeight: rawRowHeight, rowKeyGetter: rawRowKeyGetter, onCellKeyDown: rawOnCellKeyDown, onCellCopy: rawOnCellCopy, onCellPaste: rawOnCellPaste, onRowsChange, selectedRows: rawSelectedRows, onSelectedRowsChange: rawOnSelectedRowsChange, renderers, groupBy: rawGroupBy, rowGrouper, expandedGroupIds, onExpandedGroupIdsChange, groupIdGetter: rawGroupIdGetter, ...props }: TreeDataGridProps<R, SR, K>): react_jsx_runtime.JSX.Element;
|
|
2175
|
+
|
|
2176
|
+
type DataStateProps = {
|
|
2177
|
+
/** Whether data is currently loading */
|
|
2178
|
+
isLoading?: boolean;
|
|
2179
|
+
/** Error that occurred during data fetching */
|
|
2180
|
+
error?: Error | null;
|
|
2181
|
+
/** Whether the data set is empty (after successful load) */
|
|
2182
|
+
isEmpty?: boolean;
|
|
2183
|
+
/** Message to display when data is empty */
|
|
2184
|
+
emptyMessage?: string;
|
|
2185
|
+
/** Aria label for the loading indicator */
|
|
2186
|
+
loadingLabel?: string;
|
|
2187
|
+
/** Message to display when there's an error */
|
|
2188
|
+
errorMessage?: string;
|
|
2189
|
+
/** Content to render when data is successfully loaded */
|
|
2190
|
+
children: ReactNode;
|
|
2191
|
+
};
|
|
2192
|
+
/**
|
|
2193
|
+
* A component that handles common data fetching states: loading, error, and empty.
|
|
2194
|
+
* Renders children only when data is successfully loaded and not empty.
|
|
2195
|
+
*
|
|
2196
|
+
* @example
|
|
2197
|
+
* ```tsx
|
|
2198
|
+
* <DataState
|
|
2199
|
+
* isLoading={isLoading}
|
|
2200
|
+
* error={error}
|
|
2201
|
+
* isEmpty={data.length === 0}
|
|
2202
|
+
* emptyMessage="No items found"
|
|
2203
|
+
* loadingLabel="Loading search results..."
|
|
2204
|
+
* >
|
|
2205
|
+
* <DataGrid data={data} />
|
|
2206
|
+
* </DataState>
|
|
2207
|
+
* ```
|
|
2208
|
+
*/
|
|
2209
|
+
declare const DataState: FC<DataStateProps>;
|
|
2210
|
+
|
|
2211
|
+
interface DockProps {
|
|
2212
|
+
center: React__default.ReactNode;
|
|
2213
|
+
left?: React__default.ReactNode;
|
|
2214
|
+
right?: React__default.ReactNode;
|
|
2215
|
+
top?: React__default.ReactNode;
|
|
2216
|
+
defaultLeftWidth?: number;
|
|
2217
|
+
defaultRightWidth?: number;
|
|
2218
|
+
}
|
|
2219
|
+
declare const Dock: React__default.FC<DockProps>;
|
|
2220
|
+
|
|
2221
|
+
interface ActionDropdownMenuProps {
|
|
2222
|
+
trigger: React__default.ReactNode;
|
|
2223
|
+
actions: ActionOrSeparator[];
|
|
2224
|
+
className?: string;
|
|
2225
|
+
contentClassName?: string;
|
|
2226
|
+
/**
|
|
2227
|
+
* Side offset for the dropdown menu content.
|
|
2228
|
+
* @default 4
|
|
2229
|
+
*/
|
|
2230
|
+
sideOffset?: number;
|
|
2231
|
+
/**
|
|
2232
|
+
* Whether the menu should close when an action is executed.
|
|
2233
|
+
* @default true
|
|
2234
|
+
*/
|
|
2235
|
+
closeOnAction?: boolean;
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* A dropdown menu component that takes standardized actions and renders them as menu items.
|
|
2239
|
+
* Supports both command and handler actions, with automatic action execution.
|
|
2240
|
+
* Actions can be grouped using "separator" entries.
|
|
2241
|
+
*/
|
|
2242
|
+
declare const ActionDropdownMenu: React__default.ForwardRefExoticComponent<ActionDropdownMenuProps & React__default.RefAttributes<never>>;
|
|
2243
|
+
|
|
2244
|
+
declare function DropdownMenu({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
2245
|
+
declare function DropdownMenuPortal({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
2246
|
+
declare function DropdownMenuTrigger({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
2247
|
+
declare function DropdownMenuContent({ className, sideOffset, side, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
2248
|
+
declare function DropdownMenuGroup({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Group>): react_jsx_runtime.JSX.Element;
|
|
2249
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
2250
|
+
inset?: boolean;
|
|
2251
|
+
variant?: "default" | "destructive";
|
|
2252
|
+
}): react_jsx_runtime.JSX.Element;
|
|
2253
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): react_jsx_runtime.JSX.Element;
|
|
2254
|
+
declare function DropdownMenuRadioGroup({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): react_jsx_runtime.JSX.Element;
|
|
2255
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): react_jsx_runtime.JSX.Element;
|
|
2256
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
2257
|
+
inset?: boolean;
|
|
2258
|
+
}): react_jsx_runtime.JSX.Element;
|
|
2259
|
+
declare function DropdownMenuSeparator({ className, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Separator>): react_jsx_runtime.JSX.Element;
|
|
2260
|
+
declare function DropdownMenuShortcut({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
2261
|
+
declare function DropdownMenuSub({ ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Sub>): react_jsx_runtime.JSX.Element;
|
|
2262
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
2263
|
+
inset?: boolean;
|
|
2264
|
+
}): react_jsx_runtime.JSX.Element;
|
|
2265
|
+
declare function DropdownMenuSubContent({ className, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
|
|
2266
|
+
|
|
2267
|
+
interface ThemeToggleProps {
|
|
2268
|
+
className?: string;
|
|
2269
|
+
defaultTheme: "light" | "dark";
|
|
2270
|
+
}
|
|
2271
|
+
declare const ThemeToggle: ({ className }: ThemeToggleProps) => react_jsx_runtime.JSX.Element;
|
|
2272
|
+
|
|
2273
|
+
type ToastType = "default" | "error";
|
|
2274
|
+
type ToastPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
2275
|
+
interface ToastData {
|
|
2276
|
+
id: string;
|
|
2277
|
+
message: ReactNode;
|
|
2278
|
+
type: ToastType;
|
|
2279
|
+
duration?: number;
|
|
2280
|
+
closable?: boolean;
|
|
2281
|
+
promise?: Promise<any>;
|
|
2282
|
+
loadingText?: ReactNode;
|
|
2283
|
+
}
|
|
2284
|
+
interface ToastOptions {
|
|
2285
|
+
duration?: number;
|
|
2286
|
+
closable?: boolean;
|
|
2287
|
+
}
|
|
2288
|
+
interface PromiseToastOptions extends ToastOptions {
|
|
2289
|
+
loadingText?: ReactNode;
|
|
2290
|
+
}
|
|
2291
|
+
interface PromiseResult<T = any> {
|
|
2292
|
+
success: boolean;
|
|
2293
|
+
data?: T;
|
|
2294
|
+
error?: any;
|
|
2295
|
+
}
|
|
2296
|
+
interface PromiseToastConfig {
|
|
2297
|
+
message: ReactNode;
|
|
2298
|
+
type: ToastType;
|
|
2299
|
+
duration?: number;
|
|
2300
|
+
}
|
|
2301
|
+
type PromiseToastCallback<T = any> = (result: PromiseResult<T>) => PromiseToastConfig;
|
|
2302
|
+
interface ToastContextType {
|
|
2303
|
+
toasts: ToastData[];
|
|
2304
|
+
addToast: (message: ReactNode, type: ToastType, options?: ToastOptions) => string;
|
|
2305
|
+
addPromiseToast: <T>(promise: Promise<T>, callback: PromiseToastCallback<T>, options?: PromiseToastOptions) => string;
|
|
2306
|
+
removeToast: (id: string) => void;
|
|
2307
|
+
updateToast: (id: string, updates: Partial<ToastData>) => void;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
interface ToastProps {
|
|
2311
|
+
toast: ToastData;
|
|
2312
|
+
onClose: () => void;
|
|
2313
|
+
}
|
|
2314
|
+
declare const Toast: FC<ToastProps>;
|
|
2315
|
+
|
|
2316
|
+
interface ToastContainerProps {
|
|
2317
|
+
className?: string;
|
|
2318
|
+
}
|
|
2319
|
+
declare const ToastContainer: FC<ToastContainerProps>;
|
|
2320
|
+
|
|
2321
|
+
declare const useToast: () => ToastContextType;
|
|
2322
|
+
interface ToastProviderProps {
|
|
2323
|
+
children: ReactNode;
|
|
2324
|
+
}
|
|
2325
|
+
declare const ToastProvider: ({ children }: ToastProviderProps) => react_jsx_runtime.JSX.Element;
|
|
2326
|
+
|
|
2327
|
+
declare const showToast: (message: ReactNode, type?: ToastType, options?: ToastOptions) => string;
|
|
2328
|
+
declare const showPromiseToast: <T>(promise: Promise<T>, callback: PromiseToastCallback<T>, options?: PromiseToastOptions) => string;
|
|
2329
|
+
|
|
2330
|
+
interface PatchResult {
|
|
2331
|
+
success: boolean;
|
|
2332
|
+
errors?: string[];
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
interface FormFieldRendererProps {
|
|
2336
|
+
schema: BaseSchema<any>;
|
|
2337
|
+
fieldState: AnyFieldApi;
|
|
2338
|
+
metadata: SchemaMetadata<any>;
|
|
2339
|
+
mode?: "edit" | "view" | "patch";
|
|
2340
|
+
onPatch?: (value: any, fieldState?: AnyFieldApi) => Promise<PatchResult>;
|
|
2341
|
+
}
|
|
2342
|
+
declare const FormFieldRenderer: React__default.FC<FormFieldRendererProps>;
|
|
2343
|
+
|
|
2344
|
+
type FormValidationErrorsProps = {
|
|
2345
|
+
form: ReactFormExtendedApi<any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
2346
|
+
className?: string;
|
|
2347
|
+
testId?: string;
|
|
2348
|
+
};
|
|
2349
|
+
/**
|
|
2350
|
+
* Component to display form-level validation errors.
|
|
2351
|
+
* Subscribes to form state and displays onSubmit errors.
|
|
2352
|
+
*/
|
|
2353
|
+
declare const FormValidationErrors: React__default.FC<FormValidationErrorsProps>;
|
|
2354
|
+
|
|
2355
|
+
interface SchemaFormProps extends React__default.FormHTMLAttributes<HTMLFormElement> {
|
|
2356
|
+
form: SchemaFormConfiguration<any>;
|
|
2357
|
+
className?: string;
|
|
2358
|
+
children?: React__default.ReactNode;
|
|
2359
|
+
onSubmit?: (e: React__default.FormEvent) => void;
|
|
2360
|
+
}
|
|
2361
|
+
declare const SchemaForm: React__default.ForwardRefExoticComponent<SchemaFormProps & React__default.RefAttributes<HTMLFormElement>>;
|
|
2362
|
+
|
|
2363
|
+
interface SchemaFormButtonBarProps {
|
|
2364
|
+
form: SchemaFormConfiguration<any>;
|
|
2365
|
+
submitText?: string;
|
|
2366
|
+
isComputing?: boolean;
|
|
2367
|
+
className?: string;
|
|
2368
|
+
alignment?: "left" | "center" | "right";
|
|
2369
|
+
variant?: "transparent" | "muted";
|
|
2370
|
+
}
|
|
2371
|
+
declare const SchemaFormButtonBar: React__default.FC<SchemaFormButtonBarProps>;
|
|
2372
|
+
|
|
2373
|
+
type SchemaFormValidationErrorsProps = {
|
|
2374
|
+
form: SchemaFormConfiguration<any>;
|
|
2375
|
+
className?: string;
|
|
2376
|
+
};
|
|
2377
|
+
/**
|
|
2378
|
+
* Component to display form-level validation errors for SchemaForm.
|
|
2379
|
+
* Only renders in edit/create modes, not in view mode.
|
|
2380
|
+
*/
|
|
2381
|
+
declare const SchemaFormValidationErrors: React__default.FC<SchemaFormValidationErrorsProps>;
|
|
2382
|
+
|
|
2383
|
+
declare const buttonVariants: (props?: ({
|
|
2384
|
+
variant?: "secondary" | "default" | "destructive" | null | undefined;
|
|
2385
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2386
|
+
interface ButtonProps extends React__default.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
|
|
2387
|
+
asChild?: boolean;
|
|
2388
|
+
isLoading?: boolean;
|
|
2389
|
+
}
|
|
2390
|
+
declare const Button: React__default.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
2391
|
+
|
|
2392
|
+
interface CheckboxProps extends React$1.ComponentProps<typeof CheckboxPrimitive.Root> {
|
|
2393
|
+
hasError?: boolean;
|
|
2394
|
+
}
|
|
2395
|
+
declare const Checkbox: React$1.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
2396
|
+
|
|
2397
|
+
declare const searchTextInputVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
2398
|
+
interface SearchTextInputProps extends Omit<React__default.ComponentProps<"input">, "size">, VariantProps<typeof searchTextInputVariants> {
|
|
2399
|
+
hasError?: boolean;
|
|
2400
|
+
}
|
|
2401
|
+
declare const SearchTextInput: React__default.ForwardRefExoticComponent<Omit<SearchTextInputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
2402
|
+
|
|
2403
|
+
declare const selectVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
2404
|
+
interface SelectOption<T = unknown> {
|
|
2405
|
+
value: T;
|
|
2406
|
+
label: string;
|
|
2407
|
+
disabled?: boolean;
|
|
2408
|
+
}
|
|
2409
|
+
interface SelectProps<T = unknown> extends Omit<React__default.HTMLAttributes<HTMLDivElement>, "onChange" | "onSelect">, VariantProps<typeof selectVariants> {
|
|
2410
|
+
options: SelectOption<T>[];
|
|
2411
|
+
value?: T;
|
|
2412
|
+
onChange?: (value: T | null) => void;
|
|
2413
|
+
onSelectionChange?: (selectedItem: SelectOption<T> | null) => void;
|
|
2414
|
+
placeholder?: string;
|
|
2415
|
+
disabled?: boolean;
|
|
2416
|
+
hasError?: boolean;
|
|
2417
|
+
loading?: boolean;
|
|
2418
|
+
loadingMessage?: string;
|
|
2419
|
+
emptyMessage?: string;
|
|
2420
|
+
clearable?: boolean;
|
|
2421
|
+
searchable?: boolean;
|
|
2422
|
+
filterOptions?: (options: SelectOption<T>[], inputValue: string) => SelectOption<T>[];
|
|
2423
|
+
}
|
|
2424
|
+
declare const Select: React__default.ForwardRefExoticComponent<SelectProps<any> & React__default.RefAttributes<HTMLDivElement>>;
|
|
2425
|
+
|
|
2426
|
+
declare const textInputVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
2427
|
+
interface TextInputProps extends Omit<React__default.ComponentProps<"input">, "size">, VariantProps<typeof textInputVariants> {
|
|
2428
|
+
hasError?: boolean;
|
|
2429
|
+
}
|
|
2430
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
2431
|
+
|
|
2432
|
+
interface FormControlProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
2433
|
+
label?: string;
|
|
2434
|
+
hint?: string;
|
|
2435
|
+
error?: string;
|
|
2436
|
+
required?: boolean;
|
|
2437
|
+
children: React__default.ReactElement<{
|
|
2438
|
+
id?: string;
|
|
2439
|
+
}>;
|
|
2440
|
+
field?: AnyFieldApi;
|
|
2441
|
+
}
|
|
2442
|
+
declare const FormControl: React__default.ForwardRefExoticComponent<FormControlProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
2443
|
+
|
|
2444
|
+
declare const labelVariants: (props?: ({
|
|
2445
|
+
variant?: "default" | "muted" | "required" | null | undefined;
|
|
2446
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
2447
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2448
|
+
interface LabelProps extends React__default.LabelHTMLAttributes<HTMLLabelElement>, VariantProps<typeof labelVariants> {
|
|
2449
|
+
required?: boolean;
|
|
2450
|
+
}
|
|
2451
|
+
declare const Label: React__default.ForwardRefExoticComponent<LabelProps & React__default.RefAttributes<HTMLLabelElement>>;
|
|
2452
|
+
|
|
2453
|
+
interface SelectionRange {
|
|
2454
|
+
start: number;
|
|
2455
|
+
end: number;
|
|
2456
|
+
}
|
|
2457
|
+
interface TextState {
|
|
2458
|
+
text: string;
|
|
2459
|
+
selection: SelectionRange;
|
|
2460
|
+
}
|
|
2461
|
+
interface TextController {
|
|
2462
|
+
replaceSelection(text: string): TextState;
|
|
2463
|
+
setSelectionRange(selection: SelectionRange): TextState;
|
|
2464
|
+
getState(): TextState;
|
|
2465
|
+
}
|
|
2466
|
+
interface ExecuteOptions {
|
|
2467
|
+
initialState: TextState;
|
|
2468
|
+
textApi: TextController;
|
|
2469
|
+
}
|
|
2470
|
+
interface MarkdownCommand {
|
|
2471
|
+
shouldUndo?: (options: Pick<ExecuteOptions, "initialState">) => boolean;
|
|
2472
|
+
execute: (options: ExecuteOptions) => void;
|
|
2473
|
+
undo?: (options: ExecuteOptions) => void;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
declare const boldCommand: MarkdownCommand;
|
|
2477
|
+
declare const italicCommand: MarkdownCommand;
|
|
2478
|
+
declare const strikethroughCommand: MarkdownCommand;
|
|
2479
|
+
declare const codeCommand: MarkdownCommand;
|
|
2480
|
+
declare const headingCommand: (level: number) => MarkdownCommand;
|
|
2481
|
+
declare const linkCommand: MarkdownCommand;
|
|
2482
|
+
declare const imageCommand: MarkdownCommand;
|
|
2483
|
+
declare const quoteCommand: MarkdownCommand;
|
|
2484
|
+
declare const codeBlockCommand: MarkdownCommand;
|
|
2485
|
+
declare const unorderedListCommand: MarkdownCommand;
|
|
2486
|
+
declare const orderedListCommand: MarkdownCommand;
|
|
2487
|
+
declare const checkListCommand: MarkdownCommand;
|
|
2488
|
+
|
|
2489
|
+
interface MarkdownTextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
2490
|
+
className?: string;
|
|
2491
|
+
}
|
|
2492
|
+
interface MarkdownTextAreaHandle {
|
|
2493
|
+
executeCommand: (command: MarkdownCommand) => void;
|
|
2494
|
+
getTextController: () => TextController;
|
|
2495
|
+
}
|
|
2496
|
+
declare const MarkdownTextArea: React__default.ForwardRefExoticComponent<MarkdownTextAreaProps & React__default.RefAttributes<MarkdownTextAreaHandle>>;
|
|
2497
|
+
|
|
2498
|
+
type BreadcrumbProps = React__default.ComponentProps<"nav">;
|
|
2499
|
+
declare function Breadcrumb({ ...props }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
|
|
2500
|
+
type BreadcrumbListProps = React__default.ComponentProps<"ol">;
|
|
2501
|
+
declare function BreadcrumbList({ className, ...props }: BreadcrumbListProps): react_jsx_runtime.JSX.Element;
|
|
2502
|
+
type BreadcrumbItemProps = React__default.ComponentProps<"li">;
|
|
2503
|
+
declare function BreadcrumbItem({ className, ...props }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
|
|
2504
|
+
type BreadcrumbLinkProps = React__default.ComponentProps<"a">;
|
|
2505
|
+
declare function BreadcrumbLink({ className, ...props }: BreadcrumbLinkProps): react_jsx_runtime.JSX.Element;
|
|
2506
|
+
type BreadcrumbPageProps = React__default.ComponentProps<"span">;
|
|
2507
|
+
declare function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps): react_jsx_runtime.JSX.Element;
|
|
2508
|
+
type BreadcrumbSeparatorProps = React__default.ComponentProps<"li"> & {
|
|
2509
|
+
children?: React__default.ReactNode;
|
|
2510
|
+
};
|
|
2511
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: BreadcrumbSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
2512
|
+
type BreadcrumbEllipsisProps = React__default.ComponentProps<"span">;
|
|
2513
|
+
declare function BreadcrumbEllipsis({ className, ...props }: BreadcrumbEllipsisProps): react_jsx_runtime.JSX.Element;
|
|
2514
|
+
|
|
2515
|
+
type BreadcrumbBarProps = {
|
|
2516
|
+
items: BreadcrumbItem$1[];
|
|
2517
|
+
className?: string;
|
|
2518
|
+
};
|
|
2519
|
+
declare const BreadcrumbBar: FC<BreadcrumbBarProps>;
|
|
2520
|
+
|
|
2521
|
+
interface MainNavProps extends React.HTMLAttributes<HTMLElement> {
|
|
2522
|
+
items: MenuItem[];
|
|
2523
|
+
searchPlaceholder?: string;
|
|
2524
|
+
}
|
|
2525
|
+
declare const MainNav: React$1.ForwardRefExoticComponent<MainNavProps & React$1.RefAttributes<HTMLElement>>;
|
|
2526
|
+
|
|
2527
|
+
interface NavItem {
|
|
2528
|
+
id: string;
|
|
2529
|
+
label: string;
|
|
2530
|
+
children?: NavItem[];
|
|
2531
|
+
href?: string;
|
|
2532
|
+
onClick?: () => void;
|
|
2533
|
+
disabled?: boolean;
|
|
2534
|
+
badge?: string | number;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
interface NavItemsProps {
|
|
2538
|
+
items: NavItem[];
|
|
2539
|
+
level?: number;
|
|
2540
|
+
expandedItems: string[];
|
|
2541
|
+
activeItemId?: string;
|
|
2542
|
+
onToggle: (id: string) => void;
|
|
2543
|
+
onItemClick?: (item: NavItem) => void;
|
|
2544
|
+
}
|
|
2545
|
+
declare const NavItems: FC<NavItemsProps>;
|
|
2546
|
+
|
|
2547
|
+
declare const flattenNavItems: (items: NavItem[], level?: number) => (NavItem & {
|
|
2548
|
+
level: number;
|
|
2549
|
+
})[];
|
|
2550
|
+
declare const filterNavItems: (items: NavItem[], query: string) => NavItem[];
|
|
2551
|
+
|
|
2552
|
+
type ControllableSearchableTreeProps = {
|
|
2553
|
+
items: MenuItem[];
|
|
2554
|
+
placeHolder: string;
|
|
2555
|
+
height?: "full" | number | string;
|
|
2556
|
+
selectedItemId: string;
|
|
2557
|
+
onSelectionChange: (itemId: string) => void;
|
|
2558
|
+
};
|
|
2559
|
+
declare const ControllableSearchableTree: React$1.ForwardRefExoticComponent<ControllableSearchableTreeProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
2560
|
+
|
|
2561
|
+
type SearchableTreeNavigatorProps = {
|
|
2562
|
+
items: MenuItem[];
|
|
2563
|
+
placeHolder: string;
|
|
2564
|
+
height?: "full" | number | string;
|
|
2565
|
+
/** Test ID for the navigator container */
|
|
2566
|
+
"data-testid"?: string;
|
|
2567
|
+
};
|
|
2568
|
+
declare const SearchableTreeNavigator: React$1.ForwardRefExoticComponent<SearchableTreeNavigatorProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Internal flattened representation of a MenuItem for rendering.
|
|
2572
|
+
* Adds hierarchy metadata needed for tree display.
|
|
2573
|
+
*/
|
|
2574
|
+
interface FlatMenuItem extends MenuItem {
|
|
2575
|
+
level: number;
|
|
2576
|
+
parentId?: string;
|
|
2577
|
+
isExpanded?: boolean;
|
|
2578
|
+
hasChildren: boolean;
|
|
2579
|
+
}
|
|
2580
|
+
interface MenuItemComponentProps {
|
|
2581
|
+
item: FlatMenuItem;
|
|
2582
|
+
index: number;
|
|
2583
|
+
isSelected: boolean;
|
|
2584
|
+
onToggleExpanded: (itemId: string) => void;
|
|
2585
|
+
itemRef: (el: HTMLButtonElement | null) => void;
|
|
2586
|
+
"data-testid"?: string;
|
|
2587
|
+
}
|
|
2588
|
+
declare const MenuItemComponent: ({ item, isSelected, onToggleExpanded, itemRef, "data-testid": testId, }: MenuItemComponentProps) => react_jsx_runtime.JSX.Element;
|
|
2589
|
+
/** @deprecated Use MenuItem from '../../menu/types' instead */
|
|
2590
|
+
type TreeNavigatorItem = MenuItem;
|
|
2591
|
+
/** @deprecated Use FlatMenuItem instead */
|
|
2592
|
+
type FlatItem = FlatMenuItem;
|
|
2593
|
+
|
|
2594
|
+
interface TreeNavigatorProps {
|
|
2595
|
+
items: MenuItem[];
|
|
2596
|
+
searchInputRef?: RefObject<HTMLInputElement>;
|
|
2597
|
+
selectedItemId?: string;
|
|
2598
|
+
onSelectionChange?: (itemId: string) => void;
|
|
2599
|
+
/** Test ID for the navigator container */
|
|
2600
|
+
"data-testid"?: string;
|
|
2601
|
+
}
|
|
2602
|
+
declare const TreeNavigator: ({ items, searchInputRef, "data-testid": testId, }: TreeNavigatorProps) => react_jsx_runtime.JSX.Element;
|
|
2603
|
+
/** @deprecated Use TreeNavigator instead */
|
|
2604
|
+
declare const ListNavigator: ({ items, searchInputRef, "data-testid": testId, }: TreeNavigatorProps) => react_jsx_runtime.JSX.Element;
|
|
2605
|
+
/** @deprecated Use MenuItem from '../../menu/types' instead */
|
|
2606
|
+
type ListNavigatorItem = MenuItem;
|
|
2607
|
+
type ListNavigatorProps = TreeNavigatorProps;
|
|
2608
|
+
|
|
2609
|
+
type NubaseAppProps = {
|
|
2610
|
+
config: NubaseFrontendConfig;
|
|
2611
|
+
};
|
|
2612
|
+
declare const NubaseApp: FC<NubaseAppProps>;
|
|
2613
|
+
|
|
2614
|
+
declare function Pagination({ className, ...props }: React$1.ComponentProps<"nav">): react_jsx_runtime.JSX.Element;
|
|
2615
|
+
declare function PaginationContent({ className, ...props }: React$1.ComponentProps<"ul">): react_jsx_runtime.JSX.Element;
|
|
2616
|
+
declare function PaginationItem({ ...props }: React$1.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
2617
|
+
type PaginationLinkProps = {
|
|
2618
|
+
isActive?: boolean;
|
|
2619
|
+
} & Pick<React$1.ComponentProps<typeof Button>, "variant"> & React$1.ComponentProps<"a">;
|
|
2620
|
+
declare function PaginationLink({ className, isActive, variant, ...props }: PaginationLinkProps): react_jsx_runtime.JSX.Element;
|
|
2621
|
+
declare function PaginationPrevious({ className, ...props }: React$1.ComponentProps<typeof PaginationLink>): react_jsx_runtime.JSX.Element;
|
|
2622
|
+
declare function PaginationNext({ className, ...props }: React$1.ComponentProps<typeof PaginationLink>): react_jsx_runtime.JSX.Element;
|
|
2623
|
+
declare function PaginationEllipsis({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
2624
|
+
interface EnhancedPaginationProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
2625
|
+
currentPage: number;
|
|
2626
|
+
totalPages: number;
|
|
2627
|
+
pageSize: number;
|
|
2628
|
+
totalItems: number;
|
|
2629
|
+
onPageChange: (page: number) => void;
|
|
2630
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
2631
|
+
pageSizeOptions?: number[];
|
|
2632
|
+
showPageSizeSelector?: boolean;
|
|
2633
|
+
showInfo?: boolean;
|
|
2634
|
+
}
|
|
2635
|
+
declare const EnhancedPagination: React$1.ForwardRefExoticComponent<EnhancedPaginationProps & React$1.RefAttributes<HTMLElement>>;
|
|
2636
|
+
|
|
2637
|
+
declare function Table({ className, ...props }: React$1.ComponentProps<"table">): react_jsx_runtime.JSX.Element;
|
|
2638
|
+
declare function TableHeader({ className, ...props }: React$1.ComponentProps<"thead">): react_jsx_runtime.JSX.Element;
|
|
2639
|
+
declare function TableBody({ className, ...props }: React$1.ComponentProps<"tbody">): react_jsx_runtime.JSX.Element;
|
|
2640
|
+
declare function TableFooter({ className, ...props }: React$1.ComponentProps<"tfoot">): react_jsx_runtime.JSX.Element;
|
|
2641
|
+
declare function TableRow({ className, ...props }: React$1.ComponentProps<"tr">): react_jsx_runtime.JSX.Element;
|
|
2642
|
+
declare function TableHead({ className, ...props }: React$1.ComponentProps<"th">): react_jsx_runtime.JSX.Element;
|
|
2643
|
+
declare function TableCell({ className, ...props }: React$1.ComponentProps<"td">): react_jsx_runtime.JSX.Element;
|
|
2644
|
+
declare function TableCaption({ className, ...props }: React$1.ComponentProps<"caption">): react_jsx_runtime.JSX.Element;
|
|
2645
|
+
|
|
2646
|
+
type TabsProps = React$1.ComponentProps<typeof TabsPrimitive.Root>;
|
|
2647
|
+
declare function Tabs({ className, ...props }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
2648
|
+
type TabsListProps = React$1.ComponentProps<typeof TabsPrimitive.List>;
|
|
2649
|
+
declare function TabsList({ className, ...props }: TabsListProps): react_jsx_runtime.JSX.Element;
|
|
2650
|
+
type TabsTriggerProps = React$1.ComponentProps<typeof TabsPrimitive.Trigger>;
|
|
2651
|
+
declare function TabsTrigger({ className, ...props }: TabsTriggerProps): react_jsx_runtime.JSX.Element;
|
|
2652
|
+
type TabsContentProps = React$1.ComponentProps<typeof TabsPrimitive.Content>;
|
|
2653
|
+
declare function TabsContent({ className, ...props }: TabsContentProps): react_jsx_runtime.JSX.Element;
|
|
2654
|
+
|
|
2655
|
+
interface SearchBarProps extends Omit<React__default.ComponentProps<"button">, "onClick"> {
|
|
2656
|
+
context: NubaseContextData;
|
|
2657
|
+
placeholder?: string;
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* SearchBar component that triggers the command palette when clicked.
|
|
2661
|
+
* Provides a unified search interface for all commands in the application.
|
|
2662
|
+
*/
|
|
2663
|
+
declare const SearchBar: React__default.ForwardRefExoticComponent<Omit<SearchBarProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
2664
|
+
|
|
2665
|
+
interface TopBarProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
2666
|
+
context: NubaseContextData;
|
|
2667
|
+
}
|
|
2668
|
+
/**
|
|
2669
|
+
* TopBar component that provides global search and actions.
|
|
2670
|
+
* Contains a SearchBar for command search and ActionBar for global actions.
|
|
2671
|
+
*/
|
|
2672
|
+
declare const TopBar: React__default.ForwardRefExoticComponent<TopBarProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
2673
|
+
|
|
2674
|
+
interface UserAvatarProps {
|
|
2675
|
+
/** User's display name or username */
|
|
2676
|
+
name: string;
|
|
2677
|
+
/** Additional class names */
|
|
2678
|
+
className?: string;
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* Get initials from a name (up to 2 characters).
|
|
2682
|
+
* Examples:
|
|
2683
|
+
* - "John Doe" -> "JD"
|
|
2684
|
+
* - "admin" -> "AD"
|
|
2685
|
+
* - "A" -> "A"
|
|
2686
|
+
*/
|
|
2687
|
+
declare function getInitials(name: string): string;
|
|
2688
|
+
/**
|
|
2689
|
+
* UserAvatar component that displays user initials in a circle.
|
|
2690
|
+
* This is a pure presentational component - wrap it in UserMenu for dropdown functionality.
|
|
2691
|
+
*/
|
|
2692
|
+
declare function UserAvatar({ name, className }: UserAvatarProps): react_jsx_runtime.JSX.Element;
|
|
2693
|
+
|
|
2694
|
+
interface UserMenuProps {
|
|
2695
|
+
/** User's display name or username */
|
|
2696
|
+
name: string;
|
|
2697
|
+
/** Optional email to display in dropdown */
|
|
2698
|
+
email?: string;
|
|
2699
|
+
/** Callback when sign out is clicked */
|
|
2700
|
+
onSignOut?: () => void;
|
|
2701
|
+
/** Additional class names for the avatar trigger */
|
|
2702
|
+
className?: string;
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* UserMenu component that displays a user avatar with a dropdown menu.
|
|
2706
|
+
* Clicking the avatar opens a dropdown with user info and sign out option.
|
|
2707
|
+
*/
|
|
2708
|
+
declare function UserMenu({ name, email, onSignOut, className }: UserMenuProps): react_jsx_runtime.JSX.Element;
|
|
2709
|
+
|
|
2710
|
+
type ModalViewRendererProps = {
|
|
2711
|
+
view: View;
|
|
2712
|
+
context: NubaseContextData;
|
|
2713
|
+
params?: Record<string, any>;
|
|
2714
|
+
resourceName?: string;
|
|
2715
|
+
onClose?: () => void;
|
|
2716
|
+
onRowClick?: (row: any) => void;
|
|
2717
|
+
onError?: (error: Error) => void;
|
|
2718
|
+
};
|
|
2719
|
+
declare const ModalViewRenderer: FC<ModalViewRendererProps>;
|
|
2720
|
+
|
|
2721
|
+
type ResourceCreateViewModalRendererProps = {
|
|
2722
|
+
view: ResourceCreateView;
|
|
2723
|
+
context: NubaseContextData;
|
|
2724
|
+
resourceName?: string;
|
|
2725
|
+
onClose?: () => void;
|
|
2726
|
+
onCreate?: (data: ObjectOutput<any>) => void;
|
|
2727
|
+
onError?: (error: Error) => void;
|
|
2728
|
+
};
|
|
2729
|
+
declare const ResourceCreateViewModalRenderer: FC<ResourceCreateViewModalRendererProps>;
|
|
2730
|
+
|
|
2731
|
+
type ResourceSearchViewModalRendererProps = {
|
|
2732
|
+
view: ResourceSearchView;
|
|
2733
|
+
context: NubaseContextData;
|
|
2734
|
+
params?: Record<string, any>;
|
|
2735
|
+
resourceName?: string;
|
|
2736
|
+
onClose?: () => void;
|
|
2737
|
+
onRowClick?: (row: any) => void;
|
|
2738
|
+
onError?: (error: Error) => void;
|
|
2739
|
+
};
|
|
2740
|
+
declare const ResourceSearchViewModalRenderer: FC<ResourceSearchViewModalRendererProps>;
|
|
2741
|
+
|
|
2742
|
+
type ResourceViewViewModalRendererProps = {
|
|
2743
|
+
view: ResourceViewView;
|
|
2744
|
+
context: NubaseContextData;
|
|
2745
|
+
params?: Record<string, any>;
|
|
2746
|
+
onClose?: () => void;
|
|
2747
|
+
onPatch?: (data: ObjectOutput<any>) => void;
|
|
2748
|
+
onError?: (error: Error) => void;
|
|
2749
|
+
};
|
|
2750
|
+
declare const ResourceViewViewModalRenderer: FC<ResourceViewViewModalRendererProps>;
|
|
2751
|
+
|
|
2752
|
+
type ResourceCreateViewRendererProps = {
|
|
2753
|
+
view: ResourceCreateView;
|
|
2754
|
+
resourceName?: string;
|
|
2755
|
+
onCreate?: (data: ObjectOutput<any>) => void;
|
|
2756
|
+
onError?: (error: Error) => void;
|
|
2757
|
+
};
|
|
2758
|
+
declare const ResourceCreateViewRenderer: FC<ResourceCreateViewRendererProps>;
|
|
2759
|
+
|
|
2760
|
+
type ResourceSearchViewRendererProps = {
|
|
2761
|
+
view: ResourceSearchView;
|
|
2762
|
+
params?: Record<string, any>;
|
|
2763
|
+
resourceName?: string;
|
|
2764
|
+
resource?: ResourceDescriptor;
|
|
2765
|
+
onError?: (error: Error) => void;
|
|
2766
|
+
};
|
|
2767
|
+
declare const ResourceSearchViewRenderer: FC<ResourceSearchViewRendererProps>;
|
|
2768
|
+
|
|
2769
|
+
type ResourceViewViewRendererProps = {
|
|
2770
|
+
view: ResourceViewView;
|
|
2771
|
+
params?: Record<string, any>;
|
|
2772
|
+
onPatch?: (data: ObjectOutput<any>) => void;
|
|
2773
|
+
onError?: (error: Error) => void;
|
|
2774
|
+
};
|
|
2775
|
+
declare const ResourceViewViewRenderer: FC<ResourceViewViewRendererProps>;
|
|
2776
|
+
|
|
2777
|
+
interface WidgetProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
2778
|
+
/** The title of the widget */
|
|
2779
|
+
title: string;
|
|
2780
|
+
/** Optional icon component (not instantiated) shown before the title */
|
|
2781
|
+
icon?: IconComponent;
|
|
2782
|
+
/** Optional action elements (e.g., buttons) shown on the right side of the header */
|
|
2783
|
+
action?: React$1.ReactNode;
|
|
2784
|
+
/** Optional footer content */
|
|
2785
|
+
footer?: React$1.ReactNode;
|
|
2786
|
+
/** The widget content */
|
|
2787
|
+
children: React$1.ReactNode;
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Widget is a pre-composed Card component for dashboard-style content.
|
|
2791
|
+
* It provides a compact header with title, optional icon, and action elements.
|
|
2792
|
+
* Widget always includes a border separator between header and content.
|
|
2793
|
+
* For layouts without the border, use the Card components directly.
|
|
2794
|
+
*/
|
|
2795
|
+
declare const Widget: React$1.ForwardRefExoticComponent<WidgetProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* Dashboard builder that enables chained, type-safe dashboard configuration.
|
|
2799
|
+
*
|
|
2800
|
+
* The builder pattern enables sequential type inference, solving the circular
|
|
2801
|
+
* dependency problem between API endpoints and widget configurations.
|
|
2802
|
+
*
|
|
2803
|
+
* @example
|
|
2804
|
+
* ```typescript
|
|
2805
|
+
* const analyticsDashboard = createDashboard("analytics")
|
|
2806
|
+
* .withApiEndpoints(apiEndpoints)
|
|
2807
|
+
* .withTitle("Analytics Dashboard")
|
|
2808
|
+
* .withWidgets([
|
|
2809
|
+
* {
|
|
2810
|
+
* type: "series",
|
|
2811
|
+
* id: "revenue-chart",
|
|
2812
|
+
* title: "Revenue Trend",
|
|
2813
|
+
* variant: "area",
|
|
2814
|
+
* endpoint: "getRevenueChart", // TypeScript validates this!
|
|
2815
|
+
* defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
|
|
2816
|
+
* },
|
|
2817
|
+
* {
|
|
2818
|
+
* type: "kpi",
|
|
2819
|
+
* id: "total-revenue",
|
|
2820
|
+
* title: "Total Revenue",
|
|
2821
|
+
* endpoint: "getTotalRevenue", // TypeScript validates this!
|
|
2822
|
+
* defaultLayout: { x: 8, y: 0, w: 4, h: 2 },
|
|
2823
|
+
* },
|
|
2824
|
+
* ]);
|
|
2825
|
+
* ```
|
|
2826
|
+
*/
|
|
2827
|
+
declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
|
|
2828
|
+
private config;
|
|
2829
|
+
constructor(id: TId);
|
|
2830
|
+
/**
|
|
2831
|
+
* Configure API endpoints for type-safe widget endpoint references.
|
|
2832
|
+
* This must be called before withWidgets() to enable type checking.
|
|
2833
|
+
*/
|
|
2834
|
+
withApiEndpoints<T>(apiEndpoints: T): DashboardBuilder<TId, T>;
|
|
2835
|
+
/**
|
|
2836
|
+
* Set the dashboard title.
|
|
2837
|
+
*/
|
|
2838
|
+
withTitle(title: string): this;
|
|
2839
|
+
/**
|
|
2840
|
+
* Set the dashboard icon.
|
|
2841
|
+
*/
|
|
2842
|
+
withIcon(icon: IconComponent): this;
|
|
2843
|
+
/**
|
|
2844
|
+
* Configure grid layout options.
|
|
2845
|
+
*/
|
|
2846
|
+
withGridConfig(gridConfig: DashboardGridConfig): this;
|
|
2847
|
+
/**
|
|
2848
|
+
* Configure widgets for this dashboard.
|
|
2849
|
+
* This is the final step that produces the DashboardDescriptor.
|
|
2850
|
+
*
|
|
2851
|
+
* TypeScript will validate that each widget's endpoint matches its expected data type:
|
|
2852
|
+
* - Series widgets must reference endpoints returning SeriesData
|
|
2853
|
+
* - Proportional widgets must reference endpoints returning ProportionalData
|
|
2854
|
+
* - KPI widgets must reference endpoints returning KpiData
|
|
2855
|
+
* - Table widgets must reference endpoints returning TableData
|
|
2856
|
+
*/
|
|
2857
|
+
withWidgets(widgets: WidgetDescriptor<TApiEndpoints>[]): DashboardDescriptor<TApiEndpoints>;
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Creates a new dashboard builder with the specified ID.
|
|
2861
|
+
*
|
|
2862
|
+
* The builder pattern enables sequential type inference:
|
|
2863
|
+
* 1. First, call `.withApiEndpoints(apiEndpoints)` to provide the API type context
|
|
2864
|
+
* 2. Then, configure the dashboard with `.withTitle()`, `.withGridConfig()`, etc.
|
|
2865
|
+
* 3. Finally, call `.withWidgets([...])` to define the widgets with type-safe endpoint references
|
|
2866
|
+
*
|
|
2867
|
+
* @param id Unique identifier for the dashboard
|
|
2868
|
+
* @returns A DashboardBuilder instance
|
|
2869
|
+
*
|
|
2870
|
+
* @example
|
|
2871
|
+
* ```typescript
|
|
2872
|
+
* import { apiEndpoints } from "schema";
|
|
2873
|
+
*
|
|
2874
|
+
* const salesDashboard = createDashboard("sales")
|
|
2875
|
+
* .withApiEndpoints(apiEndpoints)
|
|
2876
|
+
* .withTitle("Sales Dashboard")
|
|
2877
|
+
* .withGridConfig({ rowHeight: 100 })
|
|
2878
|
+
* .withWidgets([
|
|
2879
|
+
* {
|
|
2880
|
+
* type: "series",
|
|
2881
|
+
* id: "revenue",
|
|
2882
|
+
* title: "Revenue",
|
|
2883
|
+
* variant: "area",
|
|
2884
|
+
* endpoint: "getRevenueChart",
|
|
2885
|
+
* defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
|
|
2886
|
+
* },
|
|
2887
|
+
* ]);
|
|
2888
|
+
* ```
|
|
2889
|
+
*/
|
|
2890
|
+
declare function createDashboard<TId extends string>(id: TId): DashboardBuilder<TId, never>;
|
|
2891
|
+
|
|
2892
|
+
/**
|
|
2893
|
+
* Inline action definition for resource actions
|
|
2894
|
+
*/
|
|
2895
|
+
type InlineResourceActionConfig<TApiEndpoints> = {
|
|
2896
|
+
label?: string;
|
|
2897
|
+
icon?: React__default.ComponentType<{
|
|
2898
|
+
size?: number;
|
|
2899
|
+
className?: string;
|
|
2900
|
+
}>;
|
|
2901
|
+
disabled?: boolean;
|
|
2902
|
+
variant?: "default" | "destructive";
|
|
2903
|
+
onExecute: (args: {
|
|
2904
|
+
selectedIds: (string | number)[];
|
|
2905
|
+
context: NubaseContextData<TApiEndpoints>;
|
|
2906
|
+
}) => void | Promise<void>;
|
|
2907
|
+
};
|
|
2908
|
+
/**
|
|
2909
|
+
* Inline view definition for create views
|
|
2910
|
+
*/
|
|
2911
|
+
type InlineCreateViewConfig<TApiEndpoints, TActionIds extends string, TSchema extends ObjectSchema<any> = ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined> = {
|
|
2912
|
+
type: "resource-create";
|
|
2913
|
+
id: string;
|
|
2914
|
+
title: string;
|
|
2915
|
+
schemaPost: (api: TApiEndpoints) => TSchema;
|
|
2916
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
2917
|
+
actions?: ActionLayout<TActionIds>;
|
|
2918
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema>;
|
|
2919
|
+
onSubmit: (args: {
|
|
2920
|
+
data: Infer<TSchema>;
|
|
2921
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
2922
|
+
}) => Promise<HttpResponse<any>>;
|
|
2923
|
+
};
|
|
2924
|
+
/**
|
|
2925
|
+
* Inline view definition for view views
|
|
2926
|
+
*/
|
|
2927
|
+
type InlineViewViewConfig<TApiEndpoints, TActionIds extends string, TSchema extends ObjectSchema<any> = ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined> = {
|
|
2928
|
+
type: "resource-view";
|
|
2929
|
+
id: string;
|
|
2930
|
+
title: string;
|
|
2931
|
+
schemaGet: (api: TApiEndpoints) => TSchema;
|
|
2932
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
2933
|
+
actions?: ActionLayout<TActionIds>;
|
|
2934
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema, Infer<TSchema>>;
|
|
2935
|
+
onLoad: (args: {
|
|
2936
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
2937
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
2938
|
+
onPatch: (args: {
|
|
2939
|
+
data: Partial<Infer<TSchema>>;
|
|
2940
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
2941
|
+
}) => Promise<HttpResponse<any>>;
|
|
2942
|
+
};
|
|
2943
|
+
/**
|
|
2944
|
+
* Inline view definition for search views
|
|
2945
|
+
*/
|
|
2946
|
+
type InlineSearchViewConfig<TApiEndpoints, TActionIds extends string, TSchema extends ArraySchema<any> = ArraySchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined> = {
|
|
2947
|
+
type: "resource-search";
|
|
2948
|
+
id: string;
|
|
2949
|
+
title: string;
|
|
2950
|
+
schemaGet: (api: TApiEndpoints) => TSchema;
|
|
2951
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
2952
|
+
tableActions?: ActionLayout<TActionIds>;
|
|
2953
|
+
rowActions?: ActionLayout<TActionIds>;
|
|
2954
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema>;
|
|
2955
|
+
onLoad: (args: {
|
|
2956
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
2957
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
2958
|
+
};
|
|
2959
|
+
/**
|
|
2960
|
+
* Union type for all inline view configs
|
|
2961
|
+
*/
|
|
2962
|
+
type InlineViewConfig<TApiEndpoints, TActionIds extends string> = InlineCreateViewConfig<TApiEndpoints, TActionIds, any, any> | InlineViewViewConfig<TApiEndpoints, TActionIds, any, any> | InlineSearchViewConfig<TApiEndpoints, TActionIds, any, any>;
|
|
2963
|
+
/**
|
|
2964
|
+
* Resource builder that enables chained, type-safe resource configuration.
|
|
2965
|
+
*
|
|
2966
|
+
* Usage:
|
|
2967
|
+
* ```typescript
|
|
2968
|
+
* createResource("ticket")
|
|
2969
|
+
* .withApiEndpoints(apiEndpoints)
|
|
2970
|
+
* .withActions({ delete: { ... } })
|
|
2971
|
+
* .withViews({ create: { ... }, view: { ... } })
|
|
2972
|
+
* ```
|
|
2973
|
+
*/
|
|
2974
|
+
declare class ResourceBuilder<TId extends string, TApiEndpoints = never, TActions extends Record<string, InlineResourceActionConfig<TApiEndpoints>> = Record<string, never>> {
|
|
2975
|
+
private config;
|
|
2976
|
+
constructor(id: TId);
|
|
2977
|
+
/**
|
|
2978
|
+
* Configure API endpoints for this resource.
|
|
2979
|
+
* This unlocks type-safe HTTP client in actions and views.
|
|
2980
|
+
*/
|
|
2981
|
+
withApiEndpoints<T>(apiEndpoints: T): ResourceBuilder<TId, T, Record<string, never>>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Configure actions for this resource.
|
|
2984
|
+
* Actions can reference the API endpoints for type-safe HTTP calls.
|
|
2985
|
+
*/
|
|
2986
|
+
withActions<T extends Record<string, InlineResourceActionConfig<TApiEndpoints>>>(actions: T): ResourceBuilder<TId, TApiEndpoints, T>;
|
|
2987
|
+
/**
|
|
2988
|
+
* Configure views for this resource.
|
|
2989
|
+
* Views can reference API endpoints for schemas and action keys for tableActions/rowActions.
|
|
2990
|
+
* This is the final step that produces the ResourceDescriptor.
|
|
2991
|
+
*/
|
|
2992
|
+
withViews<TViews extends Record<string, InlineViewConfig<TApiEndpoints, keyof TActions & string>>>(views: TViews): ResourceDescriptor<{
|
|
2993
|
+
[K in keyof TViews]: TViews[K] extends InlineViewConfig<TApiEndpoints, any> ? TViews[K] extends InlineCreateViewConfig<TApiEndpoints, any, infer TSchema, infer TParamsSchema> ? ResourceCreateView<TSchema, TApiEndpoints, TParamsSchema, keyof TActions & string> : TViews[K] extends InlineViewViewConfig<TApiEndpoints, any, infer TSchema, infer TParamsSchema> ? ResourceViewView<TSchema, TApiEndpoints, TParamsSchema, keyof TActions & string> : TViews[K] extends InlineSearchViewConfig<TApiEndpoints, any, infer TSchema, infer TParamsSchema> ? ResourceSearchView<TSchema, TApiEndpoints, TParamsSchema, keyof TActions & string> : never : never;
|
|
2994
|
+
}, {
|
|
2995
|
+
[K in keyof TActions]: TActions[K] extends InlineResourceActionConfig<TApiEndpoints> ? {
|
|
2996
|
+
type: "resource";
|
|
2997
|
+
id: string;
|
|
2998
|
+
label?: string;
|
|
2999
|
+
icon?: React__default.ComponentType<{
|
|
3000
|
+
size?: number;
|
|
3001
|
+
className?: string;
|
|
3002
|
+
}>;
|
|
3003
|
+
disabled?: boolean;
|
|
3004
|
+
variant?: "default" | "destructive";
|
|
3005
|
+
onExecute: (context: ResourceActionExecutionContext) => void | Promise<void>;
|
|
3006
|
+
} : never;
|
|
3007
|
+
}>;
|
|
3008
|
+
private setApiEndpoints;
|
|
3009
|
+
private setActions;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Creates a new resource builder with the specified ID.
|
|
3013
|
+
*
|
|
3014
|
+
* The builder pattern enables sequential type inference, solving the circular
|
|
3015
|
+
* dependency problem between API endpoints, actions, and views.
|
|
3016
|
+
*
|
|
3017
|
+
* @example
|
|
3018
|
+
* ```typescript
|
|
3019
|
+
* const ticketResource = createResource("ticket")
|
|
3020
|
+
* .withApiEndpoints(apiEndpoints)
|
|
3021
|
+
* .withActions({
|
|
3022
|
+
* delete: {
|
|
3023
|
+
* label: "Delete",
|
|
3024
|
+
* onExecute: async ({ selectedIds, context }) => {
|
|
3025
|
+
* // context.http is fully typed
|
|
3026
|
+
* }
|
|
3027
|
+
* }
|
|
3028
|
+
* })
|
|
3029
|
+
* .withViews({
|
|
3030
|
+
* create: {
|
|
3031
|
+
* type: "resource-create",
|
|
3032
|
+
* schemaPost: (api) => api.postTicket.requestBody,
|
|
3033
|
+
* onSubmit: async ({ data, context }) => context.http.postTicket({ data })
|
|
3034
|
+
* }
|
|
3035
|
+
* });
|
|
3036
|
+
* ```
|
|
3037
|
+
*/
|
|
3038
|
+
declare function createResource<TId extends string>(id: TId): ResourceBuilder<TId, never, Record<string, never>>;
|
|
3039
|
+
|
|
3040
|
+
/**
|
|
3041
|
+
* Factory function to create a ResourceCreateView with type inference.
|
|
3042
|
+
* Eliminates redundancy by inferring schema and API client types from parameters.
|
|
3043
|
+
*/
|
|
3044
|
+
declare function createCreateView<TSchema extends ObjectSchema<any>, TEndpoints, TParamsSchema extends ObjectSchema<any> | undefined = undefined>({ id, title, schemaPost, schemaParams, onSubmit, }: {
|
|
3045
|
+
id: string;
|
|
3046
|
+
title: string;
|
|
3047
|
+
schemaPost: TSchema;
|
|
3048
|
+
schemaParams?: TParamsSchema;
|
|
3049
|
+
onSubmit: ({ data, context, }: {
|
|
3050
|
+
data: Infer<TSchema>;
|
|
3051
|
+
context: NubaseContextData<TEndpoints, TParamsSchema>;
|
|
3052
|
+
}) => Promise<HttpResponse<any>>;
|
|
3053
|
+
}): ResourceCreateView<TSchema, TEndpoints, TParamsSchema>;
|
|
3054
|
+
/**
|
|
3055
|
+
* Factory function to create a ResourceViewView with type inference.
|
|
3056
|
+
* Eliminates redundancy by inferring schema and API client types from parameters.
|
|
3057
|
+
*/
|
|
3058
|
+
declare function createViewView<TSchema extends ObjectSchema<any>, TEndpoints, TParamsSchema extends ObjectSchema<any> | undefined = undefined>({ id, title, schemaGet, schemaParams, onLoad, onPatch, }: {
|
|
3059
|
+
id: string;
|
|
3060
|
+
title: string;
|
|
3061
|
+
schemaGet: TSchema;
|
|
3062
|
+
schemaParams?: TParamsSchema;
|
|
3063
|
+
onLoad: ({ context, }: {
|
|
3064
|
+
context: NubaseContextData<TEndpoints, TParamsSchema>;
|
|
3065
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
3066
|
+
onPatch: ({ data, context, }: {
|
|
3067
|
+
data: Partial<Infer<TSchema>>;
|
|
3068
|
+
context: NubaseContextData<TEndpoints, TParamsSchema>;
|
|
3069
|
+
}) => Promise<HttpResponse<any>>;
|
|
3070
|
+
}): ResourceViewView<TSchema, TEndpoints, TParamsSchema>;
|
|
3071
|
+
|
|
3072
|
+
/**
|
|
3073
|
+
* Creates a view factory pre-configured with API endpoints.
|
|
3074
|
+
* This eliminates the need to import apiEndpoints in each view file.
|
|
3075
|
+
*/
|
|
3076
|
+
declare function createViewFactory<TApiEndpoints>(apiEndpoints: TApiEndpoints): {
|
|
3077
|
+
createView<TSchema extends ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string>(config: {
|
|
3078
|
+
id: string;
|
|
3079
|
+
title: string;
|
|
3080
|
+
schemaGet: (api: TApiEndpoints) => TSchema;
|
|
3081
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
3082
|
+
actions?: ActionLayout<TActionIds>;
|
|
3083
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema, Infer<TSchema>>;
|
|
3084
|
+
onLoad: (args: {
|
|
3085
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
3086
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
3087
|
+
onPatch: (args: {
|
|
3088
|
+
data: Partial<Infer<TSchema>>;
|
|
3089
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
3090
|
+
}) => Promise<HttpResponse<any>>;
|
|
3091
|
+
}): ResourceViewView<TSchema, TApiEndpoints, TParamsSchema, TActionIds>;
|
|
3092
|
+
createCreate<TSchema extends ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string>(config: {
|
|
3093
|
+
id: string;
|
|
3094
|
+
title: string;
|
|
3095
|
+
schemaPost: (api: TApiEndpoints) => TSchema;
|
|
3096
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
3097
|
+
actions?: ActionLayout<TActionIds>;
|
|
3098
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema>;
|
|
3099
|
+
onSubmit: (args: {
|
|
3100
|
+
data: Infer<TSchema>;
|
|
3101
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
3102
|
+
}) => Promise<HttpResponse<any>>;
|
|
3103
|
+
}): ResourceCreateView<TSchema, TApiEndpoints, TParamsSchema, TActionIds>;
|
|
3104
|
+
createSearch<TSchema extends ArraySchema<any>, TParamsSchema extends ObjectSchema<any> | undefined = undefined, TActionIds extends string = string>(config: {
|
|
3105
|
+
id: string;
|
|
3106
|
+
title: string;
|
|
3107
|
+
schemaGet: (api: TApiEndpoints) => TSchema;
|
|
3108
|
+
schemaParams?: (api: TApiEndpoints) => TParamsSchema;
|
|
3109
|
+
tableActions?: ActionLayout<TActionIds>;
|
|
3110
|
+
rowActions?: ActionLayout<TActionIds>;
|
|
3111
|
+
breadcrumbs?: BreadcrumbDefinition<TApiEndpoints, TParamsSchema>;
|
|
3112
|
+
onLoad: (args: {
|
|
3113
|
+
context: NubaseContextData<TApiEndpoints, TParamsSchema>;
|
|
3114
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
3115
|
+
}): ResourceSearchView<TSchema, TApiEndpoints, TParamsSchema, TActionIds>;
|
|
3116
|
+
};
|
|
3117
|
+
|
|
3118
|
+
/**
|
|
3119
|
+
* Helper to create a ResourceViewView with full type inference.
|
|
3120
|
+
* Infers all generic types from the provided configuration.
|
|
3121
|
+
*/
|
|
3122
|
+
declare function defineViewView<TSchema extends ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined, TConfig extends {
|
|
3123
|
+
id: string;
|
|
3124
|
+
title: string;
|
|
3125
|
+
schema: TSchema;
|
|
3126
|
+
schemaParams?: TParamsSchema;
|
|
3127
|
+
onLoad: (args: {
|
|
3128
|
+
context: any;
|
|
3129
|
+
}) => Promise<HttpResponse<Infer<TSchema>>>;
|
|
3130
|
+
onPatch: (args: {
|
|
3131
|
+
data: Partial<Infer<TSchema>>;
|
|
3132
|
+
context: any;
|
|
3133
|
+
}) => Promise<HttpResponse<any>>;
|
|
3134
|
+
}>(config: TConfig): TConfig & {
|
|
3135
|
+
type: "resource-view";
|
|
3136
|
+
};
|
|
3137
|
+
/**
|
|
3138
|
+
* Helper to create a ResourceCreateView with full type inference.
|
|
3139
|
+
* Infers all generic types from the provided configuration.
|
|
3140
|
+
*/
|
|
3141
|
+
declare function defineCreateView<TSchema extends ObjectSchema<any>, TParamsSchema extends ObjectSchema<any> | undefined, TConfig extends {
|
|
3142
|
+
id: string;
|
|
3143
|
+
title: string;
|
|
3144
|
+
schema: TSchema;
|
|
3145
|
+
schemaParams?: TParamsSchema;
|
|
3146
|
+
onSubmit: (args: {
|
|
3147
|
+
data: Infer<TSchema>;
|
|
3148
|
+
context: any;
|
|
3149
|
+
}) => Promise<HttpResponse<any>>;
|
|
3150
|
+
}>(config: TConfig): TConfig & {
|
|
3151
|
+
type: "resource-create";
|
|
3152
|
+
};
|
|
3153
|
+
|
|
3154
|
+
/**
|
|
3155
|
+
* Workspace context for path-based multi-workspace.
|
|
3156
|
+
* This file is intentionally separate from routes/root.tsx to avoid circular dependencies.
|
|
3157
|
+
* Components can safely import from here without creating import cycles.
|
|
3158
|
+
*/
|
|
3159
|
+
interface WorkspaceContext {
|
|
3160
|
+
slug: string;
|
|
3161
|
+
}
|
|
3162
|
+
/**
|
|
3163
|
+
* Hook to get the current workspace context.
|
|
3164
|
+
* Must be used within a route nested under /$workspace.
|
|
3165
|
+
* @throws Error if used outside of workspace route
|
|
3166
|
+
*/
|
|
3167
|
+
declare function useWorkspace(): WorkspaceContext;
|
|
3168
|
+
/**
|
|
3169
|
+
* Hook to optionally get the current workspace context.
|
|
3170
|
+
* Returns null if not within a workspace route.
|
|
3171
|
+
*/
|
|
3172
|
+
declare function useWorkspaceOptional(): WorkspaceContext | null;
|
|
3173
|
+
/**
|
|
3174
|
+
* Extract workspace slug from router state.
|
|
3175
|
+
* Use this in commands and other non-React contexts where hooks aren't available.
|
|
3176
|
+
*/
|
|
3177
|
+
declare function getWorkspaceFromRouter(router: {
|
|
3178
|
+
state: {
|
|
3179
|
+
matches: Array<{
|
|
3180
|
+
params: Record<string, string>;
|
|
3181
|
+
}>;
|
|
3182
|
+
};
|
|
3183
|
+
}): string | null;
|
|
3184
|
+
|
|
3185
|
+
/**
|
|
3186
|
+
* Keybinding extend options
|
|
3187
|
+
*/
|
|
3188
|
+
interface KeybindingExtendOptions {
|
|
3189
|
+
/**
|
|
3190
|
+
* Additional keybindings to add
|
|
3191
|
+
*/
|
|
3192
|
+
add?: Keybinding[];
|
|
3193
|
+
/**
|
|
3194
|
+
* List of command IDs to remove from defaults
|
|
3195
|
+
* More explicit and works better with action-based keybindings
|
|
3196
|
+
*/
|
|
3197
|
+
removeCommands?: string[];
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Creates an extended keybinding configuration from the defaults
|
|
3201
|
+
* @param options Configuration for extending keybindings
|
|
3202
|
+
* @returns Array of keybindings with extensions applied
|
|
3203
|
+
*/
|
|
3204
|
+
declare function extendKeybindings(options?: KeybindingExtendOptions): Keybinding[];
|
|
3205
|
+
/**
|
|
3206
|
+
* Default keybindings object with extend functionality
|
|
3207
|
+
*/
|
|
3208
|
+
declare const defaultKeybindings: {
|
|
3209
|
+
/**
|
|
3210
|
+
* Get the default keybindings array
|
|
3211
|
+
*/
|
|
3212
|
+
get(): Keybinding[];
|
|
3213
|
+
/**
|
|
3214
|
+
* Extend the default keybindings with additional or overridden bindings
|
|
3215
|
+
* @param options Configuration for extending keybindings
|
|
3216
|
+
* @returns Array of keybindings with extensions applied
|
|
3217
|
+
*
|
|
3218
|
+
* @example
|
|
3219
|
+
* // Add a new action-based keybinding (recommended)
|
|
3220
|
+
* const keybindings = defaultKeybindings.extend({
|
|
3221
|
+
* add: [{
|
|
3222
|
+
* key: "meta+/",
|
|
3223
|
+
* action: createCommandAction({ id: "theme-toggle" }, workbenchSetTheme)
|
|
3224
|
+
* }]
|
|
3225
|
+
* });
|
|
3226
|
+
*
|
|
3227
|
+
* @example
|
|
3228
|
+
* // Add a legacy command-based keybinding
|
|
3229
|
+
* const keybindings = defaultKeybindings.extend({
|
|
3230
|
+
* add: [{ key: "meta+/", command: "workbench.setTheme", commandArgs: {} }]
|
|
3231
|
+
* });
|
|
3232
|
+
*
|
|
3233
|
+
* @example
|
|
3234
|
+
* // Remove default keybindings and add custom ones
|
|
3235
|
+
* const keybindings = defaultKeybindings.extend({
|
|
3236
|
+
* removeCommands: ["workbench.runCommand"],
|
|
3237
|
+
* add: [{
|
|
3238
|
+
* key: "meta+shift+p",
|
|
3239
|
+
* action: createCommandAction({ id: "custom-cmd" }, myCustomCommand)
|
|
3240
|
+
* }]
|
|
3241
|
+
* });
|
|
3242
|
+
*/
|
|
3243
|
+
extend: typeof extendKeybindings;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* Legacy parsed keybinding using string-based commands
|
|
3248
|
+
*/
|
|
3249
|
+
interface ParsedCommandKeybinding {
|
|
3250
|
+
/** The original key string */
|
|
3251
|
+
key: string;
|
|
3252
|
+
/** Array of key sequences for chords (e.g., ["ctrl+k", "ctrl+c"]) */
|
|
3253
|
+
sequences: string[];
|
|
3254
|
+
/** The command to execute */
|
|
3255
|
+
command: string;
|
|
3256
|
+
/** Optional arguments for the command */
|
|
3257
|
+
commandArgs?: Record<string, unknown>;
|
|
3258
|
+
}
|
|
3259
|
+
/**
|
|
3260
|
+
* Modern parsed keybinding using typed actions
|
|
3261
|
+
*/
|
|
3262
|
+
interface ParsedActionKeybinding {
|
|
3263
|
+
/** The original key string */
|
|
3264
|
+
key: string;
|
|
3265
|
+
/** Array of key sequences for chords (e.g., ["ctrl+k", "ctrl+c"]) */
|
|
3266
|
+
sequences: string[];
|
|
3267
|
+
/** The action to execute */
|
|
3268
|
+
action: Action;
|
|
3269
|
+
}
|
|
3270
|
+
/**
|
|
3271
|
+
* Union type supporting both legacy command and modern action keybindings
|
|
3272
|
+
*/
|
|
3273
|
+
type ParsedKeybinding = ParsedCommandKeybinding | ParsedActionKeybinding;
|
|
3274
|
+
interface KeySequence {
|
|
3275
|
+
/** Modifier keys */
|
|
3276
|
+
meta?: boolean;
|
|
3277
|
+
ctrl?: boolean;
|
|
3278
|
+
alt?: boolean;
|
|
3279
|
+
shift?: boolean;
|
|
3280
|
+
/** The main key */
|
|
3281
|
+
key: string;
|
|
3282
|
+
}
|
|
3283
|
+
interface KeybindingState {
|
|
3284
|
+
/** Current chord sequence being built */
|
|
3285
|
+
currentChord: string[];
|
|
3286
|
+
/** Timeout for chord completion */
|
|
3287
|
+
chordTimeout: number | null;
|
|
3288
|
+
/** Whether we're waiting for the next key in a chord */
|
|
3289
|
+
waitingForChord: boolean;
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
/**
|
|
3293
|
+
* Manages keybindings with VS Code-style syntax support including chords
|
|
3294
|
+
*/
|
|
3295
|
+
declare class KeybindingManager {
|
|
3296
|
+
private keybindings;
|
|
3297
|
+
private state;
|
|
3298
|
+
private context;
|
|
3299
|
+
private readonly CHORD_TIMEOUT;
|
|
3300
|
+
/**
|
|
3301
|
+
* Sets the Nubase context for action execution
|
|
3302
|
+
*/
|
|
3303
|
+
setContext(context: NubaseContextData | null): void;
|
|
3304
|
+
/**
|
|
3305
|
+
* Registers an array of keybindings
|
|
3306
|
+
*/
|
|
3307
|
+
registerKeybindings(keybindings: Keybinding[]): void;
|
|
3308
|
+
/**
|
|
3309
|
+
* Handles keyboard events and executes matching commands
|
|
3310
|
+
*/
|
|
3311
|
+
handleKeyboardEvent(event: KeyboardEvent): Promise<boolean>;
|
|
3312
|
+
/**
|
|
3313
|
+
* Finds all keybindings that could match the current key
|
|
3314
|
+
*/
|
|
3315
|
+
private findMatches;
|
|
3316
|
+
/**
|
|
3317
|
+
* Handles completion of a chord sequence
|
|
3318
|
+
*/
|
|
3319
|
+
private handleChordCompletion;
|
|
3320
|
+
/**
|
|
3321
|
+
* Starts a new chord sequence
|
|
3322
|
+
*/
|
|
3323
|
+
private startChordSequence;
|
|
3324
|
+
/**
|
|
3325
|
+
* Resets the chord timeout
|
|
3326
|
+
*/
|
|
3327
|
+
private resetChordTimeout;
|
|
3328
|
+
/**
|
|
3329
|
+
* Resets the chord state
|
|
3330
|
+
*/
|
|
3331
|
+
private resetChordState;
|
|
3332
|
+
/**
|
|
3333
|
+
* Executes a command or action for a matching keybinding
|
|
3334
|
+
*/
|
|
3335
|
+
private executeKeybinding;
|
|
3336
|
+
/**
|
|
3337
|
+
* Determines if we should ignore a keyboard event based on the target element
|
|
3338
|
+
*/
|
|
3339
|
+
private shouldIgnoreEvent;
|
|
3340
|
+
/**
|
|
3341
|
+
* Clears all registered keybindings
|
|
3342
|
+
*/
|
|
3343
|
+
clear(): void;
|
|
3344
|
+
/**
|
|
3345
|
+
* Gets all registered keybindings
|
|
3346
|
+
*/
|
|
3347
|
+
getKeybindings(): ParsedKeybinding[];
|
|
3348
|
+
}
|
|
3349
|
+
declare const keybindingManager: KeybindingManager;
|
|
3350
|
+
|
|
3351
|
+
/**
|
|
3352
|
+
* Parses a key string into a KeySequence
|
|
3353
|
+
* Supports VS Code format: "ctrl+alt+k", "meta+shift+p", etc.
|
|
3354
|
+
*/
|
|
3355
|
+
declare function parseKeySequence(keyString: string): KeySequence;
|
|
3356
|
+
/**
|
|
3357
|
+
* Parses a keybinding definition into ParsedKeybinding
|
|
3358
|
+
* Supports chords like "ctrl+k ctrl+c" (space-separated sequences)
|
|
3359
|
+
* Supports alternative keys as array: ["meta+k", "ctrl+k"]
|
|
3360
|
+
* Supports both command-based and action-based keybindings
|
|
3361
|
+
*/
|
|
3362
|
+
declare function parseKeybinding(keybinding: Keybinding): ParsedKeybinding[];
|
|
3363
|
+
/**
|
|
3364
|
+
* Creates a normalized key string from a KeyboardEvent
|
|
3365
|
+
* Matches VS Code's key format
|
|
3366
|
+
*/
|
|
3367
|
+
declare function normalizeEventKey(event: KeyboardEvent): string;
|
|
3368
|
+
/**
|
|
3369
|
+
* Checks if a key sequence matches a parsed sequence
|
|
3370
|
+
*/
|
|
3371
|
+
declare function matchesKeySequence(eventKey: string, targetSequence: string): boolean;
|
|
3372
|
+
|
|
3373
|
+
/**
|
|
3374
|
+
* Registers keybindings and sets up the global keyboard event listener
|
|
3375
|
+
* This replaces the hook-based approach with a centralized system
|
|
3376
|
+
*/
|
|
3377
|
+
declare function registerKeybindings(keybindings: Keybinding[]): void;
|
|
3378
|
+
/**
|
|
3379
|
+
* Cleans up the keybinding system
|
|
3380
|
+
* Call this when unmounting the app or when you want to remove all keybindings
|
|
3381
|
+
*/
|
|
3382
|
+
declare function cleanupKeybindings(): void;
|
|
3383
|
+
/**
|
|
3384
|
+
* Updates keybindings without removing the global listener
|
|
3385
|
+
* Useful for hot-reloading keybinding configurations
|
|
3386
|
+
*/
|
|
3387
|
+
declare function updateKeybindings(keybindings: Keybinding[]): void;
|
|
3388
|
+
|
|
3389
|
+
/**
|
|
3390
|
+
* Resolved menu item with all display properties guaranteed.
|
|
3391
|
+
* This is what components receive after resolution.
|
|
3392
|
+
*/
|
|
3393
|
+
interface ResolvedMenuItem {
|
|
3394
|
+
id: string;
|
|
3395
|
+
label: string;
|
|
3396
|
+
subtitle?: string;
|
|
3397
|
+
icon?: IconComponent;
|
|
3398
|
+
disabled?: boolean;
|
|
3399
|
+
variant?: "default" | "destructive";
|
|
3400
|
+
/** String path or ResourceLink for type-safe resource navigation */
|
|
3401
|
+
href?: string | ResourceLink;
|
|
3402
|
+
commandId?: string;
|
|
3403
|
+
commandArgs?: Record<string, unknown>;
|
|
3404
|
+
onExecute?: () => void | Promise<void>;
|
|
3405
|
+
onFocus?: () => void;
|
|
3406
|
+
children?: ResolvedMenuItem[];
|
|
3407
|
+
}
|
|
3408
|
+
/**
|
|
3409
|
+
* Resolves a MenuItem by deriving missing label/icon from command definitions.
|
|
3410
|
+
*
|
|
3411
|
+
* Resolution priority:
|
|
3412
|
+
* 1. Explicit `label`/`icon` on the MenuItem (highest priority)
|
|
3413
|
+
* 2. `name`/`icon` from the referenced command definition
|
|
3414
|
+
* 3. `id` as fallback for label (lowest priority)
|
|
3415
|
+
*
|
|
3416
|
+
* @param item - The menu item to resolve
|
|
3417
|
+
* @param commandRegistry - Command registry to look up command definitions
|
|
3418
|
+
* @returns Resolved menu item with guaranteed label
|
|
3419
|
+
*/
|
|
3420
|
+
declare function resolveMenuItem(item: MenuItem, commandRegistry?: CommandRegistry): ResolvedMenuItem;
|
|
3421
|
+
/**
|
|
3422
|
+
* Resolves an array of menu items.
|
|
3423
|
+
*/
|
|
3424
|
+
declare function resolveMenuItems(items: MenuItem[], commandRegistry?: CommandRegistry): ResolvedMenuItem[];
|
|
3425
|
+
|
|
3426
|
+
interface ParseErrorDetail {
|
|
3427
|
+
path: string;
|
|
3428
|
+
message: string;
|
|
3429
|
+
code: string;
|
|
3430
|
+
expected?: string;
|
|
3431
|
+
received?: string;
|
|
3432
|
+
}
|
|
3433
|
+
interface NetworkErrorOptions {
|
|
3434
|
+
endpoint: string;
|
|
3435
|
+
method: string;
|
|
3436
|
+
statusCode?: number;
|
|
3437
|
+
responseText?: string;
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Base class for all network-related errors
|
|
3441
|
+
*/
|
|
3442
|
+
declare abstract class NetworkError extends Error {
|
|
3443
|
+
readonly endpoint: string;
|
|
3444
|
+
readonly method: string;
|
|
3445
|
+
readonly timestamp: Date;
|
|
3446
|
+
constructor(message: string, options: NetworkErrorOptions);
|
|
3447
|
+
}
|
|
3448
|
+
/**
|
|
3449
|
+
* Error thrown when client-side validation fails before making a network request
|
|
3450
|
+
*/
|
|
3451
|
+
declare class ClientNetworkError extends NetworkError {
|
|
3452
|
+
get [Symbol.toStringTag](): string;
|
|
3453
|
+
readonly phase: "request-validation" | "response-validation" | "network-failure";
|
|
3454
|
+
readonly parseErrors?: ParseErrorDetail[];
|
|
3455
|
+
readonly originalError?: unknown;
|
|
3456
|
+
readonly zodError?: ZodError;
|
|
3457
|
+
constructor(message: string, options: NetworkErrorOptions & {
|
|
3458
|
+
phase: "request-validation" | "response-validation" | "network-failure";
|
|
3459
|
+
parseErrors?: ParseErrorDetail[];
|
|
3460
|
+
originalError?: unknown;
|
|
3461
|
+
zodError?: ZodError;
|
|
3462
|
+
});
|
|
3463
|
+
toString(): string;
|
|
3464
|
+
toJSON(): any;
|
|
3465
|
+
/**
|
|
3466
|
+
* Creates a ClientNetworkError for network failures (no response from server)
|
|
3467
|
+
*/
|
|
3468
|
+
static fromNetworkFailure(error: unknown, options: NetworkErrorOptions): ClientNetworkError;
|
|
3469
|
+
}
|
|
3470
|
+
/**
|
|
3471
|
+
* Error thrown when the server returns an error response
|
|
3472
|
+
*/
|
|
3473
|
+
declare class ServerNetworkError extends NetworkError {
|
|
3474
|
+
get [Symbol.toStringTag](): string;
|
|
3475
|
+
readonly statusCode: number;
|
|
3476
|
+
readonly responseText?: string;
|
|
3477
|
+
readonly responseData?: unknown;
|
|
3478
|
+
constructor(message: string, options: NetworkErrorOptions & {
|
|
3479
|
+
statusCode: number;
|
|
3480
|
+
responseText?: string;
|
|
3481
|
+
responseData?: unknown;
|
|
3482
|
+
});
|
|
3483
|
+
toString(): string;
|
|
3484
|
+
toJSON(): any;
|
|
3485
|
+
/**
|
|
3486
|
+
* Creates a ServerNetworkError from an HTTP response
|
|
3487
|
+
*/
|
|
3488
|
+
static fromResponse(response: Response, responseText?: string, responseData?: unknown): ServerNetworkError;
|
|
3489
|
+
/**
|
|
3490
|
+
* Checks if this is a specific type of server error
|
|
3491
|
+
*/
|
|
3492
|
+
isNotFound(): boolean;
|
|
3493
|
+
isUnauthorized(): boolean;
|
|
3494
|
+
isForbidden(): boolean;
|
|
3495
|
+
isServerError(): boolean;
|
|
3496
|
+
isClientError(): boolean;
|
|
3497
|
+
}
|
|
3498
|
+
/**
|
|
3499
|
+
* Type guard to check if an error is a NetworkError
|
|
3500
|
+
*/
|
|
3501
|
+
declare function isNetworkError(error: unknown): error is NetworkError;
|
|
3502
|
+
/**
|
|
3503
|
+
* Type guard to check if an error is a ClientNetworkError
|
|
3504
|
+
*/
|
|
3505
|
+
declare function isClientNetworkError(error: unknown): error is ClientNetworkError;
|
|
3506
|
+
/**
|
|
3507
|
+
* Type guard to check if an error is a ServerNetworkError
|
|
3508
|
+
*/
|
|
3509
|
+
declare function isServerNetworkError(error: unknown): error is ServerNetworkError;
|
|
3510
|
+
/**
|
|
3511
|
+
* Helper to get a user-friendly error message
|
|
3512
|
+
*/
|
|
3513
|
+
declare function getNetworkErrorMessage(error: unknown): string;
|
|
3514
|
+
|
|
3515
|
+
export { ACTION_COLUMN_KEY, type Action, ActionBar, ActionBarContainer, type ActionBarContainerProps, type ActionBarProps, ActionCellFormatter, ActionCellRendererCell, ActionCellRendererGroup, ActionDropdownMenu, type ActionDropdownMenuProps, type ActionKeybinding, type ActionLayout, type ActionOrSeparator, ActivityIndicator, type ActivityIndicatorProps, type AuthenticatedUser, type AuthenticationController, type AuthenticationState, type AuthenticationStateListener, type BaseAction, type BaseModalFrameProps, type BaseWidgetDescriptor, Breadcrumb, BreadcrumbBar, type BreadcrumbBarProps, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, type BreadcrumbListProps, BreadcrumbPage, type BreadcrumbPageProps, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Button, ButtonBar, type ButtonBarProps, type ButtonProps, type CalculatedColumn, type CalculatedColumnOrColumnGroup, type CalculatedColumnParent, Callout, type CalloutProps, Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, CellComponent as Cell, type CellCopyArgs, type CellKeyDownArgs, type CellKeyboardEvent, type CellMouseArgs, type CellMouseEvent, type CellPasteArgs, type CellRendererProps, type CellSelectArgs, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, type CheckboxProps, ClientNetworkError, type ColSpanArgs, type Column, type ColumnGroup, type ColumnOrColumnGroup, type ColumnWidth, type ColumnWidths, type CommandAction, type CommandRegistry, ConnectedWidget, type ConnectedWidgetProps, ControllableSearchableTree, type ControllableSearchableTreeProps, Dashboard, type DashboardDescriptor, type DashboardDragConfig, type DashboardGridConfig, type DashboardProps, DashboardRenderer, type DashboardRendererProps, type DashboardResizeConfig, DashboardWidget, type DashboardWidgetProps, DataGrid, DataGridDefaultRenderersContext, type DataGridHandle, type DataGridProps, DataState, type DataStateProps, type DefaultColumnOptions, Dialog, type DialogProps, Dock, type DockProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EnhancedPagination, type EnhancedPaginationProps, type ErrorListener, type FillEvent, type FlatItem, type FlatMenuItem, FormControl, type FormControlProps, FormFieldRenderer, type FormFieldRendererProps, FormValidationErrors, type FormValidationErrorsProps, type GlobalActionsConfig, type HandlerAction, HttpClient, type HttpRequestConfig, type HttpResponse, type IconComponent, type InlineCreateViewConfig, type InlineResourceActionConfig, type InlineSearchViewConfig, type InlineViewConfig, type InlineViewViewConfig, type KeySequence, type Keybinding, type KeybindingState, type KpiWidgetDescriptor, Label, type LabelProps, EnhancedPagination as LegacyPagination, ListNavigator, type ListNavigatorItem, type ListNavigatorProps, type LoginCompleteCredentials, type LoginCredentials, type LoginStartResponse, MainNav, type MainNavProps, type MarkdownCommand, MarkdownTextArea, type MarkdownTextAreaHandle, type MarkdownTextAreaProps, type MenuItem, MenuItemComponent, type MenuItemOrSeparator, Modal, type ModalAlignment, type ModalConfig, ModalFrame, type ModalFrameProps, ModalFrameSchemaForm, type ModalFrameSchemaFormProps, ModalFrameStructured, type ModalFrameStructuredProps, type ModalInstance, type ModalProps, ModalProvider, type ModalSize, ModalViewRenderer, type ModalViewRendererProps, type NavItem, NavItems, NetworkError, type NetworkErrorOptions, NubaseApp, type NubaseAppProps, type NubaseContextData, type NubaseFrontendConfig, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type EnhancedPaginationProps as PaginationProps, type ParseErrorDetail, type ParsedKeybinding, type PromiseResult, type PromiseToastCallback, type PromiseToastConfig, type PromiseToastOptions, type ProportionalChartVariant, type ProportionalWidgetDescriptor, type RenderCellProps, type RenderCheckboxProps, type RenderEditCellProps, type RenderGroupCellProps, type RenderHeaderCellProps, type RenderRowProps, type RenderSortIconProps, type RenderSortPriorityProps, type RenderSortStatusProps, type RenderSummaryCellProps, type Renderers, type ResolvedMenuItem, type ResourceAction, type ResourceActionExecutionContext, type ResourceCreateView, ResourceCreateViewModalRenderer, type ResourceCreateViewModalRendererProps, ResourceCreateViewRenderer, type ResourceCreateViewRendererProps, type ResourceDescriptor, type ResourceLink, type ResourceSearchView, ResourceSearchViewModalRenderer, type ResourceSearchViewModalRendererProps, ResourceSearchViewRenderer, type ResourceSearchViewRendererProps, type ResourceViewView, ResourceViewViewModalRenderer, type ResourceViewViewModalRendererProps, ResourceViewViewRenderer, type ResourceViewViewRendererProps, RowComponent as Row, type RowHeightArgs, type RowsChangeData, SELECT_COLUMN_KEY, SchemaForm, SchemaFormBody, type SchemaFormBodyProps, SchemaFormButtonBar, type SchemaFormButtonBarProps, type SchemaFormConfiguration, type SchemaFormProps, SchemaFormValidationErrors, type SchemaFormValidationErrorsProps, SearchBar, type SearchBarProps, SearchTextInput, type SearchTextInputProps, SearchableTreeNavigator, type SearchableTreeNavigatorProps, Select, SelectCellFormatter, type SelectCellOptions, SelectColumn, type SelectHeaderRowEvent, type SelectOption, type SelectProps, type SelectRowEvent, type SelectionRange, type SeriesChartVariant, type SeriesWidgetDescriptor, ServerNetworkError, type SignupCredentials, type SortColumn, type SortDirection, type StandardViews, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, type TableWidgetDescriptor, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, type TextController, TextInput, type TextInputProps, type TextState, ThemeToggle, type ThemeToggleProps, Toast, ToastContainer, type ToastData, type ToastOptions, type ToastPosition, ToastProvider, type ToastType, ToggleGroup, TopBar, type TopBarProps, TreeDataGrid, type TreeDataGridProps, TreeNavigator, type TreeNavigatorItem, type TreeNavigatorProps, TypedApiClient, type TypedApiClientFromEndpoints, type TypedCommandDefinition, type UseDialogResult, type UseModalResult, type UseNubaseMutationOptions, type UseNubaseQueryOptions, type UseSchemaFormOptions, UserAvatar, type UserAvatarProps, UserMenu, type UserMenuProps, type View, type ViewBase, type ViewType, Widget, type WidgetDescriptor, type WidgetLayoutConfig, type WidgetProps, type WorkspaceContext, type WorkspaceInfo, boldCommand, checkListCommand, cleanupKeybindings, codeBlockCommand, codeCommand, commandRegistry, index as commands, createActionColumn, createCommand, createCommandAction, createCreateView, createDashboard, createHandlerAction, createResource, createResourceAction, createTypedApiClient, createViewFactory, createViewView, defaultKeybindings, defineCreateView, defineViewView, filterNavItems, flattenNavItems, getInitials, getLayout, getNetworkErrorMessage, getResourceLinkSearch, getWorkspaceFromRouter, groupActionsBySeparators, headingCommand, imageCommand, isClientNetworkError, isCommandAction, isHandlerAction, isNetworkError, isResourceLink, isServerNetworkError, italicCommand, keybindingManager, linkCommand, matchesKeySequence, normalizeEventKey, orderedListCommand, parseKeySequence, parseKeybinding, quoteCommand, registerKeybindings, renderCheckbox, renderHeaderCell, renderSortIcon, renderSortPriority, renderToggleGroup, renderValue, resolveMenuItem, resolveMenuItems, resolveResourceLink, resourceLink, showPromiseToast, showToast, strikethroughCommand, textEditor, unorderedListCommand, updateKeybindings, useActionExecutor, useChart, useComputedMetadata, useDialog, useHeaderRowSelection, useLayout, useModal, useNubaseMutation, useNubaseQuery, useResourceCreateMutation, useResourceDeleteMutation, useResourceInvalidation, useResourceSearchQuery, useResourceUpdateMutation, useResourceViewQuery, useRowSelection, useSchemaForm, useToast, useWorkspace, useWorkspaceOptional, workbenchOpenResourceOperation, workbenchOpenResourceOperationInModal, workbenchRunCommand, workbenchSetTheme, workbenchViewHistory };
|