@pk-design/react-tailwind 1.0.6 → 1.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/dist/react-tailwind.cjs.js +1593 -362
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +1579 -360
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -0
- package/dist/types/components/Alert/Alert.test.d.ts +1 -0
- package/dist/types/components/Alert/Alert.types.d.ts +34 -0
- package/dist/types/components/Alert/index.d.ts +2 -35
- package/dist/types/components/Badge/Badge.d.ts +3 -0
- package/dist/types/components/Badge/Badge.test.d.ts +1 -0
- package/dist/types/components/Badge/Badge.types.d.ts +22 -0
- package/dist/types/components/Badge/index.d.ts +2 -24
- package/dist/types/components/Banner/Banner.d.ts +3 -0
- package/dist/types/components/Banner/Banner.test.d.ts +1 -0
- package/dist/types/components/Banner/Banner.types.d.ts +14 -0
- package/dist/types/components/Banner/index.d.ts +2 -16
- package/dist/types/components/BodyText/BodyText.d.ts +3 -0
- package/dist/types/components/BodyText/BodyText.test.d.ts +1 -0
- package/dist/types/components/BodyText/BodyText.types.d.ts +27 -0
- package/dist/types/components/BodyText/index.d.ts +2 -28
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/types/components/Breadcrumb/Breadcrumb.test.d.ts +1 -0
- package/dist/types/components/Breadcrumb/Breadcrumb.types.d.ts +29 -0
- package/dist/types/components/Breadcrumb/index.d.ts +2 -30
- package/dist/types/components/Button/Button.d.ts +2 -3
- package/dist/types/components/Button/Button.test.d.ts +1 -0
- package/dist/types/components/Button/Button.types.d.ts +171 -0
- package/dist/types/components/Button/index.d.ts +1 -1
- package/dist/types/components/Card/Card.d.ts +3 -0
- package/dist/types/components/Card/Card.test.d.ts +1 -0
- package/dist/types/components/Card/Card.types.d.ts +23 -0
- package/dist/types/components/Card/index.d.ts +2 -9
- package/dist/types/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/types/components/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.types.d.ts +14 -0
- package/dist/types/components/Checkbox/index.d.ts +2 -13
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
- package/dist/types/components/CheckboxGroup/CheckboxGroup.test.d.ts +1 -0
- package/dist/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +55 -0
- package/dist/types/components/CheckboxGroup/index.d.ts +2 -56
- package/dist/types/components/DataTable/DataTable.d.ts +2 -0
- package/dist/types/components/DataTable/DataTable.icons.d.ts +4 -0
- package/dist/types/components/DataTable/DataTable.test.d.ts +1 -0
- package/dist/types/components/DataTable/DataTable.types.d.ts +63 -0
- package/dist/types/components/DataTable/DataTable.utils.d.ts +12 -0
- package/dist/types/components/DataTable/DataTable.utils.test.d.ts +1 -0
- package/dist/types/components/DataTable/index.d.ts +4 -0
- package/dist/types/components/DetailedInformation/DetailedInformation.d.ts +2 -0
- package/dist/types/components/DetailedInformation/DetailedInformation.test.d.ts +1 -0
- package/dist/types/components/DetailedInformation/DetailedInformation.types.d.ts +54 -0
- package/dist/types/components/DetailedInformation/index.d.ts +2 -63
- package/dist/types/components/Drawer/Drawer.d.ts +1 -1
- package/dist/types/components/Drawer/Drawer.test.d.ts +1 -0
- package/dist/types/components/Drawer/{type.d.ts → Drawer.types.d.ts} +1 -1
- package/dist/types/components/Drawer/index.d.ts +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/types/components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/types/components/Dropdown/Dropdown.types.d.ts +107 -0
- package/dist/types/components/Dropdown/index.d.ts +2 -62
- package/dist/types/components/HeadingText/HeadingText.d.ts +9 -0
- package/dist/types/components/HeadingText/HeadingText.types.d.ts +5 -0
- package/dist/types/components/HeadingText/index.d.ts +2 -12
- package/dist/types/components/Input/Input.d.ts +6 -0
- package/dist/types/components/Input/Input.test.d.ts +1 -0
- package/dist/types/components/Input/Input.types.d.ts +12 -0
- package/dist/types/components/Input/index.d.ts +2 -13
- package/dist/types/components/Label/Label.d.ts +6 -0
- package/dist/types/components/Label/index.d.ts +1 -5
- package/dist/types/components/Pagination/Pagination.d.ts +1 -31
- package/dist/types/components/Pagination/Pagination.test.d.ts +1 -0
- package/dist/types/components/Pagination/Pagination.types.d.ts +36 -0
- package/dist/types/components/Pagination/index.d.ts +1 -0
- package/dist/types/components/Pagination/usePagination.d.ts +1 -5
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +6 -0
- package/dist/types/components/PasswordInput/PasswordInput.test.d.ts +1 -0
- package/dist/types/components/PasswordInput/index.d.ts +1 -6
- package/dist/types/components/Radio/Radio.d.ts +2 -0
- package/dist/types/components/Radio/Radio.test.d.ts +1 -0
- package/dist/types/components/Radio/Radio.types.d.ts +14 -0
- package/dist/types/components/Radio/index.d.ts +2 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/types/components/RadioGroup/RadioGroup.test.d.ts +1 -0
- package/dist/types/components/RadioGroup/RadioGroup.types.d.ts +65 -0
- package/dist/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/types/components/RadioSwitch/RadioSwitch.d.ts +7 -0
- package/dist/types/components/RadioSwitch/RadioSwitch.test.d.ts +1 -0
- package/dist/types/components/RadioSwitch/RadioSwitch.types.d.ts +47 -0
- package/dist/types/components/RadioSwitch/index.d.ts +2 -0
- package/dist/types/components/RangeInput/-backup.d.ts +10 -0
- package/dist/types/components/RangeInput/RangeInput.d.ts +2 -0
- package/dist/types/components/RangeInput/RangeInput.test.d.ts +1 -0
- package/dist/types/components/RangeInput/RangeInput.types.d.ts +14 -0
- package/dist/types/components/RangeInput/index.d.ts +1 -10
- package/dist/types/components/RangeSlider/RangeSlider.d.ts +3 -0
- package/dist/types/components/RangeSlider/RangeSlider.test.d.ts +1 -0
- package/dist/types/components/RangeSlider/RangeSlider.types.d.ts +68 -0
- package/dist/types/components/RangeSlider/index.d.ts +2 -0
- package/dist/types/components/SelectBox/SelectBox.d.ts +2 -0
- package/dist/types/components/SelectBox/SelectBox.test.d.ts +1 -0
- package/dist/types/components/SelectBox/SelectBox.types.d.ts +94 -0
- package/dist/types/components/SelectBox/index.d.ts +2 -40
- package/dist/types/components/Table/Table.d.ts +10 -0
- package/dist/types/components/Table/Table.test.d.ts +1 -0
- package/dist/types/components/Table/Table.types.d.ts +91 -0
- package/dist/types/components/Table/index.d.ts +2 -48
- package/dist/types/components/Tabs/Tabs.d.ts +3 -0
- package/dist/types/components/Tabs/Tabs.test.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.types.d.ts +48 -0
- package/dist/types/components/Tabs/index.d.ts +1 -2
- package/dist/types/components/TextContent/TextContent.d.ts +3 -0
- package/dist/types/components/TextContent/TextContent.test.d.ts +1 -0
- package/dist/types/components/TextContent/TextContent.types.d.ts +23 -0
- package/dist/types/components/TextContent/index.d.ts +2 -10
- package/dist/types/components/Textarea/Textarea.d.ts +2 -0
- package/dist/types/components/Textarea/Textarea.test.d.ts +1 -0
- package/dist/types/components/Textarea/Textarea.types.d.ts +6 -0
- package/dist/types/components/Textarea/index.d.ts +2 -7
- package/dist/types/components/Toast/Toast.d.ts +4 -8
- package/dist/types/components/Toast/Toast.test.d.ts +1 -0
- package/dist/types/components/Toast/Toast.types.d.ts +117 -0
- package/dist/types/components/Toast/ToastProvider.d.ts +2 -11
- package/dist/types/components/Toast/ToastProvider.test.d.ts +1 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/VirtualizedDataTable/VirtualizedDataTable.d.ts +3 -0
- package/dist/types/components/VirtualizedDataTable/VirtualizedDataTable.test.d.ts +1 -0
- package/dist/types/components/VirtualizedDataTable/VirtualizedDataTable.types.d.ts +18 -0
- package/dist/types/components/VirtualizedDataTable/VirtualizedRow.d.ts +5 -0
- package/dist/types/components/VirtualizedDataTable/index.d.ts +2 -0
- package/dist/types/components/_Dialog/Dialog.d.ts +4 -0
- package/dist/types/components/_Dialog/Dialog.types.d.ts +53 -0
- package/dist/types/components/_Dialog/index.d.ts +2 -0
- package/dist/types/components/common-type.d.ts +2 -1
- package/dist/types/hooks/use-debounce.d.ts +2 -0
- package/dist/types/hooks/use-is-mobile.d.ts +1 -0
- package/dist/types/hooks/use-is-tablet.d.ts +1 -0
- package/dist/types/index.d.ts +11 -6
- package/dist/types/utils/get.d.ts +1 -0
- package/package.json +20 -4
- package/dist/types/components/Button/type.d.ts +0 -58
- package/dist/types/components/RadioButton/index.d.ts +0 -7
- package/dist/types/components/RadioButtonGroup/index.d.ts +0 -19
- package/dist/types/components/RadioSwtich/index.d.ts +0 -14
- package/dist/types/components/Tag/index.d.ts +0 -12
- package/dist/types/components/hooks/use-debounce.d.ts +0 -1
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Checkbox item label
|
|
5
|
-
*/
|
|
6
|
-
label: string;
|
|
7
|
-
/**
|
|
8
|
-
* Checkbox item value
|
|
9
|
-
*/
|
|
10
|
-
value: any;
|
|
11
|
-
};
|
|
12
|
-
export interface CheckboxGroupProps {
|
|
13
|
-
/**
|
|
14
|
-
* Group name
|
|
15
|
-
*/
|
|
16
|
-
name?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Selected value
|
|
19
|
-
*/
|
|
20
|
-
value?: any;
|
|
21
|
-
/**
|
|
22
|
-
* Label of checkbox group field
|
|
23
|
-
*/
|
|
24
|
-
label?: ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Label class for checkbox group field
|
|
27
|
-
*/
|
|
28
|
-
labelClass?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Label wrapper class for checkbox group field
|
|
31
|
-
*/
|
|
32
|
-
labelWrapperClass?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Group field hint
|
|
35
|
-
*/
|
|
36
|
-
labelHint?: ReactNode;
|
|
37
|
-
/**
|
|
38
|
-
* Group field container
|
|
39
|
-
*/
|
|
40
|
-
containerClass?: string;
|
|
41
|
-
/**
|
|
42
|
-
* On change handler
|
|
43
|
-
* @param e ChangeEvent<HTMLInputElement>
|
|
44
|
-
* @returns void
|
|
45
|
-
*/
|
|
46
|
-
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
47
|
-
/**
|
|
48
|
-
* List of checkbox field option
|
|
49
|
-
*/
|
|
50
|
-
options: string[] | CheckboxGroupItem[];
|
|
51
|
-
/**
|
|
52
|
-
* Defines whether to list the checkbox inline
|
|
53
|
-
*/
|
|
54
|
-
inline?: boolean;
|
|
55
|
-
}
|
|
56
|
-
export declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
|
|
1
|
+
export * from './CheckboxGroup';
|
|
2
|
+
export * from './CheckboxGroup.types';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SortIconKey, Sorting } from './DataTable.types';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export declare const SortIconMap: Record<SortIconKey, ReactNode>;
|
|
4
|
+
export declare const getSortIcon: (sort?: Sorting) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TPagination } from '../Pagination';
|
|
3
|
+
/**
|
|
4
|
+
* Allowed column value data types
|
|
5
|
+
* Used only to influence sorting logic
|
|
6
|
+
*/
|
|
7
|
+
export type DataValueType = 'string' | 'number' | 'date';
|
|
8
|
+
/**
|
|
9
|
+
* Sorting direction
|
|
10
|
+
*/
|
|
11
|
+
export type Sorting = 'asc' | 'desc' | '1' | '-1';
|
|
12
|
+
/** Allowed sort icon types */
|
|
13
|
+
export type SortIconKey = Extract<Sorting, 'asc' | 'desc' | '1' | '-1'>;
|
|
14
|
+
export type SortQuery = Record<string, Sorting>;
|
|
15
|
+
/**
|
|
16
|
+
* Column definition for DataTable
|
|
17
|
+
*/
|
|
18
|
+
export interface DataTableColumn {
|
|
19
|
+
/** Unique key used to extract column data (supports nested paths) */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Display label for the header */
|
|
22
|
+
label: ReactNode;
|
|
23
|
+
/** Text alignment for header */
|
|
24
|
+
headerAlign?: 'left' | 'center' | 'right';
|
|
25
|
+
/** Text alignment for body cells */
|
|
26
|
+
align?: 'left' | 'center' | 'right';
|
|
27
|
+
/** Custom cell renderer (highest priority) */
|
|
28
|
+
render?: (item: any) => ReactNode;
|
|
29
|
+
/** Optional fixed width (px, %, rem) */
|
|
30
|
+
width?: string | number;
|
|
31
|
+
/** Enables sorting when true */
|
|
32
|
+
sortable?: boolean;
|
|
33
|
+
/** Type of cell value helps sorting logic */
|
|
34
|
+
type?: DataValueType;
|
|
35
|
+
/** Sticks cell to right side */
|
|
36
|
+
sticky?: 'left' | 'right';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* DataTable props
|
|
40
|
+
*/
|
|
41
|
+
export interface DataTableProps {
|
|
42
|
+
/** Array of data items */
|
|
43
|
+
items: any[];
|
|
44
|
+
/** Column definitions */
|
|
45
|
+
columns: DataTableColumn[];
|
|
46
|
+
/** Sorting state, keyed by column name */
|
|
47
|
+
sorting?: Record<string, Sorting>;
|
|
48
|
+
/** Loading state (shows skeleton rows) */
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/** Pagination config */
|
|
51
|
+
pagination?: TPagination;
|
|
52
|
+
/** Empty message to show when no results */
|
|
53
|
+
emptyMessage?: ReactNode;
|
|
54
|
+
/** External sorting handler */
|
|
55
|
+
onSort?: (column: DataTableColumn) => void;
|
|
56
|
+
/** Pagination setter */
|
|
57
|
+
setPagination?: (pagination: Partial<TPagination>) => void;
|
|
58
|
+
/** Layout of table cells */
|
|
59
|
+
layout?: 'fixed' | 'auto';
|
|
60
|
+
/** Optional wrapper styles */
|
|
61
|
+
containerClass?: string;
|
|
62
|
+
wrapperClass?: string;
|
|
63
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DataValueType, Sorting, SortQuery } from './DataTable.types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute the next sorting direction for a column.
|
|
4
|
+
* - string: undefined → asc → desc → undefined
|
|
5
|
+
* - number/date: undefined → 1 → -1 → undefined
|
|
6
|
+
*/
|
|
7
|
+
export declare const nextSortDirection: (prev: Sorting | undefined, type?: "string" | "number" | "date") => Sorting | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Update the sort query object for a table column.
|
|
10
|
+
* Toggles sort direction, removing key when reset.
|
|
11
|
+
*/
|
|
12
|
+
export declare const updateSortQuery: (sortQuery: SortQuery, name: string, type?: DataValueType) => SortQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type Detail = {
|
|
3
|
+
/**
|
|
4
|
+
* Label of the information to be displayed
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Information to be displayed
|
|
9
|
+
*/
|
|
10
|
+
value?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Classname of the value content sections
|
|
13
|
+
*/
|
|
14
|
+
contentClass?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Defines if the items should be hidden.
|
|
17
|
+
*/
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export interface DetailedInformationProps {
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Title for the information section
|
|
24
|
+
*/
|
|
25
|
+
title?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Subtitle for the information section
|
|
28
|
+
*/
|
|
29
|
+
subTitle?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* List of details / information to be displayed
|
|
32
|
+
*/
|
|
33
|
+
details: Detail[];
|
|
34
|
+
/**
|
|
35
|
+
* Defines if the layout should be compact
|
|
36
|
+
*/
|
|
37
|
+
compact?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Defines if the section should have borders
|
|
40
|
+
*/
|
|
41
|
+
bordered?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Defines if each item in section should have divider
|
|
44
|
+
*/
|
|
45
|
+
divider?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Classname for title element
|
|
48
|
+
*/
|
|
49
|
+
titleClass?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Classname for details section
|
|
52
|
+
*/
|
|
53
|
+
detailsClass?: string;
|
|
54
|
+
}
|
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Label of the information to be displayed
|
|
5
|
-
*/
|
|
6
|
-
label: string;
|
|
7
|
-
/**
|
|
8
|
-
* Information to be displayed
|
|
9
|
-
*/
|
|
10
|
-
value?: ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Classname of the value content sections
|
|
13
|
-
*/
|
|
14
|
-
contentClass?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Defines if the items should be hidden.
|
|
17
|
-
*/
|
|
18
|
-
hidden?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export interface DetailedInformationProps {
|
|
21
|
-
className?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Title for the information section
|
|
24
|
-
*/
|
|
25
|
-
title?: ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* Subtitle for the information section
|
|
28
|
-
*/
|
|
29
|
-
subTitle?: ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* List of details / information to be displayed
|
|
32
|
-
*/
|
|
33
|
-
details: Detail[];
|
|
34
|
-
/**
|
|
35
|
-
* Defines if the layout should be compact
|
|
36
|
-
*/
|
|
37
|
-
compact?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Defines if the section should have borders
|
|
40
|
-
*/
|
|
41
|
-
bordered?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Defines if each item in section should have divider
|
|
44
|
-
*/
|
|
45
|
-
divider?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Classname for title element
|
|
48
|
-
*/
|
|
49
|
-
titleClass?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Classname for details section
|
|
52
|
-
*/
|
|
53
|
-
detailsClass?: string;
|
|
54
|
-
/**
|
|
55
|
-
* JSX element to be rendered as.
|
|
56
|
-
*/
|
|
57
|
-
as?: keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
58
|
-
/**
|
|
59
|
-
* When rendering as Link, use `to` prop for navigation
|
|
60
|
-
*/
|
|
61
|
-
to?: string;
|
|
62
|
-
}
|
|
63
|
-
export declare const DetailedInformation: React.FC<DetailedInformationProps>;
|
|
1
|
+
export * from './DetailedInformation';
|
|
2
|
+
export * from './DetailedInformation.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
export type DrawerAlignment = 'center' | 'start' | 'end' | 'top' | 'bottom'
|
|
2
|
+
export type DrawerAlignment = 'center' | 'start' | 'end' | 'top' | 'bottom';
|
|
3
3
|
export type DrawerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
|
|
4
4
|
export interface DrawerProps {
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Drawer';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './Drawer.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type DropdownAlignment = 'start' | 'end';
|
|
3
|
+
export type DropdownPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
export type DropdownAnchorTo = `${DropdownPlacement}` | `${DropdownPlacement} ${DropdownAlignment}`;
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for advanced positioning when using object-based `anchor`.
|
|
7
|
+
*/
|
|
8
|
+
export type DropdownBaseAnchorProps = {
|
|
9
|
+
/** Space between the trigger and the menu panel. */
|
|
10
|
+
gap: number | string;
|
|
11
|
+
/** Nudges the menu panel from its natural anchor position. */
|
|
12
|
+
offset: number | string;
|
|
13
|
+
/** Minimum distance between the menu panel and the viewport. */
|
|
14
|
+
padding: number | string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Render props passed to `renderTriggerButton`.
|
|
18
|
+
* These reflect the trigger state.
|
|
19
|
+
*/
|
|
20
|
+
export type DropdownTriggerBtnProps = {
|
|
21
|
+
/** Whether the trigger is active (pressed). */
|
|
22
|
+
active: boolean;
|
|
23
|
+
/** Whether the dropdown is open. */
|
|
24
|
+
open: boolean;
|
|
25
|
+
/** Whether the trigger button is disabled. */
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
/** Whether the trigger is hovered. */
|
|
28
|
+
hover: boolean;
|
|
29
|
+
/** Whether the trigger is focused. */
|
|
30
|
+
focus: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Individual item shown inside the dropdown menu.
|
|
34
|
+
*/
|
|
35
|
+
export type DropdownItem = {
|
|
36
|
+
/** Unique ID for the item. */
|
|
37
|
+
id: string;
|
|
38
|
+
/** Display label (optional if using custom render). */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** If true, renders a horizontal divider instead of an item. */
|
|
41
|
+
divider?: boolean;
|
|
42
|
+
/** Optional: mark item as disabled. */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Allow additional arbitrary metadata. */
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
47
|
+
/** Base props shared between both trigger modes. */
|
|
48
|
+
type DropdownBaseProps = {
|
|
49
|
+
/** Additional classes for the menu container. */
|
|
50
|
+
itemsContainerClass?: string;
|
|
51
|
+
/** Enables menu transition animations. Default: true */
|
|
52
|
+
transition?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Controls dropdown placement.
|
|
55
|
+
* Accepts:
|
|
56
|
+
* - `"bottom start"`
|
|
57
|
+
* - `"top end"`
|
|
58
|
+
* - `"right"`
|
|
59
|
+
* - or object configuration for advanced placement.
|
|
60
|
+
*/
|
|
61
|
+
anchor?: false | DropdownAnchorTo | Partial<DropdownBaseAnchorProps & {
|
|
62
|
+
/** Placement descriptor for advanced mode. */
|
|
63
|
+
to: DropdownAnchorTo;
|
|
64
|
+
}>;
|
|
65
|
+
/** List of dropdown menu items. */
|
|
66
|
+
items: DropdownItem[];
|
|
67
|
+
/**
|
|
68
|
+
* Renderer for customizing how a menu item is displayed.
|
|
69
|
+
* If omitted, the default item UI is used.
|
|
70
|
+
*/
|
|
71
|
+
renderItem?: (item: DropdownItem) => ReactNode;
|
|
72
|
+
/** Custom CSS classes applied to each menu item. */
|
|
73
|
+
menuItemClass?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Called when a menu item is clicked.
|
|
76
|
+
* Receives: (item, index)
|
|
77
|
+
*/
|
|
78
|
+
onMenuClick?: (item: DropdownItem, index: number) => void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Mode 1: Using static JSX as trigger (`triggerButton`)
|
|
82
|
+
*/
|
|
83
|
+
export type DropdownWithStaticTrigger = DropdownBaseProps & {
|
|
84
|
+
/** JSX element used as the trigger button. */
|
|
85
|
+
triggerButton: ReactNode;
|
|
86
|
+
/** Must NOT be provided when using triggerButton. */
|
|
87
|
+
renderTriggerButton?: never;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Mode 2: Using a render function for trigger (`renderTriggerButton`)
|
|
91
|
+
*/
|
|
92
|
+
export type DropdownWithRenderTrigger = DropdownBaseProps & {
|
|
93
|
+
/**
|
|
94
|
+
* Custom trigger renderer.
|
|
95
|
+
* Receives trigger UI state (open, focus, hover, etc.)
|
|
96
|
+
* Must return a valid element.
|
|
97
|
+
*/
|
|
98
|
+
renderTriggerButton: (props: DropdownTriggerBtnProps) => ReactNode;
|
|
99
|
+
/** Must NOT be provided when using renderTriggerButton. */
|
|
100
|
+
triggerButton?: never;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Final Dropdown Props:
|
|
104
|
+
* Exactly ONE of the trigger modes must be used.
|
|
105
|
+
*/
|
|
106
|
+
export type DropdownProps = DropdownWithStaticTrigger | DropdownWithRenderTrigger;
|
|
107
|
+
export {};
|
|
@@ -1,62 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type Placement = 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
-
type AnchorTo = `${Placement}` | `${Placement} ${Align}`;
|
|
5
|
-
type BaseAnchorProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The `gap` is the space between the trigger and the panel.
|
|
8
|
-
*/
|
|
9
|
-
gap: number | string;
|
|
10
|
-
/**
|
|
11
|
-
* The `offset` is the amount the panel should be nudged from its original position.
|
|
12
|
-
*/
|
|
13
|
-
offset: number | string;
|
|
14
|
-
/**
|
|
15
|
-
* The `padding` is the minimum space between the panel and the viewport.
|
|
16
|
-
*/
|
|
17
|
-
padding: number | string;
|
|
18
|
-
};
|
|
19
|
-
export type DropdownItem = Record<string, any> & {
|
|
20
|
-
id: string;
|
|
21
|
-
divider?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type DropdownProps = {
|
|
24
|
-
/**
|
|
25
|
-
* Dropdown menu trigger button
|
|
26
|
-
*/
|
|
27
|
-
triggerButton: ReactNode;
|
|
28
|
-
/**
|
|
29
|
-
* Dropdown menu item container class
|
|
30
|
-
*/
|
|
31
|
-
itemsContainerClass?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Controls animation of dropdown menu
|
|
34
|
-
* @default true
|
|
35
|
-
*/
|
|
36
|
-
transition?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Controls placement of the dropdown menu
|
|
39
|
-
* @default "bottom start"
|
|
40
|
-
*/
|
|
41
|
-
anchor?: false | AnchorTo | Partial<BaseAnchorProps & {
|
|
42
|
-
/**
|
|
43
|
-
* The `to` value defines which side of the trigger the panel should be placed on and its
|
|
44
|
-
* alignment.
|
|
45
|
-
*/
|
|
46
|
-
to: AnchorTo;
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* List of dropdown menu items
|
|
50
|
-
*/
|
|
51
|
-
items: DropdownItem[];
|
|
52
|
-
/**
|
|
53
|
-
* Renderer function that returns react element to render dropdown item
|
|
54
|
-
* @param item DropdownItem
|
|
55
|
-
* @returns ReactNode
|
|
56
|
-
*/
|
|
57
|
-
renderItem: (item: DropdownItem, options: {
|
|
58
|
-
className: string;
|
|
59
|
-
}) => ReactNode;
|
|
60
|
-
};
|
|
61
|
-
export declare const Dropdown: React.FC<DropdownProps>;
|
|
62
|
-
export {};
|
|
1
|
+
export * from './Dropdown';
|
|
2
|
+
export * from './Dropdown.types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HeadingTextProps } from './HeadingText.types';
|
|
3
|
+
export declare const HeadingText: {
|
|
4
|
+
Title: React.FC<HeadingTextProps>;
|
|
5
|
+
SubTitle: React.FC<HeadingTextProps>;
|
|
6
|
+
SubTitle2: React.FC<HeadingTextProps>;
|
|
7
|
+
SubTitle3: React.FC<HeadingTextProps>;
|
|
8
|
+
SubTitle4: React.FC<HeadingTextProps>;
|
|
9
|
+
};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const HeadingText: {
|
|
7
|
-
Title: React.FC<HeadingTextProps>;
|
|
8
|
-
SubTitle: React.FC<HeadingTextProps>;
|
|
9
|
-
SubTitle2: React.FC<HeadingTextProps>;
|
|
10
|
-
SubTitle3: React.FC<HeadingTextProps>;
|
|
11
|
-
SubTitle4: React.FC<HeadingTextProps>;
|
|
12
|
-
};
|
|
1
|
+
export * from './HeadingText';
|
|
2
|
+
export * from './HeadingText.types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InputProps } from './Input.types';
|
|
2
|
+
export declare function buildInputClass(className?: string, { isFocusWithin, disabled }?: {
|
|
3
|
+
isFocusWithin?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { InputCustomProps } from '../common-type';
|
|
3
|
+
export interface InputProps extends InputHTMLAttributes<HTMLInputElement>, InputCustomProps {
|
|
4
|
+
/**
|
|
5
|
+
* Space for right icon
|
|
6
|
+
*/
|
|
7
|
+
rightGroup?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Space for left icon
|
|
10
|
+
*/
|
|
11
|
+
leftGroup?: ReactNode;
|
|
12
|
+
}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface InputProps extends InputHTMLAttributes<HTMLInputElement>, InputCustomProps {
|
|
4
|
-
/**
|
|
5
|
-
* Space for right icon
|
|
6
|
-
*/
|
|
7
|
-
rightGroup?: ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Space for left icon
|
|
10
|
-
*/
|
|
11
|
-
leftGroup?: ReactNode;
|
|
12
|
-
}
|
|
13
|
-
export declare const Input: React.FC<InputProps>;
|
|
1
|
+
export * from './Input';
|
|
2
|
+
export * from './Input.types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { type LabelHTMLAttributes } from 'react';
|
|
2
|
+
interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
3
|
+
htmlFor?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
6
|
+
export {};
|
|
@@ -1,33 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Defines current page number
|
|
5
|
-
*/
|
|
6
|
-
page: number;
|
|
7
|
-
/**
|
|
8
|
-
* Defines page limit
|
|
9
|
-
*/
|
|
10
|
-
limit: number;
|
|
11
|
-
/**
|
|
12
|
-
* Defines totol items in the list to be paginated.
|
|
13
|
-
*/
|
|
14
|
-
total: number;
|
|
15
|
-
}
|
|
16
|
-
export type PaginationProps = TPagination & {
|
|
17
|
-
/**
|
|
18
|
-
* Pagination component classname
|
|
19
|
-
*/
|
|
20
|
-
className?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Handler for page change
|
|
23
|
-
* @param pagination Partial<TPagination>
|
|
24
|
-
* @returns void
|
|
25
|
-
*/
|
|
26
|
-
onChange: (pagination: Partial<TPagination>) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Whether to show ellipsis for large page numbers
|
|
29
|
-
* @default true
|
|
30
|
-
*/
|
|
31
|
-
ellipsis?: boolean;
|
|
32
|
-
};
|
|
2
|
+
import type { PaginationProps } from './Pagination.types';
|
|
33
3
|
export declare const Pagination: React.FC<PaginationProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface TPagination {
|
|
2
|
+
/**
|
|
3
|
+
* Defines current page number
|
|
4
|
+
*/
|
|
5
|
+
page: number;
|
|
6
|
+
/**
|
|
7
|
+
* Defines page limit
|
|
8
|
+
*/
|
|
9
|
+
limit: number;
|
|
10
|
+
/**
|
|
11
|
+
* Defines totol items in the list to be paginated.
|
|
12
|
+
*/
|
|
13
|
+
total: number;
|
|
14
|
+
}
|
|
15
|
+
export type PaginationProps = TPagination & {
|
|
16
|
+
/**
|
|
17
|
+
* Pagination component classname
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Handler for page change
|
|
22
|
+
* @param pagination Partial<TPagination>
|
|
23
|
+
* @returns void
|
|
24
|
+
*/
|
|
25
|
+
onChange: (pagination: Partial<TPagination>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to show ellipsis for large page numbers
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
ellipsis?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type UsePaginationProps = {
|
|
33
|
+
totalPages: number;
|
|
34
|
+
currentPage: number;
|
|
35
|
+
siblingCount?: number;
|
|
36
|
+
};
|