@pk-design/react-tailwind 1.0.6 → 1.1.1
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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type AlertType = 'success' | 'danger' | 'warning' | 'info';
|
|
3
|
+
export interface BaseAlertProps {
|
|
4
|
+
/**
|
|
5
|
+
* Defines alert type
|
|
6
|
+
* @default "info"
|
|
7
|
+
*/
|
|
8
|
+
type?: AlertType;
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Defines if alert is removable
|
|
12
|
+
*/
|
|
13
|
+
removable?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Handler when closing / dismissing alert
|
|
16
|
+
* @returns void
|
|
17
|
+
*/
|
|
18
|
+
onRemove?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Alert component used to display important messages.
|
|
22
|
+
*
|
|
23
|
+
* One of `message` or `children` is required.
|
|
24
|
+
* @remarks Only one should be provided at a time.
|
|
25
|
+
*/
|
|
26
|
+
export type AlertProps = (BaseAlertProps & {
|
|
27
|
+
/** Text content to display in alert */
|
|
28
|
+
message: string;
|
|
29
|
+
children?: never;
|
|
30
|
+
}) | (BaseAlertProps & {
|
|
31
|
+
/** ReactNode to display in alert */
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
message?: never;
|
|
34
|
+
});
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export interface BaseAlertProps {
|
|
4
|
-
/**
|
|
5
|
-
* Defines alert type
|
|
6
|
-
* @default "info"
|
|
7
|
-
*/
|
|
8
|
-
type?: AlertType;
|
|
9
|
-
className?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Defines if alert is removable
|
|
12
|
-
*/
|
|
13
|
-
removable?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Handler when closing / dismissing alert
|
|
16
|
-
* @returns void
|
|
17
|
-
*/
|
|
18
|
-
onRemove?: () => void;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Alert component used to display important messages.
|
|
22
|
-
*
|
|
23
|
-
* One of `message` or `children` is required.
|
|
24
|
-
* @remarks Only one should be provided at a time.
|
|
25
|
-
*/
|
|
26
|
-
export type AlertProps = (BaseAlertProps & {
|
|
27
|
-
/** Text content to display in alert */
|
|
28
|
-
message: string;
|
|
29
|
-
children?: never;
|
|
30
|
-
}) | (BaseAlertProps & {
|
|
31
|
-
/** ReactNode to display in alert */
|
|
32
|
-
children: ReactNode;
|
|
33
|
-
message?: never;
|
|
34
|
-
});
|
|
35
|
-
export declare const Alert: React.FC<AlertProps>;
|
|
1
|
+
export * from './Alert';
|
|
2
|
+
export * from './Alert.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type BadgeTheme = 'success' | 'danger' | 'warning' | 'info' | 'secondary';
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
/**
|
|
4
|
+
* Defines theme of the Badge
|
|
5
|
+
* @default "info"
|
|
6
|
+
*/
|
|
7
|
+
theme?: BadgeTheme;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: any;
|
|
10
|
+
/**
|
|
11
|
+
* Defines if badge is removable
|
|
12
|
+
*/
|
|
13
|
+
removable?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Defines if corners are rounded
|
|
16
|
+
*/
|
|
17
|
+
rounded?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Handler on removing badge
|
|
20
|
+
*/
|
|
21
|
+
onRemove?: () => void;
|
|
22
|
+
}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export interface BadgeProps {
|
|
4
|
-
/**
|
|
5
|
-
* Defines theme of the Badge
|
|
6
|
-
* @default "info"
|
|
7
|
-
*/
|
|
8
|
-
theme?: BadgeTheme;
|
|
9
|
-
className?: string;
|
|
10
|
-
children: any;
|
|
11
|
-
/**
|
|
12
|
-
* Defines if badge is removable
|
|
13
|
-
*/
|
|
14
|
-
removable?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Defines if corners are rounded
|
|
17
|
-
*/
|
|
18
|
-
rounded?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Handler on removing badge
|
|
21
|
-
*/
|
|
22
|
-
onRemove?: () => void;
|
|
23
|
-
}
|
|
24
|
-
export declare const Badge: React.FC<BadgeProps>;
|
|
1
|
+
export * from './Badge';
|
|
2
|
+
export * from './Badge.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type BannerType = 'info' | 'error' | 'success' | 'warning';
|
|
2
|
+
export type IconSize = 5 | 6 | 7 | 8 | 9 | 10;
|
|
3
|
+
export interface BannerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Defines banner type
|
|
6
|
+
* @default "info"
|
|
7
|
+
*/
|
|
8
|
+
type?: BannerType;
|
|
9
|
+
children: any;
|
|
10
|
+
/**
|
|
11
|
+
* Controls the icon size
|
|
12
|
+
*/
|
|
13
|
+
iconSize?: IconSize;
|
|
14
|
+
}
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export type IconSize = 5 | 6 | 7 | 8 | 9 | 10;
|
|
4
|
-
export interface BannerProps {
|
|
5
|
-
/**
|
|
6
|
-
* Defines banner type
|
|
7
|
-
* @default "info"
|
|
8
|
-
*/
|
|
9
|
-
type?: BannerType;
|
|
10
|
-
children: any;
|
|
11
|
-
/**
|
|
12
|
-
* Controls the icon size
|
|
13
|
-
*/
|
|
14
|
-
iconSize?: IconSize;
|
|
15
|
-
}
|
|
16
|
-
export declare const Banner: React.FC<BannerProps>;
|
|
1
|
+
export * from './Banner';
|
|
2
|
+
export * from './Banner.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes, JSX, JSXElementConstructor } from 'react';
|
|
2
|
+
export interface BodyTextProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Add's `text-sm` class to the element
|
|
5
|
+
*/
|
|
6
|
+
small?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Add's `font-semibold` class to the element
|
|
9
|
+
*/
|
|
10
|
+
strong?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Add's `text-gray-500` class to the element
|
|
13
|
+
*/
|
|
14
|
+
muted?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Add's `text-red-500` class to the element
|
|
17
|
+
*/
|
|
18
|
+
error?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Add's `inline-flex items-center gap-2` class to the element
|
|
21
|
+
*/
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* JSX element to be render in place of `p`
|
|
25
|
+
*/
|
|
26
|
+
as?: keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
27
|
+
}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Add's `text-sm` class to the element
|
|
5
|
-
*/
|
|
6
|
-
small?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Add's `font-semibold` class to the element
|
|
9
|
-
*/
|
|
10
|
-
strong?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Add's `text-gray-500` class to the element
|
|
13
|
-
*/
|
|
14
|
-
muted?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Add's `text-red-500` class to the element
|
|
17
|
-
*/
|
|
18
|
-
error?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Add's `inline-flex items-center gap-2` class to the element
|
|
21
|
-
*/
|
|
22
|
-
inline?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* JSX element to be render in place of `p`
|
|
25
|
-
*/
|
|
26
|
-
as?: keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
27
|
-
}
|
|
28
|
-
export declare const BodyText: React.FC<BodyTextProps>;
|
|
1
|
+
export * from './BodyText';
|
|
2
|
+
export * from './BodyText.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BreadcrumbItem = {
|
|
3
|
+
/**
|
|
4
|
+
* Unique key for each breadcrumn item
|
|
5
|
+
*/
|
|
6
|
+
key: string;
|
|
7
|
+
/**
|
|
8
|
+
* Text content to display
|
|
9
|
+
*/
|
|
10
|
+
text: string;
|
|
11
|
+
/**
|
|
12
|
+
* Href Link to navigate using breadcrumb
|
|
13
|
+
*/
|
|
14
|
+
to?: string;
|
|
15
|
+
};
|
|
16
|
+
export interface BreadcrumbProps {
|
|
17
|
+
/**
|
|
18
|
+
* List of breadcrumb items
|
|
19
|
+
*/
|
|
20
|
+
items: BreadcrumbItem[];
|
|
21
|
+
/**
|
|
22
|
+
* Rendered method for breadcrumbItem,
|
|
23
|
+
* This method is called for all items except the last,
|
|
24
|
+
* since, last item in breadcrumb will be the current page of user
|
|
25
|
+
* @param item BreadcrumbItem
|
|
26
|
+
* @returns ReactNode
|
|
27
|
+
*/
|
|
28
|
+
render: (item: BreadcrumbItem) => ReactNode;
|
|
29
|
+
}
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Unique key for each breadcrumn item
|
|
5
|
-
*/
|
|
6
|
-
key: string;
|
|
7
|
-
/**
|
|
8
|
-
* Text content to display
|
|
9
|
-
*/
|
|
10
|
-
text: string;
|
|
11
|
-
/**
|
|
12
|
-
* Href Link to navigate using breadcrumb
|
|
13
|
-
*/
|
|
14
|
-
to?: string;
|
|
15
|
-
};
|
|
16
|
-
export interface BreadcrumbProps {
|
|
17
|
-
/**
|
|
18
|
-
* List of breadcrumb items
|
|
19
|
-
*/
|
|
20
|
-
items: BreadcrumbItem[];
|
|
21
|
-
/**
|
|
22
|
-
* Rendered method for breadcrumbItem,
|
|
23
|
-
* This method is called for all items except the last,
|
|
24
|
-
* since, last item in breadcrumb will be the current page of user
|
|
25
|
-
* @param item BreadcrumbItem
|
|
26
|
-
* @returns ReactNode
|
|
27
|
-
*/
|
|
28
|
-
render: (item: BreadcrumbItem) => ReactNode;
|
|
29
|
-
}
|
|
30
|
-
export declare const Breadcrumb: React.FC<BreadcrumbProps>;
|
|
1
|
+
export * from './Breadcrumb';
|
|
2
|
+
export * from './Breadcrumb.types';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare const Button: React.FC<ButtonProps>;
|
|
1
|
+
import type { ButtonComponent } from './Button.types';
|
|
2
|
+
export declare const Button: ButtonComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { JSX, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Theme variants applied to the Button component.
|
|
4
|
+
*
|
|
5
|
+
* Controls the color scheme of the button.
|
|
6
|
+
*
|
|
7
|
+
* @default "primary"
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonTheme = 'primary' | 'secondary' | 'danger';
|
|
10
|
+
/**
|
|
11
|
+
* Visual variant of the button.
|
|
12
|
+
*
|
|
13
|
+
* - **default**: Filled style (solid background)
|
|
14
|
+
* - **outlined**: Transparent background + border
|
|
15
|
+
* - **plain**: Text-only style
|
|
16
|
+
*
|
|
17
|
+
* @default "default"
|
|
18
|
+
*/
|
|
19
|
+
export type ButtonVariant = 'default' | 'outlined' | 'plain';
|
|
20
|
+
/**
|
|
21
|
+
* Predefined Button sizes.
|
|
22
|
+
*
|
|
23
|
+
* Controls padding, font size, and spacing.
|
|
24
|
+
*
|
|
25
|
+
* @default "md"
|
|
26
|
+
*/
|
|
27
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
28
|
+
/**
|
|
29
|
+
* Mapping of theme + variant to Tailwind class strings.
|
|
30
|
+
*
|
|
31
|
+
* Internal use only.
|
|
32
|
+
*/
|
|
33
|
+
export type ThemedButtonClass = {
|
|
34
|
+
[key in ButtonTheme]: {
|
|
35
|
+
[key in ButtonVariant]: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Utility: Extract the correct `ref` type for intrinsic elements
|
|
40
|
+
* or custom React components.
|
|
41
|
+
*/
|
|
42
|
+
export type PolymorphicRef<C extends ElementType> = ComponentPropsWithoutRef<C>['ref'];
|
|
43
|
+
/**
|
|
44
|
+
* Utility: Builds a polymorphic prop type.
|
|
45
|
+
*
|
|
46
|
+
* This allows the component to accept **any HTML element** or **any custom React component**
|
|
47
|
+
* via the `as` prop while automatically inheriting the correct props.
|
|
48
|
+
*
|
|
49
|
+
* Example:
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Button as="a" href="/home" />
|
|
52
|
+
* <Button as={MyLink} to="/home" customProp />
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export type PolymorphicButtonProps<C extends ElementType, Props = {}> = Props & {
|
|
56
|
+
/**
|
|
57
|
+
* The element or component to render.
|
|
58
|
+
*
|
|
59
|
+
* Supports:
|
|
60
|
+
* - HTML elements (e.g., `"button"`, `"a"`, `"div"`)
|
|
61
|
+
* - React components (e.g., `Link`, `NextLink`, `MyCustomButton`)
|
|
62
|
+
*
|
|
63
|
+
* @default "button"
|
|
64
|
+
*/
|
|
65
|
+
as?: C;
|
|
66
|
+
} & Omit<ComponentPropsWithoutRef<C>, keyof Props | 'as' | 'type' | 'disabled'>;
|
|
67
|
+
/**
|
|
68
|
+
* Core props shared by all Button variants.
|
|
69
|
+
*
|
|
70
|
+
* These do **not** include any HTML attributes — those come from the polymorphic type.
|
|
71
|
+
*/
|
|
72
|
+
export interface ButtonBaseProps {
|
|
73
|
+
/**
|
|
74
|
+
* Controls button theme (color palette).
|
|
75
|
+
*
|
|
76
|
+
* @default "primary"
|
|
77
|
+
*/
|
|
78
|
+
theme?: ButtonTheme;
|
|
79
|
+
/**
|
|
80
|
+
* Controls the visual styling of the button.
|
|
81
|
+
*
|
|
82
|
+
* @default "default"
|
|
83
|
+
*/
|
|
84
|
+
variant?: ButtonVariant;
|
|
85
|
+
/**
|
|
86
|
+
* Controls padding, font size, spacing.
|
|
87
|
+
*
|
|
88
|
+
* @default "md"
|
|
89
|
+
*/
|
|
90
|
+
size?: ButtonSize;
|
|
91
|
+
/**
|
|
92
|
+
* If true, shows a Loader inside the button.
|
|
93
|
+
*
|
|
94
|
+
* While loading:
|
|
95
|
+
* - children are replaced
|
|
96
|
+
* - button typically becomes disabled
|
|
97
|
+
*/
|
|
98
|
+
loading?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Optional text to display next to the loader.
|
|
101
|
+
*
|
|
102
|
+
* Only shown when `loading=true`.
|
|
103
|
+
*
|
|
104
|
+
* @default ""
|
|
105
|
+
*/
|
|
106
|
+
loadingText?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Applies 50% border radius, producing a pill-shaped button.
|
|
109
|
+
*
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
rounded?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Indicates that the button only contains an icon.
|
|
115
|
+
*
|
|
116
|
+
* Adjusts padding to match icon-only UX.
|
|
117
|
+
*
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
iconOnly?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Prevents outline styles on keyboard focus.
|
|
123
|
+
*
|
|
124
|
+
* Useful for icon buttons or custom focus handling.
|
|
125
|
+
*
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
noOutlineOnFocus?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Additional classNames merged with the computed classes.
|
|
131
|
+
*/
|
|
132
|
+
className?: string;
|
|
133
|
+
/**
|
|
134
|
+
* The HTML button type.
|
|
135
|
+
* Only valid when rendering as <button>.
|
|
136
|
+
*/
|
|
137
|
+
type?: 'button' | 'submit' | 'reset';
|
|
138
|
+
/**
|
|
139
|
+
* Standard disabled attribute.
|
|
140
|
+
* Only applies when as="button".
|
|
141
|
+
*/
|
|
142
|
+
disabled?: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Complete Button props,
|
|
146
|
+
* supporting **polymorphic rendering** via the `as` prop.
|
|
147
|
+
*
|
|
148
|
+
* Examples:
|
|
149
|
+
*
|
|
150
|
+
* Render as a native button:
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <Button type="submit">Save</Button>
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* Render as a link:
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <Button as="a" href="/pricing" target="_blank">Learn More</Button>
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* Render as a custom component:
|
|
161
|
+
* ```tsx
|
|
162
|
+
* <Button as={MyCustomComponent} customProp="123">Custom</Button>
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export type ButtonProps<C extends ElementType = 'button'> = PolymorphicButtonProps<C, ButtonBaseProps>;
|
|
166
|
+
export interface ButtonComponent {
|
|
167
|
+
<C extends ElementType = 'button'>(props: ButtonProps<C> & {
|
|
168
|
+
ref?: PolymorphicRef<C>;
|
|
169
|
+
}): JSX.Element;
|
|
170
|
+
displayName?: string;
|
|
171
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Button';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './Button.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import { PolymorphicProps } from '../common-type';
|
|
3
|
+
export type CardBaseProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Make card hoverable (adds shadow transitions)
|
|
6
|
+
*/
|
|
7
|
+
hoverable?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Adds border around the card
|
|
10
|
+
*/
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Removes default padding
|
|
14
|
+
*/
|
|
15
|
+
noPadding?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Render Card as different element or component
|
|
18
|
+
*
|
|
19
|
+
* @default "div"
|
|
20
|
+
*/
|
|
21
|
+
as?: ElementType;
|
|
22
|
+
};
|
|
23
|
+
export type CardProps<C extends ElementType = 'div'> = PolymorphicProps<C, CardBaseProps>;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
to?: string;
|
|
4
|
-
hoverable?: boolean;
|
|
5
|
-
bordered?: boolean;
|
|
6
|
-
noPadding?: boolean;
|
|
7
|
-
as?: keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
8
|
-
}
|
|
9
|
-
export declare const Card: React.FC<CardProps>;
|
|
1
|
+
export * from './Card';
|
|
2
|
+
export * from './Card.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { InputCustomProps } from '../common-type';
|
|
3
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>, Omit<InputCustomProps, 'labelHint'> {
|
|
4
|
+
/** Force type to checkbox only */
|
|
5
|
+
type?: 'checkbox';
|
|
6
|
+
/** Extra class for outer wrapper */
|
|
7
|
+
wrapperClass?: string;
|
|
8
|
+
/** Input container class */
|
|
9
|
+
containerClass?: string;
|
|
10
|
+
/** Label class */
|
|
11
|
+
labelClass?: string;
|
|
12
|
+
/** Error message */
|
|
13
|
+
error?: string | ReactNode;
|
|
14
|
+
}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement>, Omit<InputCustomProps, 'labelHint'> {
|
|
4
|
-
/**
|
|
5
|
-
* Type is constant 'checkbox'
|
|
6
|
-
*/
|
|
7
|
-
type?: 'checkbox';
|
|
8
|
-
/**
|
|
9
|
-
* Input wrapper class
|
|
10
|
-
*/
|
|
11
|
-
wrapperClass?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
1
|
+
export * from './Checkbox';
|
|
2
|
+
export * from './Checkbox.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ChangeEvent, ReactNode } from 'react';
|
|
2
|
+
export type CheckboxGroupItem<T = any> = {
|
|
3
|
+
/**
|
|
4
|
+
* Checkbox item label
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Checkbox item value
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
};
|
|
12
|
+
export interface CheckboxGroupProps<T = any> {
|
|
13
|
+
/**
|
|
14
|
+
* Group name applied to all checkboxes in the group
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Currently selected values
|
|
19
|
+
*/
|
|
20
|
+
value?: T[];
|
|
21
|
+
/**
|
|
22
|
+
* Label displayed above the group
|
|
23
|
+
*/
|
|
24
|
+
label?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Label CSS classes
|
|
27
|
+
*/
|
|
28
|
+
labelClass?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Wrapper classes for the label row
|
|
31
|
+
*/
|
|
32
|
+
labelWrapperClass?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Hint text shown next to the label
|
|
35
|
+
*/
|
|
36
|
+
labelHint?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Container classes for the group wrapper
|
|
39
|
+
*/
|
|
40
|
+
containerClass?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Callback fired whenever selection updates.
|
|
43
|
+
*/
|
|
44
|
+
onChange?: (values: T[], e: ChangeEvent<HTMLInputElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Options in the group — can be:
|
|
47
|
+
* - string[] → converted to {label, value}
|
|
48
|
+
* - CheckboxGroupItem<T>[]
|
|
49
|
+
*/
|
|
50
|
+
options: string[] | CheckboxGroupItem<T>[];
|
|
51
|
+
/**
|
|
52
|
+
* Whether to arrange checkboxes inline
|
|
53
|
+
*/
|
|
54
|
+
inline?: boolean;
|
|
55
|
+
}
|