@cloudwick/astral-ui 5.1.0 → 5.2.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/adpIcon.d.ts +64 -0
- package/dist/components/adpIcon/svgObjects.d.ts +268 -0
- package/dist/components/adpIcon/svgObjects.js +6 -0
- package/dist/components/adpIcon/svgObjects.js.map +1 -1
- package/dist/components/badge/badgeVariants.d.ts +5 -0
- package/dist/components/button/buttonVariants.d.ts +6 -0
- package/dist/components/checkbox/checkbox.d.ts +29 -0
- package/dist/components/checkboxGroup/checkboxGroup.d.ts +47 -0
- package/dist/components/ctaGroup/ctaGroup.d.ts +32 -0
- package/dist/components/ctaGroup/ctaGroup.js +6 -6
- package/dist/components/ctaGroup/ctaGroup.js.map +1 -1
- package/dist/components/ctaGroup/ctaGroupVariants.d.ts +5 -0
- package/dist/components/ctaGroup/ctaGroupVariants.js +22 -5
- package/dist/components/ctaGroup/ctaGroupVariants.js.map +1 -1
- package/dist/components/dataTable/dataTable.d.ts +143 -0
- package/dist/components/datePicker/datePicker.d.ts +39 -0
- package/dist/components/fileUpload/statusCardVariants.d.ts +3 -0
- package/dist/components/pagination/pagination.d.ts +42 -0
- package/dist/components/panel/panel.d.ts +54 -0
- package/dist/components/panel/panelHeader.d.ts +38 -0
- package/dist/components/progress/progress.d.ts +67 -0
- package/dist/components/progress/progressVariants.d.ts +24 -0
- package/dist/components/radio/radio.d.ts +19 -0
- package/dist/components/radioGroup/radioGroup.d.ts +53 -0
- package/dist/components/scrollbar/scrollbar.d.ts +43 -0
- package/dist/components/tabs/tabs.d.ts +119 -0
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tabs/tabsVariants.d.ts +12 -0
- package/dist/components/tabs/tabsVariants.js +55 -10
- package/dist/components/tabs/tabsVariants.js.map +1 -1
- package/dist/components/textField/textField.d.ts +48 -0
- package/dist/components/textarea/textarea.d.ts +30 -0
- package/dist/components/textarea/textareaVariants.d.ts +9 -0
- package/dist/components/toast/toastVariants.d.ts +10 -0
- package/dist/components/toggle/toggle.d.ts +46 -0
- package/dist/components/toggle/toggle.js +4 -4
- package/dist/css/index.min.css +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SortingState, type OnChangeFn } from "@tanstack/react-table";
|
|
4
|
+
import type { TIColumn, TFilterItem, TAdvancedFilterItem, TFilters } from "./types";
|
|
5
|
+
interface ISearchProps {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Props to control the onSearch function debounceTime
|
|
12
|
+
*/
|
|
13
|
+
debounceTime?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Attach the debounced search function
|
|
16
|
+
*/
|
|
17
|
+
onSearch?: (value: string) => void;
|
|
18
|
+
}
|
|
19
|
+
interface IPaginationProps {
|
|
20
|
+
onPageSizeChange?: (args: number) => void;
|
|
21
|
+
onPageChange?: (args: number) => void;
|
|
22
|
+
totalRecords?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IDataTableProps<T> {
|
|
27
|
+
/**
|
|
28
|
+
* Defines the column structure for the Data Table, including column headers,
|
|
29
|
+
* accessors, and any additional configurations.
|
|
30
|
+
*/
|
|
31
|
+
columns: TIColumn[];
|
|
32
|
+
/**
|
|
33
|
+
* The array of data objects that will populate the rows of the Data Table.
|
|
34
|
+
*/
|
|
35
|
+
data: T[];
|
|
36
|
+
/**
|
|
37
|
+
* Optional: Provide custom class names as a space-separated
|
|
38
|
+
* string to override the default Data Table styling.
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for applying advanced filters to the Data Table.
|
|
43
|
+
* Allows complex filtering logic and customization.
|
|
44
|
+
*/
|
|
45
|
+
advancedFilters?: TAdvancedFilterItem[];
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for applying basic filters to the Data Table.
|
|
48
|
+
* Enables simple filtering by key-value pairs.
|
|
49
|
+
* Showing maximum 3 basic filters in the table.
|
|
50
|
+
*/
|
|
51
|
+
basicFilters?: TFilterItem[];
|
|
52
|
+
/**
|
|
53
|
+
* Allows to set filters by key-value pairs.
|
|
54
|
+
*/
|
|
55
|
+
filters?: TFilters;
|
|
56
|
+
/**
|
|
57
|
+
* A callback function used to update the list of applied filters.
|
|
58
|
+
*/
|
|
59
|
+
setFilters?: (filters: TFilters) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Boolean value to display a loading state in the Data Table,
|
|
62
|
+
* typically while loading or processing data.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
loading?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* A callback function triggered to refresh the Data Table,
|
|
68
|
+
* typically re-fetching or updating the data.
|
|
69
|
+
*/
|
|
70
|
+
onRefresh?: () => void;
|
|
71
|
+
/**
|
|
72
|
+
* To adjust the width of the columns
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
resizable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* To adding virtualization for column in the data table
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
columnVirtualization?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* To adding virtualization for row in the data table
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
rowVirtualization?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* To pin the first columns of the data table
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
pinnedFirstColumn?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* To make the row selectable by showing checkboxes
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
selectable?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Callback function triggered on row selection.
|
|
98
|
+
* @param selectedRows - Index List of the selected rows
|
|
99
|
+
*/
|
|
100
|
+
onRowSelection?: (selectedRows: object) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Allows to set sort by using key-value pair.
|
|
103
|
+
*/
|
|
104
|
+
sorting?: SortingState;
|
|
105
|
+
/**
|
|
106
|
+
* Callback function triggered on row sorting.
|
|
107
|
+
* @param sortState - Index List of the selected rows
|
|
108
|
+
*/
|
|
109
|
+
setSorting?: OnChangeFn<SortingState> | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Allows to set pagination props.
|
|
112
|
+
*/
|
|
113
|
+
paginationProps?: IPaginationProps;
|
|
114
|
+
/**
|
|
115
|
+
* To Adjust the height of the table.
|
|
116
|
+
* @default 100%
|
|
117
|
+
*/
|
|
118
|
+
height?: string;
|
|
119
|
+
/**
|
|
120
|
+
* To set the page size option
|
|
121
|
+
* @default PAGE_SIZE_OPTIONS
|
|
122
|
+
*/
|
|
123
|
+
pageSizeOptions?: number[];
|
|
124
|
+
/**
|
|
125
|
+
* To add the custom CTAs
|
|
126
|
+
*/
|
|
127
|
+
customCTAs?: ReactNode;
|
|
128
|
+
/**
|
|
129
|
+
* Callback function triggered on change of Column Preferences.
|
|
130
|
+
* @param columns - columns array with updated order and selected key value
|
|
131
|
+
*/
|
|
132
|
+
setColumns: (columns: TIColumn[]) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Allows to set search textfield props.
|
|
135
|
+
*/
|
|
136
|
+
searchProps?: ISearchProps;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* DataTable is a powerful component that displays tabular data with advanced features
|
|
140
|
+
* like filtering, sorting, pagination, and row selection.
|
|
141
|
+
*/
|
|
142
|
+
export declare const DataTable: <T extends object>({ advancedFilters, basicFilters, className, columns, data, filters, loading, paginationProps, resizable, selectable, pinnedFirstColumn, rowVirtualization, columnVirtualization, sorting, height, customCTAs, searchProps, pageSizeOptions, setFilters, setSorting, onRefresh, onRowSelection, setColumns }: IDataTableProps<T>) => ReactNode;
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type DatePickerProps } from "react-datepicker";
|
|
3
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
4
|
+
import { type ITextFieldProps } from "../textField";
|
|
5
|
+
import "../../components/datePicker/datePicker.styles.css";
|
|
6
|
+
export type TDatePickerCombinedProps = (DatePickerProps & {
|
|
7
|
+
inline?: false;
|
|
8
|
+
textFieldProps?: Omit<ITextFieldProps, "ref" | "onBlur" | "onFocus" | "disabled">;
|
|
9
|
+
}) | (DatePickerProps & {
|
|
10
|
+
inline?: true;
|
|
11
|
+
textFieldProps?: never;
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* DatePicker component that wraps react-datepicker with custom styling and text field integration
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage
|
|
19
|
+
* <DatePicker
|
|
20
|
+
* selected={date}
|
|
21
|
+
* onChange={(date) => setDate(date)}
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* // With time selection
|
|
25
|
+
* <DatePicker
|
|
26
|
+
* selected={date}
|
|
27
|
+
* onChange={(date) => setDate(date)}
|
|
28
|
+
* showTimeSelect
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* // Inline calendar
|
|
32
|
+
* <DatePicker
|
|
33
|
+
* selected={date}
|
|
34
|
+
* onChange={(date) => setDate(date)}
|
|
35
|
+
* inline
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<TDatePickerCombinedProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Pagination component for navigating through multiple pages of content.
|
|
4
|
+
*/
|
|
5
|
+
export interface IPaginationProps {
|
|
6
|
+
/**
|
|
7
|
+
* The total number of pages.
|
|
8
|
+
*/
|
|
9
|
+
totalPages?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Use the prop to set the active page number. The value for activePageNo needs to start from 1.
|
|
12
|
+
*/
|
|
13
|
+
activePageNo?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Layout of the pagination.
|
|
16
|
+
* @default detailed
|
|
17
|
+
*/
|
|
18
|
+
layout?: "detailed" | "basic" | "minimal";
|
|
19
|
+
/**
|
|
20
|
+
* Pagination variant.
|
|
21
|
+
* @default filled
|
|
22
|
+
*/
|
|
23
|
+
variant?: "filled" | "outline";
|
|
24
|
+
/**
|
|
25
|
+
* Use the prop to hide the labels "Next" & "Previous"
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
showLabels?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback function triggered when the active page changes.
|
|
31
|
+
* @param activePageNo - The new page number that was selected
|
|
32
|
+
*/
|
|
33
|
+
onPageChange?: (activePageNo: number) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Optional CSS class name.
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Pagination component for navigating through multiple pages of content.
|
|
41
|
+
*/
|
|
42
|
+
export declare const Pagination: React.ForwardRefExoticComponent<IPaginationProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PanelHeader } from "./panelHeader";
|
|
3
|
+
import { PanelBody } from "./panelBody";
|
|
4
|
+
import { PanelFooter } from "./panelFooter";
|
|
5
|
+
export interface IPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "dir"> {
|
|
6
|
+
/**
|
|
7
|
+
* Variant of the Panel
|
|
8
|
+
* @default compact
|
|
9
|
+
*/
|
|
10
|
+
variant?: "extended" | "compact";
|
|
11
|
+
/**
|
|
12
|
+
* Prop to control the panel display
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
showPanel?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Toggle the visibility of the Panel without unmounting it
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
toggleVisibilityUsingCss?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Overwrite the Panel styles by passing space separated class names
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Accepts children of ReactNode type
|
|
27
|
+
*/
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* If set to true, the panel will open from left and sets dir="rtl"
|
|
31
|
+
*/
|
|
32
|
+
rtl?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Pass a reference to the element where the Panel needs to be rendered
|
|
35
|
+
* @default document.body
|
|
36
|
+
*/
|
|
37
|
+
portalTarget?: HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* A list of Refs to be considered as a part of the Lock. The html elements in the list will be accessible while the Panel is open.
|
|
40
|
+
*/
|
|
41
|
+
shards?: (HTMLElement | React.RefObject<any>)[];
|
|
42
|
+
/**
|
|
43
|
+
* Optional callback function to call when panel is closed
|
|
44
|
+
*/
|
|
45
|
+
onClose?: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare const PanelComponent: React.ForwardRefExoticComponent<IPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
|
+
type TPanelCompoundComponent = typeof PanelComponent & {
|
|
49
|
+
Header: typeof PanelHeader;
|
|
50
|
+
Body: typeof PanelBody;
|
|
51
|
+
Footer: typeof PanelFooter;
|
|
52
|
+
};
|
|
53
|
+
export declare const Panel: TPanelCompoundComponent;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface IPanelHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Overwrite the Panel Header styles by passing space separated class names
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Control panel's back button visibility
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
showBackButton?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function for back button
|
|
14
|
+
*/
|
|
15
|
+
onBackHandler?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Control panel's close button visibility
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
showCloseButton?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Callback function for close button
|
|
23
|
+
*/
|
|
24
|
+
onCloseHandler?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Header of Panel
|
|
27
|
+
*/
|
|
28
|
+
header?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Sub header of Panel
|
|
31
|
+
*/
|
|
32
|
+
subHeader?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Pass custom CTA that will appear close to header
|
|
35
|
+
*/
|
|
36
|
+
customCTA?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare const PanelHeader: React.ForwardRefExoticComponent<IPanelHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare enum EColors {
|
|
3
|
+
PRIMARY = "primary",
|
|
4
|
+
SECONDARY = "secondary",
|
|
5
|
+
SUCCESS = "success",
|
|
6
|
+
WARNING = "warning",
|
|
7
|
+
ERROR = "error"
|
|
8
|
+
}
|
|
9
|
+
export declare enum EValuePositions {
|
|
10
|
+
TOP = "top",
|
|
11
|
+
RIGHT = "right",
|
|
12
|
+
BOTTOM = "bottom",
|
|
13
|
+
INLINE = "inline"
|
|
14
|
+
}
|
|
15
|
+
export type TColorType = `${EColors}`;
|
|
16
|
+
export type TValuePositionType = `${EValuePositions}`;
|
|
17
|
+
/**
|
|
18
|
+
* Progress component for displaying progress bars in linear or circular variants.
|
|
19
|
+
*/
|
|
20
|
+
export interface IProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/**
|
|
22
|
+
* Controls the colors of Progress
|
|
23
|
+
* Only For linear progress
|
|
24
|
+
* @default primary
|
|
25
|
+
*/
|
|
26
|
+
color?: TColorType;
|
|
27
|
+
/**
|
|
28
|
+
* Variant of the Progress
|
|
29
|
+
* @default linear
|
|
30
|
+
*/
|
|
31
|
+
variant?: "linear" | "circular";
|
|
32
|
+
/**
|
|
33
|
+
* Use the prop to change the size of the Circular Progress
|
|
34
|
+
* @default "md"
|
|
35
|
+
*/
|
|
36
|
+
size?: "md" | "lg";
|
|
37
|
+
/**
|
|
38
|
+
* Value is used to display the percentage of the progress
|
|
39
|
+
* @default 0
|
|
40
|
+
* @range 0 to 100
|
|
41
|
+
*/
|
|
42
|
+
value: number;
|
|
43
|
+
/**
|
|
44
|
+
* Prop controlling the position of the value of the Progress
|
|
45
|
+
* @default inline
|
|
46
|
+
*/
|
|
47
|
+
valuePosition?: TValuePositionType;
|
|
48
|
+
/**
|
|
49
|
+
* Set to true to display the percentage of progress.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
showPercentage?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Prop to set striped background
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
striped?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Prop to set animated background, use in conjunction with striped property
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
animate?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Progress component for displaying progress bars in linear or circular variants.
|
|
66
|
+
*/
|
|
67
|
+
export declare const Progress: React.ForwardRefExoticComponent<IProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const progressContainerVariants: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const progressTrackVariants: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const progressBarVariants: (props?: ({
|
|
4
|
+
color?: "error" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
5
|
+
striped?: boolean | null | undefined;
|
|
6
|
+
animate?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const progressTextVariants: (props?: ({
|
|
9
|
+
position?: "inline" | "top" | "right" | "bottom" | null | undefined;
|
|
10
|
+
color?: "error" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
+
export declare const progressValueTextVariants: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
13
|
+
export declare const progressCircularVariants: (props?: ({
|
|
14
|
+
size?: "md" | "lg" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
|
+
export declare const progressCircularTrackVariants: (props?: ({
|
|
17
|
+
color?: "error" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
19
|
+
export declare const progressCircularProgressVariants: (props?: ({
|
|
20
|
+
color?: "error" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
21
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
22
|
+
export declare const progressCircularTextVariants: (props?: ({
|
|
23
|
+
size?: "md" | "lg" | null | undefined;
|
|
24
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Radio component props
|
|
4
|
+
*/
|
|
5
|
+
export interface IRadioProps extends Omit<React.HTMLProps<HTMLInputElement>, "label" | "size"> {
|
|
6
|
+
/**
|
|
7
|
+
* Size of the Radio button
|
|
8
|
+
* @default sm
|
|
9
|
+
*/
|
|
10
|
+
size?: "sm" | "md" | "lg";
|
|
11
|
+
/**
|
|
12
|
+
* Label for the Radio button
|
|
13
|
+
*/
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Radio component for single-option selection within a group
|
|
18
|
+
*/
|
|
19
|
+
export declare const Radio: React.ForwardRefExoticComponent<Omit<IRadioProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ReactElement } from "react";
|
|
3
|
+
import { type IRadioProps } from "../radio";
|
|
4
|
+
export type TRadioGroupSize = "sm" | "md" | "lg";
|
|
5
|
+
/**
|
|
6
|
+
* RadioGroup component props
|
|
7
|
+
*/
|
|
8
|
+
export interface IRadioGroupProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
|
|
9
|
+
/**
|
|
10
|
+
* Size of the Radio group.
|
|
11
|
+
* @default md
|
|
12
|
+
*/
|
|
13
|
+
size?: TRadioGroupSize;
|
|
14
|
+
/**
|
|
15
|
+
* Pass space separated class names to override the RadioGroup styling
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Pass boolean value to disable the component.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Selected value
|
|
25
|
+
*/
|
|
26
|
+
selectedValue?: string;
|
|
27
|
+
/**
|
|
28
|
+
* An array of objects of radio props type
|
|
29
|
+
*/
|
|
30
|
+
options: IRadioProps[];
|
|
31
|
+
/**
|
|
32
|
+
* Callback function that is called when the radio group selection changes.
|
|
33
|
+
* A selected value is passed as an argument to the function.
|
|
34
|
+
*/
|
|
35
|
+
onChange?: (arg: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Placement of the radio
|
|
38
|
+
* @default "start"
|
|
39
|
+
*/
|
|
40
|
+
radioPlacement?: "start" | "end";
|
|
41
|
+
/**
|
|
42
|
+
* Variant of the RadioGroup
|
|
43
|
+
* @default outline
|
|
44
|
+
*/
|
|
45
|
+
variant?: "outline" | "text";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* RadioGroup component for grouping radio button options
|
|
49
|
+
*/
|
|
50
|
+
export declare const RadioGroup: {
|
|
51
|
+
({ size, options, onChange, className, selectedValue, disabled, radioPlacement, variant }: IRadioGroupProps): ReactElement;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type TVoidElements = "area" | "base" | "br" | "col" | "embed" | "hr" | "img" | "input" | "link" | "meta" | "param" | "source" | "track" | "wbr" | "audio" | "video" | "canvas" | "iframe" | "embed" | "object" | "param" | "picture" | "portal" | "svg" | "math" | "svg";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Scrollbar component
|
|
5
|
+
*/
|
|
6
|
+
export interface IScrollbarProps {
|
|
7
|
+
/**
|
|
8
|
+
* children to render inside the scroll container
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The type of tag to render for the scroll container, the default value is "div".
|
|
13
|
+
* @default div
|
|
14
|
+
*/
|
|
15
|
+
as?: keyof Omit<JSX.IntrinsicElements, TVoidElements>;
|
|
16
|
+
/**
|
|
17
|
+
* Overwrite the scrollbar container styles by passing space separated class names.
|
|
18
|
+
* @optional
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Pass a boolean value to set the visibility of the scroller, by default the scrollbar will be visible on content hover.
|
|
23
|
+
* @optional
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
alwaysVisible?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Set it to true if you want to directly scroll to the click position,
|
|
29
|
+
* by default the scroller will move in the direction of the click
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
scrollToClickPosition?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Optional ID for the scrollbar container
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Scrollbar component provides a custom scrollbar with support for both vertical and horizontal scrolling.
|
|
40
|
+
* It includes features like custom styling, touch support, RTL support, and keyboard navigation.
|
|
41
|
+
*/
|
|
42
|
+
export declare const Scrollbar: React.ForwardRefExoticComponent<IScrollbarProps & React.RefAttributes<HTMLElement>>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ReactElement } from "react";
|
|
3
|
+
export declare enum ETabSizes {
|
|
4
|
+
XS = "xs",
|
|
5
|
+
SM = "sm",
|
|
6
|
+
MD = "md",
|
|
7
|
+
LG = "lg"
|
|
8
|
+
}
|
|
9
|
+
export type TTabSize = `${ETabSizes}`;
|
|
10
|
+
/**
|
|
11
|
+
* Props for the Tab component.
|
|
12
|
+
*/
|
|
13
|
+
export interface ITabProps {
|
|
14
|
+
/**
|
|
15
|
+
* Id of the tab.
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Name of the tab.
|
|
20
|
+
*/
|
|
21
|
+
title: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Function to call when the tab is displayed.
|
|
24
|
+
*/
|
|
25
|
+
onEnter?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Function to call when the tab is exited.
|
|
28
|
+
*/
|
|
29
|
+
onExit?: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Dynamically updates the className applied to the component.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Content to be displayed within the tab.
|
|
36
|
+
*/
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates whether the tab is disabled.
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Icon to be displayed before the title of the Tab.
|
|
44
|
+
* @description
|
|
45
|
+
* This prop accepts either an IconType (string) or a ReactNode.
|
|
46
|
+
* - If an IconType is provided, it will be rendered as-is.
|
|
47
|
+
* - If a ReactNode is provided, it will be rendered as-is.
|
|
48
|
+
*/
|
|
49
|
+
prefixIcon?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Icon to be displayed after the title of the Tab.
|
|
52
|
+
* @description
|
|
53
|
+
* This prop accepts either an IconType (string) or a ReactNode.
|
|
54
|
+
* - If an IconType is provided, it will be rendered as-is.
|
|
55
|
+
* - If a ReactNode is provided, it will be rendered as-is.
|
|
56
|
+
*/
|
|
57
|
+
suffixIcon?: React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
export declare const Tab: React.ForwardRefExoticComponent<ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
/**
|
|
61
|
+
* Props for the Tabs component.
|
|
62
|
+
*/
|
|
63
|
+
export interface ITabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
64
|
+
/**
|
|
65
|
+
* Active tab index. Tab index starts from 0.
|
|
66
|
+
*/
|
|
67
|
+
activeIndex?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Default active tab index, to be used with the uncontrolled version of the Tabs component.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
defaultActiveIndex?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Dynamically updates the className applied to the component.
|
|
75
|
+
*/
|
|
76
|
+
className?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Renders all the tabs at once and switches between them using CSS.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
switchUsingCss?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Called on click of a tab header.
|
|
84
|
+
* @param selectedTabIndex {number} Selected tab index.
|
|
85
|
+
*/
|
|
86
|
+
onSelect?: (selectedTabIndex: number) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Array of items to be displayed in the Tabs,
|
|
89
|
+
* each item should be wrapped in Tabs.Tab component
|
|
90
|
+
* @required
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <Tabs>
|
|
94
|
+
* <Tabs.Tab title="Tab 1">Content of Tab 1</Tabs.Tab>
|
|
95
|
+
* </Tabs>
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
children: ReactElement<ITabProps> | Array<ReactElement<ITabProps> | boolean> | boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Size of the tab.
|
|
101
|
+
* @default md
|
|
102
|
+
*/
|
|
103
|
+
size?: TTabSize;
|
|
104
|
+
/**
|
|
105
|
+
* Variant of the tab.
|
|
106
|
+
* @default text
|
|
107
|
+
*/
|
|
108
|
+
variant?: "filled" | "text" | "brick";
|
|
109
|
+
/**
|
|
110
|
+
* Color of the tab. Only applicable for filled variant.
|
|
111
|
+
*/
|
|
112
|
+
color?: "primary" | "secondary";
|
|
113
|
+
}
|
|
114
|
+
declare const TabsComponent: React.ForwardRefExoticComponent<ITabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
115
|
+
type TTabsType = typeof TabsComponent & {
|
|
116
|
+
Tab: typeof Tab;
|
|
117
|
+
};
|
|
118
|
+
declare const Tabs: TTabsType;
|
|
119
|
+
export { Tabs };
|
|
@@ -125,7 +125,7 @@ const TabsComponent = React.forwardRef((_a, ref) => {
|
|
|
125
125
|
const isActive = index === evalActiveIndex;
|
|
126
126
|
const btnId = tab.props.id ? `${tab.props.id}-btn` : `tab-${index}-btn`;
|
|
127
127
|
const ariaControls = tab.props.id || `tab-${index}`;
|
|
128
|
-
return (_jsxs("button", { type: "button", role: "tab", ref: tabRefs.current[index], disabled: tab.props.disabled, id: btnId, "aria-controls": ariaControls, "aria-selected": isActive, onClick: handleSelect(tab.props, index), onKeyDown: handleKeyDown, className: cn(tabsListItemVariants({ size, variant, color, active: isActive })), children: [tab.props.prefixIcon && (_jsx("span", { className: "mr-2", children: tab.props.prefixIcon })), tab.props.title, tab.props.suffixIcon && (_jsx("span", { className: "ml-2", children: tab.props.suffixIcon }))] }, index));
|
|
128
|
+
return (_jsxs("button", { type: "button", role: "tab", ref: tabRefs.current[index], disabled: tab.props.disabled, id: btnId, "aria-controls": ariaControls, "aria-selected": isActive, onClick: handleSelect(tab.props, index), onKeyDown: handleKeyDown, className: cn(tabsListItemVariants({ size, variant, color, active: isActive })), children: [tab.props.prefixIcon && (_jsx("span", { className: "mr-2 rtl:mr-0 rtl:ml-2", children: tab.props.prefixIcon })), tab.props.title, tab.props.suffixIcon && (_jsx("span", { className: "ml-2 rtl:ml-0 rtl:mr-2", children: tab.props.suffixIcon }))] }, index));
|
|
129
129
|
}) }) }), switchUsingCss
|
|
130
130
|
? filteredChildren.map((tab, index) => (_jsx("div", { id: tab.props.id || `tab-${index}`, role: "tabpanel", "aria-labelledby": tab.props.id ? `${tab.props.id}-btn` : `tab-${index}-btn`, tabIndex: 0, className: cn(tabsContentVariants(), index === evalActiveIndex
|
|
131
131
|
? activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.className
|