gantri-components 3.0.0-beta.49 → 3.0.0-beta.50

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 (42) hide show
  1. package/dist/components/box/box.types.d.ts +1 -1
  2. package/dist/components/modal/modal.styles.d.ts +0 -3
  3. package/dist/components/table/components/cell-reorder-wrapper/cell-reorder-wrapper.types.d.ts +2 -2
  4. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/index.d.ts +2 -0
  5. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-drag-handle/index.d.ts +1 -0
  6. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-drag-handle/preference-item-drag-handle.d.ts +4 -0
  7. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-drag-handle/preference-item-drag-handle.styles.d.ts +1 -0
  8. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-overlay/index.d.ts +1 -0
  9. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-overlay/preference-item-overlay.d.ts +5 -0
  10. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/preference-item-overlay/preference-item-overlay.styles.d.ts +1 -0
  11. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/sortable-preference-item/SortablePreferenceItem.types.d.ts +4 -0
  12. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/sortable-preference-item/index.d.ts +1 -0
  13. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/sortable-preference-item/sortable-preference-item.d.ts +3 -0
  14. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/sortable-preference-item/sortable-preference-item.styles.d.ts +1 -0
  15. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/sortable.d.ts +4 -0
  16. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/components/user-preferences-modal/user-preferences-modal.types.d.ts +1 -0
  17. package/dist/components/table/components/custom-columns-toggle/components/user-preferences-toggle/user-preferences-toggle.types.d.ts +1 -1
  18. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.adapters.d.ts +3 -0
  19. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.helpers.d.ts +15 -0
  20. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.types.d.ts +5 -2
  21. package/dist/components/table/components/table-header/table-header.types.d.ts +3 -4
  22. package/dist/components/table/components/table-row/table-row.types.d.ts +2 -2
  23. package/dist/components/table/components/table-row-cells/table-row-cells.types.d.ts +2 -2
  24. package/dist/components/table/components/table-row-overlay/table-row-overlay.types.d.ts +2 -2
  25. package/dist/components/table/hooks/index.d.ts +1 -0
  26. package/dist/components/table/hooks/use-drag-and-drop-rows/index.d.ts +1 -0
  27. package/dist/components/table/hooks/use-drag-and-drop-rows/use-drag-and-drop-rows.d.ts +9 -0
  28. package/dist/components/table/hooks/use-drag-and-drop-rows/use-drag-and-drop-rows.types.d.ts +9 -0
  29. package/dist/components/table/hooks/use-track-sticky-cells/use-track-sticky-cells.d.ts +1 -6
  30. package/dist/components/table/hooks/use-track-sticky-cells/use-track-sticky-cells.helpers.d.ts +6 -0
  31. package/dist/components/table/hooks/use-track-sticky-cells/use-track-sticky-cells.types.d.ts +2 -4
  32. package/dist/components/table/index.d.ts +0 -2
  33. package/dist/components/table/table.adapters.d.ts +16 -0
  34. package/dist/components/table/table.helpers.d.ts +9 -0
  35. package/dist/components/table/table.types.d.ts +12 -4
  36. package/dist/index.cjs.js +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.esm.js +1 -1
  39. package/dist/index.umd.js +1 -1
  40. package/dist/styles/index.d.ts +1 -1
  41. package/dist/styles/theme.d.ts +7 -0
  42. package/package.json +3 -2
@@ -9,7 +9,7 @@ type DeprecatedSize = 's1' | 's2' | 's3' | 's4' | 's5' | 's6';
9
9
  /**
10
10
  *
11
11
  */
12
- export type BoxDimension = DeprecatedSize | '.5x' | 'x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x' | '11x' | '12x' | '16x' | '18x' | '24x' | 'unset' | null | '0' | `${number}px` | `${number}rem` | `${number}vw` | `${number}%` | `calc(${string})`;
12
+ export type BoxDimension = DeprecatedSize | '.5x' | 'x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x' | '11x' | '12x' | '13x' | '14x' | '15x' | '16x' | '17x' | '18x' | '19x' | '20x' | '24x' | 'unset' | null | '0' | `${number}px` | `${number}rem` | `${number}vw` | `${number}%` | `calc(${string})`;
13
13
  type AllowedBoxDimension<T> = T extends BoxDimension ? T : never;
