rud-dashboard 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,261 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import { VariantProps } from 'class-variance-authority';
4
+ import * as react from 'react';
5
+ import { ReactNode, ComponentType } from 'react';
6
+
7
+ interface GridItem$1<T = any> {
8
+ id: string;
9
+ x: number;
10
+ y: number;
11
+ w: number;
12
+ h: number;
13
+ type: string;
14
+ title: string;
15
+ content?: () => T;
16
+ onMenuClick?: (event: any) => void;
17
+ menuIcon?: T;
18
+ isAnimating?: boolean;
19
+ originalX?: number;
20
+ originalY?: number;
21
+ originalW?: number;
22
+ originalH?: number;
23
+ }
24
+ interface DragState$1<T = any> {
25
+ id: string;
26
+ startX: number;
27
+ startY: number;
28
+ originalItem: GridItem$1<T>;
29
+ }
30
+ interface ResizeState$1<T = any> extends DragState$1<T> {
31
+ handle: string;
32
+ }
33
+ interface WidgetType$1<T = any> {
34
+ id: string;
35
+ type: string;
36
+ title: string;
37
+ icon: T;
38
+ defaultSize: {
39
+ w: number;
40
+ h: number;
41
+ };
42
+ description: string;
43
+ component: any;
44
+ preview: any;
45
+ onMenuClick?: (event: any) => void;
46
+ menuIcon?: T;
47
+ }
48
+ type GridMode = 'elegant' | 'dots' | 'harsh' | 'blank';
49
+ interface DashboardActions$1<T = any> {
50
+ toggleEditMode: () => void;
51
+ toggleAddWidgetMode: () => void;
52
+ autoOrganize: () => void;
53
+ toggleFixedHeight: () => void;
54
+ addWidget: (widget: WidgetType$1<T>, x?: number, y?: number) => void;
55
+ removeItem: (id: string) => void;
56
+ }
57
+ interface DashboardState$1<T = any> {
58
+ isEditMode: boolean;
59
+ isAddWidgetMode: boolean;
60
+ isFixedHeight: boolean;
61
+ gridDimensions: {
62
+ width: number;
63
+ height: number;
64
+ cols: number;
65
+ rows: number;
66
+ };
67
+ itemCount: number;
68
+ items: GridItem$1<T>[];
69
+ }
70
+ interface SerializedDashboard {
71
+ items: Omit<GridItem$1<any>, 'content'>[];
72
+ }
73
+ interface DashboardController$1<T = any> {
74
+ items: GridItem$1<T>[];
75
+ addItem: (item: GridItem$1<T>) => void;
76
+ removeItem: (id: string) => void;
77
+ updateItem: (id: string, updates: Partial<GridItem$1<T>>) => void;
78
+ setItems: (items: GridItem$1<T>[] | ((prev: GridItem$1<T>[]) => GridItem$1<T>[])) => void;
79
+ save: () => SerializedDashboard;
80
+ load: (state: SerializedDashboard) => void;
81
+ clear: () => void;
82
+ isEditMode: boolean;
83
+ toggleEditMode: () => void;
84
+ setEditMode: (enabled: boolean) => void;
85
+ }
86
+ interface UseDashboardControllerOptions$1<T = any> {
87
+ initialItems?: GridItem$1<T>[];
88
+ initialEditMode?: boolean;
89
+ }
90
+ interface CustomToolbarProps$1<T = any> {
91
+ state: DashboardState$1<T>;
92
+ actions: DashboardActions$1<T>;
93
+ availableWidgetTypes: WidgetType$1<T>[];
94
+ }
95
+ interface DashboardProps$2<T = any> {
96
+ availableWidgetTypes?: WidgetType$1<T>[];
97
+ initialItems?: Omit<GridItem$1<T>, 'content'>[];
98
+ widgetRegistry?: Record<string, any>;
99
+ onItemsChange?: (items: Omit<GridItem$1<T>, 'content'>[]) => void;
100
+ className?: string;
101
+ enableEditMode?: boolean;
102
+ defaultEditMode?: boolean;
103
+ gridMode?: GridMode;
104
+ showDefaultToolbar?: boolean;
105
+ customToolbar?: any;
106
+ toolbarClassName?: string;
107
+ onEditModeChange?: (isEditMode: boolean) => void;
108
+ onAddWidgetModeChange?: (isAddWidgetMode: boolean) => void;
109
+ onFixedHeightChange?: (isFixedHeight: boolean) => void;
110
+ controller?: DashboardController$1<T>;
111
+ }
112
+ interface DashboardToolbarProps$2<T = any> {
113
+ isEditMode: boolean;
114
+ onToggleMode: () => void;
115
+ onAutoOrganize: () => void;
116
+ onToggleFixedHeight: () => void;
117
+ isFixedHeight: boolean;
118
+ gridDimensions: {
119
+ width: number;
120
+ height: number;
121
+ cols: number;
122
+ rows: number;
123
+ };
124
+ itemCount: number;
125
+ isAddWidgetMode?: boolean;
126
+ onToggleAddWidgetMode?: () => void;
127
+ onAddWidget?: (widget: WidgetType$1<T>) => void;
128
+ availableWidgetTypes?: WidgetType$1<T>[];
129
+ }
130
+ interface BasicWidgetProps {
131
+ id?: string;
132
+ title?: string;
133
+ }
134
+ interface ProgressBarData {
135
+ label: string;
136
+ value: number;
137
+ max: number;
138
+ color?: string;
139
+ }
140
+ interface ProgressBarWidgetProps {
141
+ data?: ProgressBarData;
142
+ }
143
+ interface PieChartData {
144
+ label: string;
145
+ segments: Array<{
146
+ name: string;
147
+ value: number;
148
+ color: string;
149
+ }>;
150
+ }
151
+ interface PieChartWidgetProps {
152
+ data?: PieChartData;
153
+ }
154
+ interface BarChartData {
155
+ label: string;
156
+ data: Array<{
157
+ name: string;
158
+ value: number;
159
+ color?: string;
160
+ }>;
161
+ }
162
+ interface BarChartWidgetProps {
163
+ data?: BarChartData;
164
+ }
165
+ interface LineChartData {
166
+ label: string;
167
+ data: Array<{
168
+ name: string;
169
+ value: number;
170
+ }>;
171
+ color?: string;
172
+ }
173
+ interface LineChartWidgetProps {
174
+ data?: LineChartData;
175
+ }
176
+
177
+ type DashboardProps$1 = DashboardProps$2<any>;
178
+ type DashboardToolbarProps$1 = DashboardToolbarProps$2<any>;
179
+
180
+ declare function Dashboard({ availableWidgetTypes, initialItems, widgetRegistry, onItemsChange, className, enableEditMode, defaultEditMode, gridMode, showDefaultToolbar, customToolbar, toolbarClassName, onEditModeChange, onAddWidgetModeChange, onFixedHeightChange, controller: externalController, }: DashboardProps$1): react_jsx_runtime.JSX.Element;
181
+
182
+ declare function DashboardToolbar({ isEditMode, onToggleMode, onAutoOrganize, onToggleFixedHeight, isFixedHeight, gridDimensions, itemCount, isAddWidgetMode, onToggleAddWidgetMode, onAddWidget, availableWidgetTypes, }: DashboardToolbarProps$1): react_jsx_runtime.JSX.Element;
183
+
184
+ declare const buttonVariants: (props?: ({
185
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
186
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
187
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
188
+ interface ButtonProps extends VariantProps<typeof buttonVariants> {
189
+ className?: string;
190
+ onClick?: (e: any) => void;
191
+ disabled?: boolean;
192
+ type?: "button" | "submit" | "reset";
193
+ children?: any;
194
+ ref?: any;
195
+ [key: string]: any;
196
+ }
197
+ declare function Button({ className, variant, size, ref, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
198
+ declare namespace Button {
199
+ var displayName: string;
200
+ }
201
+
202
+ interface TooltipProviderProps {
203
+ children?: unknown;
204
+ }
205
+ declare function TooltipProvider({ children }: TooltipProviderProps): react_jsx_runtime.JSX.Element;
206
+ interface TooltipProps {
207
+ children?: unknown;
208
+ delayDuration?: number;
209
+ }
210
+ declare function Tooltip({ children, delayDuration }: TooltipProps): react_jsx_runtime.JSX.Element;
211
+ interface TooltipTriggerProps {
212
+ children?: unknown;
213
+ className?: string;
214
+ asChild?: boolean;
215
+ [key: string]: any;
216
+ }
217
+ declare function TooltipTrigger({ children, asChild, className, ...props }: TooltipTriggerProps): react_jsx_runtime.JSX.Element;
218
+ declare namespace TooltipTrigger {
219
+ var displayName: string;
220
+ }
221
+ interface TooltipContentProps {
222
+ children?: unknown;
223
+ className?: string;
224
+ sideOffset?: number;
225
+ side?: "top" | "right" | "bottom" | "left";
226
+ [key: string]: any;
227
+ }
228
+ declare function TooltipContent({ className, sideOffset, side, children, ...props }: TooltipContentProps): react.ReactPortal | null;
229
+ declare namespace TooltipContent {
230
+ var displayName: string;
231
+ }
232
+
233
+ type GridItem = GridItem$1<ReactNode>;
234
+ type DragState = DragState$1<ReactNode>;
235
+ type ResizeState = ResizeState$1<ReactNode>;
236
+ type WidgetType = Omit<WidgetType$1<ReactNode>, 'component' | 'preview'> & {
237
+ component: ComponentType<any>;
238
+ preview: ComponentType<any>;
239
+ };
240
+ type DashboardActions = DashboardActions$1<ReactNode>;
241
+ type DashboardState = DashboardState$1<ReactNode>;
242
+ type DashboardController = DashboardController$1<ReactNode>;
243
+ type UseDashboardControllerOptions = UseDashboardControllerOptions$1<ReactNode>;
244
+ type CustomToolbarProps = CustomToolbarProps$1<ReactNode>;
245
+ type DashboardProps = DashboardProps$2<ReactNode> & {
246
+ widgetRegistry?: Record<string, ComponentType<any>>;
247
+ customToolbar?: ComponentType<CustomToolbarProps> | ((props: CustomToolbarProps) => ReactNode);
248
+ };
249
+ type DashboardToolbarProps = DashboardToolbarProps$2<ReactNode>;
250
+
251
+ declare const GRID_SIZE = 40;
252
+ declare const MARGIN = 8;
253
+ declare const CELL_SIZE: number;
254
+ declare const ANIMATION_DURATION = 300;
255
+ declare const MIN_SIZE = 2;
256
+ declare const MAX_SIZE = 24;
257
+ declare const CONTAINER_PADDING = 16;
258
+ declare const MIN_CONTAINER_HEIGHT = 200;
259
+ declare const DEBOUNCE_DELAY = 150;
260
+
261
+ export { ANIMATION_DURATION, type BarChartData, type BarChartWidgetProps, type BasicWidgetProps, Button, CELL_SIZE, CONTAINER_PADDING, type CustomToolbarProps, DEBOUNCE_DELAY, Dashboard, type DashboardActions, type DashboardController, type DashboardProps, type DashboardState, DashboardToolbar, type DashboardToolbarProps, type DragState, GRID_SIZE, type GridItem, type GridMode, type LineChartData, type LineChartWidgetProps, MARGIN, MAX_SIZE, MIN_CONTAINER_HEIGHT, MIN_SIZE, type PieChartData, type PieChartWidgetProps, type ProgressBarData, type ProgressBarWidgetProps, type ResizeState, type SerializedDashboard, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseDashboardControllerOptions, type WidgetType, Dashboard as default };