@grasp-labs/ds-react-components 0.14.0 → 0.15.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.
@@ -4,10 +4,11 @@ export type DrawerProps = {
4
4
  onClose: () => void;
5
5
  placement?: "top" | "right" | "bottom" | "left";
6
6
  size?: "sm" | "lg";
7
+ portalContainer?: HTMLElement | null;
7
8
  closeOnBackdropClick?: boolean;
8
9
  showClose?: boolean;
9
10
  closeButtonAriaLabel?: string;
10
11
  drawerClassName?: string;
11
12
  backdropClassName?: string;
12
13
  } & Omit<CardProps, "className">;
13
- export declare function Drawer({ isOpen, onClose, placement, size, closeOnBackdropClick, showClose, closeButtonAriaLabel, drawerClassName, backdropClassName, title, headerActions, footerActions, children, headerClassName, bodyClassName, footerClassName, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function Drawer({ isOpen, onClose, placement, size, closeOnBackdropClick, showClose, closeButtonAriaLabel, drawerClassName, backdropClassName, title, headerActions, footerActions, portalContainer, children, headerClassName, bodyClassName, footerClassName, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,5 @@
1
1
  import { JSX } from 'react';
2
2
  import { TableProps } from './types';
3
- /**
4
- * A customizable table component using TanStack Table.
5
- *
6
- * @template T - The row data type.
7
- * @param {TableProps<T>} props - The table props.
8
- * @returns {JSX.Element} The rendered table.
9
- */
10
3
  declare function Table<T extends {
11
4
  id?: string | number;
12
5
  }>({ data, columns, className, scrollWrapperClassName, getCoreRowModel, enableRowSelection, enableMultiRowSelection, enablePagination, paginationProps, ...options }: TableProps<T>): JSX.Element;
@@ -1,16 +1,51 @@
1
- import { PaginationState, TableOptions } from '@tanstack/react-table';
2
- export type TableProps<T> = Omit<TableOptions<T>, "state" | "getCoreRowModel" | "onPaginationChange" | "getPaginationRowModel" | "manualPagination" | "pageCount" | "autoResetPageIndex" | "onSortingChange" | "onRowSelectionChange"> & {
1
+ import { TableOptions } from '@tanstack/react-table';
2
+ /**
3
+ * Props for the Table component.
4
+ * Supports both controlled and uncontrolled modes for sorting, selection, and pagination.
5
+ *
6
+ * @template T - The row data type.
7
+ *
8
+ * @example
9
+ * // Uncontrolled (component manages state internally via TanStack Table)
10
+ * <Table data={data} columns={columns} />
11
+ *
12
+ * @example
13
+ * // Controlled selection
14
+ * <Table
15
+ * data={data}
16
+ * columns={columns}
17
+ * enableRowSelection
18
+ * state={{ rowSelection }}
19
+ * onRowSelectionChange={setRowSelection}
20
+ * />
21
+ *
22
+ * @example
23
+ * // Server-side pagination
24
+ * <Table
25
+ * data={data}
26
+ * columns={columns}
27
+ * enablePagination
28
+ * state={{ pagination }}
29
+ * onPaginationChange={setPagination}
30
+ * paginationProps={{ mode: 'server', totalItems: 1000 }}
31
+ * />
32
+ */
33
+ export type TableProps<T> = Omit<TableOptions<T>, "getCoreRowModel" | "getSortedRowModel" | "getPaginationRowModel" | "manualPagination" | "pageCount" | "autoResetPageIndex"> & {
3
34
  className?: string;
4
35
  scrollWrapperClassName?: string;
5
36
  getCoreRowModel?: TableOptions<T>["getCoreRowModel"];
6
37
  enablePagination?: boolean;
7
38
  paginationProps?: {
39
+ mode?: "client";
8
40
  itemsPerPageOptions?: number[];
9
- pagination?: PaginationState;
10
- onPaginationChange?: (pagination: PaginationState) => void;
11
- totalItems?: number;
12
41
  itemsPerPageText?: string;
13
42
  fromText?: string;
43
+ totalItems?: never;
44
+ } | {
45
+ mode: "server";
46
+ itemsPerPageOptions?: number[];
47
+ itemsPerPageText?: string;
48
+ fromText?: string;
49
+ totalItems: number;
14
50
  };
15
- state?: Omit<TableOptions<T>["state"], "sorting" | "rowSelection" | "pagination">;
16
51
  };
@@ -1,6 +1,7 @@
1
1
  import { RefObject } from 'react';
2
2
  export type DropdownPosition = {
3
- top: number;
3
+ top?: number;
4
+ bottom?: number;
4
5
  left: number;
5
6
  width: number;
6
7
  };