@juv/codego-react-ui 3.4.7 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -104,6 +104,26 @@ interface BreadcrumbProps {
104
104
  }
105
105
  declare function Breadcrumb({ items, separator, maxItems, className, }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
106
106
 
107
+ interface RepeaterField {
108
+ type: "input" | "image" | "attachment";
109
+ key: string;
110
+ label?: string;
111
+ placeholder?: string;
112
+ }
113
+ interface RepeaterProps<T> {
114
+ items: T[];
115
+ onAdd: () => void;
116
+ onRemove: (index: number) => void;
117
+ renderItem?: (item: T, index: number) => React.ReactNode;
118
+ /** Structured field definitions — when provided, renders fields automatically */
119
+ fields?: RepeaterField[];
120
+ /** Called when a field value changes: (rowIndex, key, value) */
121
+ onFieldChange?: (index: number, key: string, value: any) => void;
122
+ addButtonText?: string;
123
+ className?: string;
124
+ }
125
+ declare function Repeater<T extends Record<string, any>>({ items, onAdd, onRemove, renderItem, fields, onFieldChange, addButtonText, className, }: RepeaterProps<T>): react_jsx_runtime.JSX.Element;
126
+
107
127
  type ToastVariant = "default" | "success" | "error" | "warning" | "info";
108
128
  type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
109
129
  interface ToastItem {
@@ -289,15 +309,46 @@ interface UseServerTableReturn<T> {
289
309
  error: string | null;
290
310
  goToPage: (page: number) => void;
291
311
  reload: () => void;
292
- /** Manually trigger a data refresh (alias for reload, respects refresh option) */
293
312
  refresh: () => void;
294
- searchValue?: string;
295
- onSearchChange?: (value: string) => void;
313
+ searchValue: string;
314
+ onSearchChange: (value: string) => void;
315
+ page: number;
316
+ onPageChange: (page: number) => void;
317
+ sort: {
318
+ key: string;
319
+ direction: "asc" | "desc";
320
+ }[];
321
+ onSortChange: (sort: {
322
+ key: string;
323
+ direction: "asc" | "desc";
324
+ }[]) => void;
325
+ onRowClick?: (item: T) => void;
326
+ onRowDoubleClick?: (item: T) => void;
327
+ rowClassName?: (item: T) => string;
328
+ expandable?: boolean;
329
+ renderExpanded?: (item: T) => React.ReactNode;
330
+ columnVisibility?: Record<string, boolean>;
331
+ onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;
332
+ exportable?: boolean;
333
+ onExport?: (type: "csv" | "excel" | "pdf") => void;
334
+ virtualized?: boolean;
335
+ draggable?: boolean;
336
+ onRowReorder?: (data: T[]) => void;
337
+ keyboardNavigation?: boolean;
338
+ theme?: "light" | "dark" | "auto";
339
+ meta?: Record<string, any>;
340
+ actions?: Record<string, (item: T) => void>;
341
+ searchable?: boolean;
342
+ searchPlaceholder?: string;
343
+ clientPagination?: boolean;
344
+ itemsPerPage?: number;
345
+ selectable?: boolean;
346
+ onBulkDelete?: (selectedIds: string[]) => void;
347
+ bulkDeleteBaseUrl?: string;
348
+ idKey?: keyof T;
349
+ defaultActions?: DefaultActionsConfig<T>;
350
+ className?: string;
296
351
  }
297
- /**
298
- * Server-side pagination prop passed to the Table component
299
- * @interface ServerPaginationProp
300
- */
301
352
  interface ServerPaginationProp {
302
353
  pagination: ServerPagination;
303
354
  currentPage: number;
@@ -329,7 +380,7 @@ type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle"
329
380
  * Display type for viewForm fields — controls how the value is rendered in the View modal
330
381
  * @type {ViewFieldType}
331
382
  */
332
- type ViewFieldType = "text" | "image" | "checkbox" | "toggle" | "attachment" | "text-url" | "text-url-open-other-tabs" | "image-url" | "image-url-open-other-tabs";
383
+ type ViewFieldType = "text" | "image" | "checkbox" | "toggle" | "attachment" | "text-url" | "text-url-open-other-tabs" | "image-url" | "image-url-open-other-tabs" | "repeater";
333
384
  /**
334
385
  * Configuration for a single field in action forms (edit/view modals)
335
386
  * @interface ActionField
@@ -355,6 +406,8 @@ interface ActionField {
355
406
  step?: number;
356
407
  /** Number of OTP digits for type="otp" */
357
408
  digits?: number;
409
+ /** Field definitions for type="repeater" / viewType="repeater" */
410
+ repeaterFields?: RepeaterField[];
358
411
  /** Validation: regex or built-in preset ("email" | "url" | "numeric" | "alpha" | "alphanumeric") */
359
412
  validation?: RegExp | "email" | "url" | "numeric" | "alpha" | "alphanumeric";
360
413
  /** Custom message shown when validation fails */
@@ -636,7 +689,7 @@ interface TableProps<T> {
636
689
  actions?: Record<string, (item: T) => void>;
637
690
  searchable?: boolean;
638
691
  searchPlaceholder?: string;
639
- pagination?: boolean;
692
+ clientPagination?: boolean;
640
693
  itemsPerPage?: number;
641
694
  selectable?: boolean;
642
695
  onBulkDelete?: (selectedIds: string[]) => void;
@@ -651,6 +704,15 @@ interface TableProps<T> {
651
704
  defaultActions?: DefaultActionsConfig<T>;
652
705
  /** Pass the serverPagination object from useServerTable to enable server-side pagination */
653
706
  serverPagination?: ServerPaginationProp | null;
707
+ /**
708
+ * Visual variant of the table.
709
+ * - `"default"` — bordered card with subtle bg (original style)
710
+ * - `"zebra"` — alternating row colors for easy scanning
711
+ * - `"card"` — each row rendered as an individual card
712
+ * - `"glass"` — glassmorphism: transparent + backdrop blur
713
+ * - `"soft"` — neumorphic soft shadows, no hard borders
714
+ */
715
+ variant?: "default" | "zebra" | "card" | "glass" | "soft";
654
716
  className?: string;
655
717
  }
656
718
  /**
@@ -670,7 +732,7 @@ interface TableProps<T> {
670
732
  * { key: "active", type: "toggle", onChange: handleToggle },
671
733
  * ]}
672
734
  * searchable
673
- * pagination
735
+ * clientPagination
674
736
  * selectable
675
737
  * onBulkDelete={handleBulkDelete}
676
738
  * defaultActions={{
@@ -680,7 +742,7 @@ interface TableProps<T> {
680
742
  * />
681
743
  * ```
682
744
  */
683
- declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, bulkDeleteBaseUrl, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
745
+ declare function Table<T extends Record<string, any>>({ data, columns, loading, emptyState, error: errorProp, searchable, searchPlaceholder, searchValue: controlledSearch, onSearchChange, clientPagination, itemsPerPage, selectable, onBulkDelete, idKey, bulkDeleteBaseUrl, defaultActions, serverPagination, variant, className, onRowClick, onRowDoubleClick, rowClassName, expandable, renderExpanded, columnVisibility, onColumnVisibilityChange, exportable, onExport, virtualized, draggable, onRowReorder, keyboardNavigation, }: TableProps<T>): react_jsx_runtime.JSX.Element;
684
746
 
685
747
  type BulletinPriority = "low" | "medium" | "high" | "urgent";
686
748
  type BulletinLayout = "grid" | "list" | "masonry";
@@ -1961,16 +2023,6 @@ interface RadioGroupProps {
1961
2023
  }
1962
2024
  declare function RadioGroup({ options, value: controlledValue, defaultValue, onChange, variant, size, orientation, name, className, required, error, }: RadioGroupProps): react_jsx_runtime.JSX.Element;
1963
2025
 
1964
- interface RepeaterProps<T> {
1965
- items: T[];
1966
- onAdd: () => void;
1967
- onRemove: (index: number) => void;
1968
- renderItem: (item: T, index: number) => React.ReactNode;
1969
- addButtonText?: string;
1970
- className?: string;
1971
- }
1972
- declare function Repeater<T>({ items, onAdd, onRemove, renderItem, addButtonText, className, }: RepeaterProps<T>): react_jsx_runtime.JSX.Element;
1973
-
1974
2026
  interface ResizablePanelsProps {
1975
2027
  children: [React.ReactNode, React.ReactNode];
1976
2028
  orientation?: "horizontal" | "vertical";
package/dist/index.d.ts CHANGED
@@ -104,6 +104,26 @@ interface BreadcrumbProps {
104
104
  }
105
105
  declare function Breadcrumb({ items, separator, maxItems, className, }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
106
106
 
107
+ interface RepeaterField {
108
+ type: "input" | "image" | "attachment";
109
+ key: string;
110
+ label?: string;
111
+ placeholder?: string;
112
+ }
113
+ interface RepeaterProps<T> {
114
+ items: T[];
115
+ onAdd: () => void;
116
+ onRemove: (index: number) => void;
117
+ renderItem?: (item: T, index: number) => React.ReactNode;
118
+ /** Structured field definitions — when provided, renders fields automatically */
119
+ fields?: RepeaterField[];
120
+ /** Called when a field value changes: (rowIndex, key, value) */
121
+ onFieldChange?: (index: number, key: string, value: any) => void;
122
+ addButtonText?: string;
123
+ className?: string;
124
+ }
125
+ declare function Repeater<T extends Record<string, any>>({ items, onAdd, onRemove, renderItem, fields, onFieldChange, addButtonText, className, }: RepeaterProps<T>): react_jsx_runtime.JSX.Element;
126
+
107
127
  type ToastVariant = "default" | "success" | "error" | "warning" | "info";
108
128
  type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
109
129
  interface ToastItem {
@@ -289,15 +309,46 @@ interface UseServerTableReturn<T> {
289
309
  error: string | null;
290
310
  goToPage: (page: number) => void;
291
311
  reload: () => void;
292
- /** Manually trigger a data refresh (alias for reload, respects refresh option) */
293
312
  refresh: () => void;
294
- searchValue?: string;
295
- onSearchChange?: (value: string) => void;
313
+ searchValue: string;
314
+ onSearchChange: (value: string) => void;
315
+ page: number;
316
+ onPageChange: (page: number) => void;
317
+ sort: {
318
+ key: string;
319
+ direction: "asc" | "desc";
320
+ }[];
321
+ onSortChange: (sort: {
322
+ key: string;
323
+ direction: "asc" | "desc";
324
+ }[]) => void;
325
+ onRowClick?: (item: T) => void;
326
+ onRowDoubleClick?: (item: T) => void;
327
+ rowClassName?: (item: T) => string;
328
+ expandable?: boolean;
329
+ renderExpanded?: (item: T) => React.ReactNode;
330
+ columnVisibility?: Record<string, boolean>;
331
+ onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;
332
+ exportable?: boolean;
333
+ onExport?: (type: "csv" | "excel" | "pdf") => void;
334
+ virtualized?: boolean;
335
+ draggable?: boolean;
336
+ onRowReorder?: (data: T[]) => void;
337
+ keyboardNavigation?: boolean;
338
+ theme?: "light" | "dark" | "auto";
339
+ meta?: Record<string, any>;
340
+ actions?: Record<string, (item: T) => void>;
341
+ searchable?: boolean;
342
+ searchPlaceholder?: string;
343
+ clientPagination?: boolean;
344
+ itemsPerPage?: number;
345
+ selectable?: boolean;
346
+ onBulkDelete?: (selectedIds: string[]) => void;
347
+ bulkDeleteBaseUrl?: string;
348
+ idKey?: keyof T;
349
+ defaultActions?: DefaultActionsConfig<T>;
350
+ className?: string;
296
351
  }
297
- /**
298
- * Server-side pagination prop passed to the Table component
299
- * @interface ServerPaginationProp
300
- */
301
352
  interface ServerPaginationProp {
302
353
  pagination: ServerPagination;
303
354
  currentPage: number;
@@ -329,7 +380,7 @@ type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle"
329
380
  * Display type for viewForm fields — controls how the value is rendered in the View modal
330
381
  * @type {ViewFieldType}
331
382
  */
332
- type ViewFieldType = "text" | "image" | "checkbox" | "toggle" | "attachment" | "text-url" | "text-url-open-other-tabs" | "image-url" | "image-url-open-other-tabs";
383
+ type ViewFieldType = "text" | "image" | "checkbox" | "toggle" | "attachment" | "text-url" | "text-url-open-other-tabs" | "image-url" | "image-url-open-other-tabs" | "repeater";
333
384
  /**
334
385
  * Configuration for a single field in action forms (edit/view modals)
335
386
  * @interface ActionField
@@ -355,6 +406,8 @@ interface ActionField {
355
406
  step?: number;
356
407
  /** Number of OTP digits for type="otp" */
357
408
  digits?: number;
409
+ /** Field definitions for type="repeater" / viewType="repeater" */
410
+ repeaterFields?: RepeaterField[];
358
411
  /** Validation: regex or built-in preset ("email" | "url" | "numeric" | "alpha" | "alphanumeric") */
359
412
  validation?: RegExp | "email" | "url" | "numeric" | "alpha" | "alphanumeric";
360
413
  /** Custom message shown when validation fails */
@@ -636,7 +689,7 @@ interface TableProps<T> {
636
689
  actions?: Record<string, (item: T) => void>;
637
690
  searchable?: boolean;
638
691
  searchPlaceholder?: string;
639
- pagination?: boolean;
692
+ clientPagination?: boolean;
640
693
  itemsPerPage?: number;
641
694
  selectable?: boolean;
642
695
  onBulkDelete?: (selectedIds: string[]) => void;
@@ -651,6 +704,15 @@ interface TableProps<T> {
651
704
  defaultActions?: DefaultActionsConfig<T>;
652
705
  /** Pass the serverPagination object from useServerTable to enable server-side pagination */
653
706
  serverPagination?: ServerPaginationProp | null;
707
+ /**
708
+ * Visual variant of the table.
709
+ * - `"default"` — bordered card with subtle bg (original style)
710
+ * - `"zebra"` — alternating row colors for easy scanning
711
+ * - `"card"` — each row rendered as an individual card
712
+ * - `"glass"` — glassmorphism: transparent + backdrop blur
713
+ * - `"soft"` — neumorphic soft shadows, no hard borders
714
+ */
715
+ variant?: "default" | "zebra" | "card" | "glass" | "soft";
654
716
  className?: string;
655
717
  }
656
718
  /**
@@ -670,7 +732,7 @@ interface TableProps<T> {
670
732
  * { key: "active", type: "toggle", onChange: handleToggle },
671
733
  * ]}
672
734
  * searchable
673
- * pagination
735
+ * clientPagination
674
736
  * selectable
675
737
  * onBulkDelete={handleBulkDelete}
676
738
  * defaultActions={{
@@ -680,7 +742,7 @@ interface TableProps<T> {
680
742
  * />
681
743
  * ```
682
744
  */
683
- declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, bulkDeleteBaseUrl, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
745
+ declare function Table<T extends Record<string, any>>({ data, columns, loading, emptyState, error: errorProp, searchable, searchPlaceholder, searchValue: controlledSearch, onSearchChange, clientPagination, itemsPerPage, selectable, onBulkDelete, idKey, bulkDeleteBaseUrl, defaultActions, serverPagination, variant, className, onRowClick, onRowDoubleClick, rowClassName, expandable, renderExpanded, columnVisibility, onColumnVisibilityChange, exportable, onExport, virtualized, draggable, onRowReorder, keyboardNavigation, }: TableProps<T>): react_jsx_runtime.JSX.Element;
684
746
 
685
747
  type BulletinPriority = "low" | "medium" | "high" | "urgent";
686
748
  type BulletinLayout = "grid" | "list" | "masonry";
@@ -1961,16 +2023,6 @@ interface RadioGroupProps {
1961
2023
  }
1962
2024
  declare function RadioGroup({ options, value: controlledValue, defaultValue, onChange, variant, size, orientation, name, className, required, error, }: RadioGroupProps): react_jsx_runtime.JSX.Element;
1963
2025
 
1964
- interface RepeaterProps<T> {
1965
- items: T[];
1966
- onAdd: () => void;
1967
- onRemove: (index: number) => void;
1968
- renderItem: (item: T, index: number) => React.ReactNode;
1969
- addButtonText?: string;
1970
- className?: string;
1971
- }
1972
- declare function Repeater<T>({ items, onAdd, onRemove, renderItem, addButtonText, className, }: RepeaterProps<T>): react_jsx_runtime.JSX.Element;
1973
-
1974
2026
  interface ResizablePanelsProps {
1975
2027
  children: [React.ReactNode, React.ReactNode];
1976
2028
  orientation?: "horizontal" | "vertical";