grep-components 2.12.0 → 2.13.0

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SelectProps, InputBaseComponentProps } from '@mui/material';
2
+ import { SelectProps, InputBaseComponentProps, InputLabelProps } from '@mui/material';
3
3
  export interface SelectItem {
4
4
  value: string | number;
5
5
  label?: string;
@@ -14,6 +14,7 @@ export type GrepSelectProps = SelectProps & {
14
14
  selectItems: SelectItem[];
15
15
  unselectOption?: boolean;
16
16
  useCheckedSelect?: boolean;
17
+ labelProps?: InputLabelProps;
17
18
  inputProps?: InputBaseComponentProps | undefined;
18
19
  };
19
20
  declare const _default: React.ComponentType<GrepSelectProps>;
@@ -0,0 +1,10 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { UniqueIdentifier } from '@dnd-kit/core';
3
+ import { TableColumn } from '../../GrepTable';
4
+ interface props<T> extends Omit<React.HTMLProps<HTMLTableRowElement>, 'id'> {
5
+ id: UniqueIdentifier;
6
+ item: T;
7
+ columns: Array<TableColumn<T>>;
8
+ }
9
+ export declare function SortableTableRow2<T>({ id, columns, item, ...props }: props<T>): ReactElement;
10
+ export {};
@@ -1,20 +1,38 @@
1
- import { ReactNode, JSX } from 'react';
1
+ import { UniqueIdentifier } from '@dnd-kit/core';
2
2
  import { TableCellProps } from '@mui/material/TableCell';
3
+ import { ReactElement } from 'react';
4
+ import { ReactNode } from 'react';
5
+ import { TableColumn } from '../GrepTable';
3
6
  export interface CellNode {
4
7
  value: ReactNode;
5
8
  properties?: TableCellProps;
6
9
  }
7
- interface Properties<T = unknown> {
8
- columns: Array<keyof T>;
9
- items: T[];
10
+ export interface dndModifiers {
11
+ modifiers: 'restrict';
12
+ dragOverlay: boolean;
13
+ }
14
+ interface SortableTableProperties<T extends {
15
+ id: UniqueIdentifier;
16
+ }> {
17
+ columns: Array<TableColumn<T>>;
18
+ data: T[];
19
+ /** @default false */
20
+ header?: boolean;
21
+ /** @default "medium"
22
+ * Overrides tablecell sizes
23
+ */
24
+ size?: 'small' | 'medium';
25
+ /** Disables drag and drop for the component */
10
26
  disabled?: boolean;
11
- identify: (item: T) => string | number;
12
- headerValue?: (column: keyof T) => CellNode | ReactNode;
13
- cellValue?: (column: keyof T, item: T) => CellNode | ReactNode;
14
27
  onChange?: (order: {
15
28
  id: string | number;
16
29
  index: number;
17
30
  }[]) => void;
31
+ /** Restricts possibility to drag outside the table itself
32
+ * ref: https://docs.dndkit.com/api-documentation/modifiers */
33
+ modifiers?: 'restrict';
18
34
  }
19
- export declare const SortableTable: <T>({ columns, items, identify, headerValue, cellValue, disabled, onChange, }: Properties<T>) => JSX.Element;
35
+ declare const SortableTable: <T extends {
36
+ id: UniqueIdentifier;
37
+ }>({ data, onChange, ...props }: SortableTableProperties<T>) => ReactElement;
20
38
  export default SortableTable;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  };
5
5
  export default _default;
6
- export declare const Standard: {
6
+ export declare const SortableTableStory: {
7
7
  render: () => React.JSX.Element;
8
8
  name: string;
9
9
  };
@@ -1,12 +1,10 @@
1
- export declare const useStyles: (params: {
2
- isDragging: boolean;
3
- }, muiStyleOverridesParams?: {
1
+ export declare const useSortableTableStyles: (params: void, muiStyleOverridesParams?: {
4
2
  props: Record<string, unknown>;
5
3
  ownerState?: Record<string, unknown> | undefined;
6
4
  } | undefined) => {
7
- classes: Record<"row", string>;
5
+ classes: Record<"dragOverlayRow" | "sortableRow", string>;
8
6
  theme: import("@mui/material").Theme;
9
7
  css: import("tss-react").Css;
10
8
  cx: import("tss-react").Cx;
11
9
  };
12
- export default useStyles;
10
+ export default useSortableTableStyles;