@opencxh/ui-kit 1.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 +261 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3076 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +2 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/src/action/Button.d.ts +50 -0
- package/dist/src/action/ButtonGroup.d.ts +17 -0
- package/dist/src/action/Link.d.ts +21 -0
- package/dist/src/command-palette/CommandPalette.d.ts +22 -0
- package/dist/src/command-palette/index.d.ts +2 -0
- package/dist/src/content/Icon.d.ts +21 -0
- package/dist/src/content/Image.d.ts +29 -0
- package/dist/src/content/PageHeader.d.ts +43 -0
- package/dist/src/content/Table.d.ts +108 -0
- package/dist/src/feedback/Badge.d.ts +48 -0
- package/dist/src/feedback/ContentLoading.d.ts +21 -0
- package/dist/src/feedback/Spinner.d.ts +32 -0
- package/dist/src/forms/Form.d.ts +119 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/input/Checkbox.d.ts +55 -0
- package/dist/src/input/DatePicker.d.ts +26 -0
- package/dist/src/input/Select.d.ts +89 -0
- package/dist/src/input/TextArea.d.ts +39 -0
- package/dist/src/input/TextField.d.ts +68 -0
- package/dist/src/navigation/Sidebar.d.ts +17 -0
- package/dist/src/navigation/Tabs.d.ts +59 -0
- package/dist/src/overlays/Dropdown.d.ts +41 -0
- package/dist/src/overlays/Modal.d.ts +82 -0
- package/dist/src/primitives/Box.d.ts +47 -0
- package/dist/src/primitives/Card.d.ts +6 -0
- package/dist/src/typography/Heading.d.ts +23 -0
- package/dist/src/typography/List.d.ts +31 -0
- package/dist/src/typography/Text.d.ts +31 -0
- package/dist/src/utils/cn.d.ts +14 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +62 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The visual style variant of the button
|
|
5
|
+
*/
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
7
|
+
/**
|
|
8
|
+
* The size of the button
|
|
9
|
+
*/
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
11
|
+
/**
|
|
12
|
+
* Whether the button should take the full width of its container
|
|
13
|
+
*/
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the button is in a loading state
|
|
17
|
+
*/
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Icon to display before the button text
|
|
21
|
+
*/
|
|
22
|
+
leftIcon?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Icon to display after the button text
|
|
25
|
+
*/
|
|
26
|
+
rightIcon?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the button should only display an icon (no text)
|
|
29
|
+
*/
|
|
30
|
+
iconOnly?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Button component with theme integration and multiple variants
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Button variant="primary" size="md">
|
|
38
|
+
* Click me
|
|
39
|
+
* </Button>
|
|
40
|
+
*
|
|
41
|
+
* <Button variant="outline" leftIcon={<PlusIcon />}>
|
|
42
|
+
* Add item
|
|
43
|
+
* </Button>
|
|
44
|
+
*
|
|
45
|
+
* <Button iconOnly variant="ghost" size="sm">
|
|
46
|
+
* <SearchIcon />
|
|
47
|
+
* </Button>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ButtonGroupProps {
|
|
3
|
+
/** Child buttons to group */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Size of the button group */
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
/** Orientation of the button group */
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
/** Whether buttons should be attached (no gap) */
|
|
10
|
+
attached?: boolean;
|
|
11
|
+
/** Additional CSS classes */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ButtonGroup component for grouping related buttons
|
|
16
|
+
*/
|
|
17
|
+
export declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
/** Link variant */
|
|
4
|
+
variant?: 'default' | 'subtle' | 'underline' | 'button';
|
|
5
|
+
/** Link size */
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
/** Color theme */
|
|
8
|
+
color?: 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
9
|
+
/** Whether the link is disabled */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Whether to show external link icon */
|
|
12
|
+
external?: boolean;
|
|
13
|
+
/** Additional CSS classes */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Child content */
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Link component with theme integration and accessibility features
|
|
20
|
+
*/
|
|
21
|
+
export declare const Link: React.FC<LinkProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface Command {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
action?: () => void;
|
|
6
|
+
subCommands?: Command[];
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface CommandPaletteProps {
|
|
10
|
+
commands: Command[];
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
labels?: {
|
|
14
|
+
searchPlaceholder?: string;
|
|
15
|
+
navigate?: string;
|
|
16
|
+
select?: string;
|
|
17
|
+
close?: string;
|
|
18
|
+
noCommandsFound?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare const CommandPalette: React.FC<CommandPaletteProps>;
|
|
22
|
+
export default CommandPalette;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
/** Icon component from lucide-react or custom icon */
|
|
4
|
+
icon: React.ComponentType<any>;
|
|
5
|
+
/** Icon size */
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
7
|
+
/** Icon color */
|
|
8
|
+
color?: 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'current';
|
|
9
|
+
/** Whether the icon should be clickable */
|
|
10
|
+
clickable?: boolean;
|
|
11
|
+
/** Click handler */
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
/** Additional CSS classes */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Accessibility label */
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Icon component that works with Lucide React icons and provides theme integration
|
|
20
|
+
*/
|
|
21
|
+
export declare const Icon: React.FC<IconProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
3
|
+
/** Image source URL */
|
|
4
|
+
src: string;
|
|
5
|
+
/** Alt text for accessibility */
|
|
6
|
+
alt: string;
|
|
7
|
+
/** Image size preset */
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
9
|
+
/** Aspect ratio */
|
|
10
|
+
aspectRatio?: 'square' | 'video' | 'portrait' | 'landscape' | 'auto';
|
|
11
|
+
/** Border radius */
|
|
12
|
+
radius?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
13
|
+
/** Whether to show loading state */
|
|
14
|
+
showLoading?: boolean;
|
|
15
|
+
/** Whether to show error state */
|
|
16
|
+
showError?: boolean;
|
|
17
|
+
/** Fallback image URL */
|
|
18
|
+
fallback?: string;
|
|
19
|
+
/** Loading placeholder content */
|
|
20
|
+
loadingContent?: React.ReactNode;
|
|
21
|
+
/** Error placeholder content */
|
|
22
|
+
errorContent?: React.ReactNode;
|
|
23
|
+
/** Additional CSS classes */
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Image component with loading states, error handling, and theme integration
|
|
28
|
+
*/
|
|
29
|
+
export declare const Image: React.FC<ImageProps>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface PageHeaderAction {
|
|
3
|
+
/** Action identifier */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Action label */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Action icon */
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
/** Action handler */
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
/** Action variant */
|
|
12
|
+
variant?: "primary" | "secondary" | "outline" | "ghost" | "destructive";
|
|
13
|
+
/** Whether action is disabled */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface PageHeaderProps {
|
|
17
|
+
/** Page title */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Page subtitle/description */
|
|
20
|
+
subtitle?: string;
|
|
21
|
+
/** Breadcrumb items */
|
|
22
|
+
breadcrumbs?: Array<{
|
|
23
|
+
label: string;
|
|
24
|
+
href?: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** Action buttons */
|
|
27
|
+
actions?: PageHeaderAction[];
|
|
28
|
+
/** Additional content to render in the header */
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/** Additional CSS classes */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Back button label */
|
|
33
|
+
backLabel?: string;
|
|
34
|
+
/** Back button handler */
|
|
35
|
+
onBack?: () => void;
|
|
36
|
+
/** Back button class name */
|
|
37
|
+
backClassName?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const ChevronLeftIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* PageHeader component for consistent page layouts with title, actions, and breadcrumbs
|
|
42
|
+
*/
|
|
43
|
+
export declare const PageHeader: React.FC<PageHeaderProps>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TableColumn<T = any> {
|
|
3
|
+
/** Unique column identifier */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Column header text */
|
|
6
|
+
header: string;
|
|
7
|
+
/** Data accessor - can be string key or function */
|
|
8
|
+
accessor: keyof T | ((row: T) => any);
|
|
9
|
+
/** Custom cell renderer */
|
|
10
|
+
cell?: (value: any, row: T, index: number) => React.ReactNode;
|
|
11
|
+
/** Column width */
|
|
12
|
+
width?: string | number;
|
|
13
|
+
/** Whether column is sortable */
|
|
14
|
+
sortable?: boolean;
|
|
15
|
+
/** Whether column is searchable */
|
|
16
|
+
searchable?: boolean;
|
|
17
|
+
/** Column alignment */
|
|
18
|
+
align?: 'left' | 'center' | 'right';
|
|
19
|
+
/** Whether column is sticky */
|
|
20
|
+
sticky?: 'left' | 'right';
|
|
21
|
+
/** Custom header renderer */
|
|
22
|
+
headerCell?: () => React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export interface TableAction<T = any> {
|
|
25
|
+
/** Action identifier */
|
|
26
|
+
id: string;
|
|
27
|
+
/** Action label */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Action icon */
|
|
30
|
+
icon?: React.ReactNode;
|
|
31
|
+
/** Action handler */
|
|
32
|
+
onClick: (row: T, index: number) => void;
|
|
33
|
+
/** Whether action is disabled for this row */
|
|
34
|
+
disabled?: (row: T) => boolean;
|
|
35
|
+
/** Action variant */
|
|
36
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
37
|
+
}
|
|
38
|
+
export interface TableFilter {
|
|
39
|
+
/** Filter identifier */
|
|
40
|
+
id: string;
|
|
41
|
+
/** Filter label */
|
|
42
|
+
label: string;
|
|
43
|
+
/** Filter type */
|
|
44
|
+
type?: 'select' | 'date' | 'dateRange';
|
|
45
|
+
/** Filter options (for select type) */
|
|
46
|
+
options?: Array<{
|
|
47
|
+
value: string;
|
|
48
|
+
label: string;
|
|
49
|
+
}>;
|
|
50
|
+
/** Current filter value */
|
|
51
|
+
value?: string | Date | null | string[];
|
|
52
|
+
/** Filter change handler */
|
|
53
|
+
onChange: (value: string | Date | null | string[]) => void;
|
|
54
|
+
/** Placeholder text */
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
/** Whether filter is multi-select */
|
|
57
|
+
multiSelect?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface TableProps<T = any> {
|
|
60
|
+
/** Table data */
|
|
61
|
+
data: T[];
|
|
62
|
+
/** Column definitions */
|
|
63
|
+
columns: TableColumn<T>[];
|
|
64
|
+
/** Loading state */
|
|
65
|
+
loading?: boolean;
|
|
66
|
+
/** Whether table is searchable */
|
|
67
|
+
searchable?: boolean;
|
|
68
|
+
/** Search placeholder text */
|
|
69
|
+
searchPlaceholder?: string;
|
|
70
|
+
/** Table filters */
|
|
71
|
+
filters?: TableFilter[];
|
|
72
|
+
/** Whether table has pagination */
|
|
73
|
+
paginated?: boolean;
|
|
74
|
+
/** Page size options */
|
|
75
|
+
pageSizeOptions?: number[];
|
|
76
|
+
/** Default page size */
|
|
77
|
+
defaultPageSize?: number;
|
|
78
|
+
/** Row actions */
|
|
79
|
+
actions?: TableAction<T>[];
|
|
80
|
+
/** Row click handler */
|
|
81
|
+
onRowClick?: (row: T, index: number) => void;
|
|
82
|
+
/** Row selection */
|
|
83
|
+
selectable?: boolean;
|
|
84
|
+
/** Selected rows */
|
|
85
|
+
selectedRows?: T[];
|
|
86
|
+
/** Selection change handler */
|
|
87
|
+
onSelectionChange?: (selectedRows: T[]) => void;
|
|
88
|
+
/** Row key accessor */
|
|
89
|
+
getRowKey?: (row: T, index: number) => string | number;
|
|
90
|
+
/** Empty state content */
|
|
91
|
+
emptyContent?: React.ReactNode;
|
|
92
|
+
/** Table size */
|
|
93
|
+
size?: 'sm' | 'md' | 'lg';
|
|
94
|
+
/** Whether to show row hover */
|
|
95
|
+
hoverable?: boolean;
|
|
96
|
+
/** Whether to show row borders */
|
|
97
|
+
bordered?: boolean;
|
|
98
|
+
/** Whether to stripe rows */
|
|
99
|
+
striped?: boolean;
|
|
100
|
+
/** Additional CSS classes */
|
|
101
|
+
className?: string;
|
|
102
|
+
/** Custom row className */
|
|
103
|
+
rowClassName?: (row: T, index: number) => string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* High-performance Table component with sorting, pagination, search, and custom renderers
|
|
107
|
+
*/
|
|
108
|
+
export declare const Table: <T extends Record<string, any>>({ data, columns, loading, searchable, searchPlaceholder, filters, paginated, pageSizeOptions, defaultPageSize, actions, onRowClick, selectable, selectedRows, onSelectionChange, getRowKey, emptyContent, hoverable, bordered, striped, className, rowClassName, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The visual variant of the badge
|
|
5
|
+
*/
|
|
6
|
+
variant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
|
|
7
|
+
/**
|
|
8
|
+
* The size of the badge
|
|
9
|
+
*/
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
/**
|
|
12
|
+
* Whether the badge should have a dot indicator
|
|
13
|
+
*/
|
|
14
|
+
dot?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Icon to display in the badge
|
|
17
|
+
*/
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the badge can be dismissed
|
|
21
|
+
*/
|
|
22
|
+
dismissible?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Callback fired when the badge is dismissed
|
|
25
|
+
*/
|
|
26
|
+
onDismiss?: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Badge component for displaying status indicators and labels
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Badge variant="success">Active</Badge>
|
|
34
|
+
*
|
|
35
|
+
* <Badge variant="warning" dot>
|
|
36
|
+
* Pending
|
|
37
|
+
* </Badge>
|
|
38
|
+
*
|
|
39
|
+
* <Badge variant="error" dismissible onDismiss={() => console.log('dismissed')}>
|
|
40
|
+
* Error
|
|
41
|
+
* </Badge>
|
|
42
|
+
*
|
|
43
|
+
* <Badge variant="primary" icon={<StarIcon />}>
|
|
44
|
+
* Featured
|
|
45
|
+
* </Badge>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function Badge({ variant, size, dot, icon, dismissible, onDismiss, className, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ContentLoadingProps {
|
|
3
|
+
/**
|
|
4
|
+
* Optional custom skeleton content (overrides default)
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* If true, renders a table-style skeleton
|
|
9
|
+
*/
|
|
10
|
+
showTableSkeleton?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Number of table columns (default: 6)
|
|
13
|
+
*/
|
|
14
|
+
tableColumns?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Number of table rows (default: 8)
|
|
17
|
+
*/
|
|
18
|
+
tableRows?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function ContentLoading({ children, showTableSkeleton, tableColumns, tableRows, }: ContentLoadingProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SpinnerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The size of the spinner
|
|
5
|
+
*/
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
/**
|
|
8
|
+
* The color variant of the spinner
|
|
9
|
+
*/
|
|
10
|
+
variant?: 'primary' | 'secondary' | 'white' | 'current';
|
|
11
|
+
/**
|
|
12
|
+
* Optional label for accessibility
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to show the spinner with a label
|
|
17
|
+
*/
|
|
18
|
+
showLabel?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Spinner component for loading states
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Spinner size="md" variant="primary" />
|
|
26
|
+
*
|
|
27
|
+
* <Spinner size="lg" variant="primary" showLabel label="Loading..." />
|
|
28
|
+
*
|
|
29
|
+
* <Spinner size="sm" variant="white" />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function Spinner({ size, variant, label, showLabel, className, ...props }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type FormFieldType = "text" | "email" | "password" | "number" | "tel" | "url" | "textarea" | "select" | "checkbox" | "radio" | "date" | "custom" | "array";
|
|
3
|
+
export interface FormGroupItem<T = any> {
|
|
4
|
+
/** Field name (key in form data) */
|
|
5
|
+
name: keyof T;
|
|
6
|
+
/** Field label */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Field type */
|
|
9
|
+
type: FormFieldType;
|
|
10
|
+
/** Text input type (when type is 'text') */
|
|
11
|
+
textType?: "text" | "email" | "password" | "number" | "tel" | "url";
|
|
12
|
+
/** Field width (CSS width value or grid columns) */
|
|
13
|
+
width?: string | number;
|
|
14
|
+
/** Placeholder text */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Autocomplete attribute */
|
|
17
|
+
autocomplete?: string;
|
|
18
|
+
/** Options for select/radio/checkbox types */
|
|
19
|
+
options?: Array<{
|
|
20
|
+
value: string | number;
|
|
21
|
+
label: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/** Validation function */
|
|
25
|
+
validator?: (value: any, formData: T) => string | null;
|
|
26
|
+
/** Conditional function to show/hide field */
|
|
27
|
+
conditional?: (formData: T) => boolean;
|
|
28
|
+
/** Whether field can be empty */
|
|
29
|
+
allowEmpty?: boolean;
|
|
30
|
+
/** Remove field from form data when empty */
|
|
31
|
+
removeIfEmpty?: boolean;
|
|
32
|
+
/** Whether field is hidden */
|
|
33
|
+
hidden?: boolean;
|
|
34
|
+
/** Whether field is required */
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Whether field is disabled */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** Custom component renderer */
|
|
39
|
+
customComponent?: (props: {
|
|
40
|
+
value: any;
|
|
41
|
+
onChange: (value: any) => void;
|
|
42
|
+
error?: string;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}) => React.ReactNode;
|
|
45
|
+
/** Additional props to pass to the field component */
|
|
46
|
+
fieldProps?: Record<string, any>;
|
|
47
|
+
/** For 'array' type, defines the fields for each item in the array */
|
|
48
|
+
arrayFields?: FormGroupItem<any>[];
|
|
49
|
+
/** For 'select' type, whether the select should be searchable */
|
|
50
|
+
searchable?: boolean;
|
|
51
|
+
/** For 'select' type, whether the select should be multiple */
|
|
52
|
+
multiple?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface FormGroup<T = any> {
|
|
55
|
+
/** Group identifier */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Group title */
|
|
58
|
+
title: string;
|
|
59
|
+
/** Group description */
|
|
60
|
+
description?: string;
|
|
61
|
+
/** Group items */
|
|
62
|
+
items: FormGroupItem<T>[];
|
|
63
|
+
/** Conditional function to show/hide group */
|
|
64
|
+
conditional?: (formData: T) => boolean;
|
|
65
|
+
/** Group layout */
|
|
66
|
+
layout?: "grid" | "flex";
|
|
67
|
+
/** Number of columns for grid layout */
|
|
68
|
+
columns?: number;
|
|
69
|
+
/** Additional CSS classes */
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface FormButtonProps {
|
|
73
|
+
/** Button label */
|
|
74
|
+
label: string;
|
|
75
|
+
/** Button variant */
|
|
76
|
+
variant?: "primary" | "secondary" | "outline" | "ghost" | "destructive";
|
|
77
|
+
/** Button size */
|
|
78
|
+
size?: "sm" | "md" | "lg";
|
|
79
|
+
/** Whether button is disabled */
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/** Additional CSS classes */
|
|
82
|
+
className?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface FormProps<T = Record<string, any>> {
|
|
85
|
+
/** Form groups */
|
|
86
|
+
groups: FormGroup<T>[];
|
|
87
|
+
/** Initial form data */
|
|
88
|
+
data?: Partial<T>;
|
|
89
|
+
/** Form submit handler */
|
|
90
|
+
onSubmit?: (data: T, transformedData?: any) => void | Promise<void>;
|
|
91
|
+
/** Form cancel handler */
|
|
92
|
+
onCancel?: () => void;
|
|
93
|
+
/** Form change handler */
|
|
94
|
+
onChange?: (data: Partial<T>, changedField?: keyof T) => void;
|
|
95
|
+
/** Data transformation function (called before submit) */
|
|
96
|
+
transform?: (data: T) => any;
|
|
97
|
+
/** Form validation function */
|
|
98
|
+
validate?: (data: T) => Record<keyof T, string> | null;
|
|
99
|
+
/** Submit button props */
|
|
100
|
+
submitButton?: FormButtonProps;
|
|
101
|
+
/** Cancel button props */
|
|
102
|
+
cancelButton?: FormButtonProps;
|
|
103
|
+
/** Whether to show buttons */
|
|
104
|
+
showButtons?: boolean;
|
|
105
|
+
/** Form layout */
|
|
106
|
+
layout?: "vertical" | "horizontal";
|
|
107
|
+
/** Form size */
|
|
108
|
+
size?: "sm" | "md" | "lg" | "full";
|
|
109
|
+
/** Whether form is loading */
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
/** Additional CSS classes */
|
|
112
|
+
className?: string;
|
|
113
|
+
/** Form ref */
|
|
114
|
+
ref?: React.RefObject<HTMLFormElement>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Generic Form component with groups, validation, and conditional rendering
|
|
118
|
+
*/
|
|
119
|
+
export declare const Form: <T extends Record<string, any>>({ groups, data: externalData, onSubmit, onCancel, onChange, transform, validate, submitButton, cancelButton, showButtons, layout, size, loading, className, ref, }: FormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { cn, createSizes, createVariants } from './utils/cn';
|
|
2
|
+
export { Button, type ButtonProps } from './action/Button';
|
|
3
|
+
export { ButtonGroup, type ButtonGroupProps } from './action/ButtonGroup';
|
|
4
|
+
export { Link, type LinkProps } from './action/Link';
|
|
5
|
+
export { Checkbox, type CheckboxProps } from './input/Checkbox';
|
|
6
|
+
export { DatePicker, type DatePickerProps } from './input/DatePicker';
|
|
7
|
+
export { Select, type SelectOption, type SelectProps } from './input/Select';
|
|
8
|
+
export { TextArea, type TextAreaProps } from './input/TextArea';
|
|
9
|
+
export { TextField, type TextFieldProps } from './input/TextField';
|
|
10
|
+
export { Form, type FormButtonProps, type FormFieldType, type FormGroup, type FormGroupItem, type FormProps, } from './forms/Form';
|
|
11
|
+
export { Dropdown, type DropdownOption, type DropdownProps, } from './overlays/Dropdown';
|
|
12
|
+
export { Modal, type ModalProps } from './overlays/Modal';
|
|
13
|
+
export { Badge, type BadgeProps } from './feedback/Badge';
|
|
14
|
+
export { ContentLoading } from './feedback/ContentLoading';
|
|
15
|
+
export { Spinner, type SpinnerProps } from './feedback/Spinner';
|
|
16
|
+
export { Icon, type IconProps } from './content/Icon';
|
|
17
|
+
export { Image, type ImageProps } from './content/Image';
|
|
18
|
+
export { PageHeader, type PageHeaderAction, type PageHeaderProps, } from './content/PageHeader';
|
|
19
|
+
export { Table, type TableAction, type TableColumn, type TableFilter, type TableProps, } from './content/Table';
|
|
20
|
+
export { SidebarMenu, type MenuItem } from './navigation/Sidebar';
|
|
21
|
+
export { TabBar, Tabs, type TabItem, type TabsProps } from './navigation/Tabs';
|
|
22
|
+
export { Heading, type HeadingProps } from './typography/Heading';
|
|
23
|
+
export { List, type ListItem, type ListProps } from './typography/List';
|
|
24
|
+
export { Text, type TextProps } from './typography/Text';
|
|
25
|
+
export * from './command-palette';
|
|
26
|
+
export * from './primitives/Box';
|
|
27
|
+
export * from './primitives/Card';
|
|
28
|
+
export * from './typography/Text';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
3
|
+
/**
|
|
4
|
+
* The label for the checkbox
|
|
5
|
+
*/
|
|
6
|
+
label?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Helper text to display below the checkbox
|
|
9
|
+
*/
|
|
10
|
+
helperText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Error message to display when the checkbox is invalid
|
|
13
|
+
*/
|
|
14
|
+
error?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The size of the checkbox
|
|
17
|
+
*/
|
|
18
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
19
|
+
/**
|
|
20
|
+
* Whether the checkbox is in an indeterminate state
|
|
21
|
+
*/
|
|
22
|
+
indeterminate?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Additional class name for the container
|
|
25
|
+
*/
|
|
26
|
+
containerClassName?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Additional class name for the label
|
|
29
|
+
*/
|
|
30
|
+
labelClassName?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checkbox component with theme integration
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Checkbox label="Accept terms and conditions" />
|
|
38
|
+
*
|
|
39
|
+
* <Checkbox
|
|
40
|
+
* label="Subscribe to newsletter"
|
|
41
|
+
* helperText="You can unsubscribe at any time"
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* <Checkbox
|
|
45
|
+
* label="Required field"
|
|
46
|
+
* error="This field is required"
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* <Checkbox
|
|
50
|
+
* label="Select all"
|
|
51
|
+
* indeterminate={true}
|
|
52
|
+
* />
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface DatePickerProps {
|
|
2
|
+
/** Current date value */
|
|
3
|
+
value?: Date | null;
|
|
4
|
+
/** Change handler */
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
/** Placeholder text */
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Whether the input is disabled */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Whether the input is required */
|
|
11
|
+
required?: boolean;
|
|
12
|
+
/** Input size */
|
|
13
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
14
|
+
/** Additional CSS classes */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Minimum selectable date */
|
|
17
|
+
minDate?: Date;
|
|
18
|
+
/** Maximum selectable date */
|
|
19
|
+
maxDate?: Date;
|
|
20
|
+
/** Date format for display */
|
|
21
|
+
format?: 'MM/dd/yyyy' | 'dd/MM/yyyy' | 'yyyy-MM-dd';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* DatePicker component with calendar popup
|
|
25
|
+
*/
|
|
26
|
+
export declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLInputElement>>;
|