14
14
  export interface ResolutionAwarePropBase<T> {
15
15
  lg?: AllowedBoxDimension<T>;
@@ -17,9 +17,6 @@ export declare const StyledModalContent: import("styled-components").StyledCompo
17
17
  export declare const StyledDetailsPanelContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box/box.types").BoxProps & import("react").RefAttributes<import("../box/box.types").BoxProps>>, import("styled-components").DefaultTheme, {
18
18
  isFullScreen?: boolean | undefined;
19
19
  }, never>;
20
- export declare const StyledModalBodyContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../stack/stack.types").StackProps & import("react").RefAttributes<import("../stack/stack.types").StackProps>>, import("styled-components").DefaultTheme, {
21
- isFullScreen?: boolean | undefined;
22
- }, never>;
23
20
  export declare const StyledModalHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
24
21
  $closeable?: boolean | undefined;
25
22
  isFullScreen?: boolean | undefined;
@@ -1,10 +1,10 @@
1
1
  import { PropsWithChildren, ReactNode } from 'react';
2
2
  import { RowData } from '@tanstack/react-table';
3
- import { ReorderingProps } from '../../table.types';
3
+ import { RowReorderingProps } from '../../table.types';
4
4
  export type CellReorderWrapperProps<TData extends RowData> = PropsWithChildren<{
5
5
  FirstColumnContent: JSX.Element | ReactNode;
6
6
  /** Rendered when `reordering` is provided, but `reordering.isAvailable === false`. */
7
7
  FirstColumnFallback: JSX.Element | ReactNode;
8
8
  index: number;
9
- reordering: ReorderingProps<TData> | undefined;
9
+ reordering: RowReorderingProps<TData> | undefined;
10
10
  }>;
@@ -1 +1,3 @@
1
+ export * from './preference-item-overlay';
2
+ export * from './sortable-preference-item';
1
3
  export * from './user-preferences-modal';
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ export declare const PreferenceItemDragHandle: FC<{
3
+ id: string;
4
+ }>;
@@ -0,0 +1 @@
1
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { CustomColumnOption } from '../../../../custom-columns-toggle.types';
3
+ export declare const PreferenceItemOverlay: FC<{
4
+ data: CustomColumnOption;
5
+ }>;
@@ -0,0 +1 @@
1
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,4 @@
1
+ export interface SortablePreferenceItemProps {
2
+ id: string;
3
+ reorderEnable: boolean;
4
+ }
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { SortablePreferenceItemProps } from './SortablePreferenceItem.types';
3
+ export declare const SortablePreferenceItem: FC<PropsWithChildren<SortablePreferenceItemProps>>;
@@ -0,0 +1 @@
1
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,4 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ export declare const Sortable: FC<PropsWithChildren<{
3
+ id: string;
4
+ }>>;
@@ -1,5 +1,6 @@
1
1
  import { CustomColumnOption } from '../../../../custom-columns-toggle.types';
