@juv/codego-react-ui 3.3.0 → 3.3.3
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.cjs +174 -41
- package/dist/index.d.cts +259 -17
- package/dist/index.d.ts +259 -17
- package/dist/index.global.js +176 -43
- package/dist/index.js +175 -42
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -194,11 +194,19 @@ interface NotificationBannerProps {
|
|
|
194
194
|
}
|
|
195
195
|
declare function NotificationBanner({ variant, title, description, icon, closable, onClose, action, className, }: NotificationBannerProps): react_jsx_runtime.JSX.Element;
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Represents a single pagination link in server-side pagination
|
|
199
|
+
* @interface ServerPaginationLink
|
|
200
|
+
*/
|
|
197
201
|
interface ServerPaginationLink {
|
|
198
202
|
page: number;
|
|
199
203
|
url: string;
|
|
200
204
|
active: boolean;
|
|
201
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Server-side pagination metadata returned from the API
|
|
208
|
+
* @interface ServerPagination
|
|
209
|
+
*/
|
|
202
210
|
interface ServerPagination {
|
|
203
211
|
first_page_url: string;
|
|
204
212
|
last_page_url: string;
|
|
@@ -209,11 +217,20 @@ interface ServerPagination {
|
|
|
209
217
|
total: number;
|
|
210
218
|
links: ServerPaginationLink[];
|
|
211
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Response structure from server-side table API
|
|
222
|
+
* @template T - The data type for table rows
|
|
223
|
+
* @extends ServerPagination
|
|
224
|
+
*/
|
|
212
225
|
interface ServerTableResponse<T> extends ServerPagination {
|
|
213
226
|
current_page: number;
|
|
214
227
|
data: T[];
|
|
215
228
|
pagination?: ServerPagination;
|
|
216
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Options for the useServerTable hook
|
|
232
|
+
* @interface UseServerTableOptions
|
|
233
|
+
*/
|
|
217
234
|
interface UseServerTableOptions {
|
|
218
235
|
/** Base URL — page param appended automatically: `url?page=N` */
|
|
219
236
|
url: string;
|
|
@@ -232,6 +249,11 @@ interface UseServerTableOptions {
|
|
|
232
249
|
*/
|
|
233
250
|
columnOverrides?: Record<string, Partial<Column<any>>>;
|
|
234
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Return type from the useServerTable hook
|
|
254
|
+
* @template T - The data type for table rows
|
|
255
|
+
* @interface UseServerTableReturn
|
|
256
|
+
*/
|
|
235
257
|
interface UseServerTableReturn<T> {
|
|
236
258
|
data: T[];
|
|
237
259
|
columns: Column<T>[];
|
|
@@ -243,24 +265,52 @@ interface UseServerTableReturn<T> {
|
|
|
243
265
|
goToPage: (page: number) => void;
|
|
244
266
|
reload: () => void;
|
|
245
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Server-side pagination prop passed to the Table component
|
|
270
|
+
* @interface ServerPaginationProp
|
|
271
|
+
*/
|
|
246
272
|
interface ServerPaginationProp {
|
|
247
273
|
pagination: ServerPagination;
|
|
248
274
|
currentPage: number;
|
|
249
275
|
goToPage: (page: number) => void;
|
|
250
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Custom hook for fetching and managing server-side paginated table data.
|
|
279
|
+
* Supports Laravel encryption, auto-column derivation, and flexible pagination.
|
|
280
|
+
*
|
|
281
|
+
* @template T - The data type for table rows
|
|
282
|
+
* @param options - Configuration options for the server table
|
|
283
|
+
* @returns Object with data, columns, pagination state, loading, error, and control functions
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```tsx
|
|
287
|
+
* const { data, columns, serverPagination, loading } = useServerTable({
|
|
288
|
+
* url: "/api/users",
|
|
289
|
+
* params: { sort: "name" },
|
|
290
|
+
* })
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
251
293
|
declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides }: UseServerTableOptions): UseServerTableReturn<T>;
|
|
294
|
+
/**
|
|
295
|
+
* Available field types for action forms (edit/view modals)
|
|
296
|
+
* @type {ActionFieldType}
|
|
297
|
+
*/
|
|
252
298
|
type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle" | "select" | "radio" | "slider" | "tag-input" | "otp" | "combobox" | "color-picker" | "date-range" | "rich-text" | "file-upload" | "repeater";
|
|
299
|
+
/**
|
|
300
|
+
* Configuration for a single field in action forms (edit/view modals)
|
|
301
|
+
* @interface ActionField
|
|
302
|
+
*/
|
|
253
303
|
interface ActionField {
|
|
254
304
|
key: string;
|
|
255
305
|
label: string;
|
|
256
306
|
type?: ActionFieldType;
|
|
257
307
|
/** HTML input type for type="input" (e.g. "email", "number", "password") */
|
|
258
308
|
inputType?: string;
|
|
259
|
-
/** Options for type="select", "radio", "combobox" — string[]
|
|
309
|
+
/** Options for type="select", "radio", "combobox" — string[], { label, value }[], or [label, value][] */
|
|
260
310
|
options?: string[] | {
|
|
261
311
|
label: string;
|
|
262
312
|
value: string;
|
|
263
|
-
}[];
|
|
313
|
+
}[] | [string, string][];
|
|
264
314
|
placeholder?: string;
|
|
265
315
|
required?: boolean;
|
|
266
316
|
/** Min value for type="slider" */
|
|
@@ -282,7 +332,10 @@ interface ActionField {
|
|
|
282
332
|
/** Custom render — overrides built-in field renderer */
|
|
283
333
|
render?: (value: any, onChange: (v: any) => void) => React.ReactNode;
|
|
284
334
|
}
|
|
285
|
-
/**
|
|
335
|
+
/**
|
|
336
|
+
* Configuration for customizing the appearance of action buttons (View/Edit/Delete)
|
|
337
|
+
* @interface ActionButtonConfig
|
|
338
|
+
*/
|
|
286
339
|
interface ActionButtonConfig {
|
|
287
340
|
/** Button variant. Defaults: view→"outline", edit→"outline", delete→"danger" */
|
|
288
341
|
variant?: "primary" | "secondary" | "outline" | "ghost" | "link" | "danger" | "success" | "destructive";
|
|
@@ -304,7 +357,11 @@ interface ActionButtonConfig {
|
|
|
304
357
|
displayMode?: "icon" | "text" | "icon-text";
|
|
305
358
|
className?: string;
|
|
306
359
|
}
|
|
307
|
-
/**
|
|
360
|
+
/**
|
|
361
|
+
* Configuration for extra custom action buttons added alongside default actions
|
|
362
|
+
* @template T - The data type for table rows
|
|
363
|
+
* @interface ExtraActionConfig
|
|
364
|
+
*/
|
|
308
365
|
interface ExtraActionConfig<T> {
|
|
309
366
|
/** Unique key */
|
|
310
367
|
key: string;
|
|
@@ -328,6 +385,11 @@ interface ExtraActionConfig<T> {
|
|
|
328
385
|
className?: string;
|
|
329
386
|
onClick: (item: T) => void;
|
|
330
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Configuration for default View/Edit/Delete actions on table rows
|
|
390
|
+
* @template T - The data type for table rows
|
|
391
|
+
* @interface DefaultActionsConfig
|
|
392
|
+
*/
|
|
331
393
|
interface DefaultActionsConfig<T> {
|
|
332
394
|
/**
|
|
333
395
|
* Base URL used to build PUT and DELETE requests.
|
|
@@ -362,6 +424,10 @@ interface DefaultActionsConfig<T> {
|
|
|
362
424
|
/** Extra action buttons rendered alongside view/edit/delete */
|
|
363
425
|
extraActions?: ExtraActionConfig<T>[];
|
|
364
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Configuration for success notifications after edit/delete operations
|
|
429
|
+
* @interface ActionSuccessNotif
|
|
430
|
+
*/
|
|
365
431
|
interface ActionSuccessNotif {
|
|
366
432
|
/** "toast" uses the ToastProvider. "notification" renders an inline banner. Default "toast". */
|
|
367
433
|
type?: "toast" | "notification";
|
|
@@ -382,6 +448,22 @@ interface ActionSuccessNotif {
|
|
|
382
448
|
/** Extra action element rendered inside the notification */
|
|
383
449
|
action?: React.ReactNode;
|
|
384
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Predefined modal width options for View/Edit/Delete modals
|
|
453
|
+
* @constant {Object} MODAL_WIDTH
|
|
454
|
+
* @property {string} sm - Small: max-w-sm (384px)
|
|
455
|
+
* @property {string} md - Medium: max-w-md (448px)
|
|
456
|
+
* @property {string} lg - Large: max-w-lg (512px)
|
|
457
|
+
* @property {string} xl - Extra Large: max-w-xl (576px)
|
|
458
|
+
* @property {string} 2xl - 2X Large: max-w-2xl (672px)
|
|
459
|
+
* @property {string} 3xl - 3X Large: max-w-3xl (768px)
|
|
460
|
+
* @property {string} 4xl - 4X Large: max-w-4xl (896px)
|
|
461
|
+
* @property {string} 5xl - 5X Large: max-w-5xl (1024px)
|
|
462
|
+
* @property {string} 6xl - 6X Large: max-w-6xl (1152px)
|
|
463
|
+
* @property {string} 7xl - 7X Large: max-w-7xl (1280px)
|
|
464
|
+
* @property {string} screen - Screen width: max-w-screen-xl (1280px)
|
|
465
|
+
* @property {string} full - Full width: max-w-full
|
|
466
|
+
*/
|
|
385
467
|
declare const MODAL_WIDTH: {
|
|
386
468
|
readonly sm: "max-w-sm";
|
|
387
469
|
readonly md: "max-w-md";
|
|
@@ -397,6 +479,11 @@ declare const MODAL_WIDTH: {
|
|
|
397
479
|
readonly full: "max-w-full";
|
|
398
480
|
};
|
|
399
481
|
type ModalWidth = keyof typeof MODAL_WIDTH;
|
|
482
|
+
/**
|
|
483
|
+
* Column definition for the Table component
|
|
484
|
+
* @template T - The data type for table rows
|
|
485
|
+
* @interface Column
|
|
486
|
+
*/
|
|
400
487
|
interface Column<T> {
|
|
401
488
|
key: keyof T | string;
|
|
402
489
|
title: string;
|
|
@@ -414,6 +501,11 @@ interface Column<T> {
|
|
|
414
501
|
/** Called when a cell value changes (select, toggle, color, checkbox) */
|
|
415
502
|
onChange?: (item: T, value: any) => void;
|
|
416
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Props for the Table component
|
|
506
|
+
* @template T - The data type for table rows
|
|
507
|
+
* @interface TableProps
|
|
508
|
+
*/
|
|
417
509
|
interface TableProps<T> {
|
|
418
510
|
data: T[];
|
|
419
511
|
columns: Column<T>[];
|
|
@@ -430,6 +522,33 @@ interface TableProps<T> {
|
|
|
430
522
|
serverPagination?: ServerPaginationProp | null;
|
|
431
523
|
className?: string;
|
|
432
524
|
}
|
|
525
|
+
/**
|
|
526
|
+
* Data table component with sorting, filtering, pagination, and CRUD actions
|
|
527
|
+
*
|
|
528
|
+
* @template T - The data type for table rows (must be a record with string keys)
|
|
529
|
+
* @param props - Table configuration including data, columns, and options
|
|
530
|
+
* @returns Rendered table with toolbar, pagination, and optional action modals
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```tsx
|
|
534
|
+
* <Table
|
|
535
|
+
* data={users}
|
|
536
|
+
* columns={[
|
|
537
|
+
* { key: "name", title: "Name", sortable: true },
|
|
538
|
+
* { key: "status", type: "badge" },
|
|
539
|
+
* { key: "active", type: "toggle", onChange: handleToggle },
|
|
540
|
+
* ]}
|
|
541
|
+
* searchable
|
|
542
|
+
* pagination
|
|
543
|
+
* selectable
|
|
544
|
+
* onBulkDelete={handleBulkDelete}
|
|
545
|
+
* defaultActions={{
|
|
546
|
+
* baseUrl: "/api/users",
|
|
547
|
+
* editForm: [{ key: "name", label: "Name", required: true }],
|
|
548
|
+
* }}
|
|
549
|
+
* />
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
433
552
|
declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
434
553
|
|
|
435
554
|
type BulletinPriority = "low" | "medium" | "high" | "urgent";
|
|
@@ -844,13 +963,26 @@ interface MetricRowProps {
|
|
|
844
963
|
}
|
|
845
964
|
declare function MetricRow({ items, divided, className }: MetricRowProps): react_jsx_runtime.JSX.Element;
|
|
846
965
|
|
|
966
|
+
/**
|
|
967
|
+
* Props for server-side pagination in DataGrid.
|
|
968
|
+
* Used when DataGrid is controlled by server-side data fetching.
|
|
969
|
+
*/
|
|
847
970
|
interface ServerDataGridProp {
|
|
971
|
+
/** Server pagination metadata from Laravel/API */
|
|
848
972
|
pagination: ServerPagination;
|
|
973
|
+
/** Current active page number (1-based) */
|
|
849
974
|
currentPage: number;
|
|
975
|
+
/** Function to navigate to a specific page */
|
|
850
976
|
goToPage: (page: number) => void;
|
|
851
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Options for the useServerDataGrid hook.
|
|
980
|
+
* Provides server-side data fetching with optional Laravel payload decryption.
|
|
981
|
+
*/
|
|
852
982
|
interface UseServerDataGridOptions {
|
|
983
|
+
/** API endpoint URL to fetch data from */
|
|
853
984
|
url: string;
|
|
985
|
+
/** Query parameters to include in the request */
|
|
854
986
|
params?: Record<string, string | number>;
|
|
855
987
|
/** If true, the response is expected to be a Laravel-encrypted payload */
|
|
856
988
|
encrypt?: boolean;
|
|
@@ -865,45 +997,142 @@ interface UseServerDataGridOptions {
|
|
|
865
997
|
*/
|
|
866
998
|
columnOverrides?: Record<string, Partial<DataGridColumn<any>>>;
|
|
867
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Return type for the useServerDataGrid hook.
|
|
1002
|
+
* Contains all data and state needed to render a server-side DataGrid.
|
|
1003
|
+
* @template T - The data item type
|
|
1004
|
+
*/
|
|
868
1005
|
interface UseServerDataGridReturn<T> {
|
|
1006
|
+
/** Array of data items for the current page */
|
|
869
1007
|
data: T[];
|
|
1008
|
+
/** Auto-derived column definitions from first data row */
|
|
870
1009
|
columns: DataGridColumn<T>[];
|
|
1010
|
+
/** Current active page number */
|
|
871
1011
|
currentPage: number;
|
|
1012
|
+
/** Server pagination metadata or null if not available */
|
|
872
1013
|
pagination: ServerPagination | null;
|
|
1014
|
+
/** Formatted pagination prop for DataGrid component */
|
|
873
1015
|
serverPagination: ServerDataGridProp | null | undefined;
|
|
1016
|
+
/** Whether data is currently being fetched */
|
|
874
1017
|
loading: boolean;
|
|
1018
|
+
/** Error message if request failed, null otherwise */
|
|
875
1019
|
error: string | null;
|
|
1020
|
+
/** Function to navigate to a specific page */
|
|
876
1021
|
goToPage: (page: number) => void;
|
|
1022
|
+
/** Function to force reload current page data */
|
|
877
1023
|
reload: () => void;
|
|
878
1024
|
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Custom hook for server-side data fetching with DataGrid.
|
|
1027
|
+
* Handles pagination, sorting, filtering, and optional Laravel payload decryption.
|
|
1028
|
+
*
|
|
1029
|
+
* @param options - Configuration options for the server data grid
|
|
1030
|
+
* @returns Object containing data, columns, pagination state, and control functions
|
|
1031
|
+
*
|
|
1032
|
+
* @example
|
|
1033
|
+
* ```tsx
|
|
1034
|
+
* const { data, columns, loading, pagination, goToPage, reload } = useServerDataGrid<User>({
|
|
1035
|
+
* url: "/api/users",
|
|
1036
|
+
* params: { status: "active" },
|
|
1037
|
+
* encrypt: true,
|
|
1038
|
+
* key: import.meta.env["VITE_LARAVEL_KEY"],
|
|
1039
|
+
* });
|
|
1040
|
+
* ```
|
|
1041
|
+
*/
|
|
879
1042
|
declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Sort direction for DataGrid columns.
|
|
1045
|
+
* - "asc" - Ascending order
|
|
1046
|
+
* - "desc" - Descending order
|
|
1047
|
+
* - null - No sorting applied
|
|
1048
|
+
*/
|
|
880
1049
|
type SortDir = "asc" | "desc" | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* Column definition for DataGrid component.
|
|
1052
|
+
* @template T - The data item type
|
|
1053
|
+
*/
|
|
881
1054
|
interface DataGridColumn<T> {
|
|
1055
|
+
/** Unique key identifying this column (must match a property in T) */
|
|
882
1056
|
key: keyof T | string;
|
|
1057
|
+
/** Column header display text or React node */
|
|
883
1058
|
header: React.ReactNode;
|
|
1059
|
+
/** Custom render function for cell content */
|
|
884
1060
|
render?: (row: T, idx: number) => React.ReactNode;
|
|
1061
|
+
/** Whether this column is sortable */
|
|
885
1062
|
sortable?: boolean;
|
|
1063
|
+
/** Column width (e.g., "100px", "20%") */
|
|
886
1064
|
width?: string;
|
|
1065
|
+
/** Text alignment within the column */
|
|
887
1066
|
align?: "left" | "center" | "right";
|
|
888
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Props for the DataGrid component.
|
|
1070
|
+
* @template T - The data item type
|
|
1071
|
+
*/
|
|
889
1072
|
interface DataGridProps<T> {
|
|
1073
|
+
/** Column definitions for the grid */
|
|
890
1074
|
columns: DataGridColumn<T>[];
|
|
1075
|
+
/** Array of data items to display */
|
|
891
1076
|
data: T[];
|
|
1077
|
+
/** Property name or function to get unique row identifier */
|
|
892
1078
|
rowKey: keyof T | ((row: T) => string);
|
|
1079
|
+
/** Array of column keys that should have filter inputs */
|
|
893
1080
|
filterable?: string[];
|
|
1081
|
+
/** Whether rows can be selected via checkboxes */
|
|
894
1082
|
selectable?: boolean;
|
|
1083
|
+
/** Controlled selected row keys (used with onSelectChange) */
|
|
895
1084
|
selected?: string[];
|
|
1085
|
+
/** Callback when selection changes */
|
|
896
1086
|
onSelectChange?: (keys: string[]) => void;
|
|
1087
|
+
/** Number of items per page (default: 10) */
|
|
897
1088
|
pageSize?: number;
|
|
1089
|
+
/** Whether to show pagination controls */
|
|
898
1090
|
showPagination?: boolean;
|
|
1091
|
+
/** Whether to show column visibility toggle */
|
|
899
1092
|
showColumnToggle?: boolean;
|
|
1093
|
+
/** Whether to show loading skeleton */
|
|
900
1094
|
loading?: boolean;
|
|
1095
|
+
/** Message shown when no data is available */
|
|
901
1096
|
emptyMessage?: string;
|
|
1097
|
+
/** Additional CSS classes for the container */
|
|
902
1098
|
className?: string;
|
|
1099
|
+
/** Callback when a row is clicked */
|
|
903
1100
|
onRowClick?: (row: T) => void;
|
|
1101
|
+
/** Configuration for default row actions (view/edit/delete) */
|
|
904
1102
|
defaultActions?: DefaultActionsConfig<T>;
|
|
1103
|
+
/** Server-side pagination prop (for controlled/server-fetched pagination) */
|
|
905
1104
|
serverPagination?: ServerDataGridProp | null;
|
|
906
1105
|
}
|
|
1106
|
+
/**
|
|
1107
|
+
* DataGrid component - A powerful data table with sorting, filtering, pagination, and built-in actions.
|
|
1108
|
+
*
|
|
1109
|
+
* Supports both client-side and server-side pagination, column visibility toggling,
|
|
1110
|
+
* row selection, and default CRUD actions (view/edit/delete) with modal forms.
|
|
1111
|
+
*
|
|
1112
|
+
* @param props - DataGridProps<T> containing columns, data, and configuration options
|
|
1113
|
+
* @returns A fully-featured data grid React component
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* ```tsx
|
|
1117
|
+
* <DataGrid
|
|
1118
|
+
* columns={[
|
|
1119
|
+
* { key: "id", header: "ID", sortable: true },
|
|
1120
|
+
* { key: "name", header: "Name", sortable: true },
|
|
1121
|
+
* { key: "email", header: "Email" },
|
|
1122
|
+
* ]}
|
|
1123
|
+
* data={users}
|
|
1124
|
+
* rowKey="id"
|
|
1125
|
+
* filterable={["name", "email"]}
|
|
1126
|
+
* selectable
|
|
1127
|
+
* pageSize={25}
|
|
1128
|
+
* onRowClick={(row) => console.log(row)}
|
|
1129
|
+
* defaultActions={{
|
|
1130
|
+
* baseUrl: "/api/users",
|
|
1131
|
+
* viewForm: [{ key: "name", label: "Name" }, { key: "email", label: "Email" }],
|
|
1132
|
+
* }}
|
|
1133
|
+
* />
|
|
1134
|
+
* ```
|
|
1135
|
+
*/
|
|
907
1136
|
declare function DataGrid<T extends Record<string, unknown>>({ columns, data, rowKey, filterable, selectable, selected: controlledSelected, onSelectChange, pageSize, showPagination, showColumnToggle, loading, emptyMessage, className, onRowClick, defaultActions, serverPagination, }: DataGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
908
1137
|
|
|
909
1138
|
interface DatePickerProps {
|
|
@@ -1463,45 +1692,58 @@ interface PaginationProps {
|
|
|
1463
1692
|
declare function Pagination({ page, total, pageSize, siblingCount, showFirstLast, showPageSize, pageSizeOptions, onPageChange, onPageSizeChange, className, }: PaginationProps): react_jsx_runtime.JSX.Element;
|
|
1464
1693
|
|
|
1465
1694
|
interface PanelBrand {
|
|
1466
|
-
/** Image URL shown as the project logo */
|
|
1467
1695
|
image?: string;
|
|
1468
|
-
/** Fallback icon when no image — any React element */
|
|
1469
1696
|
icon?: React.ReactNode;
|
|
1470
|
-
/** Project / app title shown when expanded */
|
|
1471
1697
|
title?: React.ReactNode;
|
|
1472
|
-
/** Extra content rendered to the right of title when expanded */
|
|
1473
1698
|
trailing?: React.ReactNode;
|
|
1474
1699
|
}
|
|
1475
1700
|
interface PanelProfile {
|
|
1476
|
-
/** Avatar image URL */
|
|
1477
1701
|
image?: string;
|
|
1478
|
-
/** Fallback icon when no image — any React element */
|
|
1479
1702
|
icon?: React.ReactNode;
|
|
1480
|
-
/** Full profile content rendered when expanded */
|
|
1481
1703
|
content?: React.ReactNode;
|
|
1482
1704
|
}
|
|
1483
1705
|
interface PanelProps {
|
|
1484
1706
|
sidebar?: React.ReactNode;
|
|
1485
|
-
/** Structured brand header: shows image+title when expanded, image/icon only when collapsed */
|
|
1486
1707
|
sidebarBrand?: PanelBrand;
|
|
1487
|
-
/** Structured profile footer: shows full content when expanded, image/icon only when collapsed */
|
|
1488
1708
|
sidebarProfile?: PanelProfile;
|
|
1489
|
-
/** @deprecated use sidebarBrand */
|
|
1490
1709
|
sidebarHeader?: React.ReactNode;
|
|
1491
|
-
/** @deprecated use sidebarProfile */
|
|
1492
1710
|
sidebarFooter?: React.ReactNode;
|
|
1493
1711
|
sidebarWidth?: string;
|
|
1494
1712
|
topbar?: React.ReactNode;
|
|
1495
1713
|
topbarTrailing?: React.ReactNode;
|
|
1496
1714
|
defaultCollapsed?: boolean;
|
|
1715
|
+
collapsed?: boolean;
|
|
1716
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1497
1717
|
collapsible?: boolean;
|
|
1498
1718
|
showThemeToggle?: boolean;
|
|
1499
1719
|
defaultPage?: string;
|
|
1720
|
+
currentPage?: string;
|
|
1721
|
+
onPageChange?: (page: string) => void;
|
|
1500
1722
|
height?: string;
|
|
1501
1723
|
children?: React.ReactNode;
|
|
1502
1724
|
className?: string;
|
|
1503
|
-
|
|
1504
|
-
|
|
1725
|
+
loading?: boolean;
|
|
1726
|
+
emptyState?: React.ReactNode;
|
|
1727
|
+
error?: string | null;
|
|
1728
|
+
showGroupDividers?: boolean;
|
|
1729
|
+
expandedGroups?: string[];
|
|
1730
|
+
onGroupToggle?: (groupTitle: string, expanded: boolean) => void;
|
|
1731
|
+
theme?: "light" | "dark" | "auto";
|
|
1732
|
+
collapseIcon?: React.ReactNode;
|
|
1733
|
+
expandIcon?: React.ReactNode;
|
|
1734
|
+
meta?: Record<string, any>;
|
|
1735
|
+
actions?: Record<string, () => void>;
|
|
1736
|
+
keyboardNavigation?: boolean;
|
|
1737
|
+
draggable?: boolean;
|
|
1738
|
+
onSidebarReorder?: (items: React.ReactNode[]) => void;
|
|
1739
|
+
animationDuration?: number;
|
|
1740
|
+
animationEasing?: string;
|
|
1741
|
+
sidebarTooltip?: (item: React.ReactNode) => React.ReactNode;
|
|
1742
|
+
mobileBreakpoint?: number;
|
|
1743
|
+
mobileCollapsed?: boolean;
|
|
1744
|
+
onMobileCollapseChange?: (collapsed: boolean) => void;
|
|
1745
|
+
}
|
|
1746
|
+
declare function Panel({ sidebar, sidebarBrand, sidebarProfile, sidebarHeader, sidebarFooter, sidebarWidth, topbar, topbarTrailing, defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, collapsible, showThemeToggle, defaultPage, currentPage: controlledPage, onPageChange, height, children, className, loading, emptyState, error, showGroupDividers, expandedGroups: controlledExpandedGroups, onGroupToggle, theme: themeProp, collapseIcon, expandIcon, meta, actions, keyboardNavigation, draggable, onSidebarReorder, animationDuration, animationEasing, sidebarTooltip, mobileBreakpoint, mobileCollapsed: controlledMobileCollapsed, onMobileCollapseChange, }: PanelProps): react_jsx_runtime.JSX.Element;
|
|
1505
1747
|
declare function PanelSidebarItem({ icon: Icon, label, active, onClick, }: {
|
|
1506
1748
|
icon?: React.ElementType;
|
|
1507
1749
|
label: string;
|