@protonradio/proton-ui 0.11.5-beta.1 → 0.11.5

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
@@ -12,6 +12,7 @@ import { ReactElement } from 'react';
12
12
  import { ReactNode } from 'react';
13
13
  import { RefAttributes } from 'react';
14
14
  import { Selection as Selection_2 } from '@react-types/shared';
15
+ import { TableColumnData as TableColumnData_2 } from '../Table';
15
16
  import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
16
17
  import { TooltipTriggerComponentProps } from 'react-aria-components';
17
18
 
@@ -995,7 +996,7 @@ export declare const Table: (({ children, name }: TableProps) => JSX_2.Element)
995
996
  Cell: ({ ...props }: TableCellProps) => any;
996
997
  };
997
998
 
998
- declare interface TableBodyProps {
999
+ export declare interface TableBodyProps {
999
1000
  children: TableRowElement | TableRowElement[];
1000
1001
  }
1001
1002
 
@@ -1009,12 +1010,14 @@ export declare type TableCellData = {
1009
1010
 
1010
1011
  declare type TableCellElement = ReactElement<TableCellProps, typeof TableCell>;
1011
1012
 
1012
- declare interface TableCellProps {
1013
+ export declare interface TableCellProps {
1013
1014
  columnKey?: string;
1014
1015
  children?: ReactNode;
1015
1016
  colSpan?: number;
1016
1017
  }
1017
1018
 
1019
+ export declare type TableCollection = ReturnType<typeof useTableCollection>;
1020
+
1018
1021
  declare const TableColumn: ({ ...props }: TableColumnProps) => any;
1019
1022
 
1020
1023
  export declare type TableColumnData = {
@@ -1026,7 +1029,7 @@ export declare type TableColumnData = {
1026
1029
 
1027
1030
  declare type TableColumnElement = ReactElement<TableColumnProps, typeof TableColumn>;
1028
1031
 
1029
- declare interface TableColumnProps {
1032
+ export declare interface TableColumnProps {
1030
1033
  id: string;
1031
1034
  children: ReactNode;
1032
1035
  "aria-sort"?: AriaAttributes["aria-sort"];
@@ -1037,7 +1040,7 @@ export declare type TableData = {
1037
1040
  rows: TableRowData[];
1038
1041
  };
1039
1042
 
1040
- declare interface TableHeaderProps {
1043
+ export declare interface TableHeaderProps {
1041
1044
  children: TableColumnElement | TableColumnElement[];
1042
1045
  isHidden?: boolean;
1043
1046
  }
@@ -1058,7 +1061,7 @@ export declare type TableRowData = {
1058
1061
 
1059
1062
  declare type TableRowElement = ReactElement<TableRowProps, typeof TableRow>;
1060
1063
 
1061
- declare interface TableRowProps {
1064
+ export declare interface TableRowProps {
1062
1065
  key?: string | number;
1063
1066
  children: TableCellElement | TableCellElement[];
1064
1067
  onClick?: () => void;
@@ -1265,6 +1268,25 @@ export declare function usePopoverTrigger(props?: OverlayTriggerProps): {
1265
1268
  state: OverlayTriggerState;
1266
1269
  };
1267
1270
 
1271
+ /**
1272
+ * Hook for managing table data structure and providing navigation methods
1273
+ */
1274
+ export declare function useTableCollection(data: TableData): {
1275
+ columns: TableColumnData_2[];
1276
+ rows: TableRowData[];
1277
+ size: number;
1278
+ firstItem: TableRowData;
1279
+ lastItem: TableRowData;
1280
+ isHeaderHidden: boolean;
1281
+ hasVisibleHeader: boolean;
1282
+ getTotalRowCount: number;
1283
+ getRowAriaIndex: (rowIndex: number) => number;
1284
+ getItemByKey: (key: string | number) => TableRowData | null;
1285
+ getItemAfter: (key: string | number) => TableRowData | null;
1286
+ getItemBefore: (key: string | number) => TableRowData | null;
1287
+ getItemIndex: (key: string | number) => number;
1288
+ };
1289
+
1268
1290
  export declare const useTheme: () => ThemeContextType;
1269
1291
 
1270
1292
  /**