@kingsimba/nc-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +233 -0
- package/dist/GeneratedIcons-B1vmWd9Q.cjs +2 -0
- package/dist/GeneratedIcons-B1vmWd9Q.cjs.map +1 -0
- package/dist/GeneratedIcons-BE4eggsw.js +490 -0
- package/dist/GeneratedIcons-BE4eggsw.js.map +1 -0
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.ts +129 -0
- package/dist/icons.js +26 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +5841 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +988 -0
- package/dist/styles.css +867 -0
- package/package.json +63 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { i18n } from 'i18next';
|
|
4
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ActivityIndicator - A spinning loading indicator.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* 1. Inline spinner: <ActivityIndicator size="small" />
|
|
12
|
+
* 2. Overlay on parent (parent must have position: relative):
|
|
13
|
+
* <div style={{ position: 'relative' }}>
|
|
14
|
+
* <Button>Click me</Button>
|
|
15
|
+
* {isLoading && <ActivityIndicator overlay />}
|
|
16
|
+
* </div>
|
|
17
|
+
* 3. Cover entire dialog: Place overlay ActivityIndicator inside dialog container
|
|
18
|
+
*/
|
|
19
|
+
export declare function ActivityIndicator({ size, color, overlay, className, }: ActivityIndicatorProps): JSX_2.Element;
|
|
20
|
+
|
|
21
|
+
declare interface ActivityIndicatorProps {
|
|
22
|
+
/** Size of the spinner */
|
|
23
|
+
size?: 'small' | 'default' | 'large';
|
|
24
|
+
/** Custom color (defaults to --primary) */
|
|
25
|
+
color?: string;
|
|
26
|
+
/** If true, renders in an overlay that covers the parent element and blocks clicks */
|
|
27
|
+
overlay?: boolean;
|
|
28
|
+
/** Additional class name */
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare function Alert({ code, text, type, button, onAction }: AlertProps): JSX_2.Element;
|
|
33
|
+
|
|
34
|
+
export declare interface AlertProps {
|
|
35
|
+
/** Error or warning code to display */
|
|
36
|
+
code: number;
|
|
37
|
+
/** Alert message text */
|
|
38
|
+
text: string;
|
|
39
|
+
/** Type of alert - determines styling */
|
|
40
|
+
type: AlertType;
|
|
41
|
+
/** Optional action button configuration */
|
|
42
|
+
button?: {
|
|
43
|
+
text: string;
|
|
44
|
+
variant?: ButtonVariant;
|
|
45
|
+
};
|
|
46
|
+
/** Callback when action button is clicked */
|
|
47
|
+
onAction?: () => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare type AlertType = 'warning' | 'error';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Container component that wraps an app with its title bar.
|
|
54
|
+
* Provides AppContext to the app component, allowing any nested
|
|
55
|
+
* component to control the title bar dynamically via useApp() hook.
|
|
56
|
+
*/
|
|
57
|
+
export declare function AppContainer({ appId, isActive, onClose }: AppContainerProps): JSX_2.Element | null;
|
|
58
|
+
|
|
59
|
+
declare interface AppContainerProps {
|
|
60
|
+
/** The app ID to render */
|
|
61
|
+
appId: string;
|
|
62
|
+
/** Whether this app is currently active (visible) */
|
|
63
|
+
isActive: boolean;
|
|
64
|
+
/** Called when the close button is clicked */
|
|
65
|
+
onClose: () => void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare const AppContext: default_2.Context<AppContextValue | null>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Context value for app components.
|
|
72
|
+
* Provides functions to control the app container from any nested component.
|
|
73
|
+
*/
|
|
74
|
+
export declare interface AppContextValue {
|
|
75
|
+
/** Set the title bar text (should be already translated) */
|
|
76
|
+
setTitle: (title: string) => void;
|
|
77
|
+
/** Set a back button handler. When set, a back arrow appears in the title bar. */
|
|
78
|
+
setBackHandler: (handler: () => void) => void;
|
|
79
|
+
/** Clear the back button handler, hiding the back arrow. */
|
|
80
|
+
clearBackHandler: () => void;
|
|
81
|
+
/** Set toolbar content to render in the title bar (right-aligned, before close button) */
|
|
82
|
+
setToolbar: (toolbar: default_2.ReactNode) => void;
|
|
83
|
+
/** Clear the toolbar content */
|
|
84
|
+
clearToolbar: () => void;
|
|
85
|
+
/** Hide the back button temporarily (useful when in edit mode) */
|
|
86
|
+
setHideBackButton: (hide: boolean) => void;
|
|
87
|
+
/** Dynamically hide or show the title bar */
|
|
88
|
+
setHideTitleBar: (hide: boolean) => void;
|
|
89
|
+
/** Close the app */
|
|
90
|
+
close: () => void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Definition of an application that can be launched in the right toolbar.
|
|
95
|
+
* App components can use the useApp() hook to access container controls.
|
|
96
|
+
*/
|
|
97
|
+
export declare interface AppDefinition {
|
|
98
|
+
/** Unique identifier for the app */
|
|
99
|
+
id: string;
|
|
100
|
+
/** i18n key for the display title (e.g., 'apps.calculator' or 'apps.maps.name') */
|
|
101
|
+
titleKey?: string;
|
|
102
|
+
/** Icon component displayed in the toolbar */
|
|
103
|
+
icon: default_2.ComponentType<{
|
|
104
|
+
size?: number;
|
|
105
|
+
className?: string;
|
|
106
|
+
}>;
|
|
107
|
+
/** The main component to render. Use useApp() hook inside to access container controls. */
|
|
108
|
+
component: default_2.ComponentType;
|
|
109
|
+
/** Panel width when the app is active (default: 400) */
|
|
110
|
+
width?: number;
|
|
111
|
+
/** Padding inside the app container (default: 0) */
|
|
112
|
+
padding?: number;
|
|
113
|
+
/** If true, hides the title bar and close button. The app cannot be closed once launched. */
|
|
114
|
+
hideTitleBar?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Renders an app in a fullscreen portal overlay without using the Dialog component.
|
|
119
|
+
* Uses AppContainer directly to preserve all app functionality (title bar, AppContext, back handlers).
|
|
120
|
+
*/
|
|
121
|
+
export declare function AppDialog({ appId, open, onClose, closeOnBackdrop, className, maxWidth, maxHeight, }: AppDialogProps): default_2.ReactPortal | null;
|
|
122
|
+
|
|
123
|
+
export declare interface AppDialogProps {
|
|
124
|
+
/** The app ID to render */
|
|
125
|
+
appId: string;
|
|
126
|
+
/** Whether the dialog is open */
|
|
127
|
+
open: boolean;
|
|
128
|
+
/** Called when the dialog should close */
|
|
129
|
+
onClose: () => void;
|
|
130
|
+
/** Whether clicking the backdrop closes the dialog (default: false) */
|
|
131
|
+
closeOnBackdrop?: boolean;
|
|
132
|
+
/** Optional CSS class name for the dialog container */
|
|
133
|
+
className?: string;
|
|
134
|
+
/** Maximum width in pixels (default: 1200) */
|
|
135
|
+
maxWidth?: number;
|
|
136
|
+
/** Maximum height in pixels (default: 900) */
|
|
137
|
+
maxHeight?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Type for app-specific i18n resources.
|
|
142
|
+
* Supports arbitrary nesting of translation keys and objects.
|
|
143
|
+
* Each key is a language code (e.g., 'en', 'zh'), and the value is an object of translation key-value pairs.
|
|
144
|
+
*/
|
|
145
|
+
export declare type AppI18nResources = Record<string, Record<string, unknown>>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* AppPanel component - Renders the right-side panel that displays running apps.
|
|
149
|
+
* Each running app is rendered via AppContainer, but only the active app is visible.
|
|
150
|
+
* On mobile devices, the panel overlays on top of the main area.
|
|
151
|
+
* On desktop, the panel sits inline next to the main area.
|
|
152
|
+
*/
|
|
153
|
+
export declare function AppPanel(): JSX_2.Element;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Registry for all available applications.
|
|
157
|
+
* Apps must be registered before they can be launched.
|
|
158
|
+
*/
|
|
159
|
+
declare class AppRegistry {
|
|
160
|
+
private apps;
|
|
161
|
+
/**
|
|
162
|
+
* Register an app definition.
|
|
163
|
+
* Applies default values (e.g., width: 400) if not specified.
|
|
164
|
+
*/
|
|
165
|
+
register(app: AppDefinition): void;
|
|
166
|
+
/**
|
|
167
|
+
* Unregister an app by its id.
|
|
168
|
+
*/
|
|
169
|
+
unregister(id: string): void;
|
|
170
|
+
/**
|
|
171
|
+
* Get an app definition by id.
|
|
172
|
+
*/
|
|
173
|
+
get(id: string): AppDefinition | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Get all registered apps.
|
|
176
|
+
*/
|
|
177
|
+
list(): AppDefinition[];
|
|
178
|
+
/**
|
|
179
|
+
* Check if an app is registered.
|
|
180
|
+
*/
|
|
181
|
+
has(id: string): boolean;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare const appRegistry: AppRegistry;
|
|
185
|
+
|
|
186
|
+
declare interface AppState {
|
|
187
|
+
activeAppId: string | null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare class AppStateStore {
|
|
191
|
+
private state;
|
|
192
|
+
private listeners;
|
|
193
|
+
constructor();
|
|
194
|
+
private loadState;
|
|
195
|
+
private saveState;
|
|
196
|
+
/**
|
|
197
|
+
* Get the currently active app ID.
|
|
198
|
+
*/
|
|
199
|
+
getActiveAppId(): string | null;
|
|
200
|
+
/**
|
|
201
|
+
* Set the active app ID (internal use by runningAppsStore).
|
|
202
|
+
*/
|
|
203
|
+
_setActiveAppId(appId: string | null): void;
|
|
204
|
+
/**
|
|
205
|
+
* Subscribe to changes of a specific state key.
|
|
206
|
+
*/
|
|
207
|
+
subscribe<K extends keyof AppState>(key: K, listener: Listener_2<AppState[K]>): () => void;
|
|
208
|
+
private notify;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export declare const appStateStore: AppStateStore;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* AppTaskbar component - A Windows 11-style taskbar for launching and switching apps.
|
|
215
|
+
* Displays pinned app icons that are always visible, plus any running non-pinned apps.
|
|
216
|
+
* Clicking an icon launches the app or toggles its active state if already running.
|
|
217
|
+
*/
|
|
218
|
+
export declare function AppTaskbar({ pinnedAppIds, className }: AppTaskbarProps): JSX_2.Element;
|
|
219
|
+
|
|
220
|
+
export declare interface AppTaskbarProps {
|
|
221
|
+
/** Array of app IDs to pin to the taskbar (always visible) */
|
|
222
|
+
pinnedAppIds: string[];
|
|
223
|
+
/** Optional className for the taskbar container */
|
|
224
|
+
className?: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Title bar component for launched applications.
|
|
229
|
+
* Displays the app title, optional back button, optional toolbar, and a close button.
|
|
230
|
+
*/
|
|
231
|
+
export declare function AppTitleBar({ title, onClose, onBack, toolbar, hideBackButton }: AppTitleBarProps): JSX_2.Element;
|
|
232
|
+
|
|
233
|
+
declare interface AppTitleBarProps {
|
|
234
|
+
title: string;
|
|
235
|
+
onClose: () => void;
|
|
236
|
+
/** If provided, shows a back arrow button on the left */
|
|
237
|
+
onBack?: () => void;
|
|
238
|
+
/** Optional toolbar content to render on the right side (before close button) */
|
|
239
|
+
toolbar?: default_2.ReactNode;
|
|
240
|
+
/** Whether to hide the back button even when onBack is provided (useful for edit mode) */
|
|
241
|
+
hideBackButton?: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Registry for back button handlers.
|
|
246
|
+
* Allows apps to register handlers that are called when the user presses back.
|
|
247
|
+
* Handlers are called in priority order (higher priority first).
|
|
248
|
+
*/
|
|
249
|
+
declare type BackHandler = () => boolean;
|
|
250
|
+
|
|
251
|
+
declare class BackHandlerRegistry {
|
|
252
|
+
private handlers;
|
|
253
|
+
/**
|
|
254
|
+
* Register a back handler.
|
|
255
|
+
* @param id - Unique identifier for this handler
|
|
256
|
+
* @param priority - Higher priority handlers are called first
|
|
257
|
+
* @param handler - Function that returns true if it handled the back action
|
|
258
|
+
* @returns Unsubscribe function
|
|
259
|
+
*/
|
|
260
|
+
register(id: string, priority: number, handler: BackHandler): () => void;
|
|
261
|
+
/**
|
|
262
|
+
* Trigger the back action.
|
|
263
|
+
* Calls handlers in priority order until one returns true.
|
|
264
|
+
* @returns true if a handler processed the back action
|
|
265
|
+
*/
|
|
266
|
+
handleBack(): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Unregister a handler by id.
|
|
269
|
+
*/
|
|
270
|
+
unregister(id: string): void;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export declare const backHandlerRegistry: BackHandlerRegistry;
|
|
274
|
+
|
|
275
|
+
export declare function Battery({ percentage, status, darkMode, colored, }: BatteryProps): JSX_2.Element;
|
|
276
|
+
|
|
277
|
+
export declare interface BatteryProps {
|
|
278
|
+
/** Battery level from 0.0 to 1.0 */
|
|
279
|
+
percentage?: number;
|
|
280
|
+
/** Current battery status */
|
|
281
|
+
status?: BatteryStatus;
|
|
282
|
+
/** Use light colors for dark backgrounds */
|
|
283
|
+
darkMode?: boolean;
|
|
284
|
+
/** Use threshold-based coloring (danger/warning/success) */
|
|
285
|
+
colored?: boolean;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export declare type BatteryStatus = 'charging' | 'discharging' | 'full';
|
|
289
|
+
|
|
290
|
+
export declare function Button({ variant, block, size, className, disabled, textSelectable, loading, onClick, children, ...rest }: ButtonProps): JSX_2.Element;
|
|
291
|
+
|
|
292
|
+
export declare function ButtonGroup<T extends string>({ value, onChange, options, disabled, labels, size, }: ButtonGroupProps<T>): JSX_2.Element;
|
|
293
|
+
|
|
294
|
+
export declare interface ButtonGroupProps<T extends string> {
|
|
295
|
+
/** Currently selected value */
|
|
296
|
+
value: T | null;
|
|
297
|
+
/** Callback when selection changes */
|
|
298
|
+
onChange: (value: T) => void;
|
|
299
|
+
/** Available options */
|
|
300
|
+
options: readonly T[];
|
|
301
|
+
/** Disable all buttons */
|
|
302
|
+
disabled?: boolean;
|
|
303
|
+
/** Custom labels for options */
|
|
304
|
+
labels?: Partial<Record<T, string>>;
|
|
305
|
+
/** Size variant */
|
|
306
|
+
size?: ButtonGroupSize;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export declare type ButtonGroupSize = 'default' | 'small';
|
|
310
|
+
|
|
311
|
+
declare type ButtonProps = default_2.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
312
|
+
variant?: ButtonVariant;
|
|
313
|
+
block?: boolean;
|
|
314
|
+
size?: 'default' | 'small' | 'large';
|
|
315
|
+
textSelectable?: boolean;
|
|
316
|
+
loading?: boolean;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
declare type ButtonVariant = 'default' | 'primary' | 'danger' | 'warning' | 'success' | 'ghost';
|
|
320
|
+
|
|
321
|
+
export declare function Checkbox({ checked, onChange, disabled, label, size, labelColor, style, className }: CheckboxProps): JSX_2.Element;
|
|
322
|
+
|
|
323
|
+
export declare interface CheckboxProps {
|
|
324
|
+
/** Whether the checkbox is checked */
|
|
325
|
+
checked: boolean;
|
|
326
|
+
/** Callback when checkbox value changes */
|
|
327
|
+
onChange: (value: boolean) => void;
|
|
328
|
+
/** Whether the checkbox is disabled */
|
|
329
|
+
disabled?: boolean;
|
|
330
|
+
/** Label text to display next to checkbox */
|
|
331
|
+
label?: string;
|
|
332
|
+
/** Size variant */
|
|
333
|
+
size?: CheckboxSize;
|
|
334
|
+
/** Custom label color */
|
|
335
|
+
labelColor?: string;
|
|
336
|
+
/** Custom styles */
|
|
337
|
+
style?: default_2.CSSProperties;
|
|
338
|
+
/** Additional CSS class names */
|
|
339
|
+
className?: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export declare type CheckboxSize = 'default' | 'small';
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Clear the app from the URL when closing.
|
|
346
|
+
*/
|
|
347
|
+
export declare function clearAppInUrl(): void;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* A reusable close button.
|
|
351
|
+
*/
|
|
352
|
+
export declare function CloseButton({ onClick, disabled, size, title, 'aria-label': ariaLabel }: CloseButtonProps): JSX_2.Element;
|
|
353
|
+
|
|
354
|
+
declare interface CloseButtonProps {
|
|
355
|
+
onClick: () => void;
|
|
356
|
+
disabled?: boolean;
|
|
357
|
+
size?: 'small' | 'default' | 'large';
|
|
358
|
+
title?: string;
|
|
359
|
+
'aria-label'?: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
363
|
+
|
|
364
|
+
export declare function ComboBox({ value, onChange, placeholder, options, disabled, label, clearable, allowTyping, placement, size, style, className, }: ComboBoxProps): JSX_2.Element;
|
|
365
|
+
|
|
366
|
+
export declare type ComboBoxOption = {
|
|
367
|
+
label: string;
|
|
368
|
+
value: string;
|
|
369
|
+
default?: boolean;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export declare interface ComboBoxProps {
|
|
373
|
+
/** Currently selected value */
|
|
374
|
+
value?: string;
|
|
375
|
+
/** Callback when selection changes */
|
|
376
|
+
onChange?: (value: string | undefined) => void;
|
|
377
|
+
/** Placeholder text when no value selected */
|
|
378
|
+
placeholder?: string;
|
|
379
|
+
/** Available options */
|
|
380
|
+
options: ComboBoxOption[];
|
|
381
|
+
/** Whether the combobox is disabled */
|
|
382
|
+
disabled?: boolean;
|
|
383
|
+
/** Label text */
|
|
384
|
+
label?: string;
|
|
385
|
+
/** Whether the selection can be cleared */
|
|
386
|
+
clearable?: boolean;
|
|
387
|
+
/** Whether typing to filter is allowed */
|
|
388
|
+
allowTyping?: boolean;
|
|
389
|
+
/** Dropdown placement preference */
|
|
390
|
+
placement?: 'top' | 'bottom';
|
|
391
|
+
/** Size variant */
|
|
392
|
+
size?: 'default' | 'small';
|
|
393
|
+
/** Custom styles */
|
|
394
|
+
style?: default_2.CSSProperties;
|
|
395
|
+
/** Additional CSS class names */
|
|
396
|
+
className?: string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* A context menu component that pops relative to an anchor element.
|
|
401
|
+
* Automatically detects available space and positions itself accordingly.
|
|
402
|
+
* Default position is right-down, but switches to right-up when space is limited.
|
|
403
|
+
*/
|
|
404
|
+
export declare function ContextMenu({ open, onClose, options, anchorRef, anchor, preferredDirection, }: ContextMenuProps): default_2.ReactPortal | null;
|
|
405
|
+
|
|
406
|
+
export declare interface ContextMenuOption {
|
|
407
|
+
id: string;
|
|
408
|
+
label: string;
|
|
409
|
+
icon?: default_2.ReactNode;
|
|
410
|
+
onClick: () => void;
|
|
411
|
+
disabled?: boolean;
|
|
412
|
+
variant?: 'default' | 'danger';
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export declare interface ContextMenuProps {
|
|
416
|
+
/** Whether the context menu is open */
|
|
417
|
+
open: boolean;
|
|
418
|
+
/** Called when the menu should close */
|
|
419
|
+
onClose: () => void;
|
|
420
|
+
/** Menu options to display */
|
|
421
|
+
options: ContextMenuOption[];
|
|
422
|
+
/** Reference element to anchor the menu position, or the element itself */
|
|
423
|
+
anchorRef?: default_2.RefObject<HTMLElement>;
|
|
424
|
+
/** Anchor element directly (alternative to anchorRef) */
|
|
425
|
+
anchor?: HTMLElement | null;
|
|
426
|
+
/** Preferred direction: 'down' or 'up' (default: 'down') */
|
|
427
|
+
preferredDirection?: 'down' | 'up';
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Factory function to create an isolated i18next instance for an app.
|
|
432
|
+
* This allows apps to have their own translations independent of the global nc-ui i18n system.
|
|
433
|
+
*
|
|
434
|
+
* Features:
|
|
435
|
+
* - Creates isolated i18next instance using createInstance()
|
|
436
|
+
* - Syncs language with document.documentElement.lang
|
|
437
|
+
* - Falls back to English for unsupported languages
|
|
438
|
+
* - Supports string interpolation like {{variableName}}
|
|
439
|
+
*
|
|
440
|
+
* @param resources - Translation resources object with language keys (en, zh, de, th, es, etc.)
|
|
441
|
+
* @returns Initialized i18next instance ready for use with I18nextProvider
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* const resources = {
|
|
446
|
+
* en: { hello: 'Hello', greeting: 'Hello {{name}}' },
|
|
447
|
+
* zh: { hello: '你好', greeting: '你好 {{name}}' },
|
|
448
|
+
* };
|
|
449
|
+
* const appI18n = createAppI18nFactory(resources);
|
|
450
|
+
*
|
|
451
|
+
* // Use with react-i18next:
|
|
452
|
+
* <I18nextProvider i18n={appI18n}>
|
|
453
|
+
* <YourApp />
|
|
454
|
+
* </I18nextProvider>
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
export declare function createAppI18nFactory(resources: AppI18nResources): i18n;
|
|
458
|
+
|
|
459
|
+
export declare function Dialog({ open, onClose, title, children, width, height, minWidth, minHeight, maxWidth, maxHeight, footerType, footer, onOk, onSave, onDelete, onCancel, onConnect, closeOnOverlay, primaryDisabled, fullScreen, hideTitleBar, }: DialogProps): JSX_2.Element | null;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* A button that automatically closes the parent Dialog when clicked.
|
|
463
|
+
* Accepts all Button props. Default children uses i18n 'common.close'.
|
|
464
|
+
*/
|
|
465
|
+
export declare function DialogClose({ children, onClick, ...props }: ButtonProps): JSX_2.Element;
|
|
466
|
+
|
|
467
|
+
declare interface DialogContextValue {
|
|
468
|
+
/** Close the dialog */
|
|
469
|
+
close: () => void;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export declare type DialogFooterType = 'ok' | 'ok-cancel' | 'save-cancel' | 'delete-cancel' | 'connect' | 'close' | 'gotit' | 'custom' | 'none';
|
|
473
|
+
|
|
474
|
+
export declare interface DialogProps {
|
|
475
|
+
/** Whether the dialog is open */
|
|
476
|
+
open: boolean;
|
|
477
|
+
/** Called when the dialog should close */
|
|
478
|
+
onClose: () => void;
|
|
479
|
+
/** Dialog title */
|
|
480
|
+
title: string;
|
|
481
|
+
/** Dialog content */
|
|
482
|
+
children: default_2.ReactNode;
|
|
483
|
+
/** Dialog width - number for pixels, string for CSS value (e.g., '50vw', '80%', 'auto') */
|
|
484
|
+
width?: number | string;
|
|
485
|
+
/** Dialog height - number for pixels, string for CSS value (e.g., '60vh', '70%', 'auto') */
|
|
486
|
+
height?: number | string;
|
|
487
|
+
/** Min width - number for pixels, string for CSS value */
|
|
488
|
+
minWidth?: number | string;
|
|
489
|
+
/** Min height - number for pixels, string for CSS value */
|
|
490
|
+
minHeight?: number | string;
|
|
491
|
+
/** Max width - number for pixels, string for CSS value (default: '95vw') */
|
|
492
|
+
maxWidth?: number | string;
|
|
493
|
+
/** Max height - number for pixels, string for CSS value (default: '95vh') */
|
|
494
|
+
maxHeight?: number | string;
|
|
495
|
+
/** Footer button preset type */
|
|
496
|
+
footerType?: DialogFooterType;
|
|
497
|
+
/** Custom footer content (used when footerType is 'custom') */
|
|
498
|
+
footer?: default_2.ReactNode;
|
|
499
|
+
/** Called when OK button is clicked */
|
|
500
|
+
onOk?: () => void;
|
|
501
|
+
/** Called when Save button is clicked */
|
|
502
|
+
onSave?: () => void;
|
|
503
|
+
/** Called when Delete button is clicked */
|
|
504
|
+
onDelete?: () => void;
|
|
505
|
+
/** Called when Cancel button is clicked */
|
|
506
|
+
onCancel?: () => void;
|
|
507
|
+
/** Called when Connect button is clicked */
|
|
508
|
+
onConnect?: () => void;
|
|
509
|
+
/** Whether clicking the overlay closes the dialog (default: true) */
|
|
510
|
+
closeOnOverlay?: boolean;
|
|
511
|
+
/** Whether the primary action button is disabled */
|
|
512
|
+
primaryDisabled?: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Whether to render the dialog in a portal covering the full viewport (default: false).
|
|
515
|
+
* Set to true to use fixed positioning via portal to document.body.
|
|
516
|
+
* Set to false to render inline with absolute positioning within parent container.
|
|
517
|
+
*/
|
|
518
|
+
fullScreen?: boolean;
|
|
519
|
+
/** Whether to hide the title bar (default: false) */
|
|
520
|
+
hideTitleBar?: boolean;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* A reusable edit button.
|
|
525
|
+
*/
|
|
526
|
+
export declare function EditButton({ onClick, disabled, size, title, 'aria-label': ariaLabel }: EditButtonProps): JSX_2.Element;
|
|
527
|
+
|
|
528
|
+
declare interface EditButtonProps {
|
|
529
|
+
onClick: () => void;
|
|
530
|
+
disabled?: boolean;
|
|
531
|
+
size?: 'small' | 'default' | 'large';
|
|
532
|
+
title?: string;
|
|
533
|
+
'aria-label'?: string;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Get the current locale.
|
|
538
|
+
* Returns manual locale if set, otherwise detects from HTML lang.
|
|
539
|
+
*/
|
|
540
|
+
export declare function getLocale(): SupportedLocale;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* A reusable hyperlink component styled as text with primary color.
|
|
544
|
+
* Useful for text-based actions that look like links.
|
|
545
|
+
*/
|
|
546
|
+
export declare function Hyperlink({ onClick, disabled, children, title, 'aria-label': ariaLabel, size }: HyperlinkProps): JSX_2.Element;
|
|
547
|
+
|
|
548
|
+
declare interface HyperlinkProps {
|
|
549
|
+
onClick?: () => void;
|
|
550
|
+
disabled?: boolean;
|
|
551
|
+
children: default_2.ReactNode;
|
|
552
|
+
title?: string;
|
|
553
|
+
'aria-label'?: string;
|
|
554
|
+
size?: 'small' | 'default';
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export declare function Input({ value, onChange, onEnter, onClear, placeholder, disabled, label, clearable, type, className, size, style, showPasswordToggle, }: InputProps): JSX_2.Element;
|
|
558
|
+
|
|
559
|
+
export declare interface InputProps {
|
|
560
|
+
/** Current value of the input */
|
|
561
|
+
value?: string;
|
|
562
|
+
/** Callback when value changes */
|
|
563
|
+
onChange?: (value: string) => void;
|
|
564
|
+
/** Callback when Enter key is pressed */
|
|
565
|
+
onEnter?: () => void;
|
|
566
|
+
/** Callback when input is cleared */
|
|
567
|
+
onClear?: () => void;
|
|
568
|
+
/** Placeholder text */
|
|
569
|
+
placeholder?: string;
|
|
570
|
+
/** Whether the input is disabled */
|
|
571
|
+
disabled?: boolean;
|
|
572
|
+
/** Label text displayed above the input */
|
|
573
|
+
label?: string;
|
|
574
|
+
/** Whether to show a clear button when there's a value */
|
|
575
|
+
clearable?: boolean;
|
|
576
|
+
/** Input type (text, password, email, etc.) */
|
|
577
|
+
type?: string;
|
|
578
|
+
/** Additional CSS class names */
|
|
579
|
+
className?: string;
|
|
580
|
+
/** Size variant */
|
|
581
|
+
size?: 'default' | 'small';
|
|
582
|
+
/** Additional inline styles */
|
|
583
|
+
style?: default_2.CSSProperties;
|
|
584
|
+
/** Whether to show a toggle button for password visibility (only works when type is 'password') */
|
|
585
|
+
showPasswordToggle?: boolean;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Options for launching an app.
|
|
590
|
+
*/
|
|
591
|
+
export declare interface LaunchAppOptions {
|
|
592
|
+
/** If true, the app will be launched but not made active. Default: false */
|
|
593
|
+
launchInBackground?: boolean;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
declare type Listener = () => void;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Simple store for persisting app state (like active app ID) across sessions.
|
|
600
|
+
* Uses localStorage for persistence.
|
|
601
|
+
*/
|
|
602
|
+
declare type Listener_2<T> = (value: T) => void;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* A container for grouping list items with a rounded border.
|
|
606
|
+
* Similar to iOS-style grouped lists or Windows 11 settings groups.
|
|
607
|
+
*/
|
|
608
|
+
export declare function ListGroup({ title, titleTools, children, style }: ListGroupProps): JSX_2.Element;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* A single item within a ListGroup.
|
|
612
|
+
* Can contain any content - fully flexible.
|
|
613
|
+
*/
|
|
614
|
+
export declare function ListGroupItem({ children, onClick, showBorder, selectable, style, }: ListGroupItemProps): JSX_2.Element;
|
|
615
|
+
|
|
616
|
+
export declare interface ListGroupItemProps {
|
|
617
|
+
/** Content of the list item */
|
|
618
|
+
children: default_2.ReactNode;
|
|
619
|
+
/** Click handler for the item */
|
|
620
|
+
onClick?: (e: default_2.MouseEvent<HTMLDivElement>) => void;
|
|
621
|
+
/** Whether to show bottom border (default: true) */
|
|
622
|
+
showBorder?: boolean;
|
|
623
|
+
/** Whether text should be selectable (default: false) */
|
|
624
|
+
selectable?: boolean;
|
|
625
|
+
/** Optional CSS styles to apply to the item */
|
|
626
|
+
style?: default_2.CSSProperties;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export declare interface ListGroupProps {
|
|
630
|
+
/** Optional group title */
|
|
631
|
+
title?: string;
|
|
632
|
+
/** Optional tools rendered on the title row (e.g., buttons) */
|
|
633
|
+
titleTools?: default_2.ReactNode;
|
|
634
|
+
/** Group content (ListGroupItem components or any other content) */
|
|
635
|
+
children: default_2.ReactNode;
|
|
636
|
+
/** Optional CSS styles to apply to the container */
|
|
637
|
+
style?: default_2.CSSProperties;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export declare function MultiSelect({ values, onChange, options, placeholder, label }: MultiSelectProps): JSX_2.Element;
|
|
641
|
+
|
|
642
|
+
export declare interface MultiSelectProps {
|
|
643
|
+
/** Array of currently selected values */
|
|
644
|
+
values: string[];
|
|
645
|
+
/** Callback when selection changes */
|
|
646
|
+
onChange: (values: string[]) => void;
|
|
647
|
+
/** Available options to select from */
|
|
648
|
+
options: Option_2[];
|
|
649
|
+
/** Placeholder text when no items are selected */
|
|
650
|
+
placeholder?: string;
|
|
651
|
+
/** Label text displayed above the select */
|
|
652
|
+
label?: string;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Renders the views in the navigation stack.
|
|
657
|
+
* All views in the stack remain mounted (hidden with CSS) to preserve state.
|
|
658
|
+
* Title bar is now handled by AppContainer, so showTitleBar is removed.
|
|
659
|
+
* Each view is wrapped with NavViewProvider for stack-based toolbar management.
|
|
660
|
+
*/
|
|
661
|
+
export declare function NavStackContainer(): JSX_2.Element;
|
|
662
|
+
|
|
663
|
+
export declare interface NavStackContextValue {
|
|
664
|
+
/** Push a new view onto the stack */
|
|
665
|
+
push: (view: NavView) => void;
|
|
666
|
+
/** Go back one level (pop the current view) */
|
|
667
|
+
pop: () => void;
|
|
668
|
+
/** Reset to root view (clear entire stack) */
|
|
669
|
+
reset: () => void;
|
|
670
|
+
/** Current stack depth (1 = root only) */
|
|
671
|
+
depth: number;
|
|
672
|
+
/** Whether back navigation is possible */
|
|
673
|
+
canGoBack: boolean;
|
|
674
|
+
/** Current view's title */
|
|
675
|
+
currentTitle: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Provides navigation stack context to child components.
|
|
680
|
+
* Manages the view stack and exposes push/pop/reset operations.
|
|
681
|
+
* Syncs title and back button with AppContainer via useApp() hook.
|
|
682
|
+
* Also manages a parallel toolbar stack for stack-based toolbar management.
|
|
683
|
+
*/
|
|
684
|
+
export declare function NavStackProvider({ rootView, children }: NavStackProviderProps): JSX_2.Element;
|
|
685
|
+
|
|
686
|
+
declare interface NavStackProviderProps {
|
|
687
|
+
/** The root view (always shown at the bottom of the stack) */
|
|
688
|
+
rootView: NavView;
|
|
689
|
+
/** Child components (typically NavStackContainer) */
|
|
690
|
+
children: default_2.ReactNode;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export declare interface NavView {
|
|
694
|
+
/** Unique identifier for the view */
|
|
695
|
+
id: string;
|
|
696
|
+
/** i18n key for the title (preferred - updates on language change) */
|
|
697
|
+
titleKey?: string;
|
|
698
|
+
/** Static title string (used when titleKey is not provided, e.g., for dynamic data like SSID) */
|
|
699
|
+
title?: string;
|
|
700
|
+
/** The view component to render */
|
|
701
|
+
component: default_2.ReactNode;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Per-view context for toolbar management.
|
|
706
|
+
* Each view gets its own setToolbar/clearToolbar that only affects its stack slot.
|
|
707
|
+
*/
|
|
708
|
+
export declare interface NavViewContextValue {
|
|
709
|
+
/** Set toolbar for THIS view only */
|
|
710
|
+
setToolbar: (toolbar: default_2.ReactNode) => void;
|
|
711
|
+
/** Clear toolbar for THIS view */
|
|
712
|
+
clearToolbar: () => void;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export declare function NumberInput({ value, onChange, min, max, step, label, disabled, size }: NumberInputProps): JSX_2.Element;
|
|
716
|
+
|
|
717
|
+
export declare interface NumberInputProps {
|
|
718
|
+
/** Current numeric value */
|
|
719
|
+
value: number;
|
|
720
|
+
/** Callback when value changes */
|
|
721
|
+
onChange: (value: number) => void;
|
|
722
|
+
/** Minimum allowed value */
|
|
723
|
+
min?: number;
|
|
724
|
+
/** Maximum allowed value */
|
|
725
|
+
max?: number;
|
|
726
|
+
/** Step increment/decrement value */
|
|
727
|
+
step?: number;
|
|
728
|
+
/** Label text displayed above the input */
|
|
729
|
+
label?: string;
|
|
730
|
+
/** Whether the input is disabled */
|
|
731
|
+
disabled?: boolean;
|
|
732
|
+
/** Size variant */
|
|
733
|
+
size?: 'default' | 'small';
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
declare type Option_2 = {
|
|
737
|
+
label: string;
|
|
738
|
+
value: string;
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* A reusable refresh button with spinning animation.
|
|
743
|
+
* Shows a spinning refresh icon when loading.
|
|
744
|
+
*/
|
|
745
|
+
export declare function RefreshButton({ onClick, loading, disabled, size, title, 'aria-label': ariaLabel }: RefreshButtonProps): JSX_2.Element;
|
|
746
|
+
|
|
747
|
+
declare interface RefreshButtonProps {
|
|
748
|
+
onClick: () => void;
|
|
749
|
+
loading?: boolean;
|
|
750
|
+
disabled?: boolean;
|
|
751
|
+
size?: 'small' | 'default' | 'large';
|
|
752
|
+
title?: string;
|
|
753
|
+
'aria-label'?: string;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Represents a running app instance.
|
|
758
|
+
* @template TRef - The type of the ref object exposed by the app
|
|
759
|
+
*/
|
|
760
|
+
export declare interface RunningApp<TRef = Record<string, unknown>> {
|
|
761
|
+
/** The app definition id */
|
|
762
|
+
appId: string;
|
|
763
|
+
/** Timestamp when the app was launched */
|
|
764
|
+
launchedAt: number;
|
|
765
|
+
/** Reference object populated by the app component with methods/state */
|
|
766
|
+
ref?: TRef;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Store for managing running applications.
|
|
771
|
+
* Only one instance of each app is allowed.
|
|
772
|
+
* Apps are not persisted across page refreshes.
|
|
773
|
+
*/
|
|
774
|
+
declare class RunningAppsStore {
|
|
775
|
+
private apps;
|
|
776
|
+
private activeAppId;
|
|
777
|
+
private listeners;
|
|
778
|
+
private refReadyResolvers;
|
|
779
|
+
/**
|
|
780
|
+
* Launch an app and wait for it to be ready (ref populated).
|
|
781
|
+
* If already running, activates it (unless launchInBackground is true) and returns the existing app.
|
|
782
|
+
* @template TRef - The type of the ref object exposed by the app (optional, for type safety)
|
|
783
|
+
* @param appId - The app id to launch
|
|
784
|
+
* @param options - Launch options
|
|
785
|
+
* @returns Promise that resolves with the RunningApp when ref is ready, or null if app not found
|
|
786
|
+
*/
|
|
787
|
+
launchApp<TRef = Record<string, unknown>>(appId: string, options?: LaunchAppOptions): Promise<RunningApp<TRef> | null>;
|
|
788
|
+
private waitForRef;
|
|
789
|
+
/**
|
|
790
|
+
* Called by app components to register their ref.
|
|
791
|
+
* This resolves any pending launchApp promises.
|
|
792
|
+
*/
|
|
793
|
+
setAppRef(appId: string, ref: Record<string, any>): void;
|
|
794
|
+
/**
|
|
795
|
+
* Get a running app by id.
|
|
796
|
+
*/
|
|
797
|
+
getApp(appId: string): RunningApp | undefined;
|
|
798
|
+
/**
|
|
799
|
+
* Close a running app.
|
|
800
|
+
*/
|
|
801
|
+
closeApp(appId: string): void;
|
|
802
|
+
/**
|
|
803
|
+
* Set the active app by its app id.
|
|
804
|
+
*/
|
|
805
|
+
setActiveApp(appId: string | null): void;
|
|
806
|
+
/**
|
|
807
|
+
* Toggle an app: if active, deactivate; if inactive, activate.
|
|
808
|
+
*/
|
|
809
|
+
toggleApp(appId: string): void;
|
|
810
|
+
/**
|
|
811
|
+
* Get the currently active app id.
|
|
812
|
+
*/
|
|
813
|
+
getActiveAppId(): string | null;
|
|
814
|
+
/**
|
|
815
|
+
* Get the currently active app definition.
|
|
816
|
+
*/
|
|
817
|
+
getActiveApp(): AppDefinition | null;
|
|
818
|
+
/**
|
|
819
|
+
* Get all running apps.
|
|
820
|
+
*/
|
|
821
|
+
getRunningApps(): RunningApp[];
|
|
822
|
+
/**
|
|
823
|
+
* Check if an app is running.
|
|
824
|
+
*/
|
|
825
|
+
isRunning(appId: string): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Subscribe to changes.
|
|
828
|
+
*/
|
|
829
|
+
subscribe(listener: Listener): () => void;
|
|
830
|
+
private notify;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export declare const runningAppsStore: RunningAppsStore;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Push a browser history entry for the app.
|
|
837
|
+
* This enables the browser back button to close/navigate apps.
|
|
838
|
+
*/
|
|
839
|
+
export declare function setAppInUrl(appId: string): void;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Set the locale for nc-ui components manually.
|
|
843
|
+
* Pass `null` to use auto-detection from HTML lang attribute.
|
|
844
|
+
* @param locale - One of: 'en', 'zh', 'de', 'th', 'es', or null for auto
|
|
845
|
+
*/
|
|
846
|
+
export declare function setLocale(locale: SupportedLocale | null): void;
|
|
847
|
+
|
|
848
|
+
export declare function Slider({ value, onChange, min, max, step, label, disabled, showValue, formatValue, width, }: SliderProps): JSX_2.Element;
|
|
849
|
+
|
|
850
|
+
export declare interface SliderProps {
|
|
851
|
+
/** Current value */
|
|
852
|
+
value: number;
|
|
853
|
+
/** Callback when value changes */
|
|
854
|
+
onChange: (value: number) => void;
|
|
855
|
+
/** Minimum value */
|
|
856
|
+
min?: number;
|
|
857
|
+
/** Maximum value */
|
|
858
|
+
max?: number;
|
|
859
|
+
/** Step increment */
|
|
860
|
+
step?: number;
|
|
861
|
+
/** Label text displayed above the slider */
|
|
862
|
+
label?: string;
|
|
863
|
+
/** Whether the slider is disabled */
|
|
864
|
+
disabled?: boolean;
|
|
865
|
+
/** Whether to show the current value next to the slider */
|
|
866
|
+
showValue?: boolean;
|
|
867
|
+
/** Custom formatter for displaying the value */
|
|
868
|
+
formatValue?: (value: number) => string;
|
|
869
|
+
/** Width of the slider track */
|
|
870
|
+
width?: number | string;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Simple built-in localization for nc-ui components.
|
|
875
|
+
* Supports: en, zh, de, th, es
|
|
876
|
+
*
|
|
877
|
+
* By default, auto-detects locale from document.documentElement.lang.
|
|
878
|
+
* Can be manually overridden with setLocale().
|
|
879
|
+
*/
|
|
880
|
+
export declare type SupportedLocale = 'en' | 'zh' | 'de' | 'th' | 'es';
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Get a translated string by key.
|
|
884
|
+
* Falls back to English if key not found.
|
|
885
|
+
*/
|
|
886
|
+
export declare function t(key: string): string;
|
|
887
|
+
|
|
888
|
+
export declare function Tabs({ tabs, active, onChange, className, toolbar, multiline, style }: TabsProps): JSX_2.Element;
|
|
889
|
+
|
|
890
|
+
export declare interface TabsProps {
|
|
891
|
+
/** Array of tab labels */
|
|
892
|
+
tabs: string[];
|
|
893
|
+
/** Currently active tab label */
|
|
894
|
+
active: string;
|
|
895
|
+
/** Callback when a tab is selected */
|
|
896
|
+
onChange: (tab: string) => void;
|
|
897
|
+
/** Additional CSS class name for the container */
|
|
898
|
+
className?: string;
|
|
899
|
+
/** Optional toolbar content rendered at the end of the tab bar */
|
|
900
|
+
toolbar?: default_2.ReactNode;
|
|
901
|
+
/** Whether tabs should wrap to multiple lines */
|
|
902
|
+
multiline?: boolean;
|
|
903
|
+
/** Additional inline styles */
|
|
904
|
+
style?: default_2.CSSProperties;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export declare function Toggle({ checked, onChange, disabled, label }: ToggleProps): JSX_2.Element;
|
|
908
|
+
|
|
909
|
+
export declare interface ToggleProps {
|
|
910
|
+
/** Whether the toggle is checked/on */
|
|
911
|
+
checked: boolean;
|
|
912
|
+
/** Callback when toggle state changes */
|
|
913
|
+
onChange: (value: boolean) => void;
|
|
914
|
+
/** Whether the toggle is disabled */
|
|
915
|
+
disabled?: boolean;
|
|
916
|
+
/** Label text displayed next to the toggle */
|
|
917
|
+
label?: string;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* A reusable trash button.
|
|
922
|
+
*/
|
|
923
|
+
export declare function TrashButton({ onClick, disabled, size, title, 'aria-label': ariaLabel }: TrashButtonProps): JSX_2.Element;
|
|
924
|
+
|
|
925
|
+
declare interface TrashButtonProps {
|
|
926
|
+
onClick: () => void;
|
|
927
|
+
disabled?: boolean;
|
|
928
|
+
size?: 'small' | 'default' | 'large';
|
|
929
|
+
title?: string;
|
|
930
|
+
'aria-label'?: string;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Hook to access app context from within an app.
|
|
935
|
+
* Returns functions to control the app container (setTitle, close, etc.)
|
|
936
|
+
* Can be called from any component nested inside an app.
|
|
937
|
+
* @throws Error if used outside of an app component
|
|
938
|
+
*/
|
|
939
|
+
export declare function useApp(): AppContextValue;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Hook to access dialog context from within a Dialog.
|
|
943
|
+
* Returns the dialog context with close() and other functions.
|
|
944
|
+
* @throws Error if used outside of a Dialog component
|
|
945
|
+
*/
|
|
946
|
+
export declare function useDialog(): DialogContextValue;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Hook to access navigation stack controls.
|
|
950
|
+
* Must be used within a NavStackProvider.
|
|
951
|
+
*/
|
|
952
|
+
export declare function useNavStack(): NavStackContextValue;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Hook to access per-view toolbar controls.
|
|
956
|
+
* Must be used within a NavStack view.
|
|
957
|
+
*/
|
|
958
|
+
export declare function useNavView(): NavViewContextValue;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Hook to access viewport information.
|
|
962
|
+
*/
|
|
963
|
+
export declare function useViewport(): ViewportContextValue;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Viewport context value providing responsive breakpoint information.
|
|
967
|
+
*/
|
|
968
|
+
export declare interface ViewportContextValue {
|
|
969
|
+
/** True if viewport width < 768px */
|
|
970
|
+
isMobile: boolean;
|
|
971
|
+
/** True if viewport width >= 768px and < 1024px */
|
|
972
|
+
isTablet: boolean;
|
|
973
|
+
/** True if viewport width >= 1024px */
|
|
974
|
+
isDesktop: boolean;
|
|
975
|
+
/** Current viewport width in pixels */
|
|
976
|
+
width: number;
|
|
977
|
+
/** Current viewport height in pixels */
|
|
978
|
+
height: number;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Provider component that tracks viewport size and provides responsive breakpoints.
|
|
983
|
+
*/
|
|
984
|
+
export declare function ViewportProvider({ children }: {
|
|
985
|
+
children: ReactNode;
|
|
986
|
+
}): JSX_2.Element;
|
|
987
|
+
|
|
988
|
+
export { }
|