@protonradio/proton-ui 0.11.0-beta.20 → 0.11.0-beta.21

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
@@ -10,13 +10,18 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
10
10
  import { OverlayTriggerProps } from 'react-stately';
11
11
  import { OverlayTriggerState } from 'react-stately';
12
12
  import { PressEvent } from 'react-aria';
13
+ import { ReactElement } from 'react';
13
14
  import { ReactNode } from 'react';
14
15
  import { RefAttributes } from 'react';
15
16
  import { RowProps } from '@react-stately/table';
16
17
  import { Section } from '@react-stately/table';
17
18
  import { Selection as Selection_2 } from 'react-stately';
18
19
  import { TableBodyProps as TableBodyProps_2 } from '@react-stately/table';
20
+ import { TableCellProps as TableCellProps_2 } from './Collection/CompoundComponents';
21
+ import { TableColumnData as TableColumnData_2 } from '../Table';
22
+ import { TableColumnProps as TableColumnProps_2 } from './Collection/CompoundComponents';
19
23
  import { TableHeader } from '@react-stately/table';
24
+ import { TableRowProps as TableRowProps_2 } from './Collection/CompoundComponents';
20
25
  import { TableStateProps } from 'react-stately';
21
26
  import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
22
27
  import { TooltipTriggerComponentProps } from 'react-aria-components';
@@ -719,10 +724,11 @@ export declare function Table(props: TableProps_2): JSX_2.Element;
719
724
  /**
720
725
  * Base Table component that renders data in rows and columns using collections.
721
726
  *
722
- * Accessibility features are built-in:
723
- * - aria-label is automatically generated from table structure and content
724
- * - aria-describedby links to caption when provided
725
- * - Full ARIA table semantics with proper roles and indices
727
+ * - Built-in keyboard navigation for interactive rows.
728
+ * - Full ARIA table semantics with proper roles, labels, and indices.
729
+ *
730
+ * API:
731
+ * - {@link TableProps}
726
732
  *
727
733
  * @example
728
734
  * ```tsx
@@ -738,53 +744,71 @@ export declare function Table(props: TableProps_2): JSX_2.Element;
738
744
  * </Table>
739
745
  * ```
740
746
  */
