@digital-ai/dot-components 1.6.1 → 1.6.2
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.
- package/CHANGE_LOG.md +27 -6
- package/dot-components.esm.js +618 -339
- package/dot-components.umd.js +616 -339
- package/lib/components/index.d.ts +2 -9
- package/lib/components/table/Table.d.ts +4 -1
- package/lib/components/table/TableBody.d.ts +4 -1
- package/lib/components/table/TableBodyCheckboxCell.d.ts +8 -0
- package/lib/components/table/TableBodyCheckboxCell.styles.d.ts +3 -0
- package/lib/components/table/TableHeader.d.ts +3 -1
- package/lib/components/table/TableHeaderCheckboxCell.d.ts +8 -0
- package/lib/components/table/TableHeaderCheckboxCell.styles.d.ts +3 -0
- package/lib/components/table/TableRow.d.ts +4 -1
- package/lib/components/table/TableRow.styles.d.ts +2 -0
- package/lib/components/table/TableSelectionToolbar.d.ts +7 -0
- package/lib/components/table/TableSelectionToolbar.styles.d.ts +3 -0
- package/lib/components/table/index.d.ts +10 -0
- package/lib/components/table/utils/helpers.d.ts +2 -0
- package/lib/components/table/utils/models.d.ts +21 -0
- package/package.json +1 -1
|
@@ -19,12 +19,7 @@ export type { RadioButtonProps } from './radio/RadioButton';
|
|
|
19
19
|
export type { RadioGroupProps } from './radio/RadioGroup';
|
|
20
20
|
export type { BackItemProps, SidebarProps } from './sidebar/Sidebar';
|
|
21
21
|
export type { SwitchProps } from './switch/Switch';
|
|
22
|
-
export type { TableRowProps } from './table
|
|
23
|
-
export type { TextAlignment } from './table/TableCell';
|
|
24
|
-
export type { DotColumnHeader, Order } from './table/TableHeader';
|
|
25
|
-
export type { SortDirection } from './table/TableHeaderCell';
|
|
26
|
-
export type { TableDataWithPagination } from './table/TableDataWithPagination';
|
|
27
|
-
export type { RowsPerPageOption } from './table/TablePagination';
|
|
22
|
+
export type { DotColumnHeader, MultiSelect, Order, RowSelectionChangeHandler, RowsPerPageOption, TableDataWithPagination, TableRowProps, TableRowSelectChangeHandler, TextAlignment, SortDirection, } from './table';
|
|
28
23
|
export type { TabProps } from './tabs/Tabs';
|
|
29
24
|
export type { TypographyVariant } from './typography/Typography';
|
|
30
25
|
export type { ProgressButtonProps } from './progress-button/ProgressButton';
|
|
@@ -77,10 +72,8 @@ export { DotSnackbarContainer, DotSnackbarProvider, useDotSnackbarContext, } fro
|
|
|
77
72
|
export { DotSplitButton } from './split-button/SplitButton';
|
|
78
73
|
export { DotProgressButton } from './progress-button/ProgressButton';
|
|
79
74
|
export { DotSwitch } from './switch/Switch';
|
|
80
|
-
export { DotTable } from './table
|
|
75
|
+
export { DotHeaderRow, DotTable, DotTablePagination } from './table';
|
|
81
76
|
export { DotTooltip } from './tooltip/Tooltip';
|
|
82
|
-
export { DotHeaderRow } from './table/TableHeader';
|
|
83
|
-
export { DotTablePagination } from './table/TablePagination';
|
|
84
77
|
export { DotTabs } from './tabs/Tabs';
|
|
85
78
|
export { DotTypography } from './typography/Typography';
|
|
86
79
|
export { DotFileUpload } from './file-upload/FileUpload';
|
|
@@ -3,6 +3,7 @@ import { CommonProps } from '../CommonProps';
|
|
|
3
3
|
import { DotColumnHeader, Order } from './TableHeader';
|
|
4
4
|
import { RowsPerPageOption } from './TablePagination';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
+
import { MultiSelect } from './utils/models';
|
|
6
7
|
export declare const TABLE_TYPOGRAPHY_VARIANT = "body1";
|
|
7
8
|
export interface TableRowProps extends CommonProps {
|
|
8
9
|
/** row identifier that will be passed to onRowClick callback */
|
|
@@ -35,6 +36,8 @@ export interface TableProps extends CommonProps {
|
|
|
35
36
|
loading?: boolean;
|
|
36
37
|
/** Maximum height of table container */
|
|
37
38
|
maxHeight?: string;
|
|
39
|
+
/** Optional multi-select checkbox object **/
|
|
40
|
+
multiSelect?: MultiSelect;
|
|
38
41
|
/** Row click event callback */
|
|
39
42
|
onRowClick?: (event: MouseEvent, id: string) => void;
|
|
40
43
|
/** Update data callback if data is managed by consumer */
|
|
@@ -61,4 +64,4 @@ export declare function stableSort<T>(array: T[], comparator: (order: T, orderBy
|
|
|
61
64
|
* A wrapper component around the Table component from @material-ui. This component can be used for
|
|
62
65
|
* creating a common structure for tables in the system.
|
|
63
66
|
*/
|
|
64
|
-
export declare const DotTable: ({ ariaLabel, bodyTypography, className, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, loading, maxHeight, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element;
|
|
67
|
+
export declare const DotTable: ({ ariaLabel, bodyTypography, className, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, loading, maxHeight, multiSelect, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { DotColumnHeader } from './TableHeader';
|
|
|
3
3
|
import { TableRowProps } from './Table';
|
|
4
4
|
import { CommonProps } from '../CommonProps';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
+
import { MultiSelectBody } from './utils/models';
|
|
6
7
|
export interface TableBodyProps extends CommonProps {
|
|
7
8
|
/** The table column headers */
|
|
8
9
|
columns: Array<DotColumnHeader>;
|
|
@@ -10,6 +11,8 @@ export interface TableBodyProps extends CommonProps {
|
|
|
10
11
|
data: Array<TableRowProps>;
|
|
11
12
|
/** Message to show if no data */
|
|
12
13
|
emptyMessage?: string;
|
|
14
|
+
/** Optional multi-select checkbox body object **/
|
|
15
|
+
multiSelectBody?: MultiSelectBody;
|
|
13
16
|
/** Row click event callback */
|
|
14
17
|
onRowClick?: (event: MouseEvent, id: string) => void;
|
|
15
18
|
/** Typography variant which will be used for body cell values **/
|
|
@@ -19,4 +22,4 @@ export interface TableBodyProps extends CommonProps {
|
|
|
19
22
|
* A wrapper component around the TableBody component from @material-ui. This component can be used
|
|
20
23
|
* to determine the functionality of the table.
|
|
21
24
|
*/
|
|
22
|
-
export declare const DotTableBody: ({ columns, data, emptyMessage, onRowClick, typography, }: TableBodyProps) => JSX.Element;
|
|
25
|
+
export declare const DotTableBody: ({ columns, data, emptyMessage, multiSelectBody, onRowClick, typography, }: TableBodyProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CommonProps } from '../CommonProps';
|
|
3
|
+
export interface DotBodyCheckboxCellProps extends CommonProps {
|
|
4
|
+
isChecked: boolean;
|
|
5
|
+
onChange: (isChecked: boolean, rowId: string) => void;
|
|
6
|
+
rowId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const DotBodyCheckboxCell: ({ ariaLabel, className, "data-testid": dataTestId, isChecked, onChange, rowId, }: DotBodyCheckboxCellProps) => ReactElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextAlignment } from './TableCell';
|
|
3
3
|
import { TypographyVariant } from '../typography/Typography';
|
|
4
|
+
import { MultiSelectHeader } from './utils/models';
|
|
4
5
|
export interface DotColumnHeader {
|
|
5
6
|
align?: TextAlignment;
|
|
6
7
|
id: string;
|
|
@@ -13,6 +14,7 @@ export declare type Order = 'asc' | 'desc';
|
|
|
13
14
|
export interface HeaderProps {
|
|
14
15
|
columns: Array<DotColumnHeader>;
|
|
15
16
|
hasActionColumn: boolean;
|
|
17
|
+
multiSelectHeader?: MultiSelectHeader;
|
|
16
18
|
onRequestSort: (property: string) => void;
|
|
17
19
|
order?: Order;
|
|
18
20
|
/** The ID of the column that you are sorting by */
|
|
@@ -24,4 +26,4 @@ export interface HeaderProps {
|
|
|
24
26
|
* A wrapper component around the TableHead component from @material-ui. This component can be used
|
|
25
27
|
* to determine the functionality of the table header.
|
|
26
28
|
*/
|
|
27
|
-
export declare const DotHeaderRow: ({ columns, hasActionColumn, onRequestSort, order, orderBy, sortable, typography, }: HeaderProps) => JSX.Element;
|
|
29
|
+
export declare const DotHeaderRow: ({ columns, hasActionColumn, multiSelectHeader, onRequestSort, order, orderBy, sortable, typography, }: HeaderProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CommonProps } from '../CommonProps';
|
|
3
|
+
import { MultiSelectState, TableRowSelectChangeHandler } from './utils/models';
|
|
4
|
+
export interface DotHeaderCheckboxCellProps extends CommonProps {
|
|
5
|
+
multiSelectState: MultiSelectState;
|
|
6
|
+
onCheckAllChange: TableRowSelectChangeHandler;
|
|
7
|
+
}
|
|
8
|
+
export declare const DotHeaderCheckboxCell: ({ ariaLabel, className, "data-testid": dataTestId, multiSelectState, onCheckAllChange, }: DotHeaderCheckboxCellProps) => ReactElement;
|
|
@@ -3,6 +3,7 @@ import { DotColumnHeader } from './TableHeader';
|
|
|
3
3
|
import { CommonProps } from '../CommonProps';
|
|
4
4
|
import { TableRowProps } from './Table';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
+
import { MultiSelectBody } from './utils/models';
|
|
6
7
|
export interface EmptyRowProps {
|
|
7
8
|
cols: number;
|
|
8
9
|
message?: string;
|
|
@@ -13,6 +14,8 @@ export interface RowProps extends CommonProps {
|
|
|
13
14
|
columns: Array<DotColumnHeader>;
|
|
14
15
|
/** The table body row data */
|
|
15
16
|
data: TableRowProps;
|
|
17
|
+
/** Optional multi-select checkbox body object **/
|
|
18
|
+
multiSelectBody?: MultiSelectBody;
|
|
16
19
|
/** Event callback of action button of menu */
|
|
17
20
|
onActionMenuTrigger: (el: HTMLElement, menuItem: Array<ReactNode>) => void;
|
|
18
21
|
/** Event callback */
|
|
@@ -28,5 +31,5 @@ export interface RowProps extends CommonProps {
|
|
|
28
31
|
* A wrapper component around the TableRow component from @material-ui. This component can be used
|
|
29
32
|
* for manipulating data prior to displaying the data inside the table
|
|
30
33
|
*/
|
|
31
|
-
export declare const DotTableRow: ({ columns, className, data, onActionMenuTrigger, onClick, rowKey, selected, typography, }: RowProps) => JSX.Element;
|
|
34
|
+
export declare const DotTableRow: ({ columns, className, data, multiSelectBody, onActionMenuTrigger, onClick, rowKey, selected, typography, }: RowProps) => JSX.Element;
|
|
32
35
|
export declare const EmptyDotRow: ({ cols, message, typography, }: EmptyRowProps) => JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const rootClassName = "dot-tr";
|
|
2
|
+
export declare const StyledTableRowStyles: import("styled-components").StyledComponent<import("@material-ui/core/OverridableComponent").OverridableComponent<import("@material-ui/core").TableRowTypeMap<{}, "tr">>, any, {}, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CommonProps } from '../CommonProps';
|
|
3
|
+
export interface TableSelectionToolbarProps extends CommonProps {
|
|
4
|
+
bulkActions?: ReactNode;
|
|
5
|
+
selectedRowsNumber: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const DotTableSelectionToolbar: ({ ariaLabel, bulkActions, className, "data-testid": dataTestId, selectedRowsNumber, }: TableSelectionToolbarProps) => JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const rootClassName = "dot-table-selection-toolbar";
|
|
3
|
+
export declare const StyledTableSelectionToolbar: import("styled-components").StyledComponent<({ ariaLabel, children, className, "data-testid": dataTestId, variant, }: import("../action-toolbar/ActionToolbar").DotActionBarProps) => JSX.Element, any, {}, never>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { TableRowProps } from './Table';
|
|
2
|
+
export type { TextAlignment } from './TableCell';
|
|
3
|
+
export type { TableDataWithPagination } from './TableDataWithPagination';
|
|
4
|
+
export type { DotColumnHeader, Order } from './TableHeader';
|
|
5
|
+
export type { SortDirection } from './TableHeaderCell';
|
|
6
|
+
export type { RowsPerPageOption } from './TablePagination';
|
|
7
|
+
export type { MultiSelect, TableRowSelectChangeHandler, RowSelectionChangeHandler, } from './utils/models';
|
|
8
|
+
export { DotTablePagination } from './TablePagination';
|
|
9
|
+
export { DotTable } from './Table';
|
|
10
|
+
export { DotHeaderRow } from './TableHeader';
|
|
@@ -5,3 +5,5 @@ import { DotColumnHeader } from '../TableHeader';
|
|
|
5
5
|
export declare const getFormattedTableCellValue: (value: unknown, typographyVariant: TypographyVariant) => ReactNode;
|
|
6
6
|
export declare const getContainerMaxHeightStyle: (stickyHeader?: boolean, maxHeight?: string) => string;
|
|
7
7
|
export declare const checkIfActionColumnExist: (columns: DotColumnHeader[], tableData: TableRowProps[]) => boolean;
|
|
8
|
+
export declare const getSelectedRowIds: (id: string, isChecked: boolean, selectedIds: string[]) => string[];
|
|
9
|
+
export declare const getBulkSelectedRowIds: (isChecked: boolean, selectedIds: string[], pageData: TableRowProps[]) => string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TableRowProps } from '../Table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare type RowSelectionChangeHandler = (isChecked: boolean, rowId: string) => void;
|
|
4
|
+
export declare type MultiSelectState = 'unchecked' | 'checked' | 'indeterminate';
|
|
5
|
+
export declare type TableRowSelectChangeHandler = (isChecked: boolean, selectedTableRowIds: string[]) => void;
|
|
6
|
+
export interface MultiSelect {
|
|
7
|
+
bulkActions?: ReactNode;
|
|
8
|
+
onCheckAllChange?: TableRowSelectChangeHandler;
|
|
9
|
+
onCheckRowChange?: TableRowSelectChangeHandler;
|
|
10
|
+
}
|
|
11
|
+
interface MultiSelectTableBase {
|
|
12
|
+
selectedTableRowIds: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface MultiSelectHeader extends MultiSelectTableBase {
|
|
15
|
+
onCheckAllChange: TableRowSelectChangeHandler;
|
|
16
|
+
pageData: TableRowProps[];
|
|
17
|
+
}
|
|
18
|
+
export interface MultiSelectBody extends MultiSelectTableBase {
|
|
19
|
+
onCheckIndividualChange?: RowSelectionChangeHandler;
|
|
20
|
+
}
|
|
21
|
+
export {};
|