@cloudwick/astral-ui 2.0.0 → 2.1.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.
- package/README.md +1 -1
- package/dist/components/adpIcon/svgObjects.d.ts +18 -9
- package/dist/components/checkboxGroup/index.d.ts +3 -3
- package/dist/components/dataTable/advancedFilters.d.ts +10 -0
- package/dist/components/dataTable/dataTableStoryHelpers.d.ts +1098 -0
- package/dist/components/dataTable/index.d.ts +147 -0
- package/dist/components/dataTable/pageSizeModal.d.ts +9 -0
- package/dist/components/dataTable/selectedFilterList.d.ts +20 -0
- package/dist/components/dataTable/settings.d.ts +10 -0
- package/dist/components/dataTable/table.d.ts +41 -0
- package/dist/components/radioGroup/index.d.ts +48 -0
- package/dist/css/index.min.css +1 -1
- package/dist/index.cjs.js +13 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +23 -2
- package/package.json +3 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { CellContext, OnChangeFn, type SortingState, type ColumnHelper, type SortingFnOption } from "@tanstack/react-table";
|
|
3
|
+
import { type Props as ISelectProps } from "../select";
|
|
4
|
+
import { type IconType } from "../adpIcon";
|
|
5
|
+
export type IColumn = {
|
|
6
|
+
id?: string;
|
|
7
|
+
key: string;
|
|
8
|
+
header: any;
|
|
9
|
+
cell?: (row: CellContext<any, any>) => ReactNode;
|
|
10
|
+
fixed?: boolean;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
enableSorting?: boolean;
|
|
13
|
+
enableResizing?: boolean;
|
|
14
|
+
sortingFn?: SortingFnOption<any>;
|
|
15
|
+
size?: number;
|
|
16
|
+
};
|
|
17
|
+
export interface FilterItem extends ISelectProps {
|
|
18
|
+
selectedValue?: any;
|
|
19
|
+
icon?: IconType;
|
|
20
|
+
title: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
onChange?: () => void;
|
|
23
|
+
}
|
|
24
|
+
interface AdvancedFilterItem extends FilterItem {
|
|
25
|
+
setSelectedValue?: (val: any) => void;
|
|
26
|
+
subTitle?: string;
|
|
27
|
+
}
|
|
28
|
+
interface IPaginationProps {
|
|
29
|
+
onPageSizeChange?: (args: number) => number;
|
|
30
|
+
onPageChange?: (args: number) => void;
|
|
31
|
+
totalRecords?: number;
|
|
32
|
+
offset?: number;
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
}
|
|
35
|
+
type FilterOption = {
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
type Filters = {
|
|
40
|
+
[key: string]: FilterOption | FilterOption[];
|
|
41
|
+
};
|
|
42
|
+
interface ITableProps<T> {
|
|
43
|
+
/**
|
|
44
|
+
* Defines the column structure for the Data Table, including column headers,
|
|
45
|
+
* accessors, and any additional configurations.
|
|
46
|
+
*/
|
|
47
|
+
columns: IColumn[];
|
|
48
|
+
/**
|
|
49
|
+
* The array of data objects that will populate the rows of the Data Table.
|
|
50
|
+
*/
|
|
51
|
+
data: T[];
|
|
52
|
+
/**
|
|
53
|
+
* Optional: Provide custom class names as a space-separated
|
|
54
|
+
* string to override the default Data Table styling.
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Configuration for applying advanced filters to the Data Table.
|
|
59
|
+
* Allows complex filtering logic and customization.
|
|
60
|
+
*/
|
|
61
|
+
advancedFilters?: AdvancedFilterItem[];
|
|
62
|
+
/**
|
|
63
|
+
* Configuration for applying basic filters to the Data Table.
|
|
64
|
+
* Enables simple filtering by key-value pairs.
|
|
65
|
+
* Showing maximum 3 basic filters in the table.
|
|
66
|
+
*/
|
|
67
|
+
basicFilters?: FilterItem[];
|
|
68
|
+
/**
|
|
69
|
+
* Allows to set filters by key-value pairs.
|
|
70
|
+
*/
|
|
71
|
+
filters?: Filters;
|
|
72
|
+
/**
|
|
73
|
+
* A callback function used to update the list of applied filters.
|
|
74
|
+
*/
|
|
75
|
+
setFilters?: (filters: Filters) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Boolean value to display a loading state in the Data Table,
|
|
78
|
+
* typically while loading or processing data.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* A callback function triggered to refresh the Data Table,
|
|
84
|
+
* typically re-fetching or updating the data.
|
|
85
|
+
*/
|
|
86
|
+
onRefresh?: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* To adjust the width of the columns
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
resizable?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* To adding virtualization for column in the data table
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
columnVirtualization?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* To adding virtualization for row in the data table
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
rowVirtualization?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* To pin the first columns of the data table
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
pinnedFirstColumn?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* To make the row selectable by showing checkboxes
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
selectable?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Callback function triggered on row selection.
|
|
114
|
+
* @param selectedRows - Index List of the selected rows
|
|
115
|
+
*/
|
|
116
|
+
onRowSelection?: (selectedRows: object) => void;
|
|
117
|
+
/**
|
|
118
|
+
* Allows to set sort by using key-value pair.
|
|
119
|
+
*/
|
|
120
|
+
sorting?: SortingState;
|
|
121
|
+
/**
|
|
122
|
+
* Callback function triggered on row sorting.
|
|
123
|
+
* @param sortState - Index List of the selected rows
|
|
124
|
+
*/
|
|
125
|
+
setSorting?: OnChangeFn<SortingState> | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Allows to set pagination props.
|
|
128
|
+
*/
|
|
129
|
+
paginationProps?: IPaginationProps;
|
|
130
|
+
/**
|
|
131
|
+
* To Adjust the height of the table.
|
|
132
|
+
* @default 100%
|
|
133
|
+
*/
|
|
134
|
+
height?: string;
|
|
135
|
+
/**
|
|
136
|
+
* To set the page size option
|
|
137
|
+
* @default PAGE_SIZE_OPTIONS
|
|
138
|
+
*/
|
|
139
|
+
pageSizeOptions?: number[];
|
|
140
|
+
/**
|
|
141
|
+
* To add the custom CTAs
|
|
142
|
+
*/
|
|
143
|
+
customCTAs?: ReactNode;
|
|
144
|
+
}
|
|
145
|
+
export declare const deriveConfiguredColumns: (rawColumns: IColumn[], selectable: boolean, columnHelper: ColumnHelper<any>) => import("@tanstack/react-table").AccessorKeyColumnDef<any, any>[];
|
|
146
|
+
export declare const DataTable: <T extends object>({ advancedFilters, basicFilters, className, columns, data, filters, loading, paginationProps, resizable, selectable, setFilters, sorting, columnVirtualization, rowVirtualization, setSorting, onRefresh, onRowSelection, height, pageSizeOptions, customCTAs }: ITableProps<T>) => ReactNode;
|
|
147
|
+
export default DataTable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type IRecordsChangeModal = {
|
|
2
|
+
show: boolean;
|
|
3
|
+
toggleVisibility: () => void;
|
|
4
|
+
setPageSize: (args: number) => void;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
pageSizeOptions?: number[];
|
|
7
|
+
};
|
|
8
|
+
declare const PageSizeModal: ({ show, pageSize, pageSizeOptions, toggleVisibility, setPageSize }: IRecordsChangeModal) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default PageSizeModal;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FilterItem } from ".";
|
|
2
|
+
interface FilterOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
interface SelectedFilters {
|
|
7
|
+
[key: string]: FilterOption[] | {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface SelectedFilterListProps {
|
|
13
|
+
advancedFilters?: FilterItem[];
|
|
14
|
+
selectedFilters: SelectedFilters;
|
|
15
|
+
basicFilters?: FilterItem[];
|
|
16
|
+
handleRemoveFilter: (filterId: string, index: number) => void;
|
|
17
|
+
handleClearAllSelectedFilters: () => void;
|
|
18
|
+
}
|
|
19
|
+
declare const SelectedFilterList: ({ advancedFilters, selectedFilters, basicFilters, handleRemoveFilter, handleClearAllSelectedFilters }: SelectedFilterListProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default SelectedFilterList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ColumnHelper } from "@tanstack/react-table";
|
|
2
|
+
import { type IColumn } from ".";
|
|
3
|
+
declare const Settings: ({ fields, setFields, selectable, columns, columnHelper }: {
|
|
4
|
+
fields: any[];
|
|
5
|
+
setFields: (args: any) => void;
|
|
6
|
+
selectable: boolean;
|
|
7
|
+
columns: IColumn[];
|
|
8
|
+
columnHelper: ColumnHelper<any>;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default Settings;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Table } from "@tanstack/react-table";
|
|
2
|
+
export type ITable<T> = {
|
|
3
|
+
table: Table<T>;
|
|
4
|
+
/**
|
|
5
|
+
* Enable column virtualization
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
columnVirtualization?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Enable row virtualization
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
rowVirtualization?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Make the columns selectable
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
selectable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Loading state of the table
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Enable column resizing
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
resizable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Height of the table
|
|
31
|
+
* @default "auto"
|
|
32
|
+
*/
|
|
33
|
+
height?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Enable RTL mode
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
isRtl?: boolean;
|
|
39
|
+
};
|
|
40
|
+
declare const Table: <T extends object>({ table, columnVirtualization, rowVirtualization, selectable, resizable, loading, height, isRtl }: ITable<T>) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export default Table;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { type RadioProps } from "../radio";
|
|
3
|
+
export declare enum RadioGroupSizes {
|
|
4
|
+
SM = "sm",
|
|
5
|
+
MD = "md",
|
|
6
|
+
LG = "lg"
|
|
7
|
+
}
|
|
8
|
+
export type RadioGroupSize = `${RadioGroupSizes}`;
|
|
9
|
+
export interface Props extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
|
|
10
|
+
/**
|
|
11
|
+
* Size of the Radio group.
|
|
12
|
+
* @default md
|
|
13
|
+
*/
|
|
14
|
+
size?: RadioGroupSize;
|
|
15
|
+
/**
|
|
16
|
+
* Pass space separated class names to override the RadioGroup styling
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Pass boolean value to disable the component.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Selected value
|
|
26
|
+
*/
|
|
27
|
+
selectedValue?: string;
|
|
28
|
+
/**
|
|
29
|
+
* An array of objects of radio props type
|
|
30
|
+
*/
|
|
31
|
+
options: RadioProps[];
|
|
32
|
+
/**
|
|
33
|
+
* Callback function that is called when the radio group selection changes.
|
|
34
|
+
* A selected value is passed as an argument to the function.
|
|
35
|
+
*/
|
|
36
|
+
onChange?: (arg: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Placement of the radio
|
|
39
|
+
* @default "start"
|
|
40
|
+
*/
|
|
41
|
+
radioPlacement?: "start" | "end";
|
|
42
|
+
/**
|
|
43
|
+
* Variant of the RadioGroup
|
|
44
|
+
* @default outline
|
|
45
|
+
*/
|
|
46
|
+
variant?: "outline" | "text";
|
|
47
|
+
}
|
|
48
|
+
export declare const RadioGroup: ({ size, options, onChange, className, selectedValue, disabled, radioPlacement, variant }: Props) => ReactElement;
|