gantri-components 2.90.0-beta.3 → 2.90.0-beta.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.
@@ -18,7 +18,7 @@ export interface CustomActionComponentProps<TData extends RowData> {
18
18
  }
19
19
  export interface CustomActionProps<TData extends RowData> {
20
20
  Component: JSXElementConstructor<CustomActionComponentProps<TData>>;
21
- position: 'left' | 'right' | 'bottom' | 'selected-rows';
21
+ position: 'left' | 'right' | 'bottom' | 'clear-selected';
22
22
  }
23
23
  export interface TableActionsWrapperProps<TData extends RowData> {
24
24
  className: string | undefined;
@@ -1,5 +1,5 @@
1
1
  export type { GetAfterRowComponentDef, AfterRowComponentDef, } from './components/after-row-component/after-row-component.types';
2
- export * from './table.providers';
2
+ export * from './table';
3
3
  export * from './table.types';
4
4
  export * from './components/table-row/table-row.constants';
5
5
  export * from './components/table-actions-wrapper/table-actions-wrapper.types';
@@ -2,21 +2,21 @@ import { RowData, RowSelectionState } from '@tanstack/react-table';
2
2
  import React, { PropsWithChildren } from 'react';
3
3
  export declare const RowSelectionProviders: ({ children, }: PropsWithChildren<Record<never, never>>) => JSX.Element;
4
4
  /** If you need to call any of these helpers outside of the `Table` component, you must wrap your code in `RowSelectionProviders` at a higher level */
5
- export declare const useTableContext: () => {
5
+ export declare const useTableContext: <TData extends RowData<import("./table.types").CustomTData>>() => {
6
6
  clearSelectedRows: () => void;
7
- /** Can be used to deselect rows outside of the default behavior. */
8
7
  deselectRows: (rowIds: (string | number)[]) => void;
9
8
  getIsRowSelected: (rowId: number | string) => boolean;
10
- getSelectedRowData: <TData extends RowData<import("./table.types").CustomTData>>(props: {
9
+ getSelectedRowData: (props: {
11
10
  idProperty: keyof TData;
12
11
  records: TData[];
13
12
  }) => (TData | undefined)[];
13
+ /** Can be used to deselect rows outside of the default behavior. */
14
14
  isRowSelectionCheckboxes: boolean;
15
15
  isRowSelectionDisabled: boolean;
16
16
  lastSelectedId: string;
17
17
  rowSelectionState: RowSelectionState;
18
- /** Can be used to select rows outside of the default behavior. */
19
18
  selectRows: (rowIds: (string | number)[]) => void;
19
+ /** Can be used to select rows outside of the default behavior. */
20
20
  setIsRowSelectionCheckboxes: React.Dispatch<React.SetStateAction<boolean>>;
21
21
  setIsRowSelectionDisabled: React.Dispatch<React.SetStateAction<boolean>>;
22
22
  setLastSelectedId: React.Dispatch<React.SetStateAction<string>>;
@@ -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
+ }) => ({ 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>>];