2
2
  export interface UserPreferencesModalProps {
3
+ activeIndex: number;
3
4
  checklistOptions: CustomColumnOption[];
4
5
  onClose: () => Promise<void>;
5
6
  onReset: () => Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { CustomColumnOption } from '../../custom-columns-toggle.types';
3
3
  export interface UserPreferencesToggleProps {
4
+ activeIndex: number;
4
5
  checklistOptions: CustomColumnOption[];
5
6
  isActive: boolean;
6
7
  modalHeading: string;
7
- onClose: () => Promise<void>;
8
8
  onReset: () => Promise<void>;
9
9
  setIsActive: Dispatch<SetStateAction<boolean>>;
10
10
  }
@@ -0,0 +1,3 @@
1
+ export declare const transformsRecordsIntoIds: (records: Array<{
2
+ id?: string | number;
3
+ }>) => string[];
@@ -0,0 +1,15 @@
1
+ import { Column, RowData, Table } from '@tanstack/react-table';
2
+ import { CustomColumnOption } from './custom-columns-toggle.types';
3
+ export interface GetCustomColumnOptionsArgs<TData extends RowData> {
4
+ table: Table<TData>;
5
+ }
6
+ export declare const getCustomColumnOptions: <TData extends RowData<{
7
+ [key: string]: unknown;
8
+ id?: string | number | undefined;
9
+ subRows?: any[] | undefined;
10
+ }>>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
11
+ export declare const transformColumnsIntoVisibilityState: <TData extends RowData<{
12
+ [key: string]: unknown;
13
+ id?: string | number | undefined;
14
+ subRows?: any[] | undefined;
15
+ }>>(columns: Column<TData, unknown>[]) => {};
@@ -1,7 +1,9 @@
1
1
  import { RowData, Table } from '@tanstack/react-table';
2
+ import { Dispatch, SetStateAction } from 'react';
2
3
  export interface CustomColumnsWrapperProps<TData extends RowData> {
3
- customColumns: CustomColumnsProps<TData> | undefined;
4
+ isActive: boolean;
4
5
  isScrolling: boolean;
6
+ setIsActive: Dispatch<SetStateAction<boolean>>;
5
7
  table: Table<TData>;
6
8
  }
7
9
  export interface CustomColumnsProps<TData extends RowData> {
@@ -12,7 +14,8 @@ export interface CustomColumnsProps<TData extends RowData> {
12
14
  export interface CustomColumnOption {
13
15
  checked: boolean;
14
16
  disabled: boolean;
17
+ id: string;
15
18
  label: string;
16
19
  onChange: (event: unknown) => void;
17
- value: string;
20
+ reorderable: boolean;
18
21
  }
@@ -1,10 +1,9 @@
1
1
  import { RowData, Table } from '@tanstack/react-table';
2
- import { GetHeaderCellProps, ReorderingProps } from '../../table.types';
3
- import { CustomColumnsProps } from '../custom-columns-toggle/custom-columns-toggle.types';
2
+ import { GetHeaderCellProps, RowReorderingProps } from '../../table.types';
4
3
  export type TableHeaderProps<TData extends RowData> = {
5
- customColumns: CustomColumnsProps<TData> | undefined;
6
4
  getHeaderCellProps: GetHeaderCellProps<TData> | undefined;
5
+ hasConfigurableColumns: boolean;
7
6
  isScrolling: boolean;
8
- reordering: ReorderingProps<TData> | undefined;
7
+ reordering: RowReorderingProps<TData> | undefined;
9
8
  table: Table<TData>;
10
9
  };
@@ -1,10 +1,10 @@
1
1
  import { Row, RowData } from '@tanstack/react-table';
2
- import { CustomRowProps, GetCellProps, OnRowClick, ReorderingProps } from '../../table.types';
2
+ import { CustomRowProps, GetCellProps, OnRowClick, RowReorderingProps } from '../../table.types';
3
3
  export interface TableRowProps<TData extends RowData> {
4
4
  customRowProps: CustomRowProps;
5
5
  getCellProps: GetCellProps<TData> | undefined;
6
6
  index?: number;
7
7
  onRowClick?: OnRowClick<TData>;
8
- reordering: ReorderingProps<TData> | undefined;
8
+ reordering: RowReorderingProps<TData> | undefined;
9
9
  row: Row<TData>;
10
10
  }
@@ -1,8 +1,8 @@
1
1
  import { Row, RowData } from '@tanstack/react-table';
2
- import { GetCellProps, ReorderingProps } from '../../table.types';
2
+ import { GetCellProps, RowReorderingProps } from '../../table.types';
3
3
  export interface TableRowCellsProps<TData extends RowData> {
4
4
  getCellProps: GetCellProps<TData> | undefined;
5
- reordering: ReorderingProps<TData> | undefined;
5
+ reordering: RowReorderingProps<TData> | undefined;
6
6
  row: Row<TData>;
7
7
  size?: number;
8
8
  }
@@ -1,9 +1,9 @@
1
1
  import { HeaderGroup, RowData } from '@tanstack/react-table';
2
2
  import { TableRowProps } from '../table-row/table-row.types';
3
- import { GetHeaderCellProps, ReorderingProps } from '../../table.types';
3
+ import { GetHeaderCellProps, RowReorderingProps } from '../../table.types';
4
4
  export interface TableRowOverlayProps<TData extends RowData> extends Pick<TableRowProps<TData>, 'row' | 'getCellProps'> {
5
5
  getHeaderCellProps?: GetHeaderCellProps<TData>;
6
6
  getHeaderGroups?: () => HeaderGroup<TData>[];
7
- reordering: ReorderingProps<TData> | undefined;
7
+ reordering: RowReorderingProps<TData> | undefined;
8
8
  table: HTMLElement;
9
9
  }
@@ -1 +1,2 @@
1
+ export * from './use-drag-and-drop-rows';
1
2
  export * from './use-track-sticky-cells';
@@ -0,0 +1 @@
1
+ export * from './use-drag-and-drop-rows';
@@ -0,0 +1,9 @@
1
+ import { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
2
+ import { UseDragAndDropRowsProps } from './use-drag-and-drop-rows.types';
3
+ export declare const useDragAndDropRows: (props: UseDragAndDropRowsProps) => {
4
+ activeIndex: number;
5
+ handleDragEnd: (event: DragEndEvent) => void;
6
+ handleDragStart: (event: DragStartEvent) => void;
7
+ isDragging: boolean;
8
+ sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
9
+ };
@@ -0,0 +1,9 @@
1
+ import { RowReorderingProps } from '../../table.types';
2
+ export interface DragRowData {
3
+ id: string | number;
4
+ }
5
+ export type UseDragAndDropRowsProps = {
6
+ data: DragRowData[];
7
+ reordering?: RowReorderingProps<DragRowData> | undefined;
8
+ setData: (records: DragRowData[]) => void;
9
+ };
@@ -1,8 +1,3 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import { UseTrackStickyCellsProps } from './use-track-sticky-cells.types';
3
2
  /** Mark table if header and/or first column cells are sticky. */
4
- export declare const useTrackStickyCells: <TData extends RowData<{
5
- [key: string]: unknown;
6
- id?: string | number | undefined;
7
- subRows?: any[] | undefined;
8
- }>>(props: UseTrackStickyCellsProps<TData>) => void;
3
+ export declare const useTrackStickyCells: (props: UseTrackStickyCellsProps) => void;
@@ -0,0 +1,6 @@
1
+ import { StickyTo } from '../../../../helpers/mark-sticky-elements/mark-sticky-elements.types';
2
+ export type GetIsStickyArgs = {
3
+ element: HTMLElement | null;
4
+ stickyTo: StickyTo;
5
+ };
6
+ export declare const getIsSticky: (args: GetIsStickyArgs) => boolean;
@@ -1,7 +1,5 @@
1
- import { RowData } from '@tanstack/react-table';
2
- import { CustomColumnsProps } from '../../components/custom-columns-toggle/custom-columns-toggle.types';
3
- export interface UseTrackStickyCellsProps<TData extends RowData> {
4
- customColumns: CustomColumnsProps<TData> | undefined;
1
+ export interface UseTrackStickyCellsProps {
2
+ hasConfigurableColumns: boolean;
5
3
  numRows: number;
6
4
  /** The containing element that the child will intersect with. */
7
5
  root: HTMLElement | null;
@@ -1,6 +1,4 @@
1
1
  export * from './table';
2
2
  export * from './table.types';
3
3
  export * from './components/table-row/table-row.constants';
4
- export * from './components/custom-columns-toggle/helpers/get-custom-column-initial-visibility';
5
- export * from './helpers';
6
4
  export * from './components/table-actions-wrapper/table-actions-wrapper.types';
@@ -0,0 +1,16 @@
1
+ import { ColumnOrderState, RowData, Table, VisibilityState } from '@tanstack/react-table';
2
+ import { ColumnConfig } from './table.types';
3
+ interface ConvertColumnsMetadataToColumnConfigArgs<TData extends RowData> {
4
+ order: ColumnOrderState;
5
+ table: Table<TData>;
6
+ visibility: VisibilityState;
7
+ }
8
+ export declare function convertColumnsMetadataToColumnConfig<TData extends RowData>(args: ConvertColumnsMetadataToColumnConfigArgs<TData>): ColumnConfig[];
9
+ export declare const extractColumnIdsFromColumnConfig: (records: ColumnConfig[]) => string[];
10
+ export declare const extractColumnsVisibilityFromColumnConfig: (records: ColumnConfig[]) => VisibilityState;
11
+ export declare const extractColumnsVisibilityFromTable: <TData extends RowData<{
12
+ [key: string]: unknown;
13
+ id?: string | number | undefined;
14
+ subRows?: any[] | undefined;
15
+ }>>(table: Table<TData>) => {};
16
+ export {};
@@ -0,0 +1,9 @@
1
+ import { RowData } from '@tanstack/react-table';
2
+ import { ColumnConfig, GetColumnsConfigFn, TDataWithId } from './table.types';
3
+ export declare const addMissingIds: <TData extends RowData<{
4
+ [key: string]: unknown;
5
+ id?: string | number | undefined;
6
+ subRows?: any[] | undefined;
7
+ }>>(data: TData[]) => TDataWithId<TData>[];
8
+ export declare const hyphenateColumnId: ((id: string) => string) & import("lodash").MemoizedFunction;
9
+ export declare const processColumnsConfigGenerator: (fetchData: GetColumnsConfigFn, handler: (val: ColumnConfig[]) => void) => Promise<void | ColumnConfig[]>;
@@ -3,9 +3,8 @@ import { Dispatch, HTMLAttributes, MouseEvent, SetStateAction } from 'react';
3
3
  import { PagingProps } from './components/table-actions-wrapper/components/paging/paging.types';
4
4
  import { CustomActionProps, FiltersProps, SearchProps } from './components/table-actions-wrapper/table-actions-wrapper.types';
5
5
  import { SortProps } from './components/table-actions-wrapper/components/sort/sort.types';
6
- import { CustomColumnsProps } from './components/custom-columns-toggle/custom-columns-toggle.types';
7
6
  import { OverlayPosition } from '../overlay/overlay.types';
8
- export interface ReorderingProps<TData extends RowData> {
7
+ export interface RowReorderingProps<TData extends RowData> {
9
8
  disabled?: boolean;
10
9
  isActive: boolean;
11
10
  isAvailable: boolean;
@@ -15,12 +14,16 @@ export interface ReorderingProps<TData extends RowData> {
15
14
  tooltipPosition?: OverlayPosition;
16
15
  tooltipText?: string;
17
16
  }
17
+ export interface ColumnConfig {
18
+ hidden?: boolean;
19
+ id?: string;
20
+ }
21
+ export type GetColumnsConfigFn = (() => AsyncGenerator<ColumnConfig[], void | ColumnConfig, unknown>) | (() => Promise<ColumnConfig[]>);
18
22
  export interface TableProps<TData extends RowData> extends Partial<TableDefaultProps> {
19
23
  className?: string;
20
24
  columns: ColumnDef<TData, any>[];
21
25
  customAction?: CustomActionProps<TData>;
22
26
  /** Providing this will automatically make the last column sticky. */
23
- customColumns?: CustomColumnsProps<TData>;
24
27
  /**
25
28
  * For each index, if no `id` key exists, one will be assigned.
26
29
  *
@@ -30,14 +33,16 @@ export interface TableProps<TData extends RowData> extends Partial<TableDefaultP
30
33
  filters?: FiltersProps;
31
34
  /** Include `isClickable` in the returned object to apply appropriate cell styling. Text styling must be applied within the column. */
32
35
  getCellProps?: GetCellProps<TData>;
36
+ getColumnsConfig?: GetColumnsConfigFn;
33
37
  getHeaderCellProps?: GetHeaderCellProps<TData>;
34
38
  /** Include `status` in the returned object to set the row status color. */
35
39
  getRowProps?: GetRowProps<TData>;
40
+ onColumnsConfigChange?: (config: ColumnConfig[]) => Promise<void>;
36
41
  onRowClick?: OnRowClick<TData>;
37
42
  /** Any options provided are passed to `useReactTable` and may override default values. */
38
43
  options?: Partial<TableOptions<TData>>;
39
44
  paging?: PagingProps;
40
- reordering?: ReorderingProps<TData>;
45
+ reordering?: RowReorderingProps<TData>;
41
46
  search?: SearchProps;
42
47
  sorting?: SortProps;
43
48
  }
@@ -60,3 +65,6 @@ export type OnRowClick<TData extends RowData> = (data: Row<TData>, event: MouseE
60
65
  export interface CustomCellProps extends HTMLAttributes<HTMLTableCellElement>, Record<string, unknown> {
61
66
  isClickable?: boolean;
62
67
  }
68
+ export type TDataWithId<TData extends RowData> = TData & {
69
+ id: number | string;
70
+ };