@qodo/design-system 0.18.3 → 0.19.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/dist/index.d.ts CHANGED
@@ -116,6 +116,14 @@ declare type BaseMenuItemType = {
116
116
  disabled?: boolean;
117
117
  };
118
118
 
119
+ declare type BasePaginationProps = {
120
+ paginationMode?: typeof PAGINATION_MODE.PAGINATION;
121
+ onLoadMore?: never;
122
+ hasMore?: never;
123
+ loadMoreThreshold?: never;
124
+ endOfResultsMessage?: never;
125
+ };
126
+
119
127
  declare type BaseSelectProps = {
120
128
  disabled?: boolean;
121
129
  options: Option_2[];
@@ -418,6 +426,43 @@ declare type IndicatorProps = React.ComponentProps<typeof Steps_2.Indicator> & {
418
426
  index: number;
419
427
  };
420
428
 
429
+ declare type InfiniteScrollProps = {
430
+ paginationMode: typeof PAGINATION_MODE.INFINITE_SCROLL;
431
+ /**
432
+ * Callback function to load more data when scrolling near the bottom.
433
+ * Should handle appending new data to the table and return whether more data was loaded.
434
+ *
435
+ * @returns boolean | void - Return false to stop loading more, true/void to continue
436
+ *
437
+ * @example
438
+ * onLoadMore={async () => {
439
+ * const newData = await api.fetch(page);
440
+ * if (newData.length === 0) return false; // Stop loading
441
+ * setData(prev => [...prev, ...newData]);
442
+ * return true; // Continue loading on next scroll
443
+ * }}
444
+ */
445
+ onLoadMore: () => void | Promise<void> | boolean | Promise<boolean>;
446
+ /**
447
+ * Indicates whether there is more data to load.
448
+ * If undefined, will continue trying to load until onLoadMore returns false.
449
+ * When false, stops loading and shows "End of results".
450
+ *
451
+ * @default undefined (keep trying until onLoadMore returns false)
452
+ */
453
+ hasMore?: boolean;
454
+ /**
455
+ * Distance in pixels from the bottom of the scrollable container
456
+ * to trigger the onLoadMore callback. Default is 100px.
457
+ */
458
+ loadMoreThreshold?: number;
459
+ /**
460
+ * Custom message to display when there's no more data to load.
461
+ * @default "End of results"
462
+ */
463
+ endOfResultsMessage?: string;
464
+ };
465
+
421
466
  export declare const Input: React_2.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React_2.RefAttributes<HTMLInputElement>>;
422
467
 
423
468
  export declare interface InputProps extends React_2.ComponentProps<"input">, VariantProps<typeof inputVariants> {
@@ -480,6 +525,15 @@ declare type Option_2 = {
480
525
  };
481
526
  export { Option_2 as Option }
482
527
 
528
+ export declare const PAGINATION_MODE: {
529
+ readonly PAGINATION: "pagination";
530
+ readonly INFINITE_SCROLL: "infinite-scroll";
531
+ };
532
+
533
+ export declare type PaginationMode = (typeof PAGINATION_MODE)[keyof typeof PAGINATION_MODE];
534
+
535
+ declare type PaginationModeProps = BasePaginationProps | InfiniteScrollProps;
536
+
483
537
  export declare type PaginationProps<T extends RowData> = {
484
538
  table: Table_2<T>;
485
539
  };
@@ -645,7 +699,7 @@ declare const switchVariants: (props?: ({
645
699
  size?: "small" | "large" | null | undefined;
646
700
  } & ClassProp) | undefined) => string;
647
701
 
648
- export declare const Table: <T extends RowData>({ table, emptyStateComponent, noResultsComponent, errorComponent, isLoading, isError, onRowClick, emptyStateTitle, emptyStateDescription, noResultsTitle, wrapperClassName, loadingRowsCount, activeRowId, }: TableProps<T & WithId>) => JSX_2.Element;
702
+ export declare const Table: <T extends RowData>({ table, emptyStateComponent, noResultsComponent, errorComponent, isLoading, isError, onRowClick, emptyStateTitle, emptyStateDescription, noResultsTitle, wrapperClassName, loadingRowsCount, activeRowId, paginationMode, onLoadMore, hasMore, loadMoreThreshold, endOfResultsMessage, }: TableProps<T & WithId>) => JSX_2.Element;
649
703
 
650
704
  export declare type TableProps<T extends RowData> = {
651
705
  table: Table_2<T>;
@@ -661,7 +715,7 @@ export declare type TableProps<T extends RowData> = {
661
715
  wrapperClassName?: string;
662
716
  loadingRowsCount?: number;
663
717
  activeRowId?: number | string;
664
- };
718
+ } & PaginationModeProps;
665
719
 
666
720
  export declare function Tabs({ className, ...props }: React_2.ComponentProps<typeof TabsPrimitive.Root>): JSX_2.Element;
667
721