@commercetools-uikit/data-table 12.2.2 → 12.2.6

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.
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type TDataCell = {
3
+ children: ReactNode;
4
+ isCondensed?: boolean;
5
+ isTruncated?: boolean;
6
+ onCellClick?: () => void;
7
+ shouldIgnoreRowClick?: boolean;
8
+ verticalCellAlignment?: 'top' | 'center' | 'bottom';
9
+ horizontalCellAlignment?: 'left' | 'center' | 'right';
10
+ shouldRenderBottomBorder: boolean;
11
+ shouldRenderCollapseButton: boolean;
12
+ shouldRenderResizingIndicator: boolean;
13
+ handleRowCollapseClick?: () => void;
14
+ isRowCollapsed?: boolean;
15
+ };
16
+ declare type TDefaultProps = {
17
+ isTruncated: boolean;
18
+ shouldRenderBottomBorder: boolean;
19
+ };
20
+ declare const DataCell: {
21
+ (props: TDataCell): import("@emotion/react/jsx-runtime").JSX.Element;
22
+ displayName: string;
23
+ defaultProps: TDefaultProps;
24
+ };
25
+ export default DataCell;
@@ -0,0 +1,45 @@
1
+ /// <reference types="react" />
2
+ import type { TDataCell } from './cell';
3
+ declare type TCellInner = {
4
+ shouldClipContent?: boolean;
5
+ } & Pick<TDataCell, 'verticalCellAlignment' | 'horizontalCellAlignment' | 'isTruncated' | 'isCondensed'>;
6
+ declare const getPaddingStyle: (props: TCellInner) => import("@emotion/utils").SerializedStyles;
7
+ declare const getHorizontalAlignmentStyle: (props: TCellInner) => import("@emotion/utils").SerializedStyles;
8
+ declare const getVerticalAlignmentStyle: (props: TCellInner) => import("@emotion/utils").SerializedStyles;
9
+ declare const getCellInnerStyles: (props: TCellInner) => (string | import("@emotion/utils").SerializedStyles)[];
10
+ declare const CellInner: import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: import("react").ElementType<any> | undefined;
13
+ } & {
14
+ shouldClipContent?: boolean | undefined;
15
+ } & Pick<TDataCell, "isCondensed" | "horizontalCellAlignment" | "verticalCellAlignment" | "isTruncated">, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
+ declare const BaseCell: import("@emotion/styled").StyledComponent<{
17
+ theme?: import("@emotion/react").Theme | undefined;
18
+ as?: import("react").ElementType<any> | undefined;
19
+ } & {
20
+ shouldClipContent?: boolean | undefined;
21
+ } & Pick<TDataCell, "shouldIgnoreRowClick" | "shouldRenderBottomBorder">, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
22
+ declare type TBaseFooterCell = {
23
+ disableFooterStickiness?: boolean;
24
+ numberOfColumns?: number;
25
+ };
26
+ declare const BaseFooterCell: import("@emotion/styled").StyledComponent<{
27
+ theme?: import("@emotion/react").Theme | undefined;
28
+ as?: import("react").ElementType<any> | undefined;
29
+ } & TBaseFooterCell, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
30
+ declare const RowExpandCollapseButton: import("@emotion/styled").StyledComponent<{
31
+ as?: string | import("react").ComponentType<{}> | undefined;
32
+ id?: string | undefined;
33
+ type?: "button" | "reset" | "submit" | undefined;
34
+ label: string;
35
+ children: import("react").ReactNode;
36
+ isToggleButton?: boolean | undefined;
37
+ isToggled?: boolean | undefined;
38
+ isDisabled?: boolean | undefined;
39
+ className?: string | undefined;
40
+ onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent> | import("react").KeyboardEvent<HTMLButtonElement>) => void) | undefined;
41
+ buttonAttributes?: Record<string, unknown> | undefined;
42
+ } & import("react").RefAttributes<HTMLButtonElement> & {
43
+ theme?: import("@emotion/react").Theme | undefined;
44
+ } & Pick<TDataCell, "isRowCollapsed">, {}, {}>;
45
+ export { getPaddingStyle, getVerticalAlignmentStyle, getHorizontalAlignmentStyle, getCellInnerStyles, BaseCell, CellInner, BaseFooterCell, RowExpandCollapseButton, };
@@ -0,0 +1,10 @@
1
+ import type { MouseEvent } from 'react';
2
+ declare type TColumnResizer = {
3
+ onMouseDown?: (event: MouseEvent) => void;
4
+ isOnDataCell?: boolean;
5
+ };
6
+ declare const ColumnResizer: {
7
+ (props: TColumnResizer): import("@emotion/react/jsx-runtime").JSX.Element;
8
+ displayName: string;
9
+ };
10
+ export default ColumnResizer;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").Context<{}>;
3
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { TColumn, TRow, TDataTableProps } from './data-table';
2
+ export declare type TDataRow<Row extends TRow = TRow> = {
3
+ row: Row;
4
+ rowIndex: number;
5
+ columns: TColumn[];
6
+ shouldClipContent: boolean;
7
+ shouldRenderBottomBorder: boolean;
8
+ } & Pick<TDataTableProps, 'onRowClick' | 'isCondensed' | 'verticalCellAlignment' | 'horizontalCellAlignment' | 'itemRenderer'>;
9
+ declare const DataRow: {
10
+ <Row extends TRow = TRow>(props: TDataRow<Row>): import("@emotion/react/jsx-runtime").JSX.Element;
11
+ defaultProps: Pick<TDataRow<TRow>, "isCondensed" | "horizontalCellAlignment" | "verticalCellAlignment" | "itemRenderer" | "shouldRenderBottomBorder" | "shouldClipContent">;
12
+ displayName: string;
13
+ };
14
+ export default DataRow;
@@ -0,0 +1,42 @@
1
+ import { ReactNode, MouseEventHandler } from 'react';
2
+ export interface TRow {
3
+ id: string;
4
+ }
5
+ export declare type TColumn<Row extends TRow = TRow> = {
6
+ key: string;
7
+ label: ReactNode;
8
+ width?: string;
9
+ align?: 'left' | 'center' | 'right';
10
+ onClick?: (event: MouseEventHandler) => void;
11
+ renderItem?: (row: Row, isRowCollapsed: boolean) => ReactNode;
12
+ headerIcon?: ReactNode;
13
+ isTruncated?: boolean;
14
+ isSortable?: boolean;
15
+ disableResizing?: boolean;
16
+ shouldIgnoreRowClick?: boolean;
17
+ };
18
+ export declare type TDataTableProps<Row extends TRow = TRow> = {
19
+ rows: Row[];
20
+ columns: TColumn[];
21
+ footer?: ReactNode;
22
+ maxWidth?: number | string;
23
+ maxHeight?: number | string;
24
+ onRowClick?: (row: TRow, rowIndex: number, columnKey: string) => void;
25
+ isCondensed?: boolean;
26
+ onColumnResized?: (args: TColumn<Row>[]) => void;
27
+ disableSelfContainment?: boolean;
28
+ disableHeaderStickiness?: boolean;
29
+ itemRenderer: (item: TRow, column: TColumn<Row>, isRowCollapsed: boolean) => ReactNode;
30
+ wrapHeaderLabels?: boolean;
31
+ verticalCellAlignment?: 'top' | 'center' | 'bottom';
32
+ horizontalCellAlignment?: 'left' | 'center' | 'right';
33
+ sortedBy?: string;
34
+ onSortChange?: (columnKey: string, sortDirection: 'asc' | 'desc') => void;
35
+ sortDirection?: 'desc' | 'asc';
36
+ };
37
+ declare const DataTable: {
38
+ <Row extends TRow = TRow>(props: TDataTableProps<Row>): import("@emotion/react/jsx-runtime").JSX.Element;
39
+ defaultProps: Pick<TDataTableProps<TRow>, "isCondensed" | "wrapHeaderLabels" | "horizontalCellAlignment" | "verticalCellAlignment" | "disableSelfContainment" | "itemRenderer">;
40
+ displayName: string;
41
+ };
42
+ export default DataTable;
@@ -0,0 +1,38 @@
1
+ /// <reference types="react" />
2
+ import type { TDataTableProps } from './data-table';
3
+ import type { TDataRow } from './data-row';
4
+ declare type TGetClickableRowStyle = {
5
+ isRowClickable?: TDataRow['onRowClick'];
6
+ };
7
+ declare type TTableContainer = {
8
+ isBeingResized?: boolean;
9
+ maxWidth?: string | number;
10
+ disableSelfContainment: boolean;
11
+ };
12
+ declare const TableContainer: import("@emotion/styled").StyledComponent<{
13
+ theme?: import("@emotion/react").Theme | undefined;
14
+ as?: import("react").ElementType<any> | undefined;
15
+ } & TTableContainer, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
+ declare type TTableGrid = {
17
+ resizedTotalWidth?: number;
18
+ columns?: TDataTableProps['columns'];
19
+ disableSelfContainment: boolean;
20
+ maxHeight?: string | number;
21
+ };
22
+ declare const TableGrid: import("@emotion/styled").StyledComponent<{
23
+ theme?: import("@emotion/react").Theme | undefined;
24
+ as?: import("react").ElementType<any> | undefined;
25
+ } & TTableGrid, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
26
+ declare const Header: import("@emotion/styled").StyledComponent<{
27
+ theme?: import("@emotion/react").Theme | undefined;
28
+ as?: import("react").ElementType<any> | undefined;
29
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, {}>;
30
+ declare const Body: import("@emotion/styled").StyledComponent<{
31
+ theme?: import("@emotion/react").Theme | undefined;
32
+ as?: import("react").ElementType<any> | undefined;
33
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, {}>;
34
+ declare const Row: import("@emotion/styled").StyledComponent<{
35
+ theme?: import("@emotion/react").Theme | undefined;
36
+ as?: import("react").ElementType<any> | undefined;
37
+ } & TGetClickableRowStyle, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, {}>;
38
+ export { TableContainer, TableGrid, Header, Body, Row };
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ declare type TFooter = {
3
+ children: ReactNode;
4
+ isCondensed?: boolean;
5
+ horizontalCellAlignment?: 'left' | 'center' | 'right';
6
+ resizedTotalWidth?: number;
7
+ };
8
+ declare const Footer: import("@emotion/styled").StyledComponent<{
9
+ theme?: import("@emotion/react").Theme | undefined;
10
+ as?: import("react").ElementType<any> | undefined;
11
+ } & TFooter, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
+ export default Footer;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import type { TColumn } from './data-table';
3
+ export declare type THeaderCell = {
4
+ onClick?: (columnKey: string, sortDirection: 'asc' | 'desc') => void;
5
+ sortedBy?: string;
6
+ children: ReactNode;
7
+ columnKey: string;
8
+ columnWidth?: string;
9
+ shouldWrap?: boolean;
10
+ isSortable?: boolean;
11
+ isCondensed?: boolean;
12
+ sortDirection?: 'desc' | 'asc';
13
+ disableResizing?: boolean;
14
+ onColumnResized?: (args: TColumn[]) => void;
15
+ disableHeaderStickiness: boolean;
16
+ horizontalCellAlignment: 'left' | 'center' | 'right';
17
+ iconComponent?: ReactNode;
18
+ };
19
+ declare const HeaderCell: {
20
+ (props: THeaderCell): import("@emotion/react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ defaultProps: Pick<THeaderCell, "sortDirection" | "horizontalCellAlignment" | "disableHeaderStickiness">;
23
+ };
24
+ export default HeaderCell;
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import type { THeaderCell } from './header-cell';
3
+ declare type TGetSortableHeaderStyles = {
4
+ isActive?: boolean;
5
+ };
6
+ declare const HeaderCellInner: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any> | undefined;
9
+ } & Pick<THeaderCell, "isCondensed" | "horizontalCellAlignment" | "isSortable" | "shouldWrap"> & TGetSortableHeaderStyles, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ declare type TBaseHeaderCell = {
11
+ disableHeaderStickiness?: boolean;
12
+ shouldClipContent?: boolean;
13
+ };
14
+ declare const BaseHeaderCell: import("@emotion/styled").StyledComponent<{
15
+ theme?: import("@emotion/react").Theme | undefined;
16
+ as?: import("react").ElementType<any> | undefined;
17
+ } & TBaseHeaderCell, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
18
+ declare const HeaderLabelWrapper: import("@emotion/styled").StyledComponent<{
19
+ theme?: import("@emotion/react").Theme | undefined;
20
+ as?: import("react").ElementType<any> | undefined;
21
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
22
+ declare const HeaderIconWrapper: import("@emotion/styled").StyledComponent<{
23
+ theme?: import("@emotion/react").Theme | undefined;
24
+ as?: import("react").ElementType<any> | undefined;
25
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
26
+ export { HeaderCellInner, BaseHeaderCell, HeaderLabelWrapper, HeaderIconWrapper, };
@@ -0,0 +1,3 @@
1
+ export { default } from './data-table';
2
+ export { useRowSelection, useSorting } from '@commercetools-uikit/hooks';
3
+ export { default as version } from './version';
@@ -0,0 +1,20 @@
1
+ import { MutableRefObject } from 'react';
2
+ declare type TTableRef = MutableRefObject<HTMLTableElement | undefined>;
3
+ export declare type TRenderedColumnMeasurements = {
4
+ key: string | null;
5
+ width: number;
6
+ };
7
+ declare const useManualColumnResizing: (tableRef?: TTableRef | undefined) => {
8
+ reset: () => void;
9
+ getSizes: () => TRenderedColumnMeasurements[] | undefined;
10
+ startResizing: (headerRef: MutableRefObject<{
11
+ cellIndex: number;
12
+ } & HTMLTableElement>, mouseEvent: MouseEvent) => void;
13
+ onDragResizing: (event: MouseEvent, columnIndex: number) => void;
14
+ finishResizing: () => TRenderedColumnMeasurements[] | undefined;
15
+ getHasTableBeenResized: () => boolean | undefined;
16
+ getIsColumnBeingResized: (columnIndex: number) => boolean;
17
+ getIsAnyColumnBeingResized: () => boolean;
18
+ getTotalResizedTableWidth: () => number;
19
+ };
20
+ export default useManualColumnResizing;
@@ -0,0 +1,2 @@
1
+ declare const convertNumericDimensionToPixelValue: (dimensionValue: number | string) => string;
2
+ export default convertNumericDimensionToPixelValue;
@@ -0,0 +1,2 @@
1
+ declare const isFixedWidthValue: (value: string | number) => boolean;
2
+ export default isFixedWidthValue;
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/data-table",
3
3
  "description": "A component for rendering tabular data.",
4
- "version": "12.2.2",
4
+ "version": "12.2.6",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -11,7 +11,6 @@
11
11
  "homepage": "https://uikit.commercetools.com",
12
12
  "keywords": ["javascript", "design system", "react", "uikit"],
13
13
  "license": "MIT",
14
- "private": false,
15
14
  "publishConfig": {
16
15
  "access": "public"
17
16
  },
@@ -19,18 +18,15 @@
19
18
  "main": "dist/commercetools-uikit-data-table.cjs.js",
20
19
  "module": "dist/commercetools-uikit-data-table.esm.js",
21
20
  "files": ["dist"],
22
- "scripts": {
23
- "prepare": "../../../scripts/version.js replace"
24
- },
25
21
  "dependencies": {
26
- "@babel/runtime": "7.14.8",
27
- "@babel/runtime-corejs3": "7.14.8",
28
- "@commercetools-uikit/accessible-button": "12.2.2",
29
- "@commercetools-uikit/design-system": "12.2.2",
30
- "@commercetools-uikit/hooks": "12.2.2",
31
- "@commercetools-uikit/icons": "12.2.2",
32
- "@commercetools-uikit/secondary-icon-button": "12.2.2",
33
- "@commercetools-uikit/utils": "12.2.0",
22
+ "@babel/runtime": "7.16.3",
23
+ "@babel/runtime-corejs3": "7.16.3",
24
+ "@commercetools-uikit/accessible-button": "12.2.5",
25
+ "@commercetools-uikit/design-system": "12.2.5",
26
+ "@commercetools-uikit/hooks": "12.2.5",
27
+ "@commercetools-uikit/icons": "12.2.6",
28
+ "@commercetools-uikit/secondary-icon-button": "12.2.5",
29
+ "@commercetools-uikit/utils": "12.2.5",
34
30
  "@emotion/react": "^11.4.0",
35
31
  "@emotion/styled": "^11.3.0",
36
32
  "lodash": "4.17.21",
@@ -38,7 +34,7 @@
38
34
  "react-required-if": "1.0.3"
39
35
  },
40
36
  "devDependencies": {
41
- "@testing-library/react-hooks": "7.0.1",
37
+ "@testing-library/react-hooks": "7.0.2",
42
38
  "formik": "^2.2.9",
43
39
  "react": "17.0.2"
44
40
  },