@vtx-ui/react 0.0.1-beta.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/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/components/Accordion/Accordion.d.ts +31 -0
- package/dist/components/Accordion/Accordion.examples.d.ts +3 -0
- package/dist/components/Accordion/AccordionItem.d.ts +5 -0
- package/dist/components/Accordion/index.d.ts +4 -0
- package/dist/components/Accordion/types.d.ts +98 -0
- package/dist/components/Alert/Alert.d.ts +119 -0
- package/dist/components/Alert/index.d.ts +3 -0
- package/dist/components/Avatar/Avatar.d.ts +63 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Badge/Badge.d.ts +81 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Button/Button.d.ts +117 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Card/Card.d.ts +120 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +114 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +121 -0
- package/dist/components/CheckboxGroup/index.d.ts +3 -0
- package/dist/components/Chip/Chip.d.ts +91 -0
- package/dist/components/Chip/index.d.ts +3 -0
- package/dist/components/Divider/Divider.d.ts +118 -0
- package/dist/components/Divider/index.d.ts +3 -0
- package/dist/components/Flex/Flex.d.ts +66 -0
- package/dist/components/Flex/index.d.ts +3 -0
- package/dist/components/Grid/Grid.d.ts +156 -0
- package/dist/components/Grid/index.d.ts +3 -0
- package/dist/components/Header/Header.d.ts +138 -0
- package/dist/components/Header/index.d.ts +3 -0
- package/dist/components/Input/Input.d.ts +129 -0
- package/dist/components/Input/index.d.ts +3 -0
- package/dist/components/Menu/Menu.d.ts +114 -0
- package/dist/components/Menu/index.d.ts +4 -0
- package/dist/components/Modal/Modal.d.ts +201 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +190 -0
- package/dist/components/MultiSelect/index.d.ts +3 -0
- package/dist/components/Radio/Radio.d.ts +105 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +134 -0
- package/dist/components/RadioGroup/index.d.ts +3 -0
- package/dist/components/Select/Select.d.ts +169 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/SideMenu/SideMenu.d.ts +118 -0
- package/dist/components/SideMenu/index.d.ts +4 -0
- package/dist/components/Table/Table.d.ts +211 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Text/Text.d.ts +160 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Toast/Toast.d.ts +56 -0
- package/dist/components/Toast/ToastContainer.d.ts +6 -0
- package/dist/components/Toast/index.d.ts +5 -0
- package/dist/components/Toast/types.d.ts +148 -0
- package/dist/components/Toast/useToast.d.ts +34 -0
- package/dist/components/Tooltip/Tooltip.d.ts +108 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/hooks/index.d.ts +85 -0
- package/dist/hooks/useTheme.d.ts +268 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +39 -0
- package/dist/theme/cssVariables.d.ts +9 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/tokens.d.ts +258 -0
- package/dist/types/components/Accordion/Accordion.d.ts +31 -0
- package/dist/types/components/Accordion/Accordion.examples.d.ts +3 -0
- package/dist/types/components/Accordion/AccordionItem.d.ts +5 -0
- package/dist/types/components/Accordion/index.d.ts +4 -0
- package/dist/types/components/Accordion/types.d.ts +98 -0
- package/dist/types/components/Alert/Alert.d.ts +119 -0
- package/dist/types/components/Alert/index.d.ts +3 -0
- package/dist/types/components/Avatar/Avatar.d.ts +63 -0
- package/dist/types/components/Avatar/index.d.ts +3 -0
- package/dist/types/components/Badge/Badge.d.ts +81 -0
- package/dist/types/components/Badge/index.d.ts +3 -0
- package/dist/types/components/Button/Button.d.ts +117 -0
- package/dist/types/components/Button/index.d.ts +3 -0
- package/dist/types/components/Card/Card.d.ts +120 -0
- package/dist/types/components/Card/index.d.ts +3 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +114 -0
- package/dist/types/components/Checkbox/index.d.ts +3 -0
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +121 -0
- package/dist/types/components/CheckboxGroup/index.d.ts +3 -0
- package/dist/types/components/Chip/Chip.d.ts +91 -0
- package/dist/types/components/Chip/index.d.ts +3 -0
- package/dist/types/components/Divider/Divider.d.ts +118 -0
- package/dist/types/components/Divider/index.d.ts +3 -0
- package/dist/types/components/Flex/Flex.d.ts +66 -0
- package/dist/types/components/Flex/index.d.ts +3 -0
- package/dist/types/components/Grid/Grid.d.ts +156 -0
- package/dist/types/components/Grid/index.d.ts +3 -0
- package/dist/types/components/Header/Header.d.ts +138 -0
- package/dist/types/components/Header/index.d.ts +3 -0
- package/dist/types/components/Input/Input.d.ts +129 -0
- package/dist/types/components/Input/index.d.ts +3 -0
- package/dist/types/components/Menu/Menu.d.ts +114 -0
- package/dist/types/components/Menu/index.d.ts +4 -0
- package/dist/types/components/Modal/Modal.d.ts +201 -0
- package/dist/types/components/Modal/index.d.ts +3 -0
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +190 -0
- package/dist/types/components/MultiSelect/index.d.ts +3 -0
- package/dist/types/components/Radio/Radio.d.ts +105 -0
- package/dist/types/components/Radio/index.d.ts +3 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +134 -0
- package/dist/types/components/RadioGroup/index.d.ts +3 -0
- package/dist/types/components/Select/Select.d.ts +169 -0
- package/dist/types/components/Select/index.d.ts +3 -0
- package/dist/types/components/SideMenu/SideMenu.d.ts +118 -0
- package/dist/types/components/SideMenu/index.d.ts +4 -0
- package/dist/types/components/Table/Table.d.ts +211 -0
- package/dist/types/components/Table/index.d.ts +3 -0
- package/dist/types/components/Text/Text.d.ts +160 -0
- package/dist/types/components/Text/index.d.ts +3 -0
- package/dist/types/components/Toast/Toast.d.ts +56 -0
- package/dist/types/components/Toast/ToastContainer.d.ts +6 -0
- package/dist/types/components/Toast/index.d.ts +5 -0
- package/dist/types/components/Toast/types.d.ts +148 -0
- package/dist/types/components/Toast/useToast.d.ts +34 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +108 -0
- package/dist/types/components/Tooltip/index.d.ts +3 -0
- package/dist/types/hooks/index.d.ts +85 -0
- package/dist/types/hooks/useTheme.d.ts +268 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/theme/ThemeProvider.d.ts +39 -0
- package/dist/types/theme/cssVariables.d.ts +9 -0
- package/dist/types/theme/index.d.ts +6 -0
- package/dist/types/theme/tokens.d.ts +258 -0
- package/package.json +59 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SideMenu.css';
|
|
3
|
+
export interface SideMenuItemProps {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item label
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Click handler
|
|
10
|
+
*/
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Icon to display before label
|
|
14
|
+
*/
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the item is disabled
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the item is active/selected
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
active?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Submenu items for nested navigation
|
|
28
|
+
*/
|
|
29
|
+
items?: SideMenuItemProps[];
|
|
30
|
+
/**
|
|
31
|
+
* Badge content (number or text)
|
|
32
|
+
*/
|
|
33
|
+
badge?: string | number;
|
|
34
|
+
/**
|
|
35
|
+
* Custom href for links
|
|
36
|
+
*/
|
|
37
|
+
href?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SideMenuProps {
|
|
40
|
+
/**
|
|
41
|
+
* Menu items configuration
|
|
42
|
+
*/
|
|
43
|
+
items: SideMenuItemProps[];
|
|
44
|
+
/**
|
|
45
|
+
* Whether the sidebar is collapsed
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
collapsed?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Collapse toggle handler
|
|
51
|
+
*/
|
|
52
|
+
onCollapseToggle?: (collapsed: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Custom className
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Sidebar width when expanded
|
|
59
|
+
* @default '260px'
|
|
60
|
+
*/
|
|
61
|
+
width?: string | number;
|
|
62
|
+
/**
|
|
63
|
+
* Sidebar width when collapsed
|
|
64
|
+
* @default '80px'
|
|
65
|
+
*/
|
|
66
|
+
collapsedWidth?: string | number;
|
|
67
|
+
/**
|
|
68
|
+
* Header content (logo, title)
|
|
69
|
+
*/
|
|
70
|
+
header?: React.ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Footer content
|
|
73
|
+
*/
|
|
74
|
+
footer?: React.ReactNode;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* SideMenuItem component - Individual sidebar menu item with submenu support
|
|
78
|
+
*/
|
|
79
|
+
export declare const SideMenuItem: React.ForwardRefExoticComponent<SideMenuItemProps & {
|
|
80
|
+
collapsed?: boolean;
|
|
81
|
+
level?: number;
|
|
82
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
83
|
+
/**
|
|
84
|
+
* SideMenu component - Professional sidebar navigation for admin panels
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* Basic sidebar menu
|
|
88
|
+
* ```tsx
|
|
89
|
+
* <SideMenu
|
|
90
|
+
* items={[
|
|
91
|
+
* { label: 'Dashboard', icon: <DashboardIcon />, active: true },
|
|
92
|
+
* {
|
|
93
|
+
* label: 'Products',
|
|
94
|
+
* icon: <ProductIcon />,
|
|
95
|
+
* items: [
|
|
96
|
+
* { label: 'All Products', onClick: () => {} },
|
|
97
|
+
* { label: 'Categories', onClick: () => {} }
|
|
98
|
+
* ]
|
|
99
|
+
* },
|
|
100
|
+
* { label: 'Settings', icon: <SettingsIcon />, onClick: () => {} }
|
|
101
|
+
* ]}
|
|
102
|
+
* />
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* Collapsible sidebar with header
|
|
107
|
+
* ```tsx
|
|
108
|
+
* <SideMenu
|
|
109
|
+
* collapsed={isCollapsed}
|
|
110
|
+
* onCollapseToggle={setIsCollapsed}
|
|
111
|
+
* header={<Logo />}
|
|
112
|
+
* items={menuItems}
|
|
113
|
+
* />
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare const SideMenu: React.ForwardRefExoticComponent<SideMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
117
|
+
declare const _default: React.FC<SideMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
+
export default _default;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { TableHTMLAttributes } from 'react';
|
|
2
|
+
import './Table.css';
|
|
3
|
+
export interface TableColumn<T = unknown> {
|
|
4
|
+
/**
|
|
5
|
+
* Unique key for the column - used as React key and for data access
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* Column header text or custom header content
|
|
10
|
+
*/
|
|
11
|
+
header: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Function to render cell content
|
|
14
|
+
* If not provided, displays row[key] directly
|
|
15
|
+
*/
|
|
16
|
+
render?: (row: T, rowIndex: number) => React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Width of the column (CSS value: px, %, rem, etc.)
|
|
19
|
+
*/
|
|
20
|
+
width?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum width of the column
|
|
23
|
+
*/
|
|
24
|
+
minWidth?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum width of the column
|
|
27
|
+
*/
|
|
28
|
+
maxWidth?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Text alignment for the column
|
|
31
|
+
* @default 'left'
|
|
32
|
+
*/
|
|
33
|
+
align?: 'left' | 'center' | 'right';
|
|
34
|
+
/**
|
|
35
|
+
* If true, column can be sorted
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
sortable?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Custom sort function for this column
|
|
41
|
+
*/
|
|
42
|
+
sortFn?: (a: T, b: T) => number;
|
|
43
|
+
/**
|
|
44
|
+
* If true, column will be sticky (fixed) on horizontal scroll
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
sticky?: 'left' | 'right' | false;
|
|
48
|
+
/**
|
|
49
|
+
* Custom class name for column cells
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Custom class name for header cell
|
|
54
|
+
*/
|
|
55
|
+
headerClassName?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface TableProps<T = unknown> extends Omit<TableHTMLAttributes<HTMLTableElement>, 'children'> {
|
|
58
|
+
/**
|
|
59
|
+
* Column definitions
|
|
60
|
+
*/
|
|
61
|
+
columns: TableColumn<T>[];
|
|
62
|
+
/**
|
|
63
|
+
* Data rows to display
|
|
64
|
+
*/
|
|
65
|
+
data: T[];
|
|
66
|
+
/**
|
|
67
|
+
* Function to get unique key for each row
|
|
68
|
+
* Used for React key prop and row identification
|
|
69
|
+
*/
|
|
70
|
+
getRowKey: (row: T, index: number) => string | number;
|
|
71
|
+
/**
|
|
72
|
+
* If true, table will have striped rows for better readability
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
striped?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* If true, rows will have hover effect
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
hoverable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* If true, adds borders between cells
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
bordered?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Size variant
|
|
88
|
+
* @default 'medium'
|
|
89
|
+
*/
|
|
90
|
+
size?: 'small' | 'medium' | 'large';
|
|
91
|
+
/**
|
|
92
|
+
* Optional caption for the table (improves accessibility)
|
|
93
|
+
*/
|
|
94
|
+
caption?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Custom empty state content or message
|
|
97
|
+
* @default 'No data available'
|
|
98
|
+
*/
|
|
99
|
+
emptyMessage?: React.ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Loading state
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
loading?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Custom loading content
|
|
107
|
+
*/
|
|
108
|
+
loadingContent?: React.ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* If true, table will be horizontally scrollable
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
scrollable?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Maximum height for vertical scrolling
|
|
116
|
+
* Set to enable vertical scrolling with fixed header
|
|
117
|
+
*/
|
|
118
|
+
maxHeight?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Callback fired when a row is clicked
|
|
121
|
+
*/
|
|
122
|
+
onRowClick?: (row: T, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Function to determine if a row is selected
|
|
125
|
+
*/
|
|
126
|
+
isRowSelected?: (row: T, index: number) => boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Callback fired when row selection changes (requires isRowSelected)
|
|
129
|
+
*/
|
|
130
|
+
onRowSelect?: (row: T, index: number) => void;
|
|
131
|
+
/**
|
|
132
|
+
* If true, enables column sorting
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
sortable?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Current sort configuration
|
|
138
|
+
*/
|
|
139
|
+
sortConfig?: {
|
|
140
|
+
key: string;
|
|
141
|
+
direction: 'asc' | 'desc';
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Callback fired when sort changes
|
|
145
|
+
*/
|
|
146
|
+
onSortChange?: (key: string, direction: 'asc' | 'desc') => void;
|
|
147
|
+
/**
|
|
148
|
+
* Custom class name for table container
|
|
149
|
+
*/
|
|
150
|
+
containerClassName?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Table component - Displays data in rows and columns with advanced features
|
|
154
|
+
*
|
|
155
|
+
* A comprehensive table component with support for sorting, selection, loading states,
|
|
156
|
+
* sticky columns, and customizable rendering.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* Basic usage
|
|
160
|
+
* ```tsx
|
|
161
|
+
* const columns = [
|
|
162
|
+
* { key: 'name', header: 'Name' },
|
|
163
|
+
* { key: 'email', header: 'Email' },
|
|
164
|
+
* { key: 'role', header: 'Role', align: 'center' },
|
|
165
|
+
* ];
|
|
166
|
+
*
|
|
167
|
+
* const data = [
|
|
168
|
+
* { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin' },
|
|
169
|
+
* ];
|
|
170
|
+
*
|
|
171
|
+
* <Table
|
|
172
|
+
* columns={columns}
|
|
173
|
+
* data={data}
|
|
174
|
+
* getRowKey={(row) => row.id}
|
|
175
|
+
* striped
|
|
176
|
+
* />
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* With sorting and row click
|
|
181
|
+
* ```tsx
|
|
182
|
+
* <Table
|
|
183
|
+
* columns={columns}
|
|
184
|
+
* data={data}
|
|
185
|
+
* getRowKey={(row) => row.id}
|
|
186
|
+
* sortable
|
|
187
|
+
* onRowClick={(row) => console.log('Clicked:', row)}
|
|
188
|
+
* />
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* With loading state and custom rendering
|
|
193
|
+
* ```tsx
|
|
194
|
+
* <Table
|
|
195
|
+
* columns={[
|
|
196
|
+
* { key: 'name', header: 'Name', sticky: 'left' },
|
|
197
|
+
* { key: 'status', header: 'Status', render: (row) => <Badge>{row.status}</Badge> }
|
|
198
|
+
* ]}
|
|
199
|
+
* data={data}
|
|
200
|
+
* getRowKey={(row) => row.id}
|
|
201
|
+
* loading={isLoading}
|
|
202
|
+
* maxHeight="400px"
|
|
203
|
+
* />
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare function Table<T = unknown>({ columns, data, getRowKey, striped, hoverable, bordered, size, caption, emptyMessage, loading, loadingContent, scrollable, maxHeight, onRowClick, isRowSelected, onRowSelect, sortable, sortConfig, onSortChange, className, containerClassName, ...props }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
207
|
+
export declare namespace Table {
|
|
208
|
+
var displayName: string;
|
|
209
|
+
}
|
|
210
|
+
declare const _default: React.FC<TableProps & React.RefAttributes<HTMLTableElement>>;
|
|
211
|
+
export default _default;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './Text.css';
|
|
3
|
+
export type TextVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'body1' | 'body2' | 'subtitle1' | 'subtitle2' | 'caption' | 'overline' | 'button' | 'label';
|
|
4
|
+
export type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
5
|
+
export type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
6
|
+
export type TextDecoration = 'none' | 'underline' | 'line-through' | 'overline';
|
|
7
|
+
export type TextWeight = 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
|
8
|
+
export type TextAs = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'label' | 'strong' | 'em' | 'small';
|
|
9
|
+
export interface TextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
|
|
10
|
+
/**
|
|
11
|
+
* Typography variant that applies preset styles
|
|
12
|
+
* @default 'body1'
|
|
13
|
+
*/
|
|
14
|
+
variant?: TextVariant;
|
|
15
|
+
/**
|
|
16
|
+
* HTML element to render as
|
|
17
|
+
* Automatically inferred from variant if not specified
|
|
18
|
+
*/
|
|
19
|
+
as?: TextAs;
|
|
20
|
+
/**
|
|
21
|
+
* Text alignment
|
|
22
|
+
*/
|
|
23
|
+
align?: TextAlign;
|
|
24
|
+
/**
|
|
25
|
+
* Text color - accepts CSS color values or theme color tokens
|
|
26
|
+
* Examples: 'primary.500', '#000', 'rgb(0,0,0)', 'neutral.700'
|
|
27
|
+
*/
|
|
28
|
+
color?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Font weight override
|
|
31
|
+
*/
|
|
32
|
+
weight?: TextWeight | number;
|
|
33
|
+
/**
|
|
34
|
+
* Text transform
|
|
35
|
+
*/
|
|
36
|
+
transform?: TextTransform;
|
|
37
|
+
/**
|
|
38
|
+
* Text decoration
|
|
39
|
+
*/
|
|
40
|
+
decoration?: TextDecoration;
|
|
41
|
+
/**
|
|
42
|
+
* Enable text truncation with ellipsis
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
truncate?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Number of lines to show before truncating (requires truncate or clamp)
|
|
48
|
+
* Uses -webkit-line-clamp for multi-line truncation
|
|
49
|
+
*/
|
|
50
|
+
lineClamp?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Enable word break for long words
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
breakWord?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Enable italic style
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
italic?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Enable underline
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
underline?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Enable strikethrough
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
strikethrough?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Make text gradient with specified colors
|
|
73
|
+
* Example: ['#667eea', '#764ba2']
|
|
74
|
+
*/
|
|
75
|
+
gradient?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Disable user selection
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
noSelect?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Custom font size (overrides variant)
|
|
83
|
+
*/
|
|
84
|
+
size?: string | number;
|
|
85
|
+
/**
|
|
86
|
+
* Custom line height (overrides variant)
|
|
87
|
+
*/
|
|
88
|
+
lineHeight?: string | number;
|
|
89
|
+
/**
|
|
90
|
+
* Custom letter spacing (overrides variant)
|
|
91
|
+
*/
|
|
92
|
+
letterSpacing?: string | number;
|
|
93
|
+
/**
|
|
94
|
+
* Remove default margin
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
noMargin?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Remove default padding
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
noPadding?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Children content to render
|
|
105
|
+
*/
|
|
106
|
+
children?: React.ReactNode;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Text component - Versatile typography component with theme integration
|
|
110
|
+
*
|
|
111
|
+
* A comprehensive text component that provides consistent typography across your application
|
|
112
|
+
* with full theming support and extensive customization options.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* Basic usage with variants
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <Text variant="h1">Heading 1</Text>
|
|
118
|
+
* <Text variant="body1">Regular body text</Text>
|
|
119
|
+
* <Text variant="caption" color="neutral.500">Small caption text</Text>
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* Custom styling
|
|
124
|
+
* ```tsx
|
|
125
|
+
* <Text
|
|
126
|
+
* variant="body1"
|
|
127
|
+
* weight="bold"
|
|
128
|
+
* align="center"
|
|
129
|
+
* color="primary.600"
|
|
130
|
+
* >
|
|
131
|
+
* Centered bold text
|
|
132
|
+
* </Text>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* Truncation and line clamping
|
|
137
|
+
* ```tsx
|
|
138
|
+
* <Text truncate>This text will be truncated with ellipsis...</Text>
|
|
139
|
+
* <Text lineClamp={3}>This text will show only 3 lines before truncating...</Text>
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* Gradient text
|
|
144
|
+
* ```tsx
|
|
145
|
+
* <Text variant="h2" gradient={['#667eea', '#764ba2']}>
|
|
146
|
+
* Gradient Heading
|
|
147
|
+
* </Text>
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* Semantic HTML control
|
|
152
|
+
* ```tsx
|
|
153
|
+
* <Text variant="h1" as="h2">Visually h1, semantically h2</Text>
|
|
154
|
+
* <Text variant="body1" as="label" htmlFor="input">Label with body style</Text>
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
|
|
158
|
+
export { Text };
|
|
159
|
+
declare const _default: React.FC<TextProps & React.RefAttributes<HTMLElement>>;
|
|
160
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToastProps } from './types';
|
|
3
|
+
import './Toast.css';
|
|
4
|
+
/**
|
|
5
|
+
* Toast component - Displays brief notifications to users
|
|
6
|
+
*
|
|
7
|
+
* A comprehensive toast notification component with auto-dismiss, progress bar,
|
|
8
|
+
* pause on hover, and various visual variants for different message types.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Basic success toast
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Toast variant="success">
|
|
14
|
+
* Your changes have been saved successfully!
|
|
15
|
+
* </Toast>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Toast with action button
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Toast
|
|
22
|
+
* variant="warning"
|
|
23
|
+
* action={<Button size="sm">Undo</Button>}
|
|
24
|
+
* autoClose={false}
|
|
25
|
+
* >
|
|
26
|
+
* Item moved to trash
|
|
27
|
+
* </Toast>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Custom toast with icon
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Toast
|
|
34
|
+
* variant="info"
|
|
35
|
+
* icon={<CustomIcon />}
|
|
36
|
+
* progressBar={false}
|
|
37
|
+
* >
|
|
38
|
+
* Update available for download
|
|
39
|
+
* </Toast>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* Toast with custom auto-close duration
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Toast
|
|
46
|
+
* variant="error"
|
|
47
|
+
* autoClose={10000}
|
|
48
|
+
* pauseOnHover={false}
|
|
49
|
+
* >
|
|
50
|
+
* Failed to connect to server
|
|
51
|
+
* </Toast>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare const _default: React.FC<ToastProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ToastContainerProps } from './types';
|
|
3
|
+
import './ToastContainer.css';
|
|
4
|
+
export declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
5
|
+
declare const _default: React.FC<ToastContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Toast } from './Toast';
|
|
2
|
+
export { Toast as ToastComponent } from './Toast';
|
|
3
|
+
export { ToastContainer } from './ToastContainer';
|
|
4
|
+
export { useToast, toast } from './useToast';
|
|
5
|
+
export type { ToastProps, ToastVariant, ToastPosition, ToastOptions, ToastInstance } from './types';
|