gantri-components 2.90.0-beta.1 → 2.90.0-beta.11

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.
Files changed (44) hide show
  1. package/dist/components/table/components/table-actions-wrapper/components/clear-selected-rows/clear-selected-rows.constants.d.ts +1 -0
  2. package/dist/components/table/components/table-actions-wrapper/components/clear-selected-rows/clear-selected-rows.d.ts +1 -0
  3. package/dist/components/table/components/table-actions-wrapper/components/clear-selected-rows/clear-selected-rows.styles.d.ts +2 -0
  4. package/dist/components/table/components/table-actions-wrapper/components/clear-selected-rows/index.d.ts +1 -0
  5. package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.constants.d.ts +6 -0
  6. package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.styles.d.ts +4 -0
  7. package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts +2 -1
  8. package/dist/components/table/components/table-footer/components/selectable-row-footer-wrapper/index.d.ts +1 -0
  9. package/dist/components/table/components/table-footer/components/selectable-row-footer-wrapper/selectable-row-footer-wrapper.d.ts +3 -0
  10. package/dist/components/table/components/table-footer/components/selectable-row-footer-wrapper/selectable-row-footer-wrapper.types.d.ts +3 -0
  11. package/dist/components/table/components/table-header/components/selectable-row-header-wrapper/index.d.ts +1 -0
  12. package/dist/components/table/components/table-header/components/selectable-row-header-wrapper/selectable-row-header-wrapper.d.ts +4 -0
  13. package/dist/components/table/components/table-header/components/selectable-row-header-wrapper/selectable-row-header-wrapper.types.d.ts +5 -0
  14. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/helpers/get-row-range/get-row-range.d.ts +3 -0
  15. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/helpers/get-row-range/get-row-range.types.d.ts +6 -0
  16. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/helpers/get-row-range/index.d.ts +1 -0
  17. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/index.d.ts +1 -0
  18. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/selectable-row-cell-wrapper.d.ts +4 -0
  19. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/selectable-row-cell-wrapper.styles.d.ts +2 -0
  20. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/selectable-row-cell-wrapper.types.d.ts +6 -0
  21. package/dist/components/table/hooks/use-get-selected-table-rows-data/index.d.ts +1 -0
  22. package/dist/components/table/hooks/use-get-selected-table-rows-data/use-get-selected-table-rows-data.d.ts +7 -0
  23. package/dist/components/table/hooks/use-row-selection/index.d.ts +1 -0
  24. package/dist/components/table/hooks/use-row-selection/use-row-selection.constants.d.ts +6 -0
  25. package/dist/components/table/hooks/use-row-selection/use-row-selection.d.ts +8 -0
  26. package/dist/components/table/hooks/use-row-selection/use-row-selection.types.d.ts +9 -0
  27. package/dist/components/table/hooks/use-selectable-table-rows/components/clear-selected-rows/clear-selected-rows.d.ts +1 -0
  28. package/dist/components/table/hooks/use-selectable-table-rows/components/selectable-table-row-footer/selectable-table-row-footer.d.ts +2 -1
  29. package/dist/components/table/hooks/use-selectable-table-rows/components/selectable-table-row-footer/selectable-table-row-footer.types.d.ts +1 -3
  30. package/dist/components/table/hooks/use-selectable-table-rows/helpers/get-row-range/get-row-range.d.ts +2 -1
  31. package/dist/components/table/hooks/use-selectable-table-rows/helpers/get-row-range/get-row-range.types.d.ts +6 -0
  32. package/dist/components/table/hooks/use-selectable-table-rows/use-selectable-table-rows.types.d.ts +4 -1
  33. package/dist/components/table/index.d.ts +2 -1
  34. package/dist/components/table/table.context.d.ts +15 -8
  35. package/dist/components/table/table.providers.d.ts +2 -3
  36. package/dist/components/table/table.types.d.ts +3 -2
  37. package/dist/hooks/index.d.ts +1 -0
  38. package/dist/hooks/use-provider/index.d.ts +1 -0
  39. package/dist/hooks/use-provider/use-provider.d.ts +33 -0
  40. package/dist/hooks/use-provider/use-provider.types.d.ts +2 -0
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.esm.js +1 -1
  43. package/dist/index.umd.js +1 -1
  44. package/package.json +3 -2
