@cloudwick/astral-ui 2.2.0 → 3.0.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI Library for Cloudwick
4
4
 
5
- Version - 2.2.0
5
+ Version - 3.0.0
6
6
 
7
7
  ## Installation
8
8
 
@@ -77,6 +77,7 @@ export declare const iconList: {
77
77
  readonly currentBalance: "current-balance";
78
78
  readonly customIcon: "custom-icon";
79
79
  readonly customModel: "custom-model";
80
+ readonly danger: "danger";
80
81
  readonly dashboard: "dashboard";
81
82
  readonly database: "database";
82
83
  readonly databaseMaintenance: "database-maintenance";
@@ -91,6 +92,7 @@ export declare const iconList: {
91
92
  readonly disable: "disable";
92
93
  readonly disableMFA: "disable-mfa";
93
94
  readonly disconnect: "disconnect";
95
+ readonly documentUpload: "document-upload";
94
96
  readonly domains: "domains";
95
97
  readonly doubleCheck: "double-check";
96
98
  readonly downArrow: "down-arrow";
@@ -18,7 +18,7 @@ export declare const basicFilters: ({
18
18
  placeholder: string;
19
19
  icon: "access-request";
20
20
  })[];
21
- export declare const columns: IColumn[];
21
+ export declare const dataColumns: IColumn[];
22
22
  export declare const posts: {
23
23
  userId: number;
24
24
  id: number;
@@ -42,7 +42,8 @@ export declare const basicFilterOptions: ({
42
42
  title: string;
43
43
  placeholder: string;
44
44
  icon: "statistic";
45
- multiSelect?: undefined;
45
+ isMulti?: undefined;
46
+ maxVisibleValues?: undefined;
46
47
  } | {
47
48
  options: {
48
49
  value: string;
@@ -52,7 +53,8 @@ export declare const basicFilterOptions: ({
52
53
  title: string;
53
54
  placeholder: string;
54
55
  icon: "table-pivot";
55
- multiSelect: boolean;
56
+ isMulti: boolean;
57
+ maxVisibleValues: number;
56
58
  } | {
57
59
  options: {
58
60
  value: string;
@@ -62,7 +64,8 @@ export declare const basicFilterOptions: ({
62
64
  title: string;
63
65
  placeholder: string;
64
66
  icon: "globe";
65
- multiSelect?: undefined;
67
+ isMulti?: undefined;
68
+ maxVisibleValues?: undefined;
66
69
  })[];
67
70
  export declare const advancedFilterOptions: ({
68
71
  options: {
@@ -73,7 +76,7 @@ export declare const advancedFilterOptions: ({
73
76
  title: string;
74
77
  subTitle: string;
75
78
  icon: "bookmark";
76
- multiSelect: boolean;
79
+ isMulti: boolean;
77
80
  } | {
78
81
  options: {
79
82
  value: string;
@@ -83,7 +86,7 @@ export declare const advancedFilterOptions: ({
83
86
  title: string;
84
87
  subTitle: string;
85
88
  icon: "tag";
86
- multiSelect?: undefined;
89
+ isMulti?: undefined;
87
90
  })[];
88
91
  export declare const dummydatasetListColumn: ({
89
92
  key: string;
@@ -1,18 +1,46 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import { CellContext, OnChangeFn, type SortingState, type SortingFnOption } from "@tanstack/react-table";
3
+ import { Props as ITextFieldProps } from "../textField";
3
4
  import { type Props as ISelectProps } from "../select";
4
5
  import { type IconType } from "../adpIcon";
5
6
  export type IColumn = {
6
7
  id?: string;
7
8
  key: string;
8
- header: any;
9
+ header?: any;
9
10
  cell?: (row: CellContext<any, any>) => ReactNode;
11
+ /**
12
+ * A fixed column -
13
+ * * Cannot be re-ordered or hidden using the Column Preference panel
14
+ * * The column will always be placed on the left side of the table irrespective of the index of the column configuration in IColumn[]
15
+ *
16
+ * @default false
17
+ */
10
18
  fixed?: boolean;
19
+ /**
20
+ * Handle the visibility of the column
21
+ * @default false
22
+ */
11
23
  selected?: boolean;
24
+ /**
25
+ * To make the column sortable
26
+ * @default true
27
+ */
12
28
  enableSorting?: boolean;
29
+ /**
30
+ * To make the column resizable
31
+ * @default true
32
+ */
13
33
  enableResizing?: boolean;
14
34
  sortingFn?: SortingFnOption<any>;
35
+ /**
36
+ * To adjust the width of the column
37
+ */
15
38
  size?: number;
39
+ /**
40
+ * Hides the column from the Column Preference panel
41
+ * @default false
42
+ */
43
+ hideColPreference?: boolean;
16
44
  };
17
45
  export interface FilterItem extends ISelectProps {
18
46
  selectedValue?: any;
@@ -25,6 +53,16 @@ interface AdvancedFilterItem extends FilterItem {
25
53
  setSelectedValue?: (val: any) => void;
26
54
  subTitle?: string;
27
55
  }
56
+ interface ISearchProps extends Pick<ITextFieldProps, "placeholder" | "hidden" | "onChange" | "value"> {
57
+ /**
58
+ * Props to control the onSearch function debounceTime
59
+ */
60
+ debounceTime: number;
61
+ /**
62
+ * Attach the debounced search function
63
+ */
64
+ onSearch: (value: string) => void;
65
+ }
28
66
  interface IPaginationProps {
29
67
  onPageSizeChange?: (args: number) => void;
30
68
  onPageChange?: (args: number) => void;
@@ -141,6 +179,15 @@ interface ITableProps<T> {
141
179
  * To add the custom CTAs
142
180
  */
143
181
  customCTAs?: ReactNode;
182
+ /**
183
+ * Callback function triggered on change of Column Preferences.
184
+ * @param columns - columns array with updated order and selected key value
185
+ */
186
+ setColumns: (columns: IColumn[]) => void;
187
+ /**
188
+ * Allows to set search textfield props.
189
+ */
190
+ searchProps: ISearchProps;
144
191
  }
145
- 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;
192
+ export declare const DataTable: <T extends object>({ advancedFilters, basicFilters, className, columns, data, filters, loading, paginationProps, resizable, selectable, sorting, columnVirtualization, rowVirtualization, height, pageSizeOptions, customCTAs, searchProps, setFilters, setSorting, onRefresh, onRowSelection, setColumns }: ITableProps<T>) => ReactNode;
146
193
  export default DataTable;
@@ -1,9 +1,10 @@
1
1
  export type IRecordsChangeModal = {
2
2
  show: boolean;
3
3
  toggleVisibility: () => void;
4
- setPageSize: (args: number) => void;
4
+ onPageSizeChange?: (args: number) => void;
5
+ onPageChange?: (args: number) => void;
5
6
  pageSize: number;
6
7
  pageSizeOptions?: number[];
7
8
  };
8
- declare const PageSizeModal: ({ show, pageSize, pageSizeOptions, toggleVisibility, setPageSize }: IRecordsChangeModal) => import("react/jsx-runtime").JSX.Element;
9
+ declare const PageSizeModal: ({ show, pageSize, pageSizeOptions, toggleVisibility, onPageSizeChange: setPageSize, onPageChange }: IRecordsChangeModal) => import("react/jsx-runtime").JSX.Element;
9
10
  export default PageSizeModal;
@@ -1,10 +1,6 @@
1
- import { type ColumnHelper } from "@tanstack/react-table";
2
1
  import { type IColumn } from ".";
3
- declare const Settings: ({ fields, setFields, selectable, columns, columnHelper }: {
4
- fields: any[];
5
- setFields: (args: any) => void;
6
- selectable: boolean;
2
+ declare const Settings: ({ columns, setColumns }: {
7
3
  columns: IColumn[];
8
- columnHelper: ColumnHelper<any>;
4
+ setColumns: (columns: IColumn[]) => void;
9
5
  }) => import("react/jsx-runtime").JSX.Element;
10
6
  export default Settings;
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ export interface FileUploadProps {
3
+ /**
4
+ * Array of accepted file extensions
5
+ * @example [".json", ".csv"]
6
+ * @default []
7
+ */
8
+ acceptedExtensions: string[];
9
+ /**
10
+ * Custom message displayed in the drop area
11
+ */
12
+ dropAreaCustomMessage?: React.ReactNode;
13
+ /**
14
+ * State tracking the upload progress and error messages for each file.
15
+ * @default null
16
+ */
17
+ uploadState: Record<string, {
18
+ error: boolean;
19
+ helperText?: React.ReactNode;
20
+ progress: number;
21
+ }> | null;
22
+ /**
23
+ * Determines if multiple file uploads are allowed.
24
+ * When `false`, only one file can be selected or dropped at a time.
25
+ * @default true
26
+ */
27
+ multiple?: boolean;
28
+ /**
29
+ * Disables the upload functionality.
30
+ * @default false
31
+ */
32
+ disabled?: boolean;
33
+ /**
34
+ * Additional informational text to display about file requirements or upload instructions.
35
+ * @default null
36
+ */
37
+ infoText?: React.ReactNode;
38
+ /**
39
+ * Maximum allowed file size in bytes.
40
+ * @example 5 * 1024 * 1024 (5 MB)
41
+ */
42
+ maxFileSize?: number;
43
+ /**
44
+ * Function to retry uploading files that failed during the initial upload attempt.
45
+ * Called when user wants to retry uploading files that encountered errors.
46
+ */
47
+ retryFailedUpload?: () => void;
48
+ /**
49
+ * Function to reset the upload state.
50
+ */
51
+ resetUploadState: () => void;
52
+ /**
53
+ * Function triggered after file validation to handle the upload logic.
54
+ * Receives either a single file or an array of files based on the `multiple` prop.
55
+ */
56
+ handleUpload: (file: File | File[]) => void;
57
+ }
58
+ export declare const FileUpload: ({ acceptedExtensions, dropAreaCustomMessage, resetUploadState, handleUpload, uploadState, multiple, disabled, infoText, maxFileSize, retryFailedUpload }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ interface StatusCardProps {
3
+ fileEntry: {
4
+ file: File;
5
+ state: string;
6
+ };
7
+ uploadState: Record<string, {
8
+ error: boolean;
9
+ helperText?: React.ReactNode;
10
+ progress: number;
11
+ }> | null;
12
+ maxFileSize?: number;
13
+ disabled: boolean;
14
+ acceptedExtensions: string[];
15
+ removeFile: (fileName: string) => void;
16
+ }
17
+ export declare const StatusCard: ({ fileEntry, uploadState, maxFileSize, disabled, acceptedExtensions, removeFile }: StatusCardProps) => import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare const AllStateStory: () => import("react/jsx-runtime").JSX.Element;