741
- export declare const Table2: (({ children, name, className }: TableProps) => JSX_2.Element) & {
747
+ export declare const Table2: (({ children, name }: TableProps) => JSX_2.Element) & {
742
748
  /** Table header: {@link TableHeaderProps} */
743
- Header: typeof TableHeader_2;
749
+ Header: ({ ...props }: TableHeaderProps) => any;
744
750
  /** Table column: {@link TableColumnProps} */
745
- Column: typeof TableColumn;
751
+ Column: ({ ...props }: TableColumnProps_2) => any;
746
752
  /** Table body: {@link TableBodyProps} */
747
- Body: typeof TableBody_2;
753
+ Body: ({ ...props }: TableBodyProps) => any;
748
754
  /** Table row: {@link TableRowProps} */
749
- Row: typeof TableRow;
755
+ Row: ({ ...props }: TableRowProps_2) => any;
750
756
  /** Table cell: {@link TableCellProps} */
751
- Cell: typeof TableCell;
757
+ Cell: ({ ...props }: TableCellProps_2) => any;
752
758
  };
753
759
 
754
760
  export declare const TableBody: <T = object>(props: ProtonTableBodyProps<T>) => JSX.Element;
755
761
 
756
- declare function TableBody_2({ children }: TableBodyProps): any;
757
-
758
762
  export declare interface TableBodyProps {
759
- children: ReactNode;
763
+ children: TableRowElement | TableRowElement[];
760
764
  }
761
765
 
762
- declare function TableCell({ columnKey, children }: TableCellProps): any;
766
+ declare const TableCell: ({ ...props }: TableCellProps) => any;
767
+
768
+ export declare type TableCellData = {
769
+ columnKey: string | number;
770
+ value: ReactNode;
771
+ };
772
+
773
+ declare type TableCellElement = ReactElement<TableCellProps, typeof TableCell>;
763
774
 
764
775
  export declare interface TableCellProps {
765
776
  columnKey?: string;
766
777
  children: ReactNode;
767
778
  }
768
779
 
769
- declare function TableColumn({ id, children }: TableColumnProps): any;
780
+ export declare type TableCollection = ReturnType<typeof useTableCollection>;
781
+
782
+ declare const TableColumn: ({ ...props }: TableColumnProps) => any;
783
+
784
+ export declare type TableColumnData = {
785
+ key: string | number;
786
+ header: ReactNode;
787
+ isHidden?: boolean;
788
+ };
789
+
790
+ declare type TableColumnElement = ReactElement<TableColumnProps, typeof TableColumn>;
770
791
 
771
792
  export declare interface TableColumnProps {
772
793
  id: string;
773
794
  children: ReactNode;
774
795
  }
775
796
 
776
- export { TableHeader }
797
+ export declare type TableData = {
798
+ columns: TableColumnData[];
799
+ rows: TableRowData[];
800
+ };
777
801
 
778
- declare function TableHeader_2({ children }: TableHeaderProps): any;
802
+ export { TableHeader }
779
803
 
780
804
  export declare interface TableHeaderProps {
781
- children: ReactNode;
805
+ children: TableColumnElement | TableColumnElement[];
806
+ isHidden?: boolean;
782
807
  }
783
808
 
784
809
  declare interface TableProps {
785
- children: default_2.ReactNode;
810
+ children: [ReactElement<TableHeaderProps>, ReactElement<TableBodyProps>];
786
811
  name?: string;
787
- className?: string;
788
812
  }
789
813
 
790
814
  declare interface TableProps_2 extends AriaTableProps, TableStateProps<object> {
@@ -793,11 +817,20 @@ declare interface TableProps_2 extends AriaTableProps, TableStateProps<object> {
793
817
  };
794
818
  }
795
819
 
796
- declare function TableRow({ key, children }: TableRowProps): any;
820
+ declare const TableRow: ({ ...props }: TableRowProps) => any;
821
+
822
+ export declare type TableRowData = {
823
+ key: string | number;
824
+ cells: TableCellData[];
825
+ onClick?: () => void;
826
+ };
827
+
828
+ declare type TableRowElement = ReactElement<TableRowProps, typeof TableRow>;
797
829
 
798
830
  export declare interface TableRowProps {
799
- key?: string;
800
- children: ReactNode;
831
+ key?: string | number;
832
+ children: TableCellElement | TableCellElement[];
833
+ onClick?: () => void;
801
834
  }
802
835
 
803
836
  /**
@@ -989,6 +1022,26 @@ export declare function usePopoverTrigger(props?: OverlayTriggerProps): {
989
1022
  state: OverlayTriggerState;
990
1023
  };
991
1024
 
1025
+ /**
1026
+ * Hook for managing table data structure and providing navigation methods
1027
+ */
1028
+ export declare function useTableCollection(data: TableData): {
1029
+ columns: TableColumnData_2[];
1030
+ rows: TableRowData[];
1031
+ size: number;
1032
+ firstItem: TableRowData;
1033
+ lastItem: TableRowData;
1034
+ hasHeader: boolean;
1035
+ isHeaderHidden: boolean;
1036
+ hasVisibleHeader: boolean;
1037
+ getTotalRowCount: number;
1038
+ getRowAriaIndex: (rowIndex: number) => number;
1039
+ getItemByKey: (key: string | number) => TableRowData | null;
1040
+ getItemAfter: (key: string | number) => TableRowData | null;
1041
+ getItemBefore: (key: string | number) => TableRowData | null;
1042
+ getItemIndex: (key: string | number) => number;
1043
+ };
1044
+
992
1045
  export declare const useTheme: () => ThemeContextType;
993
1046
 
994
1047
  /**