@@ -0,0 +1 @@
1
+ export declare const dataAttrClearSelected = "data-clear-selected";
@@ -0,0 +1 @@
1
+ export declare const ClearSelectedRows: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledPointerFlex: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../../../flex/flex.types").FlexProps & import("react").RefAttributes<import("../../../../../flex/flex.types").FlexProps>>, import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,6 @@
1
+ export declare const customActionPositions: {
2
+ readonly bottom: "bottom";
3
+ readonly handleSelections: "handle-selections";
4
+ readonly left: "left";
5
+ readonly right: "right";
6
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledBottomActionsFlex: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../flex/flex.types").FlexProps & import("react").RefAttributes<import("../../../flex/flex.types").FlexProps>>, import("styled-components").DefaultTheme, {
3
+ showClearSelectedRows: boolean;
4
+ }, never>;
@@ -3,6 +3,7 @@ import { RowData, Table } from '@tanstack/react-table';
3
3
  import { PagingProps } from './components/paging/paging.types';
4
4
  import { SortProps } from './components/sort/sort.types';
5
5
  import { SearchProps } from './components/search/search.types';
6
+ import { customActionPositions } from './table-actions-wrapper.constants';
6
7
  export type { SearchProps };
7
8
  export type FiltersProps = {
8
9
  count: number;
@@ -18,7 +19,7 @@ export interface CustomActionComponentProps<TData extends RowData> {
18
19
  }
19
20
  export interface CustomActionProps<TData extends RowData> {
20
21
  Component: JSXElementConstructor<CustomActionComponentProps<TData>>;
21
- position: 'left' | 'right' | 'bottom';
22
+ position: typeof customActionPositions[keyof typeof customActionPositions];
22
23
  }
23
24
  export interface TableActionsWrapperProps<TData extends RowData> {
24
25
  className: string | undefined;
@@ -0,0 +1 @@
1
+ export * from './selectable-row-footer-wrapper';
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { SelectableRowFooterWrapperProps } from './selectable-row-footer-wrapper.types';
3
+ export declare const SelectableRowFooterWrapper: (props: PropsWithChildren<SelectableRowFooterWrapperProps>) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ export interface SelectableRowFooterWrapperProps {
2
+ index: number;
3
+ }
@@ -0,0 +1 @@
1
+ export * from './selectable-row-header-wrapper';
@@ -0,0 +1,4 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { RowData } from '@tanstack/react-table';
3
+ import { SelectableRowHeaderWrapperProps } from './selectable-row-header-wrapper.types';
4
+ export declare const SelectableRowHeaderWrapper: <TData extends RowData<import("../../../..").CustomTData>>(props: React.PropsWithChildren<SelectableRowHeaderWrapperProps<TData>>) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { RowData, Table } from '@tanstack/react-table';
2
+ export interface SelectableRowHeaderWrapperProps<TData extends RowData> {
3
+ index: number;
4
+ table: Table<TData>;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { Row, RowData } from '@tanstack/react-table';
2
+ import { GetRowRangeProps } from './get-row-range.types';
3
+ export declare const getRowRange: <TData extends RowData<import("../../../../../..").CustomTData>>(props: GetRowRangeProps<TData>) => Row<TData>[];
@@ -0,0 +1,6 @@
1
+ import { Row, RowData } from '@tanstack/react-table';
2
+ export interface GetRowRangeProps<TData extends RowData> {
3
+ currentIndex: number;
4
+ prevIndex: number;
5
+ rows: Row<TData>[];
6
+ }
@@ -0,0 +1 @@
1
+ export * from './selectable-row-cell-wrapper';
@@ -0,0 +1,4 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { RowData } from '@tanstack/react-table';
3
+ import { SelectableRowCellWrapperProps } from './selectable-row-cell-wrapper.types';
4
+ export declare const SelectableRowCellWrapper: <TData extends RowData<import("../../../..").CustomTData>>(props: React.PropsWithChildren<SelectableRowCellWrapperProps<TData>>) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledCheckboxCell: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../../../cell/cell.types").CellProps & import("react").RefAttributes<import("../../../../../cell/cell.types").CellProps>>, import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,6 @@
1
+ import { Row, RowData, Table } from '@tanstack/react-table';
2
+ export interface SelectableRowCellWrapperProps<TData extends RowData> {
3
+ index: number;
4
+ row: Row<TData>;
5
+ table: Table<TData>;
6
+ }
@@ -0,0 +1 @@
1
+ export * from './use-get-selected-table-rows-data';
@@ -0,0 +1,7 @@
1
+ import { RowData } from '@tanstack/react-table';
2
+ export declare const useGetSelectedRowsData: () => {
3
+ getSelectedRowsData: <TData extends RowData<import("../..").CustomTData>>(props: {
4
+ idProperty: keyof TData | undefined;
5
+ records: TData[];
6
+ }) => TData[];
7
+ };
@@ -0,0 +1 @@
1
+ export * from './use-row-selection';
@@ -0,0 +1,6 @@
1
+ export declare const selectableRowsCheckboxSize = "2rem";
2
+ export declare const dataAttrIsRowSelected = "data-is-row-selected";
3
+ export declare const rowSelectionTypes: {
4
+ readonly checkboxes: "checkboxes";
5
+ readonly custom: "custom";
6
+ };
@@ -0,0 +1,8 @@
1
+ export declare const useRowSelection: () => {
2
+ clearSelectedRows: () => void;
3
+ /** Can be used to deselect rows outside of the default behavior. */
4
+ deselectRows: (rowIds: (string | number)[]) => void;
5
+ getIsRowSelected: (rowId: number | string) => boolean;
6
+ /** Can be used to select rows outside of the default behavior. */
7
+ selectRows: (rowIds: (string | number)[]) => void;
8
+ };
@@ -0,0 +1,9 @@
1
+ import { RowData } from '@tanstack/react-table';
2
+ import { rowSelectionTypes } from './use-row-selection.constants';
3
+ export interface RowSelection<TData extends RowData> {
4
+ disabled?: boolean;
5
+ idProperty?: keyof TData;
6
+ onSelect?: (selectedRecords: TData[]) => void;
7
+ type: RowSelectionType;
8
+ }
9
+ export type RowSelectionType = typeof rowSelectionTypes[keyof typeof rowSelectionTypes];
@@ -1 +1,2 @@
1
+ export declare const dataAttrClearSelected = "data-clear-selected";
1
2
  export declare const ClearSelectedRows: () => JSX.Element;
@@ -1,2 +1,3 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { SelectableRowFooterProps } from './selectable-table-row-footer.types';
2
- export declare const SelectableRowFooter: (props: SelectableRowFooterProps) => JSX.Element;
3
+ export declare const SelectableRowFooter: (props: PropsWithChildren<SelectableRowFooterProps>) => JSX.Element;
@@ -1,5 +1,3 @@
1
- import { JSXElementConstructor } from 'react';
2
- export type SelectableRowFooterTypeDef = JSXElementConstructor<SelectableRowFooterProps>;
3
1
  export interface SelectableRowFooterProps {
4
- text: string;
2
+ index: number;
5
3
  }
@@ -1,2 +1,3 @@
1
1
  import { Row, RowData } from '@tanstack/react-table';
2
- export declare const getRowRange: <TData extends RowData<import("../../../..").CustomTData>>(rows: Row<TData>[], currentId: number, selectedId: number) => Row<TData>[];
2
+ import { GetRowRangeProps } from './get-row-range.types';
3
+ export declare const getRowRange: <TData extends RowData<import("../../../..").CustomTData>>(props: GetRowRangeProps<TData>) => Row<TData>[];
@@ -0,0 +1,6 @@
1
+ import { Row, RowData } from '@tanstack/react-table';
2
+ export interface GetRowRangeProps<TData extends RowData> {
3
+ currentIndex: number;
4
+ prevIndex: number;
5
+ rows: Row<TData>[];
6
+ }
@@ -1,6 +1,9 @@
1
+ import { RowData } from '@tanstack/react-table';
1
2
  import { rowSelectionTypes } from './use-selectable-table-rows.constants';
2
- export interface RowSelection {
3
+ export interface RowSelection<TData extends RowData> {
3
4
  disabled?: boolean;
5
+ idProperty?: keyof TData;
6
+ onSelect?: (selectedRecords: TData[]) => void;
4
7
  type: RowSelectionType;
5
8
  }
6
9
  export type RowSelectionType = typeof rowSelectionTypes[keyof typeof rowSelectionTypes];
@@ -1,6 +1,7 @@
1
1
  export type { GetAfterRowComponentDef, AfterRowComponentDef, } from './components/after-row-component/after-row-component.types';
2
+ export * from './table';
2
3
  export * from './table.providers';
3
4
  export * from './table.types';
4
5
  export * from './components/table-row/table-row.constants';
5
6
  export * from './components/table-actions-wrapper/table-actions-wrapper.types';
6
- export { useRowSelectionContext } from './table.context';
7
+ export * from './hooks/use-row-selection';
@@ -1,14 +1,21 @@
1
1
  import { RowSelectionState } from '@tanstack/react-table';
2
- import React, { PropsWithChildren } from 'react';
3
- export declare const RowSelectionProviders: ({ children, }: PropsWithChildren<Record<never, never>>) => JSX.Element;
4
- export declare const useRowSelectionContext: () => {
5
- clearSelectedRows: () => void;
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ export type GenericContextValue<Type> = [Type, Dispatch<SetStateAction<Type>>];
4
+ export declare const defaultRowSelectionState: RowSelectionState;
5
+ export declare const defaultLastSelectedId: string;
6
+ export declare const defaultIsRowSelectionDisabled: boolean;
7
+ export declare const defaultIsRowSelectionCheckboxes: boolean;
8
+ export declare const RowSelectionContext: import("react").Context<GenericContextValue<RowSelectionState>>;
9
+ export declare const LastSelectedIdContext: import("react").Context<GenericContextValue<string>>;
10
+ export declare const IsRowSelectionDisabledContext: import("react").Context<GenericContextValue<boolean>>;
11
+ export declare const IsRowSelectionCheckboxesContext: import("react").Context<GenericContextValue<boolean>>;
12
+ export declare const useTableContext: () => {
6
13
  isRowSelectionCheckboxes: boolean;
7
14
  isRowSelectionDisabled: boolean;
8
15
  lastSelectedId: string;
9
16
  rowSelectionState: RowSelectionState;
10
- setIsRowSelectionCheckboxes: React.Dispatch<React.SetStateAction<boolean>>;
11
- setIsRowSelectionDisabled: React.Dispatch<React.SetStateAction<boolean>>;
12
- setLastSelectedId: React.Dispatch<React.SetStateAction<string>>;
13
- setRowSelectionState: React.Dispatch<React.SetStateAction<RowSelectionState>>;
17
+ setIsRowSelectionCheckboxes: Dispatch<SetStateAction<boolean>>;
18
+ setIsRowSelectionDisabled: Dispatch<SetStateAction<boolean>>;
19
+ setLastSelectedId: Dispatch<SetStateAction<string>>;
20
+ setRowSelectionState: Dispatch<SetStateAction<RowSelectionState>>;
14
21
  };
@@ -1,3 +1,2 @@
1
- import { RowData } from '@tanstack/react-table';
2
- import { TableProps } from './table.types';
3
- export declare const Table: <TData extends RowData<import("./table.types").CustomTData>>(props: TableProps<TData>) => JSX.Element;
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const RowSelectionProviders: ({ children, }: PropsWithChildren<Record<never, never>>) => JSX.Element;
@@ -6,7 +6,7 @@ import { CustomActionProps, FiltersProps, SearchProps } from './components/table
6
6
  import { SortProps } from './components/table-actions-wrapper/components/sort/sort.types';
7
7
  import { OverlayPosition } from '../overlay/overlay.types';
8
8
  import { GetAfterRowComponentDef } from './components/after-row-component/after-row-component.types';
9
- import { RowSelection } from './hooks/use-selectable-table-rows/use-selectable-table-rows.types';
9
+ import { RowSelection } from './hooks/use-row-selection/use-row-selection.types';
10
10
  export interface RowReorderingProps<TData extends RowData> {
11
11
  disabled?: boolean;
12
12
  getDisableSortableRow?: (row: Row<TData>) => boolean;
@@ -64,7 +64,8 @@ export interface TableProps<TData extends RowData> extends Partial<TableDefaultP
64
64
  options?: Partial<TableOptions<TData>>;
65
65
  paging?: PagingProps;
66
66
  reordering?: RowReorderingProps<TData>;
67
- rowSelection?: RowSelection;
67
+ /** If using row selection, you must wrap your component in `RowSelectionProviders`. This should be done outside the parent the component using the `Table`. `useRowSelection` provides additional helpful functions you may wish to utilize. */
68
+ rowSelection?: RowSelection<TData>;
68
69
  search?: SearchProps;
69
70
  sorting?: SortProps;
70
71
  syncState?: SyncState;
@@ -0,0 +1 @@
1
+ export * from './use-provider';
@@ -0,0 +1 @@
1
+ export * from './use-provider';
@@ -0,0 +1,33 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { GenericContextValue } from './use-provider.types';
3
+ export declare const createGenericContext: <Type>(defaultValue: Type) => React.Context<GenericContextValue<Type>>;
4
+ /**
5
+ * ```
6
+ * const defaultMyValue = 'foo';
7
+ *
8
+ * const MyContext = createGenericContext(defaultMyValue);
9
+ *
10
+ * const OuterWrapper = () => {
11
+ * const MyProvider = useProvider({
12
+ * Context: MyContext,
13
+ * defaultValue: defaultMyValue,
14
+ * });
15
+ *
16
+ * return (
17
+ * <MyProvider>
18
+ * <InnerComponent />
19
+ * </MyProvider>
20
+ * );
21
+ * }
22
+ *
23
+ * const InnerComponent = () => {
24
+ * const [myValue, setMyValue] = useContext(MyContext);
25
+ *
26
+ * // ...
27
+ * }
28
+ * ```
29
+ */
30
+ export declare const useProvider: <Type>(props: {
31
+ Context: React.Context<GenericContextValue<Type>>;
32
+ defaultValue: Type;
33
+ }) => React.MemoExoticComponent<({ children }: PropsWithChildren<Record<never, never>>) => JSX.Element>;
@@ -0,0 +1,2 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export type GenericContextValue<Type> = [Type, Dispatch<SetStateAction<Type>>];